Version: 8.3.0
YACS::HMI::CommandSetComponentInstanceProperties Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetComponentInstanceProperties:
Collaboration diagram for YACS::HMI::CommandSetComponentInstanceProperties:

Public Member Functions

 CommandSetComponentInstanceProperties (std::string compoinstance, 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 _compoinstance
 
std::map< std::string,
std::string > 
_properties
 
std::map< std::string,
std::string > 
_oldProp
 
bool _oldAnon
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 591 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetComponentInstanceProperties::CommandSetComponentInstanceProperties ( std::string  compoinstance,
std::map< std::string, std::string >  properties 
)

Definition at line 3295 of file commandsProc.cxx.

References _oldProp, and DEBTRACE.

3297  : Command(), _compoinstance(compoinstance), _properties(properties)
3298 {
3299  DEBTRACE("CommandSetComponentInstanceProperties::CommandSetComponentInstanceProperties " << compoinstance);
3300  _oldProp.clear();
3301 }

Member Function Documentation

std::string CommandSetComponentInstanceProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3303 of file commandsProc.cxx.

References _compoinstance, and PMMLBasicsTestLauncher::ret.

3304 {
3305  string ret ="CommandSetComponentInstanceProperties " + _compoinstance;
3306  return ret;
3307 }
bool CommandSetComponentInstanceProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3309 of file commandsProc.cxx.

References _compoinstance, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectComponent, _oldAnon, _oldProp, _properties, YACS::ENGINE::Proc::componentInstanceMap, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::PropertyInterface::getProperties(), YACS::ENGINE::ComponentInstance::isAnonymous(), gui.CONNECTOR::ref(), YACS::ENGINE::ComponentInstance::setAnonymous(), setErrorMsg(), YACS::ENGINE::PropertyInterface::setProperties(), YACS::HMI::SETVALUE, YACS::HMI::Subject::update(), YACS::Exception::what(), and YASSERT.

3310 {
3311  DEBTRACE("CommandSetComponentInstanceProperties::localExecute");
3312  try
3313  {
3314  Proc* proc = GuiContext::getCurrent()->getProc();
3315  if (proc->componentInstanceMap.count(_compoinstance))
3316  {
3318  YASSERT(ref);
3319  _oldProp = ref->getProperties();
3320  _oldAnon = ref->isAnonymous();
3321  ref->setProperties(_properties);
3322  ref->setAnonymous(false);
3324  subcompo->update(SETVALUE, 0, subcompo);
3325  return true;
3326  }
3327  GuiContext::getCurrent()->_lastErrorMessage = "compoinstance not found: " + _compoinstance;
3328  return false;
3329  }
3330  catch (Exception& ex)
3331  {
3332  DEBTRACE("CommandSetComponentInstanceProperties::localExecute() : " << ex.what());
3333  setErrorMsg(ex);
3334  return false;
3335  }
3336 }
bool CommandSetComponentInstanceProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3338 of file commandsProc.cxx.

References _compoinstance, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectComponent, _oldAnon, _oldProp, YACS::ENGINE::Proc::componentInstanceMap, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), gui.CONNECTOR::ref(), YACS::ENGINE::ComponentInstance::setAnonymous(), setErrorMsg(), YACS::ENGINE::PropertyInterface::setProperties(), YACS::HMI::SETVALUE, YACS::HMI::Subject::update(), YACS::Exception::what(), and YASSERT.

3339 {
3340  DEBTRACE("CommandSetComponentInstanceProperties::localReverse");
3341  try
3342  {
3343  Proc* proc = GuiContext::getCurrent()->getProc();
3344  if (proc->componentInstanceMap.count(_compoinstance))
3345  {
3347  YASSERT(ref);
3348  ref->setProperties(_oldProp);
3349  ref->setAnonymous(_oldAnon);
3351  subcompo->update(SETVALUE, 0, subcompo);
3352  return true;
3353  }
3354  GuiContext::getCurrent()->_lastErrorMessage = "compoinstance not found: " + _compoinstance;
3355  return false;
3356  }
3357  catch (Exception& ex)
3358  {
3359  DEBTRACE("CommandSetComponentInstanceProperties::localReverse() : " << ex.what());
3360  setErrorMsg(ex);
3361  return false;
3362  }
3363 }

Member Data Documentation

std::string YACS::HMI::CommandSetComponentInstanceProperties::_compoinstance
protected

Definition at line 600 of file commandsProc.hxx.

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

bool YACS::HMI::CommandSetComponentInstanceProperties::_oldAnon
protected

Definition at line 603 of file commandsProc.hxx.

Referenced by localExecute(), and localReverse().

std::map<std::string,std::string> YACS::HMI::CommandSetComponentInstanceProperties::_oldProp
protected
std::map<std::string,std::string> YACS::HMI::CommandSetComponentInstanceProperties::_properties
protected

Definition at line 601 of file commandsProc.hxx.

Referenced by localExecute().


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