Version: 9.15.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::CommandSetContainerProperties ( std::string  container,
std::map< std::string, std::string >  properties 
)

Definition at line 3369 of file commandsProc.cxx.

3371  : Command(), _container(container), _properties(properties)
3372 {
3373  DEBTRACE("CommandSetContainerProperties::CommandSetContainerProperties " << container);
3374  _oldProp.clear();
3375 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::map< std::string, std::string > _oldProp
std::map< std::string, std::string > _properties

References _oldProp, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetContainerProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3377 of file commandsProc.cxx.

3378 {
3379  string ret ="CommandSetContainerProperties " + _container;
3380  return ret;
3381 }

References _container.

◆ localExecute()

bool CommandSetContainerProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3383 of file commandsProc.cxx.

3384 {
3385  DEBTRACE("CommandSetContainerProperties::localExecute");
3386  try
3387  {
3388  Proc* proc = GuiContext::getCurrent()->getProc();
3389  if (proc->containerMap.count(_container))
3390  {
3392  YASSERT(ref);
3393  _oldProp = ref->getProperties();
3394  ref->setProperties(_properties);
3395  SubjectContainerBase *scont(GuiContext::getCurrent()->_mapOfSubjectContainer[ref]);
3396  scont->update(UPDATE, 0, scont);
3397  scont->notifyComponentsChange(ASSOCIATE, CONTAINER, scont);
3398  return true;
3399  }
3400  GuiContext::getCurrent()->_lastErrorMessage = "container not found: " + _container;
3401  return false;
3402  }
3403  catch (Exception& ex)
3404  {
3405  DEBTRACE("CommandSetContainerProperties::localExecute() : " << ex.what());
3406  setErrorMsg(ex);
3407  return false;
3408  }
3409 }
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
Base class for all schema objects.
Definition: Proc.hxx:44
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
std::string _lastErrorMessage
Definition: guiContext.hxx:79
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
void setErrorMsg(YACS::Exception &ex)
def ref(target, callback=None)
Definition: CONNECTOR.py:120

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

◆ localReverse()

bool CommandSetContainerProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3411 of file commandsProc.cxx.

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

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

Member Data Documentation

◆ _container

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

Definition at line 572 of file commandsProc.hxx.

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

◆ _oldProp

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().

◆ _properties

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: