Version: 9.16.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...
 
virtual std::string dump ()
 
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 ()
 
virtual bool localExecute ()=0
 
virtual bool localReverse ()=0
 

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::CommandSetComponentInstanceProperties ( std::string  compoinstance,
std::map< std::string, std::string >  properties 
)

Definition at line 3297 of file commandsProc.cxx.

3299 : Command(), _compoinstance(compoinstance), _properties(properties)
3300{
3301 DEBTRACE("CommandSetComponentInstanceProperties::CommandSetComponentInstanceProperties " << compoinstance);
3302 _oldProp.clear();
3303}
#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 CommandSetComponentInstanceProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3305 of file commandsProc.cxx.

3306{
3307 string ret ="CommandSetComponentInstanceProperties " + _compoinstance;
3308 return ret;
3309}

References _compoinstance.

◆ localExecute()

bool CommandSetComponentInstanceProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3311 of file commandsProc.cxx.

3312{
3313 DEBTRACE("CommandSetComponentInstanceProperties::localExecute");
3314 try
3315 {
3316 Proc* proc = GuiContext::getCurrent()->getProc();
3317 if (proc->componentInstanceMap.count(_compoinstance))
3318 {
3320 YASSERT(ref);
3321 _oldProp = ref->getProperties();
3322 _oldAnon = ref->isAnonymous();
3323 ref->setProperties(_properties);
3324 ref->setAnonymous(false);
3326 subcompo->update(SETVALUE, 0, subcompo);
3327 return true;
3328 }
3329 GuiContext::getCurrent()->_lastErrorMessage = "compoinstance not found: " + _compoinstance;
3330 return false;
3331 }
3332 catch (Exception& ex)
3333 {
3334 DEBTRACE("CommandSetComponentInstanceProperties::localExecute() : " << ex.what());
3335 setErrorMsg(ex);
3336 return false;
3337 }
3338}
#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 component instances.
Base class for all schema objects.
Definition: Proc.hxx:44
std::map< std::string, ComponentInstance * > componentInstanceMap
Definition: Proc.hxx:92
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::string _lastErrorMessage
Definition: guiContext.hxx:79
std::map< YACS::ENGINE::ComponentInstance *, YACS::HMI::SubjectComponent * > _mapOfSubjectComponent
Definition: guiContext.hxx:74
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
virtual void update(GuiEvent event, int type, Subject *son)
void setErrorMsg(YACS::Exception &ex)
def ref(target, callback=None)
Definition: CONNECTOR.py:120

References _compoinstance, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectComponent, _oldAnon, _oldProp, _properties, YACS::ENGINE::Proc::componentInstanceMap, DEBTRACE, testCppPluginInvokation::ex, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), gui.CONNECTOR::ref(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::HMI::Subject::update(), and YASSERT.

◆ localReverse()

bool CommandSetComponentInstanceProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3340 of file commandsProc.cxx.

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

References _compoinstance, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectComponent, _oldAnon, _oldProp, YACS::ENGINE::Proc::componentInstanceMap, DEBTRACE, testCppPluginInvokation::ex, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), gui.CONNECTOR::ref(), setErrorMsg(), YACS::HMI::SETVALUE, YACS::HMI::Subject::update(), and YASSERT.

Member Data Documentation

◆ _compoinstance

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

Definition at line 600 of file commandsProc.hxx.

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

◆ _oldAnon

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

Definition at line 603 of file commandsProc.hxx.

Referenced by localExecute(), and localReverse().

◆ _oldProp

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

◆ _properties

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: