1 // Copyright (C) 2006-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "EditionContainer.hxx"
23 #include "YacsTrace.hxx"
25 #include "FormContainer.hxx"
26 #include "QtGuiContext.hxx"
27 #include "guiObservers.hxx"
29 #include "Message.hxx"
36 using namespace YACS::HMI;
37 using namespace YACS::ENGINE;
39 EditionContainer::EditionContainer(Subject* subject,
42 : ItemEdition(subject, parent, name)
44 _wContainer = new FormContainer(this);
45 _wid->gridLayout1->addWidget(_wContainer);
46 connect(_wContainer->cb_resource, SIGNAL(mousePressed()),
47 this, SLOT(fillContainerPanel()));
48 connect(_wContainer->tb_container, SIGNAL(toggled(bool)),
49 this, SLOT(fillContainerPanel())); // --- to update display of current selection
50 _wContainer->tb_container->toggle();
53 EditionContainer::~EditionContainer()
57 void EditionContainer::update(GuiEvent event, int type, Subject* son)
59 DEBTRACE("EditionContainer::update");
60 ItemEdition::update(event, type, son);
64 _wContainer->le_name->setText((son->getName()).c_str());
72 void EditionContainer::fillContainerPanel()
74 DEBTRACE("EditionContainer::fillContainerPanel");
75 SubjectContainer *scont = dynamic_cast<SubjectContainer*>(_subject);
77 _wContainer->FillPanel(scont->getContainer());
80 void EditionContainer::onApply()
82 DEBTRACE("EditionContainer::onApply");
84 if (!_wContainer->onApply())
87 Message mess(GuiContext::getCurrent()->_lastErrorMessage);
91 _isEdited = _isEdited || edited;
92 ItemEdition::onApply();
95 void EditionContainer::onCancel()
97 DEBTRACE("EditionContainer::onCancel");
98 SubjectContainer *scont = dynamic_cast<SubjectContainer*>(_subject);
100 _wContainer->FillPanel(scont->getContainer());
101 ItemEdition::onCancel();