Version: 8.3.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...
 
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 _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 ( std::string  position,
std::map< std::string, std::string >  properties 
)

Definition at line 3223 of file commandsProc.cxx.

References _oldProp, and DEBTRACE.

3224  : Command(), _position(position), _properties(properties)
3225 {
3226  DEBTRACE("CommandSetNodeProperties::CommandSetNodeProperties " << position);
3227  _oldProp.clear();
3228 }

Member Function Documentation

std::string CommandSetNodeProperties::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3230 of file commandsProc.cxx.

References _position, and PMMLBasicsTestLauncher::ret.

3231 {
3232  string ret ="CommandSetNodeProperties " + _position;
3233  return ret;
3234 }
bool CommandSetNodeProperties::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3236 of file commandsProc.cxx.

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

3237 {
3238  DEBTRACE("CommandSetNodeProperties::localExecute");
3239  try
3240  {
3241  Proc* proc = GuiContext::getCurrent()->getProc();
3242  Node* node = proc;
3243 
3244  if (!_position.empty()) node = proc->getChildByName(_position);
3245 
3246  if (node)
3247  {
3248  _oldProp = node->getPropertyMap();
3249  node->setProperties(_properties);
3251  snode->update(SETVALUE, 0, snode);
3252  return true;
3253  }
3254  GuiContext::getCurrent()->_lastErrorMessage = "node not found: " + _position;
3255  return false;
3256  }
3257  catch (Exception& ex)
3258  {
3259  DEBTRACE("CommandSetNodeProperties::localExecute() : " << ex.what());
3260  setErrorMsg(ex);
3261  return false;
3262  }
3263 }
bool CommandSetNodeProperties::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3265 of file commandsProc.cxx.

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

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

Member Data Documentation

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

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

Definition at line 586 of file commandsProc.hxx.

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

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: