Version: 8.3.0
FormContainerDecorator Class Reference

#include <FormContainerDecorator.hxx>

Inheritance diagram for FormContainerDecorator:
Collaboration diagram for FormContainerDecorator:

Public Slots

void on_tb_container_toggled (bool checked)
 
void onResMousePressed ()
 
void onResActivated (int)
 
void onContToggled (bool)
 

Signals

void typeOfContainerIsKnown (const QString &typeOfCont)
 
void resourceMousePressed ()
 
void resourceActivated (int)
 
void containerToggled (bool)
 

Public Member Functions

 FormContainerDecorator (YACS::ENGINE::Container *cont, QWidget *parent=0)
 
 ~FormContainerDecorator ()
 
void FillPanel (YACS::ENGINE::Container *container)
 
QWidgetgetWidget ()
 
bool onApply ()
 
void onCancel ()
 
void show ()
 
void hide ()
 
void synchronizeCheckContainer ()
 
std::string getHostName (int index) const
 
void setName (const std::string &name)
 

Static Public Attributes

static bool CHECKED = false
 

Private Member Functions

bool checkOK () const
 
void checkAndRepareTypeIfNecessary (YACS::ENGINE::Container *container)
 
void connectForTyp ()
 

Private Attributes

FormContainerBase_typ
 
QIcon _icon
 

Detailed Description

Definition at line 40 of file FormContainerDecorator.hxx.

Constructor & Destructor Documentation

FormContainerDecorator::FormContainerDecorator ( YACS::ENGINE::Container cont,
QWidget parent = 0 
)

Definition at line 34 of file FormContainerDecorator.cxx.

References _icon, _typ, CHECKED, connectForTyp(), FormContainerBase::FillPanel(), FormContainerBase::getTypeStr(), on_tb_container_toggled(), and typeOfContainerIsKnown().

34  :QWidget(parent),_typ(0)
35 {
36  setupUi(this);
37  _icon.addFile("icons:icon_down.png");
38  _icon.addFile("icons:icon_up.png",QSize(), QIcon::Normal, QIcon::On);
39  tb_container->setIcon(_icon);
40  connect(this,SIGNAL(typeOfContainerIsKnown(const QString&)),label,SLOT(setText(const QString &)));
41  if(!cont)
42  return ;
43  HomogeneousPoolContainer *hpc(dynamic_cast<HomogeneousPoolContainer *>(cont));
44  if(!hpc)
45  _typ=new FormContainer(this);
46  else
47  _typ=new FormHPContainer(this);
49  _typ->FillPanel(cont);
50  gridLayout_1->addWidget(_typ);
51  connectForTyp();
52  tb_container->setChecked(CHECKED);
54 }
FormContainerDecorator::~FormContainerDecorator ( )

Definition at line 56 of file FormContainerDecorator.cxx.

References _typ.

57 {
58  delete _typ;
59 }

Member Function Documentation

void FormContainerDecorator::checkAndRepareTypeIfNecessary ( YACS::ENGINE::Container container)
private

Definition at line 157 of file FormContainerDecorator.cxx.

References _typ, connectForTyp(), FormContainerBase::FillPanel(), FormContainerBase::getTypeStr(), and typeOfContainerIsKnown().

Referenced by FillPanel().

158 {
159  if(!container)
160  return ;
161  YACS::ENGINE::HomogeneousPoolContainer *cont1(dynamic_cast<YACS::ENGINE::HomogeneousPoolContainer *>(container));
162  if(_typ)
163  {
164  bool isTyp1(dynamic_cast<FormHPContainer *>(_typ)!=0);
165  if((!cont1 && !isTyp1) || (cont1 && isTyp1))
166  return ;
167  delete _typ; _typ=0;
168  }
169  if(!cont1)
170  _typ=new FormContainer(this);
171  else
172  _typ=new FormHPContainer(this);
173  gridLayout_1->addWidget(_typ);
175  connectForTyp();
176  _typ->FillPanel(container);
177 }
bool FormContainerDecorator::checkOK ( ) const
private

Definition at line 152 of file FormContainerDecorator.cxx.

References _typ.

Referenced by getHostName(), hide(), onApply(), onCancel(), setName(), and show().

153 {
154  return _typ;
155 }
void FormContainerDecorator::connectForTyp ( )
private

Definition at line 179 of file FormContainerDecorator.cxx.

References _typ, onContToggled(), onResActivated(), and onResMousePressed().

Referenced by checkAndRepareTypeIfNecessary(), and FormContainerDecorator().

180 {
181  connect(_typ->cb_resource,SIGNAL(mousePressed()),this,SLOT(onResMousePressed()));
182  connect(_typ->cb_resource,SIGNAL(activated(int)),this,SLOT(onResActivated));
183  connect(tb_container,SIGNAL(toggled(bool)),this,SLOT(onContToggled()));
184 }
void FormContainerDecorator::containerToggled ( bool  )
signal

Referenced by onContToggled().

std::string FormContainerDecorator::getHostName ( int  index) const

Definition at line 123 of file FormContainerDecorator.cxx.

References _typ, and checkOK().

Referenced by YACS::HMI::EditionSalomeNode::changeHost().

124 {
125  if(!checkOK())
126  return std::string();
127  return _typ->cb_resource->itemText(index).toStdString();
128 }
QWidget * FormContainerDecorator::getWidget ( )

Definition at line 67 of file FormContainerDecorator.cxx.

References _typ.

Referenced by on_tb_container_toggled().

68 {
69  return _typ;
70 }
void FormContainerDecorator::hide ( )

Definition at line 96 of file FormContainerDecorator.cxx.

References _typ, and checkOK().

Referenced by YACS::HMI::EditionScript::on_remote_toggled(), and YACS::HMI::EditionScript::on_tb_options_toggled().

97 {
98  QWidget::hide();
99  if(!checkOK())
100  return ;
101  _typ->hide();
102 }
void FormContainerDecorator::on_tb_container_toggled ( bool  checked)
slot

Definition at line 104 of file FormContainerDecorator.cxx.

References CHECKED, DEBTRACE, and getWidget().

Referenced by FormContainerDecorator(), and show().

105 {
106  DEBTRACE("FormContainer::on_tb_container_toggled " << checked);
107  CHECKED = checked;
108  if (CHECKED)
109  {
110  getWidget()->show();
111  }
112  else
113  {
114  getWidget()->hide();
115  }
116 }
bool FormContainerDecorator::onApply ( )

Definition at line 72 of file FormContainerDecorator.cxx.

References _typ, checkOK(), and FormContainerBase::onApply().

Referenced by YACS::HMI::EditionScript::onApply(), YACS::HMI::EditionContainer::onApply(), and YACS::HMI::EditionSalomeNode::onApply().

73 {
74  if(!checkOK())
75  return false;
76  return _typ->onApply();
77 }
void FormContainerDecorator::onCancel ( )

Definition at line 79 of file FormContainerDecorator.cxx.

References _typ, checkOK(), and FormContainerBase::onCancel().

Referenced by YACS::HMI::EditionScript::onCancel(), and YACS::HMI::EditionContainer::onCancel().

80 {
81  if(!checkOK())
82  return ;
83  _typ->onCancel();
84 }
void FormContainerDecorator::onContToggled ( bool  v)
slot

Definition at line 147 of file FormContainerDecorator.cxx.

References containerToggled().

Referenced by connectForTyp().

148 {
149  emit(containerToggled(v));
150 }
void FormContainerDecorator::onResActivated ( int  v)
slot

Definition at line 142 of file FormContainerDecorator.cxx.

References resourceActivated().

Referenced by connectForTyp().

143 {
144  emit(resourceActivated(v));
145 }
void FormContainerDecorator::onResMousePressed ( )
slot

Definition at line 137 of file FormContainerDecorator.cxx.

References resourceMousePressed().

Referenced by connectForTyp().

138 {
139  emit(resourceMousePressed());
140 }
void FormContainerDecorator::resourceActivated ( int  )
signal

Referenced by onResActivated().

void FormContainerDecorator::resourceMousePressed ( )
signal

Referenced by onResMousePressed().

void FormContainerDecorator::setName ( const std::string &  name)

Definition at line 130 of file FormContainerDecorator.cxx.

References _typ, and checkOK().

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

131 {
132  if(!checkOK())
133  return ;
134  _typ->le_name->setText(name.c_str());
135 }
void FormContainerDecorator::show ( )

Definition at line 86 of file FormContainerDecorator.cxx.

References _typ, CHECKED, checkOK(), and on_tb_container_toggled().

Referenced by YACS::HMI::EditionScript::on_remote_toggled(), and YACS::HMI::EditionScript::on_tb_options_toggled().

87 {
88  QWidget::show();
89  if(!checkOK())
90  return ;
91  _typ->show();
92  tb_container->setChecked(CHECKED);
94 }
void FormContainerDecorator::synchronizeCheckContainer ( )

Definition at line 118 of file FormContainerDecorator.cxx.

References CHECKED.

Referenced by YACS::HMI::EditionSalomeNode::synchronize().

119 {
120  tb_container->setChecked(CHECKED);
121 }
void FormContainerDecorator::typeOfContainerIsKnown ( const QString &  typeOfCont)
signal

Member Data Documentation

QIcon FormContainerDecorator::_icon
private

Definition at line 73 of file FormContainerDecorator.hxx.

Referenced by FormContainerDecorator().

bool FormContainerDecorator::CHECKED = false
static

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