Version: 8.3.0
YACS::HMI::EditionComponent Class Reference

#include <EditionComponent.hxx>

Inheritance diagram for YACS::HMI::EditionComponent:
Collaboration diagram for YACS::HMI::EditionComponent:

Public Slots

virtual void fillContainerPanel ()
 
virtual void changeContainer (int index)
 
- Public Slots inherited from YACS::HMI::ItemEdition
virtual void onApply ()
 
virtual void onCancel ()
 
virtual void onModifyName (const QString &text)
 

Public Member Functions

 EditionComponent (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionComponent ()
 
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 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
 
ComboBox_cb_container
 
- 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 Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 32 of file EditionComponent.hxx.

Constructor & Destructor Documentation

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

Definition at line 36 of file EditionComponent.cxx.

References _cb_container, _propeditor, YACS::HMI::ItemEditionBase::_subject, FormEditItem::_wid, changeContainer(), and fillContainerPanel().

39  : ItemEdition(subject, parent, name)
40 {
41 
42  QHBoxLayout* hboxLayout = new QHBoxLayout();
43  hboxLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
44  QLabel* la_container = new QLabel("Container:");
45  hboxLayout->addWidget(la_container);
46  _cb_container = new ComboBox();
47  hboxLayout->addWidget(_cb_container);
48  _wid->gridLayout1->addLayout(hboxLayout, 3, 0, 1, 1);
50  _wid->gridLayout1->addWidget(_propeditor);
51 
52  connect(_cb_container, SIGNAL(mousePressed()),
53  this, SLOT(fillContainerPanel()));
54  connect(_cb_container, SIGNAL(activated(int)),
55  this, SLOT(changeContainer(int)));
56 
58 }
EditionComponent::~EditionComponent ( )
virtual

Definition at line 60 of file EditionComponent.cxx.

61 {
62 }

Member Function Documentation

void EditionComponent::changeContainer ( int  index)
virtualslot

Definition at line 92 of file EditionComponent.cxx.

References _cb_container, YACS::HMI::GuiContext::_mapOfSubjectContainer, YACS::HMI::ItemEditionBase::_subject, YACS::HMI::SubjectComponent::associateToContainer(), YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::HMI::SubjectComponent::getComponent(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), and YACS::HMI::Subject::select().

Referenced by EditionComponent().

93 {
94  string contName = _cb_container->itemText(index).toStdString();
95  DEBTRACE(contName);
96  SubjectComponent *scompo=dynamic_cast<SubjectComponent*>(_subject);
97  ComponentInstance *compoInst = scompo->getComponent();
98 
99  Proc* proc = GuiContext::getCurrent()->getProc();
100 
101  if (proc->containerMap.count(contName)==0)
102  {
103  DEBTRACE("-------------> not found : " << contName);
104  return;
105  }
106  Container *newContainer =proc->containerMap[contName];
108  scompo->associateToContainer(scnt);
109  scompo->select(true);
110 }
void EditionComponent::fillContainerPanel ( )
virtualslot

Definition at line 74 of file EditionComponent.cxx.

References _cb_container, YACS::HMI::ItemEditionBase::_subject, YACS::ENGINE::Proc::containerMap, YACS::HMI::SubjectComponent::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::Container::getName(), and YACS::HMI::GuiContext::getProc().

Referenced by EditionComponent(), and update().

75 {
76  Proc* proc = GuiContext::getCurrent()->getProc();
77  _cb_container->clear();
78  std::map<string,Container*>::const_iterator it = proc->containerMap.begin();
79  for(; it != proc->containerMap.end(); ++it)
80  _cb_container->addItem( QString((*it).first.c_str()));
81 
82  SubjectComponent *scompo=dynamic_cast<SubjectComponent*>(_subject);
83  ComponentInstance *compoInst = scompo->getComponent();
84  Container * cont = compoInst->getContainer();
85  if (cont)
86  {
87  int index = _cb_container->findText(cont->getName().c_str());
88  _cb_container->setCurrentIndex(index);
89  }
90 }
void EditionComponent::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::ItemEdition.

Definition at line 64 of file EditionComponent.cxx.

References _propeditor, YACS::HMI::ADDREF, YACS::HMI::ASSOCIATE, DEBTRACE, YACS::HMI::GuiObserver::eventName(), fillContainerPanel(), YACS::HMI::SETVALUE, and YACS::HMI::PropertyEditor::update().

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

65 {
66  DEBTRACE("EditionComponent::update " <<eventName(event) << " " << type);
67  if(event == SETVALUE)
69 
70  if(event == ADDREF || event == ASSOCIATE)
72 }

Member Data Documentation

ComboBox* YACS::HMI::EditionComponent::_cb_container
protected

Definition at line 43 of file EditionComponent.hxx.

Referenced by changeContainer(), EditionComponent(), and fillContainerPanel().

PropertyEditor* YACS::HMI::EditionComponent::_propeditor
protected

Definition at line 42 of file EditionComponent.hxx.

Referenced by EditionComponent(), and update().


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