Version: 8.3.0
YACS::HMI::EditionSalomeNode Class Reference

#include <EditionSalomeNode.hxx>

Inheritance diagram for YACS::HMI::EditionSalomeNode:
Collaboration diagram for YACS::HMI::EditionSalomeNode:

Public Slots

virtual void fillComponentPanel ()
 
virtual void fillContainerPanel ()
 
virtual void changeInstance (int index)
 
virtual void changeContainer (int index)
 
virtual void changeHost (int index)
 
virtual void onApply ()
 
virtual void onCancel ()
 
- Public Slots inherited from YACS::HMI::EditionElementaryNode
virtual void onApply ()
 
virtual void onCancel ()
 
virtual void onPortIndexChanged (int index)
 
virtual void onCommitData (QWidget *editor)
 

Public Member Functions

 EditionSalomeNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionSalomeNode ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void synchronize ()
 
- Public Member Functions inherited from YACS::HMI::EditionElementaryNode
 EditionElementaryNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionElementaryNode ()
 
virtual void setEditablePorts (bool isEditable)
 
- Public Member Functions inherited from YACS::HMI::EditionNode
 EditionNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionNode ()
 
- Public Member Functions inherited from YACS::HMI::ItemEdition
 ItemEdition (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~ItemEdition ()
 
virtual void select (bool isSelected)
 
virtual void setName (std::string name)
 
virtual void setEdited (bool isEdited)
 
- Public Member Functions inherited from FormEditItem
 FormEditItem (QWidget *parent=0)
 
virtual ~FormEditItem ()
 
- Public Member Functions inherited from YACS::HMI::ItemEditionBase
 ItemEditionBase (Subject *subject)
 
virtual ~ItemEditionBase ()
 
virtual SubjectgetSubject ()
 
- 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 Attributes

PropertyEditor_propeditor
 
FormComponent_wComponent
 
FormContainerDecorator_wContainer
 
QHBoxLayout * _hbl_method
 
QLabel * _la_method
 
QLineEdit_le_method
 
YACS::ENGINE::ServiceNode_servNode
 
- Protected Attributes inherited from YACS::HMI::EditionElementaryNode
SubjectElementaryNode_subElemNode
 
QTabWidget * _twPorts
 
TablePortsEdition_tvInPorts
 
TablePortsEdition_tvOutPorts
 
ValueDelegate_valueDelegate
 
- Protected Attributes inherited from YACS::HMI::EditionNode
QLineEdit_le_fullName
 
SubjectNode_subjectNode
 
- Protected Attributes inherited from YACS::HMI::ItemEdition
bool _isEdited
 
bool _haveScript
 
- Protected Attributes inherited from FormEditItem
WidEditItem_wid
 
- Protected Attributes inherited from YACS::HMI::ItemEditionBase
Subject_subject
 
int _stackId
 
std::string _name
 
std::string _type
 
std::string _category
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::ItemEdition
static std::string filterName (const std::string &name)
 
- Protected Member Functions inherited from YACS::HMI::EditionElementaryNode
virtual bool hasInputPorts ()
 
virtual bool hasOutputPorts ()
 
virtual void createTablePorts (QLayout *layout)
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 47 of file EditionSalomeNode.hxx.

Constructor & Destructor Documentation

EditionSalomeNode::EditionSalomeNode ( Subject subject,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 43 of file EditionSalomeNode.cxx.

References _hbl_method, _la_method, _le_method, _propeditor, _servNode, YACS::HMI::EditionElementaryNode::_subElemNode, YACS::HMI::ItemEditionBase::_subject, _wComponent, _wContainer, FormEditItem::_wid, changeContainer(), changeHost(), changeInstance(), YACS::HMI::EditionElementaryNode::createTablePorts(), fillComponentPanel(), fillContainerPanel(), YACS::ENGINE::ServiceNode::getContainer(), YACS::ENGINE::ServiceNode::getMethod(), YACS::HMI::SubjectNode::getNode(), and YASSERT.

46  : EditionElementaryNode(subject, parent, name)
47 {
48  // SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(_subject);
49  // YASSERT(ssn);
52  // --- create property editor panel
54  _wid->gridLayout1->addWidget(_propeditor);
55 
56  // --- create container and component panels
57 
59  _wid->gridLayout1->addWidget(_wContainer);
60 
61  connect(_wContainer, SIGNAL(resourceMousePressed()), this, SLOT(fillContainerPanel()));
62  connect(_wContainer, SIGNAL(resourceActivated(int)), this, SLOT(changeHost(int)));
63  connect(_wContainer, SIGNAL(containerToggled(bool)), this, SLOT(fillContainerPanel()));
64  // --- to update display of current selection
65 
66  _wComponent = new FormComponent(this);
67  _wid->gridLayout1->addWidget(_wComponent);
68 
69  connect(_wComponent->cb_instance, SIGNAL(mousePressed()),
70  this, SLOT(fillComponentPanel()));
71  connect(_wComponent->cb_instance, SIGNAL(activated(int)),
72  this, SLOT(changeInstance(int)));
73 
74  connect(_wComponent->cb_container, SIGNAL(mousePressed()),
75  this, SLOT(fillContainerPanel()));
76  connect(_wComponent->cb_container, SIGNAL(activated(int)),
77  this, SLOT(changeContainer(int)));
78 
79  connect(_wComponent->tb_component, SIGNAL(toggled(bool)),
80  this, SLOT(fillComponentPanel())); // --- to update display of current selection
81  connect(_wComponent->tb_component, SIGNAL(toggled(bool)),
82  this, SLOT(fillContainerPanel())); // --- to update display of current selection
83 
84  // --- method
85 
86  _hbl_method = new QHBoxLayout();
87  _la_method = new QLabel(this);
88  _hbl_method->addWidget(_la_method);
89  _le_method = new QLineEdit(this);
90  _hbl_method->addWidget(_le_method);
91  _wid->gridLayout1->addLayout(_hbl_method, _wid->gridLayout1->rowCount(), 0, 1, 1);
92  _la_method->setText("Method:");
93 
94  _le_method->setText((_servNode->getMethod()).c_str());
95  _le_method->setReadOnly(true);
96 
97  // --- fill component panel
98 
100 
101  createTablePorts(_wid->gridLayout1);
102 }
EditionSalomeNode::~EditionSalomeNode ( )
virtual

Definition at line 104 of file EditionSalomeNode.cxx.

105 {
106 }

Member Function Documentation

void EditionSalomeNode::changeContainer ( int  index)
virtualslot

Definition at line 218 of file EditionSalomeNode.cxx.

References _servNode, YACS::HMI::ItemEditionBase::_subject, _wComponent, YACS::HMI::SubjectComponent::associateToContainer(), YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::ENGINE::ServiceNode::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::HMI::SubjectReference::getReference(), YACS::HMI::SubjectServiceNode::getSubjectReference(), and YASSERT.

Referenced by EditionSalomeNode().

219 {
220  string contName = _wComponent->cb_container->itemText(index).toStdString();
221  DEBTRACE(contName);
222  ComponentInstance *compoInst = _servNode->getComponent();
223  Container *oldContainer = compoInst->getContainer();
224 
225  Container *newContainer = 0;
226  Proc* proc = GuiContext::getCurrent()->getProc();
227  if (proc->containerMap.count(contName))
228  newContainer = proc->containerMap[contName];
229  if (!newContainer)
230  {
231  DEBTRACE("-------------> not found : " << contName);
232  return;
233  }
234  YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(newContainer));
235  SubjectContainerBase *scnt(GuiContext::getCurrent()->_mapOfSubjectContainer[newContainer]);
236 
237  SubjectServiceNode *ssn(dynamic_cast<SubjectServiceNode*>(_subject));
238  SubjectComponent *sco(dynamic_cast<SubjectComponent*>(ssn->getSubjectReference()->getReference()));
239  YASSERT(sco);
240  sco->associateToContainer(scnt);
241 }
void EditionSalomeNode::changeHost ( int  index)
virtualslot

Definition at line 243 of file EditionSalomeNode.cxx.

References _wContainer, DEBTRACE, and FormContainerDecorator::getHostName().

Referenced by EditionSalomeNode().

244 {
245  string hostName = _wContainer->getHostName(index);
246  DEBTRACE(hostName);
247 }
void EditionSalomeNode::changeInstance ( int  index)
virtualslot

Definition at line 199 of file EditionSalomeNode.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectComponent, _servNode, YACS::HMI::ItemEditionBase::_subject, _wComponent, YACS::ENGINE::Proc::componentInstanceMap, DEBTRACE, YACS::ENGINE::ServiceNode::getComponent(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), and YASSERT.

Referenced by EditionSalomeNode().

200 {
201  string instName = _wComponent->cb_instance->itemText(index).toStdString();
202  Proc* proc = GuiContext::getCurrent()->getProc();
203  ComponentInstance *newCompoInst = 0;
204  ComponentInstance *oldCompoInst = _servNode->getComponent();
205  if (proc->componentInstanceMap.count(instName))
206  newCompoInst = proc->componentInstanceMap[instName];
207  else DEBTRACE("-------------> not found : " << instName);
208 
209  if (newCompoInst && (newCompoInst != oldCompoInst))
210  {
211  YASSERT(GuiContext::getCurrent()->_mapOfSubjectComponent.count(newCompoInst));
212  SubjectServiceNode *ssn = dynamic_cast<SubjectServiceNode*>(_subject);
213  if(!ssn->associateToComponent(GuiContext::getCurrent()->_mapOfSubjectComponent[newCompoInst]))
214  Message mess;
215  }
216 }
void EditionSalomeNode::fillComponentPanel ( )
virtualslot

must be updated when associate service to component instance, or when the list of available component instances changes.

Definition at line 150 of file EditionSalomeNode.cxx.

References _servNode, _wComponent, YACS::ENGINE::Proc::componentInstanceMap, YACS::ENGINE::ComponentInstance::getCompoName(), YACS::ENGINE::ServiceNode::getComponent(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::ComponentInstance::getInstanceName(), and YACS::HMI::GuiContext::getProc().

Referenced by EditionSalomeNode(), synchronize(), and update().

151 {
152  ComponentInstance *compoInst = _servNode->getComponent();
153  if (compoInst)
154  {
155  _wComponent->le_name ->setText(compoInst->getCompoName().c_str());
156  Proc* proc = GuiContext::getCurrent()->getProc();
157 
158  _wComponent->cb_instance->clear();
159  map<string,ComponentInstance*>::const_iterator it = proc->componentInstanceMap.begin();
160  for(; it != proc->componentInstanceMap.end(); ++it)
161  {
162  ComponentInstance *inst=(*it).second;
163  QString compoName = inst->getCompoName().c_str();
164  if (! QString::compare(compoInst->getCompoName().c_str(), compoName)) // if same component name
165  //instanceMap[inst->getInstanceName()] = inst;
166  _wComponent->cb_instance->addItem( QString(inst->getInstanceName().c_str()));
167  }
168 
169  int index = _wComponent->cb_instance->findText(compoInst->getInstanceName().c_str());
170  //DEBTRACE("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " << index);
171  _wComponent->cb_instance->setCurrentIndex(index);
172  }
173 }
void EditionSalomeNode::fillContainerPanel ( )
virtualslot

Definition at line 175 of file EditionSalomeNode.cxx.

References _servNode, _wComponent, _wContainer, YACS::ENGINE::Proc::containerMap, DEBTRACE, FormContainerDecorator::FillPanel(), YACS::ENGINE::ServiceNode::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Container::getName(), and YACS::HMI::GuiContext::getProc().

Referenced by EditionSalomeNode(), synchronize(), and update().

176 {
177  DEBTRACE("EditionSalomeNode::fillContainerPanel");
178  ComponentInstance *compoInst = _servNode->getComponent();
179  if (compoInst)
180  {
181  Proc* proc = GuiContext::getCurrent()->getProc();
182 
183  _wComponent->cb_container->clear();
184  map<string,Container*>::const_iterator it = proc->containerMap.begin();
185  for(; it != proc->containerMap.end(); ++it)
186  _wComponent->cb_container->addItem( QString((*it).first.c_str()));
187 
188  Container * cont = compoInst->getContainer();
189  if (cont)
190  {
191  int index = _wComponent->cb_container->findText(cont->getName().c_str());
192  _wComponent->cb_container->setCurrentIndex(index);
193  _wContainer->FillPanel(cont);
194  }
195  }
196 }
void EditionSalomeNode::onApply ( )
virtualslot

Definition at line 249 of file EditionSalomeNode.cxx.

References YACS::HMI::ItemEdition::_isEdited, _wContainer, DEBTRACE, YACS::HMI::EditionElementaryNode::onApply(), and FormContainerDecorator::onApply().

250 {
251  DEBTRACE("EditionSalomeNode::onApply");
252  bool edited = true;
253  if (_wContainer->onApply())
254  edited = false;
255  _isEdited = _isEdited || edited;
257 }
void EditionSalomeNode::onCancel ( )
virtualslot
void EditionSalomeNode::synchronize ( )
virtual
void EditionSalomeNode::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

when loading a schema, creation of all edition widgets is time and memory consuming, so, widget edition creation is differed until user select an item in tree or 2D vue.

Reimplemented from YACS::HMI::EditionNode.

Definition at line 108 of file EditionSalomeNode.cxx.

References _propeditor, YACS::HMI::ADDREF, YACS::HMI::ASSOCIATE, DEBTRACE, fillComponentPanel(), fillContainerPanel(), YACS::HMI::Subject::getName(), YACS::HMI::SubjectReference::getName(), YACS::HMI::SubjectReference::getReference(), YACS::HMI::SETVALUE, YACS::HMI::PropertyEditor::update(), YACS::HMI::EditionNode::update(), and YASSERT.

Referenced by gui.graph.MyCanvas::customEvent().

109 {
110  DEBTRACE("EditionSalomeNode::update ");
111  EditionElementaryNode::update(event, type, son);
112  SubjectReference* subref= 0;
113  switch (event)
114  {
115  case ADDREF:
116  DEBTRACE("ADDREF");
117  subref = dynamic_cast<SubjectReference*>(son);
118  YASSERT(subref);
119  DEBTRACE(subref->getName() << " " << subref->getReference()->getName());
122  break;
123 
124  case ASSOCIATE:
125  DEBTRACE("ASSOCIATE");
127  break;
128 
129  case SETVALUE:
130  _propeditor->update();
131  break;
132 
133  default:
134  ;
135  }
136 }

Member Data Documentation

QHBoxLayout* YACS::HMI::EditionSalomeNode::_hbl_method
protected

Definition at line 72 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

QLabel* YACS::HMI::EditionSalomeNode::_la_method
protected

Definition at line 73 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

QLineEdit* YACS::HMI::EditionSalomeNode::_le_method
protected

Definition at line 74 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

PropertyEditor* YACS::HMI::EditionSalomeNode::_propeditor
protected

Definition at line 69 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode(), and update().

YACS::ENGINE::ServiceNode* YACS::HMI::EditionSalomeNode::_servNode
protected
FormComponent* YACS::HMI::EditionSalomeNode::_wComponent
protected
FormContainerDecorator* YACS::HMI::EditionSalomeNode::_wContainer
protected

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