Version: 8.3.0
YACS::HMI::CommandSetInlineNodeScript Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetInlineNodeScript:
Collaboration diagram for YACS::HMI::CommandSetInlineNodeScript:

Public Member Functions

 CommandSetInlineNodeScript (std::string node, std::string script)
 
- 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 _nodeName
 
std::string _script
 
std::string _oldScript
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 653 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetInlineNodeScript::CommandSetInlineNodeScript ( std::string  node,
std::string  script 
)

Definition at line 3655 of file commandsProc.cxx.

References _oldScript, and DEBTRACE.

3656  : Command(), _nodeName(node), _script(script)
3657 {
3658  DEBTRACE("CommandSetInlineNodeScript::CommandSetInlineNodeScript " << node << " " <<script);
3659  _oldScript.clear();
3660 }

Member Function Documentation

std::string CommandSetInlineNodeScript::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3662 of file commandsProc.cxx.

References _nodeName, and PMMLBasicsTestLauncher::ret.

3663 {
3664  string ret ="CommandSetInlineNodeScript " + _nodeName;
3665  return ret;
3666 }
bool CommandSetInlineNodeScript::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3668 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _nodeName, _oldScript, _script, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SYNCHRO, YACS::Exception::what(), and YASSERT.

3669 {
3670  DEBTRACE("CommandSetInlineNodeScript::localExecute");
3671  try
3672  {
3673  Proc* proc = GuiContext::getCurrent()->getProc();
3674  Node* node = proc->getChildByName(_nodeName);
3675  if (_script.empty())
3676  {
3677  GuiContext::getCurrent()->_lastErrorMessage = "InlineNode script empty: " + _nodeName;
3678  return false;
3679  }
3680  if (YACS::ENGINE::InlineNode* inlineNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3681  {
3682  _oldScript = inlineNode->getScript();
3683  inlineNode->setScript(_script);
3684  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
3686  snode->update(SYNCHRO,0,snode);
3687  return true;
3688  }
3689  else
3690  {
3691  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3692  return false;
3693  }
3694  }
3695  catch (Exception& ex)
3696  {
3697  DEBTRACE("CommandSetInlineNodeScript::localExecute() : " << ex.what());
3698  setErrorMsg(ex);
3699  return false;
3700  }
3701 }
bool CommandSetInlineNodeScript::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3703 of file commandsProc.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectNode, _nodeName, _oldScript, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SYNCHRO, YACS::Exception::what(), and YASSERT.

3704 {
3705  DEBTRACE("CommandSetInlineNodeScript::localReverse");
3706  try
3707  {
3708  Proc* proc = GuiContext::getCurrent()->getProc();
3709  Node* node = proc->getChildByName(_nodeName);
3710  if (YACS::ENGINE::InlineNode* inlineNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3711  {
3712  inlineNode->setScript(_oldScript);
3713  YASSERT(GuiContext::getCurrent()->_mapOfSubjectNode.count(node));
3715  snode->update(SYNCHRO,0,snode);
3716  return true;
3717  }
3718  else
3719  {
3720  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3721  return false;
3722  }
3723  }
3724  catch (Exception& ex)
3725  {
3726  DEBTRACE("CommandSetInlineNodeScript::localExecute() : " << ex.what());
3727  setErrorMsg(ex);
3728  return false;
3729  }
3730 }

Member Data Documentation

std::string YACS::HMI::CommandSetInlineNodeScript::_nodeName
protected

Definition at line 661 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetInlineNodeScript::_oldScript
protected

Definition at line 663 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetInlineNodeScript::_script
protected

Definition at line 662 of file commandsProc.hxx.

Referenced by localExecute().


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