Salome HOME
Merge from BR_imps_2013 14/01/2014
[modules/yacs.git] / src / genericgui / FormContainer.cxx
1 // Copyright (C) 2006-2013  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "FormContainer.hxx"
21 #include "FormComponent.hxx"
22 #include "QtGuiContext.hxx"
23 #include "Container.hxx"
24
25 #include <cassert>
26 #include <cstdlib>
27 #include <climits>
28
29 //#define _DEVDEBUG_
30 #include "YacsTrace.hxx"
31
32 #include <QList>
33 #include <sstream>
34
35 using namespace std;
36 using namespace YACS;
37 using namespace YACS::HMI;
38 using namespace YACS::ENGINE;
39
40 bool FormContainer::_checked = false;
41
42 FormContainer::FormContainer(QWidget *parent)
43 {
44   setupUi(this);
45   _advanced = false;
46   _properties.clear();
47
48   QIcon icon;
49   icon.addFile("icons:icon_down.png");
50   icon.addFile("icons:icon_up.png",
51                 QSize(), QIcon::Normal, QIcon::On);
52   tb_container->setIcon(icon);
53   on_tb_container_toggled(FormContainer::_checked);
54   on_ch_advance_stateChanged(0);
55
56   sb_mem->setMaximum(INT_MAX);
57   sb_cpu->setMaximum(INT_MAX);
58   sb_nbNodes->setMaximum(INT_MAX);
59   sb_procNode->setMaximum(INT_MAX);
60   sb_nbprocpar->setMaximum(INT_MAX);
61   sb_nbproc->setMaximum(INT_MAX);
62   
63
64   FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
65
66   connect(le_name, SIGNAL(textChanged(const QString&)),
67           this, SLOT(onModifyName(const QString&)));
68
69   connect(cb_resource, SIGNAL(activated(const QString&)),
70           this, SLOT(onModifyResource(const QString&)));
71
72   connect(cb_policy, SIGNAL(activated(const QString&)),
73           this, SLOT(onModifyPolicy(const QString&)));
74
75   connect(cb_type, SIGNAL(activated(const QString&)),
76           this, SLOT(onModifyType(const QString&)));
77
78   connect(cb_parallel, SIGNAL(activated(const QString&)),
79           this, SLOT(onModifyParLib(const QString&)));
80
81   connect(le_workdir, SIGNAL(textChanged(const QString&)),
82           this, SLOT(onModifyWorkDir(const QString&)));
83
84   connect(le_contname, SIGNAL(textChanged(const QString&)),
85           this, SLOT(onModifyContName(const QString&)));
86
87   connect(le_os, SIGNAL(textChanged(const QString&)),
88           this, SLOT(onModifyOS(const QString&)));
89
90   connect(le_hostname, SIGNAL(textChanged(const QString&)),
91           this, SLOT(onModifyHostName(const QString&)));
92
93   connect(le_compolist, SIGNAL(textChanged(const QString&)),
94           this, SLOT(onModifyCompoList(const QString&)));
95
96   connect(le_resourceList, SIGNAL(textChanged(const QString&)),
97           this, SLOT(onModifyResourceList(const QString&)));
98
99   connect(ch_mpi, SIGNAL(clicked(bool)),
100           this, SLOT(onModifyIsMPI(bool)));
101
102   connect(sb_mem, SIGNAL(valueChanged(const QString&)),
103           this, SLOT(onModifyMem(const QString&)));
104
105   connect(sb_cpu, SIGNAL(valueChanged(const QString&)),
106           this, SLOT(onModifyClock(const QString&)));
107
108   connect(sb_nbNodes, SIGNAL(valueChanged(const QString&)),
109           this, SLOT(onModifyNodes(const QString&)));
110
111   connect(sb_procNode, SIGNAL(valueChanged(const QString&)),
112           this, SLOT(onModifyProcs(const QString&)));
113
114   connect(sb_nbprocpar, SIGNAL(valueChanged(const QString&)),
115           this, SLOT(onModifyProcPar(const QString&)));
116
117   connect(sb_nbproc, SIGNAL(valueChanged(const QString&)),
118           this, SLOT(onModifyProcRes(const QString&)));
119 }
120
121 FormContainer::~FormContainer()
122 {
123 }
124
125 void FormContainer::FillPanel(YACS::ENGINE::Container *container)
126 {
127   DEBTRACE("FormContainer::FillPanel");
128   _container = container;
129   if (_container)
130     {
131       _properties = _container->getProperties();
132       le_name->setText(_container->getName().c_str());
133     }
134   else
135     {
136       _properties.clear();
137       le_name->setText("not defined");
138     }
139
140   cb_type->clear();
141   cb_type->addItem("mono");
142   cb_type->addItem("multi");
143   if(_properties.count("type") && _properties["type"]=="multi")
144   {
145     cb_type->setCurrentIndex(1);
146     cb_mode->setText("multi");
147   }
148   else
149     cb_mode->setText("mono");
150
151
152   vector<string> parlibs;
153   parlibs.push_back("");
154   parlibs.push_back("Mpi");
155   parlibs.push_back("Dummy");
156   cb_parallel->clear();
157   for(int i=0; i< parlibs.size(); i++)
158     cb_parallel->addItem(parlibs[i].c_str());
159   if(_properties.count("parallelLib"))
160     {
161       int i=0;
162       for(i=0; i< parlibs.size(); i++)
163         if(parlibs[i] == _properties["parallelLib"])
164           {
165             cb_parallel->setCurrentIndex(i);
166             break;
167           }
168     }
169   else
170     cb_parallel->setCurrentIndex(0);
171   
172   if(_properties.count("workingdir"))
173     le_workdir->setText(_properties["workingdir"].c_str());
174   else
175     le_workdir->setText("");
176
177   if(_properties.count("container_name"))
178     le_contname->setText(_properties["container_name"].c_str());
179   else
180     le_contname->setText("");
181
182   if(_properties.count("isMPI"))
183     {
184       DEBTRACE("_properties[isMPI]=" << _properties["isMPI"]);
185       if ((_properties["isMPI"] == "0") || (_properties["isMPI"] == "false"))
186         ch_mpi->setCheckState(Qt::Unchecked);
187       else
188         ch_mpi->setCheckState(Qt::Checked);
189     }
190   else
191     ch_mpi->setCheckState(Qt::Unchecked);
192
193   if(_properties.count("nb_parallel_procs"))
194     sb_nbprocpar->setValue(atoi(_properties["nb_parallel_procs"].c_str()));
195   else
196     sb_nbprocpar->setValue(0);
197
198   //Resources
199   cb_resource->clear();
200   cb_resource->addItem("automatic"); // --- when no resource is selected
201
202   //add available resources
203   list<string> machines = QtGuiContext::getQtCurrent()->getGMain()->getMachineList();
204   list<string>::iterator itm = machines.begin();
205   for( ; itm != machines.end(); ++itm)
206     {
207       cb_resource->addItem(QString((*itm).c_str()));
208     }
209
210   std::string resource="";
211   if(_properties.count("name") && _properties["name"] != "")
212     {
213       //a resource has been specified
214       int index = cb_resource->findText(_properties["name"].c_str());
215       if (index > 0)
216         {
217           //the resource is found: use it
218           cb_resource->setCurrentIndex(index);
219           resource=_properties["name"];
220         }
221       else
222         {
223           //the resource has not been found: add a false item
224           std::string item="Unknown resource ("+_properties["name"]+")";
225           cb_resource->addItem(item.c_str());
226           cb_resource->setCurrentIndex(cb_resource->count()-1);
227         }
228     }
229   else
230     cb_resource->setCurrentIndex(0);
231   updateResource(resource);
232
233   if (!QtGuiContext::getQtCurrent()->isEdition())
234     {
235       //if the schema is in execution do not allow editing
236       le_name->setReadOnly(true);
237       cb_type->setEnabled(false);
238       cb_parallel->setEnabled(false);
239       le_workdir->setReadOnly(true);
240       le_contname->setReadOnly(true);
241       ch_mpi->setEnabled(false);
242       sb_nbprocpar->setReadOnly(true);
243       cb_resource->setEnabled(false);
244       le_hostname->setEnabled(false);
245       le_os->setEnabled(false);
246       sb_nbproc->setEnabled(false);
247       sb_mem->setEnabled(false);
248       sb_cpu->setEnabled(false);
249       sb_nbNodes->setEnabled(false);
250       sb_procNode->setEnabled(false);
251       cb_policy->setEnabled(false);
252       le_compolist->setEnabled(false);
253       le_resourceList->setEnabled(false);
254     }
255 }
256
257 void FormContainer::onModified()
258 {
259   DEBTRACE("FormContainer::onModified");
260   Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
261   if (!sub) return;
262   YASSERT(QtGuiContext::getQtCurrent()->_mapOfEditionItem.count(sub));
263   QWidget *widget = QtGuiContext::getQtCurrent()->_mapOfEditionItem[sub];
264   ItemEdition *item = dynamic_cast<ItemEdition*>(widget);
265   YASSERT(item);
266   item->setEdited(true);
267 }
268
269 void FormContainer::on_tb_container_toggled(bool checked)
270 {
271   DEBTRACE("FormContainer::on_tb_container_toggled " << checked);
272   _checked = checked;
273   if (_checked) gb_basic->show();
274   else gb_basic->hide();
275 }
276
277 void FormContainer::on_ch_advance_stateChanged(int state)
278 {
279   DEBTRACE("FormContainer::on_ch_advance_stateChanged " << state);
280   if (state) tw_advance->show();
281   else tw_advance->hide();
282 }
283
284 void FormContainer::onModifyName(const QString &text)
285 {
286   DEBTRACE("onModifyName " << text.toStdString());
287   SubjectContainer *scont =
288     QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container];
289   YASSERT(scont);
290   string name = scont->getName();
291   if (name != text.toStdString())
292     onModified();
293 }
294
295 void FormContainer::updateResource(const std::string &resource)
296 {
297   DEBTRACE("FormContainer::updateResource " << resource);
298   if (resource=="")
299   {
300     //the resource is not specified: use automatic and allow editing
301     if(_properties.count("hostname"))
302       le_hostname->setText(_properties["hostname"].c_str());
303     else
304       le_hostname->setText("");
305     le_hostname->setEnabled(true);
306
307     if(_properties.count("OS"))
308       le_os->setText(_properties["OS"].c_str());
309     else
310       le_os->setText("");
311     le_os->setEnabled(true);
312
313     if(_properties.count("nb_resource_procs"))
314       sb_nbproc->setValue(atoi(_properties["nb_resource_procs"].c_str()));
315     else
316       sb_nbproc->setValue(0);
317     sb_nbproc->setEnabled(true);
318
319     if(_properties.count("mem_mb"))
320       sb_mem->setValue(atoi(_properties["mem_mb"].c_str()));
321     else
322       sb_mem->setValue(0);
323     sb_mem->setEnabled(true);
324
325     if(_properties.count("cpu_clock"))
326       sb_cpu->setValue(atoi(_properties["cpu_clock"].c_str()));
327     else
328       sb_cpu->setValue(0);
329     sb_cpu->setEnabled(true);
330
331     if(_properties.count("nb_node"))
332       sb_nbNodes->setValue(atoi(_properties["nb_node"].c_str()));
333     else
334       sb_nbNodes->setValue(0);
335     sb_nbNodes->setEnabled(true);
336
337     if(_properties.count("nb_proc_per_node"))
338       sb_procNode->setValue(atoi(_properties["nb_proc_per_node"].c_str()));
339     else
340       sb_procNode->setValue(0);
341     sb_procNode->setEnabled(true);
342
343     std::vector<std::string> policies;
344     policies.push_back("cycl");
345     policies.push_back("altcycl");
346     policies.push_back("best");
347     policies.push_back("first");
348     cb_policy->clear();
349     for(int i=0; i< policies.size(); i++)
350       cb_policy->addItem(policies[i].c_str());
351     if(_properties.count("policy"))
352       {
353         int i=0;
354         for(i=0; i< policies.size(); i++)
355           if(policies[i] == _properties["policy"])
356             {
357               cb_policy->setCurrentIndex(i);
358               break;
359             }
360       }
361     else
362       cb_policy->setCurrentIndex(1);
363     cb_policy->setEnabled(true);
364
365     if(_properties.count("component_list"))
366       le_compolist->setText(_properties["component_list"].c_str());
367     else
368       le_compolist->setText("");
369     le_compolist->setEnabled(true);
370
371     if(_properties.count("resource_list"))
372       le_resourceList->setText(_properties["resource_list"].c_str());
373     else
374       le_resourceList->setText("");
375     le_resourceList->setEnabled(true);
376   }
377   else
378   {
379     //a specific resource has been chosen: properties are those declared in the resources manager
380     //properties can not be edited
381     std::map<std::string,std::string> properties= _container->getResourceProperties(resource);
382     if(properties.count("hostname"))
383       le_hostname->setText(properties["hostname"].c_str());
384     else
385       le_hostname->setText("");
386     le_hostname->setEnabled(false);
387
388     if(properties.count("OS"))
389       le_os->setText(properties["OS"].c_str());
390     else
391       le_os->setText("");
392     le_os->setEnabled(false);
393
394     if(properties.count("nb_resource_procs"))
395       sb_nbproc->setValue(atoi(properties["nb_resource_procs"].c_str()));
396     else
397       sb_nbproc->setValue(0);
398     sb_nbproc->setEnabled(false);
399
400     if(properties.count("mem_mb"))
401       sb_mem->setValue(atoi(properties["mem_mb"].c_str()));
402     else
403       sb_mem->setValue(0);
404     sb_mem->setEnabled(false);
405
406     if(properties.count("cpu_clock"))
407       sb_cpu->setValue(atoi(properties["cpu_clock"].c_str()));
408     else
409       sb_cpu->setValue(0);
410     sb_cpu->setEnabled(false);
411
412     if(properties.count("nb_node"))
413       sb_nbNodes->setValue(atoi(properties["nb_node"].c_str()));
414     else
415       sb_nbNodes->setValue(0);
416     sb_nbNodes->setEnabled(false);
417
418     if(properties.count("nb_proc_per_node"))
419       sb_procNode->setValue(atoi(properties["nb_proc_per_node"].c_str()));
420     else
421       sb_procNode->setValue(0);
422     sb_procNode->setEnabled(false);
423
424     cb_policy->clear();
425     cb_policy->setEnabled(false);
426
427     if(properties.count("component_list"))
428       le_compolist->setText(properties["component_list"].c_str());
429     else
430       le_compolist->setText("");
431     le_compolist->setEnabled(false);
432
433     if(properties.count("resource_list"))
434       le_resourceList->setText(properties["resource_list"].c_str());
435     else
436       le_resourceList->setText("");
437     le_resourceList->setEnabled(false);
438   }
439 }
440
441 void FormContainer::onModifyResource(const QString &text)
442 {
443   DEBTRACE("onModifyResource " << text.toStdString());
444   if (!_container) return;
445   std::string resource=text.toStdString();
446   if(resource=="automatic")resource="";
447   map<string,string> properties = _container->getProperties();
448   _properties["name"] = resource;
449   if (properties["name"] != resource)
450     {
451       // reset resource properties
452       _properties.erase("hostname");
453       _properties.erase("OS");
454       _properties.erase("nb_resource_procs");
455       _properties.erase("mem_mb");
456       _properties.erase("cpu_clock");
457       _properties.erase("nb_node");
458       _properties.erase("nb_proc_per_node");
459       _properties.erase("policy");
460       onModified();
461       updateResource(resource);
462     }
463 }
464
465 void FormContainer::onModifyType(const QString &text)
466 {
467   DEBTRACE("onModifyType " << text.toStdString());
468   if (!_container) return;
469   std::string prop=_container->getProperty("type");
470   _properties["type"] = text.toStdString();
471   if (_properties["type"] == "mono")
472     cb_mode->setText("mono");
473   else
474     cb_mode->setText("multi");
475   if (prop != text.toStdString())
476     onModified();
477 }
478
479 void FormContainer::onModifyPolicy(const QString &text)
480 {
481   DEBTRACE("onModifyPolicy " << text.toStdString());
482   if (!_container) return;
483   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
484   map<string,string> properties = _container->getProperties();
485   _properties["policy"] = text.toStdString();
486   if (properties["policy"] != text.toStdString())
487     {
488       onModified();
489     }
490 }
491
492 void FormContainer::onModifyWorkDir(const QString &text)
493 {
494   DEBTRACE("onModifyWorkDir " << text.toStdString());
495   if (!_container) return;
496   map<string,string> properties = _container->getProperties();
497   _properties["workingdir"] = text.toStdString();
498   if (properties["workingdir"] != text.toStdString())
499     {
500       onModified();
501     }
502 }
503
504 void FormContainer::onModifyContName(const QString &text)
505 {
506   DEBTRACE("onModifyContName " << text.toStdString());
507   if (!_container) return;
508   map<string,string> properties = _container->getProperties();
509   _properties["container_name"] = text.toStdString();
510   if (properties["container_name"] != text.toStdString())
511     {
512       onModified();
513     }
514 }
515
516 void FormContainer::onModifyOS(const QString &text)
517 {
518   DEBTRACE("onModifyOS " << text.toStdString());
519   if (!_container) return;
520   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
521   map<string,string> properties = _container->getProperties();
522   _properties["OS"] = text.toStdString();
523   if (properties["OS"] != text.toStdString())
524     {
525       onModified();
526     }
527 }
528
529 void FormContainer::onModifyParLib(const QString &text)
530 {
531   DEBTRACE("onModifyParLib " << text.toStdString());
532   if (!_container) return;
533   map<string,string> properties = _container->getProperties();
534   _properties["parallelLib"] = text.toStdString();
535   if (properties["parallelLib"] != text.toStdString())
536     {
537       onModified();
538     }
539 }
540
541 void FormContainer::onModifyIsMPI(bool isMpi)
542 {
543   DEBTRACE("onModifyIsMPI " << isMpi);
544   if (!_container) return;
545   string text = "false";
546   if (isMpi) text = "true";
547   DEBTRACE(text);
548   map<string,string> properties = _container->getProperties();
549   _properties["isMPI"] = text;
550   if (properties["isMPI"] != text)
551     {
552       onModified();
553     }
554 }
555
556 void FormContainer::onModifyMem(const QString &text)
557 {
558   DEBTRACE("onModifyMem " << text.toStdString());
559   if (!_container) return;
560   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
561   map<string,string> properties = _container->getProperties();
562   if(properties.count("mem_mb")==0 )properties["mem_mb"]="0"; //default value
563   _properties["mem_mb"] = text.toStdString();
564   if (properties["mem_mb"] != text.toStdString())
565     {
566       onModified();
567     }
568 }
569
570 void FormContainer::onModifyClock(const QString &text)
571 {
572   DEBTRACE("onModifyClock " << text.toStdString());
573   if (!_container) return;
574   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
575   map<string,string> properties = _container->getProperties();
576   if(properties.count("cpu_clock")==0 )properties["cpu_clock"]="0"; //default value
577   _properties["cpu_clock"] = text.toStdString();
578   if (properties["cpu_clock"] != text.toStdString())
579     {
580       onModified();
581     }
582 }
583
584 void FormContainer::onModifyNodes(const QString &text)
585 {
586   DEBTRACE("onModifyNodes " << text.toStdString());
587   if (!_container) return;
588   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
589   map<string,string> properties = _container->getProperties();
590   if(properties.count("nb_node")==0 )properties["nb_node"]="0"; //default value
591   _properties["nb_node"] = text.toStdString();
592   if (properties["nb_node"] != text.toStdString())
593     {
594       onModified();
595     }
596 }
597
598 void FormContainer::onModifyProcs(const QString &text)
599 {
600   DEBTRACE("onModifyProcs " << text.toStdString());
601   if (!_container) return;
602   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
603   map<string,string> properties = _container->getProperties();
604   if(properties.count("nb_proc_per_node")==0 )properties["nb_proc_per_node"]="0"; //default value
605   _properties["nb_proc_per_node"] = text.toStdString();
606   if (properties["nb_proc_per_node"] != text.toStdString())
607     {
608       onModified();
609     }
610 }
611
612 void FormContainer::onModifyCompos(const QString &text)
613 {
614   DEBTRACE("onModifyCompo " << text.toStdString());
615   if (!_container) return;
616   map<string,string> properties = _container->getProperties();
617   _properties["nb_component_nodes"] = text.toStdString();
618   if (properties["nb_component_nodes"] != text.toStdString())
619     {
620       onModified();
621     }
622 }
623
624 void FormContainer::onModifyProcPar(const QString &text)
625 {
626   DEBTRACE("onModifyProcPar "  << text.toStdString());
627   if (!_container) return;
628   map<string,string> properties = _container->getProperties();
629   _properties["nb_parallel_procs"] = text.toStdString();
630   if (properties["nb_parallel_procs"] != text.toStdString())
631     {
632       onModified();
633     }
634 }
635
636 void FormContainer::onModifyResourceName(const QString &text)
637 {
638   DEBTRACE("onModifyResourceName "  << text.toStdString());
639   if (!_container) return;
640   map<string,string> properties = _container->getProperties();
641   _properties["resource_name"] = text.toStdString();
642   if (properties["resource_name"] != text.toStdString())
643     {
644       onModified();
645     }
646 }
647
648 void FormContainer::onModifyHostName(const QString &text)
649 {
650   DEBTRACE("onModifyHostName "  << text.toStdString());
651   if (!_container) return;
652   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
653
654   map<string,string> properties = _container->getProperties();
655   _properties["hostname"] = text.toStdString();
656   if (properties["hostname"] != text.toStdString())
657     {
658       onModified();
659     }
660 }
661
662 void FormContainer::onModifyProcRes(const QString &text)
663 {
664   DEBTRACE("onModifyProcRes "  << text.toStdString());
665   if (!_container) return;
666   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
667   map<string,string> properties = _container->getProperties();
668   if(properties.count("nb_resource_procs")==0 )properties["nb_resource_procs"]="0"; //default value
669   _properties["nb_resource_procs"] = text.toStdString();
670   if (properties["nb_resource_procs"] != text.toStdString())
671     {
672       onModified();
673     }
674 }
675
676 void FormContainer::onModifyCompoList(const QString &text)
677 {
678   DEBTRACE("onModifyCompoList "  << text.toStdString());
679   if (!_container) return;
680   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
681   map<string,string> properties = _container->getProperties();
682   _properties["component_list"] = text.toStdString();
683   if (properties["component_list"] != text.toStdString())
684     {
685       onModified();
686     }
687 }
688
689 void FormContainer::onModifyResourceList(const QString &text)
690 {
691   DEBTRACE("onModifyResourceList "  << text.toStdString());
692   if (!_container) return;
693   if(_properties.count("name") && _properties["name"] != "")return; //do not modify resource parameter when specific resource is set
694   map<string,string> properties = _container->getProperties();
695   _properties["resource_list"] = text.toStdString();
696   if (properties["resource_list"] != text.toStdString())
697     {
698       onModified();
699     }
700 }
701
702
703 bool FormContainer::onApply()
704 {
705   SubjectContainer *scont =
706     QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container];
707   YASSERT(scont);
708   bool ret = scont->setName(le_name->text().toStdString());
709   DEBTRACE(ret);
710   if (ret) ret = scont->setProperties(_properties);
711   return ret;
712 }
713
714 void FormContainer::onCancel()
715 {
716   SubjectContainer *scont =
717     QtGuiContext::getQtCurrent()->_mapOfSubjectContainer[_container];
718   YASSERT(scont);
719   FillPanel(scont->getContainer());
720 }