Version: 9.16.0
YACS::HMI::CommandSetNodeProperties Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetNodeProperties:
Collaboration diagram for YACS::HMI::CommandSetNodeProperties:

Public Member Functions

 CommandSetNodeProperties (std::string position, 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 _position
 
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 577 of file commandsProc.hxx.

Constructor & Destructor Documentation

◆ CommandSetNodeProperties()

CommandSetNodeProperties::CommandSetNodeProperties ( std::string  position,
std::map< std::string, std::string >  properties 
)

Definition at line 3225 of file commandsProc.cxx.

3226 : Command(), _position(position), _properties(properties)
3227{
3228 DEBTRACE("CommandSetNodeProperties::CommandSetNodeProperties " << position);
3229 _oldProp.clear();
3230}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::map< std::string, std::string > _properties
std::map< std::string, std::string > _oldProp

References _oldProp, and DEBTRACE.

Member Function Documentation

◆ dump()

std::string CommandSetNodeProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3232 of file commandsProc.cxx.

3233{
3234 string ret ="CommandSetNodeProperties " + _position;
3235 return ret;
3236}

References _position.

◆ localExecute()

bool CommandSetNodeProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3238 of file commandsProc.cxx.

3239{
3240 DEBTRACE("CommandSetNodeProperties::localExecute");
3241 try
3242 {
3243 Proc* proc = GuiContext::getCurrent()->getProc();
3244 Node* node = proc;
3245
3246 if (!_position.empty()) node = proc->getChildByName(_position);
3247
3248 if (node)
3249 {
3250 _oldProp = node->getPropertyMap();
3253 snode->update(SETVALUE, 0, snode);
3254 return true;
3255 }
3256 GuiContext::getCurrent()->_lastErrorMessage = "node not found: " + _position;
3257 return false;
3258 }
3259 catch (Exception& ex)
3260 {
3261 DEBTRACE("CommandSetNodeProperties::localExecute() : " << ex.what());
3262 setErrorMsg(ex);
3263 return false;
3264 }
3265}
Node * getChildByName(const std::string &name) const
Base class for all nodes.
Definition: Node.hxx:70
std::map< std::string, std::string > getPropertyMap()
Definition: Node.hxx:173
virtual void setProperties(std::map< std::string, std::string > properties)
Definition: Node.cxx:521
Base class for all schema objects.
Definition: Proc.hxx:44
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
std::string _lastErrorMessage
Definition: guiContext.hxx:79
std::map< YACS::ENGINE::Node *, YACS::HMI::SubjectNode * > _mapOfSubjectNode
Definition: guiContext.hxx:70
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
virtual void update(GuiEvent event, int type, Subject *son)
void setErrorMsg(YACS::Exception &ex)

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldProp, _position, _properties, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::Node::getPropertyMap(), setErrorMsg(), YACS::ENGINE::Node::setProperties(), YACS::HMI::SETVALUE, and YACS::HMI::SubjectNode::update().

◆ localReverse()

bool CommandSetNodeProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3267 of file commandsProc.cxx.

3268{
3269 DEBTRACE("CommandSetNodeProperties::localReverse");
3270 try
3271 {
3272 Proc* proc = GuiContext::getCurrent()->getProc();
3273 Node* node = proc;
3274
3275 if (!_position.empty()) node = proc->getChildByName(_position);
3276
3277 if (node)
3278 {
3279 node->setProperties(_oldProp);
3281 snode->update(SETVALUE, 0, snode);
3282 return true;
3283 }
3284 GuiContext::getCurrent()->_lastErrorMessage = "node not found: " + _position;
3285 return false;
3286 }
3287 catch (Exception& ex)
3288 {
3289 DEBTRACE("CommandSetNodeProperties::localReverse() : " << ex.what());
3290 setErrorMsg(ex);
3291 return false;
3292 }
3293}

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _oldProp, _position, DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::ENGINE::Node::setProperties(), YACS::HMI::SETVALUE, and YACS::HMI::SubjectNode::update().

Member Data Documentation

◆ _oldProp

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

Definition at line 588 of file commandsProc.hxx.

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

◆ _position

std::string YACS::HMI::CommandSetNodeProperties::_position
protected

Definition at line 586 of file commandsProc.hxx.

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

◆ _properties

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

Definition at line 587 of file commandsProc.hxx.

Referenced by localExecute().


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