Version: 8.3.0
YACS::HMI::SchemaDirContainersItem Class Reference

#include <SchemaDirContainersItem.hxx>

Inheritance diagram for YACS::HMI::SchemaDirContainersItem:
Collaboration diagram for YACS::HMI::SchemaDirContainersItem:

Public Member Functions

 SchemaDirContainersItem (SchemaItem *parent, QString label, Subject *subject)
 
void addContainerItem (Subject *subject)
 
void addComponentItem (Subject *subject)
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
- Public Member Functions inherited from YACS::HMI::SchemaItem
 SchemaItem (SchemaItem *parent, QString label, Subject *subject)
 
virtual ~SchemaItem ()
 
virtual void appendChild (SchemaItem *child)
 
virtual void removeChild (SchemaItem *child)
 
virtual void insertChild (int row, SchemaItem *child)
 
virtual SchemaItemchild (int row)
 
virtual int childCount () const
 
virtual int columnCount () const
 
virtual QVariant data (int column, int role) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index)
 
virtual int row () const
 
virtual SchemaItemparent ()
 
virtual SubjectgetSubject ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void select (bool isSelected)
 
virtual void toggleState ()
 
QModelIndex modelIndex (int column=0)
 
virtual ItemMimeDatamimeData (ItemMimeData *mime)
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action)
 
virtual void reparent (SchemaItem *parent)
 
virtual void setCaseValue ()
 used in node derived classes More...
 
bool isEmphasized ()
 
void setEmphasize (bool emphasize)
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 

Protected Member Functions

virtual QVariant editionWhatsThis (int column) const
 
- Protected Member Functions inherited from YACS::HMI::SchemaItem
virtual QVariant editionToolTip (int column) const
 
virtual QVariant runToolTip (int column) const
 
virtual QVariant runWhatsThis (int column) const
 
virtual QString getMimeFormat ()
 
virtual void setExecState (int execState)
 

Protected Attributes

std::map< std::string,
SchemaContainerItem * > 
_schemaContItemMap
 
std::multimap< std::string,
Subject * > 
_waitingCompItemMap
 
- Protected Attributes inherited from YACS::HMI::SchemaItem
QList< SchemaItem * > _childItems
 
QList< QVariant > _itemData
 
QList< QVariant > _itemDeco
 
QList< QVariant > _itemForeground
 
QList< QVariant > _itemBackground
 
QList< QVariant > _itemCheckState
 
QList< QVariant > _itemToolTip
 
QList< QVariant > _itemWhatsThis
 
QString _label
 
SchemaItem_parentItem
 
Subject_subject
 
int _execState
 
bool _emphasized
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 31 of file SchemaDirContainersItem.hxx.

Constructor & Destructor Documentation

SchemaDirContainersItem::SchemaDirContainersItem ( SchemaItem parent,
QString  label,
Subject subject 
)

Definition at line 38 of file SchemaDirContainersItem.cxx.

References YACS::HMI::SchemaItem::_itemDeco, _schemaContItemMap, _waitingCompItemMap, and YACS::HMI::YLabel.

39  : SchemaItem(parent, label, subject)
40 {
41  _itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
42  _schemaContItemMap.clear();
43  _waitingCompItemMap.clear();
44 }

Member Function Documentation

void SchemaDirContainersItem::addComponentItem ( Subject subject)

If a component is not associated to a container, it will be associated to a default container. If this default container does not exist, it is created. When loading a schema, container must be created before component:

See Also
SubjectProc::loadProc

Definition at line 78 of file SchemaDirContainersItem.cxx.

References _schemaContItemMap, YACS::HMI::SubjectProc::addContainer(), YACS::HMI::SubjectComponent::associateToContainer(), DEBTRACE, YACS::HMI::SubjectComponent::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::ENGINE::Container::getName(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::GuiContext::getSubjectProc(), and YASSERT.

Referenced by YACS::HMI::SchemaComposedNodeItem::update().

79 {
80  DEBTRACE("SchemaDirContainersItem::addComponentItem");
81  SubjectComponent *aSComp = dynamic_cast<SubjectComponent*>(subject);
82  YASSERT(aSComp);
83  ComponentInstance* component = aSComp->getComponent();
84  YASSERT(component);
85 
86  string contName = "DefaultContainer";
87  Container *container = component->getContainer();
88  if (container)
89  contName = container->getName();
90  else
91  {
92  if (!_schemaContItemMap.count(contName)) // no container and default container not created
93  {
95  sProc->addContainer(contName);
96  }
97  }
98 
99  YASSERT(_schemaContItemMap.count(contName));
100  SchemaContainerItem *sci = _schemaContItemMap[contName];
101  aSComp->associateToContainer(static_cast<SubjectContainer*>(sci->getSubject()));
102 }
void SchemaDirContainersItem::addContainerItem ( Subject subject)

When loading a schema, a container may appear after a component using this container. After creating the SchemaContainerItem, check if there are SchemaComponentItems to to create as children of this SchemaContainerItem

Definition at line 58 of file SchemaDirContainersItem.cxx.

References _schemaContItemMap, YACS::HMI::SchemaItem::childCount(), DEBTRACE, YACS::HMI::Subject::getName(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSchemaModel(), and YACS::HMI::SchemaItem::modelIndex().

Referenced by YACS::HMI::SchemaComposedNodeItem::update().

59 {
60  DEBTRACE("SchemaDirContainersItem::addContainerItem");
62  int nbsons = childCount();
63  string contName = subject->getName();
64 
65  model->beginInsertRows(modelIndex(), nbsons, nbsons);
67  contName.c_str(),
68  subject);
69  model->endInsertRows();
70 
71  _schemaContItemMap[contName] = item;
72 }
QVariant SchemaDirContainersItem::editionWhatsThis ( int  column) const
protectedvirtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 104 of file SchemaDirContainersItem.cxx.

105 {
106  return "<p>Containers used in this schema appears in this folder.\n" \
107  "You can add containers by using the context menu (entry \"Create container\") " \
108  "and then edit its properties in the input panel. <a href=\"modification.html#property-page-for-container\">More...</a></p>";
109 }
void SchemaDirContainersItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 46 of file SchemaDirContainersItem.cxx.

References gui.GraphViewer::m, and YACS::HMI::ContainerDirMenu::popupMenu().

47 {
49  m.popupMenu(caller, globalPos);
50 }

Member Data Documentation

std::map<std::string, SchemaContainerItem*> YACS::HMI::SchemaDirContainersItem::_schemaContItemMap
protected
std::multimap<std::string, Subject*> YACS::HMI::SchemaDirContainersItem::_waitingCompItemMap
protected

Definition at line 41 of file SchemaDirContainersItem.hxx.

Referenced by SchemaDirContainersItem().


The documentation for this class was generated from the following files: