Version: 9.15.0
FormContainerBase Class Referenceabstract

#include <FormContainerBase.hxx>

Inheritance diagram for FormContainerBase:
Collaboration diagram for FormContainerBase:

Public Slots

void on_ch_advance_stateChanged (int state)
 
void onModifyName (const QString &text)
 

Public Member Functions

 FormContainerBase (QWidget *parent=0)
 
virtual ~FormContainerBase ()
 
virtual void FillPanel (YACS::ENGINE::Container *container)
 
virtual void onModified ()
 
virtual bool onApply ()
 
virtual void onCancel ()
 
virtual QString getTypeStr () const =0
 

Protected Attributes

bool _advanced
 
YACS::ENGINE::Container_container
 
std::map< std::string, std::string > _properties
 
FormAdvParamContainer_advancedParams
 

Detailed Description

Definition at line 37 of file FormContainerBase.hxx.

Constructor & Destructor Documentation

◆ FormContainerBase()

FormContainerBase::FormContainerBase ( QWidget parent = 0)

Definition at line 41 of file FormContainerBase.cxx.

42 {
43  setupUi(this);
44  _advanced = false;
45  gridLayout_2->addWidget(_advancedParams);
47 
48  FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
49  connect(le_name, SIGNAL(textChanged(const QString&)), this, SLOT(onModifyName(const QString&)));
50  connect(cb_resource, SIGNAL(activated(const QString&)), _advancedParams, SLOT(onModifyResource(const QString&)));
51 }
std::map< std::string, std::string > _properties
void onModifyName(const QString &text)
void on_ch_advance_stateChanged(int state)
virtual void FillPanel(YACS::ENGINE::Container *container)
FormAdvParamContainer * _advancedParams

References _advanced, _advancedParams, FillPanel(), on_ch_advance_stateChanged(), and onModifyName().

◆ ~FormContainerBase()

FormContainerBase::~FormContainerBase ( )
virtual

Definition at line 53 of file FormContainerBase.cxx.

54 {
55  delete _advancedParams;
56 }

References _advancedParams.

Member Function Documentation

◆ FillPanel()

void FormContainerBase::FillPanel ( YACS::ENGINE::Container container)
virtual

Reimplemented in FormHPContainer, and FormContainer.

Definition at line 58 of file FormContainerBase.cxx.

59 {
60  DEBTRACE("FormContainer::FillPanel");
61  _container = container;
62  if (_container)
63  {
65  le_name->setText(_container->getName().c_str());
66  }
67  else
68  {
69  _properties.clear();
70  le_name->setText("not defined");
71  }
72 
73  //Resources
74  cb_resource->clear();
75  cb_resource->addItem("automatic"); // --- when no resource is selected
76 
77  //add available resources
78  list<string> machines = QtGuiContext::getQtCurrent()->getGMain()->getMachineList();
79  list<string>::iterator itm = machines.begin();
80  for( ; itm != machines.end(); ++itm)
81  {
82  cb_resource->addItem(QString((*itm).c_str()));
83  }
84 
85  std::string resource;
86  if(_properties.count("name") && _properties["name"] != "")
87  {
88  //a resource has been specified
89  int index = cb_resource->findText(_properties["name"].c_str());
90  if (index > 0)
91  {
92  //the resource is found: use it
93  cb_resource->setCurrentIndex(index);
94  resource=_properties["name"];
95  }
96  else
97  {
98  //the resource has not been found: add a false item
99  std::string item="Unknown resource ("+_properties["name"]+")";
100  cb_resource->addItem(item.c_str());
101  cb_resource->setCurrentIndex(cb_resource->count()-1);
102  }
103  }
104  else
105  cb_resource->setCurrentIndex(0);
106  _advancedParams->FillPanel(resource,container);
107 
108  if (!QtGuiContext::getQtCurrent()->isEdition())
109  {
110  //if the schema is in execution do not allow editing
111  le_name->setReadOnly(true);
112  cb_resource->setEnabled(false);
113  }
114 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
void FillPanel(const std::string &resource, YACS::ENGINE::Container *container)
YACS::ENGINE::Container * _container
virtual std::map< std::string, std::string > getProperties() const =0
virtual std::string getName() const
Definition: Container.hxx:81
std::vector< machine > machines
Definition: factory.hxx:111

References _advancedParams, _container, _properties, DEBTRACE, FormAdvParamContainer::FillPanel(), YACS::ENGINE::Container::getName(), and YACS::ENGINE::Container::getProperties().

Referenced by FormContainerDecorator::checkAndRepareTypeIfNecessary(), FormContainer::FillPanel(), FormContainerDecorator::FillPanel(), FormHPContainer::FillPanel(), FormContainerBase(), FormContainerDecorator::FormContainerDecorator(), and onCancel().

◆ getTypeStr()

virtual QString FormContainerBase::getTypeStr ( ) const
pure virtual

◆ on_ch_advance_stateChanged

void FormContainerBase::on_ch_advance_stateChanged ( int  state)
slot

Definition at line 129 of file FormContainerBase.cxx.

130 {
131  DEBTRACE("FormContainer::on_ch_advance_stateChanged " << state);
132  if (state)
133  _advancedParams->show();
134  else
135  _advancedParams->hide();
136 }

References _advancedParams, DEBTRACE, and yacsorb.CORBAEngineTest::state.

Referenced by FormContainerBase().

◆ onApply()

bool FormContainerBase::onApply ( )
virtual

Reimplemented in FormHPContainer.

Definition at line 148 of file FormContainerBase.cxx.

149 {
150  SubjectContainerBase *scont(QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container]);
151  YASSERT(scont);
152  bool ret(scont->setName(le_name->text().toStdString()));
153  DEBTRACE(ret);
154  if (ret)
155  ret = scont->setProperties(_properties);
156  return ret;
157 }
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59

References _container, _properties, DEBTRACE, YACS::HMI::SubjectContainerBase::setName(), YACS::HMI::SubjectContainerBase::setProperties(), and YASSERT.

Referenced by FormContainerDecorator::onApply().

◆ onCancel()

void FormContainerBase::onCancel ( )
virtual

Definition at line 159 of file FormContainerBase.cxx.

160 {
161  SubjectContainerBase *scont(QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container]);
162  YASSERT(scont);
163  FillPanel(scont->getContainer());
164 }

References _container, FillPanel(), YACS::HMI::SubjectContainerBase::getContainer(), and YASSERT.

Referenced by FormContainerDecorator::onCancel().

◆ onModified()

void FormContainerBase::onModified ( )
virtual

Definition at line 116 of file FormContainerBase.cxx.

117 {
118  DEBTRACE("FormContainerBase::onModified");
119  Subject *sub(QtGuiContext::getQtCurrent()->getSelectedSubject());
120  if (!sub)
121  return;
122  YASSERT(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(sub));
123  QWidget *widget(QtGuiContext::getQtCurrent()->_mapOfEditionItem[sub]);
124  ItemEdition *item(dynamic_cast<ItemEdition*>(widget));
125  YASSERT(item);
126  item->setEdited(true);
127 }

References DEBTRACE, YACS::HMI::ItemEdition::setEdited(), and YASSERT.

Referenced by FormHPContainer::initSciptChanged(), FormContainer::onModifyAOC(), onModifyName(), FormHPContainer::onModifySzOfPool(), and FormContainer::onModifyType().

◆ onModifyName

void FormContainerBase::onModifyName ( const QString &  text)
slot

Definition at line 138 of file FormContainerBase.cxx.

139 {
140  DEBTRACE("onModifyName " << text.toStdString());
141  SubjectContainerBase *scont(QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container]);
142  YASSERT(scont);
143  string name = scont->getName();
144  if (name != text.toStdString())
145  onModified();
146 }
virtual void onModified()

References _container, DEBTRACE, YACS::HMI::SubjectContainerBase::getName(), onModified(), and YASSERT.

Referenced by FormContainerBase().

Member Data Documentation

◆ _advanced

bool FormContainerBase::_advanced
protected

Definition at line 54 of file FormContainerBase.hxx.

Referenced by FormContainerBase().

◆ _advancedParams

◆ _container

◆ _properties


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