Version: 9.16.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 Slots inherited from YACS::HMI::ItemEdition
virtual void onApply ()
 
virtual void onCancel ()
 
virtual void onModifyName (const QString &text)
 

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 synchronize ()
 
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 ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
- Public Member Functions inherited from YACS::HMI::ItemEdition
 ItemEdition (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~ItemEdition ()
 
virtual void synchronize ()
 
virtual void select (bool isSelected)
 
virtual void setName (std::string name)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
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 void select (bool isSelected)
 
virtual void synchronize ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual SubjectgetSubject ()
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void select (bool isSelected)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
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)
 
- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- 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::EditionSalomeNode ( Subject subject,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 43 of file EditionSalomeNode.cxx.

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}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
WidEditItem * _wid
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
virtual std::string getMethod()
Definition: ServiceNode.hxx:51
virtual Container * getContainer()
Return the associated container.
virtual void createTablePorts(QLayout *layout)
EditionElementaryNode(Subject *subject, QWidget *parent=0, const char *name=0)
FormContainerDecorator * _wContainer
YACS::ENGINE::ServiceNode * _servNode
virtual void changeInstance(int index)
virtual void changeContainer(int index)
virtual void changeHost(int index)
A class to edit properties of a subject.
virtual YACS::ENGINE::Node * getNode()

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.

◆ ~EditionSalomeNode()

EditionSalomeNode::~EditionSalomeNode ( )
virtual

Definition at line 104 of file EditionSalomeNode.cxx.

105{
106}

Member Function Documentation

◆ changeContainer

void EditionSalomeNode::changeContainer ( int  index)
virtualslot

Definition at line 218 of file EditionSalomeNode.cxx.

219{
220 string contName = _wComponent->cb_container->itemText(index).toStdString();
221 DEBTRACE(contName);
223 Container *oldContainer = compoInst->getContainer();
224
225 Container *newContainer = 0;
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}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for all component instances.
Base class for all schema objects.
Definition: Proc.hxx:44
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91
virtual ComponentInstance * getComponent()
Return the associated component instance.
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50

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().

◆ changeHost

void EditionSalomeNode::changeHost ( int  index)
virtualslot

Definition at line 243 of file EditionSalomeNode.cxx.

244{
245 string hostName = _wContainer->getHostName(index);
246 DEBTRACE(hostName);
247}
std::string getHostName(int index) const

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

Referenced by EditionSalomeNode().

◆ changeInstance

void EditionSalomeNode::changeInstance ( int  index)
virtualslot

Definition at line 199 of file EditionSalomeNode.cxx.

200{
201 string instName = _wComponent->cb_instance->itemText(index).toStdString();
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);
214 Message mess;
215 }
216}
std::map< std::string, ComponentInstance * > componentInstanceMap
Definition: Proc.hxx:92
std::map< YACS::ENGINE::ComponentInstance *, YACS::HMI::SubjectComponent * > _mapOfSubjectComponent
Definition: guiContext.hxx:74
virtual bool associateToComponent(SubjectComponent *subcomp)

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

Referenced by EditionSalomeNode().

◆ fillComponentPanel

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.

151{
153 if (compoInst)
154 {
155 _wComponent->le_name ->setText(compoInst->getCompoName().c_str());
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}
const std::string & getInstanceName() const
const std::string & getCompoName() const

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().

◆ fillContainerPanel

void EditionSalomeNode::fillContainerPanel ( )
virtualslot

Definition at line 175 of file EditionSalomeNode.cxx.

176{
177 DEBTRACE("EditionSalomeNode::fillContainerPanel");
179 if (compoInst)
180 {
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 FillPanel(YACS::ENGINE::Container *container)
virtual std::string getName() const
Definition: Container.hxx:81

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().

◆ onApply

void EditionSalomeNode::onApply ( )
virtualslot

Definition at line 249 of file EditionSalomeNode.cxx.

250{
251 DEBTRACE("EditionSalomeNode::onApply");
252 bool edited = true;
253 if (_wContainer->onApply())
254 edited = false;
255 _isEdited = _isEdited || edited;
257}

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

◆ onCancel

void EditionSalomeNode::onCancel ( )
virtualslot

◆ synchronize()

void EditionSalomeNode::synchronize ( )
virtual

◆ update()

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.

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:
131 break;
132
133 default:
134 ;
135 }
136}
virtual void update(GuiEvent event, int type, Subject *son)
Definition: EditionNode.cxx:64
void update()
Update the property items with their values in the subject.
virtual Subject * getReference() const
virtual std::string getName()
virtual std::string getName()

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().

Member Data Documentation

◆ _hbl_method

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

Definition at line 72 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

◆ _la_method

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

Definition at line 73 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

◆ _le_method

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

Definition at line 74 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode().

◆ _propeditor

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

Definition at line 69 of file EditionSalomeNode.hxx.

Referenced by EditionSalomeNode(), and update().

◆ _servNode

YACS::ENGINE::ServiceNode* YACS::HMI::EditionSalomeNode::_servNode
protected

◆ _wComponent

FormComponent* YACS::HMI::EditionSalomeNode::_wComponent
protected

◆ _wContainer

FormContainerDecorator* YACS::HMI::EditionSalomeNode::_wContainer
protected

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