Version: 8.3.0
YACS::HMI::CommandSetContainerProperties Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetContainerProperties:
Collaboration diagram for YACS::HMI::CommandSetContainerProperties:

Public Member Functions

 CommandSetContainerProperties (std::string container, std::map< std::string, std::string > properties)
 
- Public Member Functions inherited from YACS::HMI::Command
 Command ()
 
virtual bool execute ()
 the command is executed a first time after its registration for undo redo, then on redo More...
 
virtual bool reverse (bool isNormal=true)
 Reverse action: undo. More...
 
virtual bool executeSubOnly ()
 execute only sub commands in a reverse action More...
 
std::string recursiveDump (int level=0)
 
void addSubCommand (Command *command)
 
bool isNormalReverse ()
 

Protected Member Functions

virtual bool localExecute ()
 
virtual bool localReverse ()
 
virtual std::string dump ()
 

Protected Attributes

std::string _container
 
std::map< std::string,
std::string > 
_properties
 
std::map< std::string,
std::string > 
_oldProp
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 563 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetContainerProperties::CommandSetContainerProperties ( std::string  container,
std::map< std::string, std::string >  properties 
)

Definition at line 3367 of file commandsProc.cxx.

References _oldProp, and DEBTRACE.

3369  : Command(), _container(container), _properties(properties)
3370 {
3371  DEBTRACE("CommandSetContainerProperties::CommandSetContainerProperties " << container);
3372  _oldProp.clear();
3373 }

Member Function Documentation

std::string CommandSetContainerProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3375 of file commandsProc.cxx.

References _container, and PMMLBasicsTestLauncher::ret.

3376 {
3377  string ret ="CommandSetContainerProperties " + _container;
3378  return ret;
3379 }
bool CommandSetContainerProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3381 of file commandsProc.cxx.

References _container, YACS::HMI::GuiContext::_lastErrorMessage, _oldProp, _properties, YACS::HMI::ASSOCIATE, YACS::HMI::CONTAINER, YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::Container::getProperties(), YACS::HMI::SubjectContainerBase::notifyComponentsChange(), gui.CONNECTOR::ref(), setErrorMsg(), YACS::ENGINE::Container::setProperties(), YACS::HMI::UPDATE, YACS::HMI::Subject::update(), YACS::Exception::what(), and YASSERT.

3382 {
3383  DEBTRACE("CommandSetContainerProperties::localExecute");
3384  try
3385  {
3386  Proc* proc = GuiContext::getCurrent()->getProc();
3387  if (proc->containerMap.count(_container))
3388  {
3390  YASSERT(ref);
3391  _oldProp = ref->getProperties();
3392  ref->setProperties(_properties);
3393  SubjectContainerBase *scont(GuiContext::getCurrent()->_mapOfSubjectContainer[ref]);
3394  scont->update(UPDATE, 0, scont);
3395  scont->notifyComponentsChange(ASSOCIATE, CONTAINER, scont);
3396  return true;
3397  }
3398  GuiContext::getCurrent()->_lastErrorMessage = "container not found: " + _container;
3399  return false;
3400  }
3401  catch (Exception& ex)
3402  {
3403  DEBTRACE("CommandSetContainerProperties::localExecute() : " << ex.what());
3404  setErrorMsg(ex);
3405  return false;
3406  }
3407 }
bool CommandSetContainerProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3409 of file commandsProc.cxx.

References _container, YACS::HMI::GuiContext::_lastErrorMessage, _oldProp, YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), gui.CONNECTOR::ref(), setErrorMsg(), YACS::ENGINE::Container::setProperties(), YACS::Exception::what(), and YASSERT.

3410 {
3411  DEBTRACE("CommandSetContainerProperties::localReverse");
3412  try
3413  {
3414  Proc* proc = GuiContext::getCurrent()->getProc();
3415  if (proc->containerMap.count(_container))
3416  {
3418  YASSERT(ref);
3419  ref->setProperties(_oldProp);
3420  return true;
3421  }
3422  GuiContext::getCurrent()->_lastErrorMessage = "container not found: " + _container;
3423  return false;
3424  }
3425  catch (Exception& ex)
3426  {
3427  DEBTRACE("CommandSetContainerProperties::localReverse() : " << ex.what());
3428  setErrorMsg(ex);
3429  return false;
3430  }
3431 }

Member Data Documentation

std::string YACS::HMI::CommandSetContainerProperties::_container
protected

Definition at line 572 of file commandsProc.hxx.

Referenced by dump(), localExecute(), and localReverse().

std::map<std::string,std::string> YACS::HMI::CommandSetContainerProperties::_oldProp
protected

Definition at line 574 of file commandsProc.hxx.

Referenced by CommandSetContainerProperties(), localExecute(), and localReverse().

std::map<std::string,std::string> YACS::HMI::CommandSetContainerProperties::_properties
protected

Definition at line 573 of file commandsProc.hxx.

Referenced by localExecute().


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