Version: 8.3.0
YACS::HMI::CommandSetExecutionMode Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetExecutionMode:
Collaboration diagram for YACS::HMI::CommandSetExecutionMode:

Public Member Functions

 CommandSetExecutionMode (std::string nodeName, std::string mode)
 
- 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 _mode
 
std::string _nodeName
 
std::string _oldmode
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 683 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetExecutionMode::CommandSetExecutionMode ( std::string  nodeName,
std::string  mode 
)

Definition at line 3802 of file commandsProc.cxx.

References _oldmode, and DEBTRACE.

3803  : Command(), _mode(mode),_nodeName(nodeName)
3804 {
3805  DEBTRACE("CommandSetExecutionMode::CommandSetExecutionMode " << nodeName << " " << mode);
3806  _oldmode = "local";
3807 }

Member Function Documentation

std::string CommandSetExecutionMode::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3809 of file commandsProc.cxx.

References _mode, _nodeName, and PMMLBasicsTestLauncher::ret.

3810 {
3811  string ret ="CommandSetExecutionMode " + _mode + " " + _nodeName;
3812  return ret;
3813 }
bool CommandSetExecutionMode::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3815 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _mode, _nodeName, _oldmode, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::UPDATE, YACS::HMI::SubjectNode::update(), and YACS::Exception::what().

3816 {
3817  DEBTRACE("CommandSetExecutionMode::localExecute");
3818  try
3819  {
3820  Proc* proc = GuiContext::getCurrent()->getProc();
3821  Node* node = proc->getChildByName(_nodeName);
3822  if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3823  {
3824  _oldmode = pyNode->getExecutionMode();
3825  pyNode->setExecutionMode(_mode);
3827  snode->update(UPDATE, 0, 0);
3828  return true;
3829  }
3830  else
3831  {
3832  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3833  return false;
3834  }
3835  }
3836  catch (Exception& ex)
3837  {
3838  DEBTRACE("CommandSetExecutionMode::localExecute() : " << ex.what());
3839  setErrorMsg(ex);
3840  return false;
3841  }
3842 }
bool CommandSetExecutionMode::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3844 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _mode, _nodeName, _oldmode, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::UPDATE, YACS::HMI::SubjectNode::update(), and YACS::Exception::what().

3845 {
3846  DEBTRACE("CommandSetExecutionMode::localReverse");
3847  try
3848  {
3849  if (_oldmode == _mode) return true;
3850  Proc* proc = GuiContext::getCurrent()->getProc();
3851  Node* node = proc->getChildByName(_nodeName);
3852  if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3853  {
3854  pyNode->setExecutionMode(_oldmode);
3856  snode->update(UPDATE, 0, 0);
3857  return true;
3858  }
3859  else
3860  {
3861  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3862  return false;
3863  }
3864  }
3865  catch (Exception& ex)
3866  {
3867  DEBTRACE("CommandSetExecutionMode::localReverse() : " << ex.what());
3868  setErrorMsg(ex);
3869  return false;
3870  }
3871  return true;
3872 }

Member Data Documentation

std::string YACS::HMI::CommandSetExecutionMode::_mode
protected

Definition at line 691 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetExecutionMode::_nodeName
protected

Definition at line 692 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetExecutionMode::_oldmode
protected

Definition at line 693 of file commandsProc.hxx.

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


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