Version: 8.3.0
YACS::HMI::CommandSetContainer Class Reference

#include <commandsProc.hxx>

Inheritance diagram for YACS::HMI::CommandSetContainer:
Collaboration diagram for YACS::HMI::CommandSetContainer:

Public Member Functions

 CommandSetContainer (std::string nodeName, std::string container)
 
- 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 _container
 
std::string _nodeName
 
std::string _oldcont
 
- Protected Attributes inherited from YACS::HMI::Command
std::vector< Command * > _subCommands
 
bool _normalReverse
 

Detailed Description

Definition at line 696 of file commandsProc.hxx.

Constructor & Destructor Documentation

CommandSetContainer::CommandSetContainer ( std::string  nodeName,
std::string  container 
)

Definition at line 3877 of file commandsProc.cxx.

References _oldcont, and DEBTRACE.

3878  : Command(), _container(container),_nodeName(nodeName)
3879 {
3880  DEBTRACE("CommandSetContainer::CommandSetContainer " << nodeName << " " << container);
3881  _oldcont = "DefaultContainer";
3882 }

Member Function Documentation

std::string CommandSetContainer::dump ( )
protectedvirtual

Reimplemented from YACS::HMI::Command.

Definition at line 3884 of file commandsProc.cxx.

References _container, _nodeName, and PMMLBasicsTestLauncher::ret.

3885 {
3886  string ret ="CommandSetContainer " + _container + " " + _nodeName;
3887  return ret;
3888 }
bool CommandSetContainer::localExecute ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3890 of file commandsProc.cxx.

References _container, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectContainer, YACS::HMI::GuiContext::_mapOfSubjectNode, _nodeName, _oldcont, YACS::HMI::ASSOCIATE, YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SubjectNode::update(), and YACS::Exception::what().

3891 {
3892  DEBTRACE("CommandSetContainer::localExecute");
3893  try
3894  {
3895  Proc* proc = GuiContext::getCurrent()->getProc();
3896  if (proc->containerMap.count(_container))
3897  {
3898  Container *cont = proc->containerMap[_container];
3899  Node* node = proc->getChildByName(_nodeName);
3900  if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3901  {
3902  Container* oldcont = pyNode->getContainer();
3903  if(oldcont)
3904  _oldcont = pyNode->getContainer()->getName();
3905  pyNode->setContainer(cont);
3908  snode->update(ASSOCIATE, 0, subcont);
3909  return true;
3910  }
3911  else
3912  {
3913  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3914  return false;
3915  }
3916  }
3917  else
3918  GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _container;
3919  return false;
3920  }
3921  catch (Exception& ex)
3922  {
3923  DEBTRACE("CommandSetContainer::localExecute() : " << ex.what());
3924  setErrorMsg(ex);
3925  return false;
3926  }
3927 }
bool CommandSetContainer::localReverse ( )
protectedvirtual

Implements YACS::HMI::Command.

Definition at line 3929 of file commandsProc.cxx.

References _container, YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectContainer, YACS::HMI::GuiContext::_mapOfSubjectNode, _nodeName, _oldcont, YACS::HMI::ASSOCIATE, YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::ENGINE::ComposedNode::getChildByName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), setErrorMsg(), YACS::HMI::SubjectNode::update(), and YACS::Exception::what().

3930 {
3931  DEBTRACE("CommandSetContainer::localReverse");
3932  try
3933  {
3934  if (_oldcont == _container) return true;
3935  Proc* proc = GuiContext::getCurrent()->getProc();
3936  if (proc->containerMap.count(_oldcont))
3937  {
3938  Container *cont = proc->containerMap[_oldcont];
3939  Node* node = proc->getChildByName(_nodeName);
3940  if (YACS::ENGINE::InlineNode* pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(node))
3941  {
3942  pyNode->setContainer(cont);
3945  snode->update(ASSOCIATE, 0, subcont);
3946  return true;
3947  }
3948  else
3949  {
3950  GuiContext::getCurrent()->_lastErrorMessage = "node is not an InlineNode: " + _nodeName;
3951  return false;
3952  }
3953  }
3954  else
3955  GuiContext::getCurrent()->_lastErrorMessage = "Container not found: " + _oldcont;
3956  return false;
3957  }
3958  catch (Exception& ex)
3959  {
3960  DEBTRACE("CommandSetContainer::localReverse() : " << ex.what());
3961  setErrorMsg(ex);
3962  return false;
3963  }
3964  return true;
3965 }

Member Data Documentation

std::string YACS::HMI::CommandSetContainer::_container
protected

Definition at line 704 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetContainer::_nodeName
protected

Definition at line 705 of file commandsProc.hxx.

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

std::string YACS::HMI::CommandSetContainer::_oldcont
protected

Definition at line 706 of file commandsProc.hxx.

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


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