source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc @ 401

Last change on this file since 401 was 401, checked in by garnier, 11 years ago

merge avec la branche 12_03_12-managerComboBox

File size: 4.7 KB
RevLine 
[388]1#include <Wt/WText>
[396]2#include <Wt/WVBoxLayout>
3#include <Wt/WHBoxLayout>
[399]4#include <Wt/WGridLayout>
[396]5#include <Wt/WContainerWidget>
6#include <Wt/WImage>
7
[388]8#include "GWt_sectionToExecute.h"
[396]9#include "GWt_softwarePanel.h"
[388]10
[396]11GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,GWt_softwarePanel* sPanel)
[388]12:WContainerWidget(),
13firstElement(first),
14lastElement(last),
[396]15software(soft),
16softwarePanel(sPanel)
[388]17{
[399]18    Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
[397]19    mainContainerLayout->setContentsMargins(0,0,0,0);
20
21    Wt::WContainerWidget* labelAndComboContainer = new Wt::WContainerWidget();
22    Wt::WVBoxLayout* labelAndComboContainerLayout = new Wt::WVBoxLayout();
23    labelAndComboContainerLayout->setContentsMargins(0,0,0,0);
24
25    Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget();
26    Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout();
27    labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0);
[396]28   
[399]29    labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from&nbsp;:&nbsp;"));
[397]30    labelAndComboInsideContainerLayout->addWidget(first);
[399]31    labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to&nbsp;:&nbsp;"));
[397]32    labelAndComboInsideContainerLayout->addWidget(last);
33    labelAndComboInsideContainerLayout->addWidget(soft);
[388]34
[397]35    labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout);
36
37    labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer);
38    labelAndComboContainerLayout->addStretch (10);
39   
40    labelAndComboContainer->setLayout(labelAndComboContainerLayout);
41   
42           
[396]43    // add errors and warning layout
44    warningsContainer_ = new Wt::WContainerWidget();
45    errorsContainer_ = new Wt::WContainerWidget();
[388]46
[396]47    Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget();
[399]48    Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout();
[396]49   
50    Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout();
51    Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout();
52
53   
[399]54    warningsLabel_ = new Wt::WText("",XHTMLText);
55    errorsLabel_ = new Wt::WText("",XHTMLText);
[396]56    hLayoutContainerWarnings->addWidget(warningsLabel_);
57    hLayoutContainerErrors->addWidget(errorsLabel_);
58
59    warningsAndErrorsContainer->addWidget(warningsLabel_);
60    warningsAndErrorsContainer->addWidget(errorsLabel_);
61   
62   
63    // set Layouts
64    warningsContainer_->setLayout(hLayoutContainerWarnings);
65    errorsContainer_->setLayout(hLayoutContainerErrors);
66   
[399]67    vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_);
68    vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_);
69    vWarningsAndErrorsLayoutContainer->addStretch (100);
[396]70
[399]71    warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer);
72
73    // add label and Combo containers
74    mainContainerLayout->addWidget(labelAndComboContainer,0,0);
[396]75    // add warnings and errors containers
[399]76    mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0);
[396]77
[399]78    // manage margins
79    vWarningsAndErrorsLayoutContainer->setContentsMargins(20,0,0,0);
80    hLayoutContainerWarnings->setContentsMargins(0,0,0,0);
81    hLayoutContainerErrors->setContentsMargins(0,0,0,0);
82
83    setLayout(mainContainerLayout);
84    warningsContainer_->setStyleClass("warningsContainer");
85    errorsContainer_->setStyleClass("errorsContainer");
86
[396]87   
88    firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
89    lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
90    software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
[397]91
92    manageWarningsAndErrors();
[388]93}
94
95
96void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){
[396]97    for (int a=0; a< firstElement->count(); a++) {
98        if (firstElement->itemText(a) == txt) {
99            firstElement->setCurrentIndex (a);
100            return;
101        }
102    }
[388]103}
104
105void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){
[396]106    for (int a=0; a< lastElement->count(); a++) {
107        if (lastElement->itemText(a) == txt) {
108            lastElement->setCurrentIndex (a);
109            return;
110        }
111    }
[388]112}
113
114void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){
115  for (int a=0; a< software->count(); a++) {
116    if (software->itemText(a) == txt) {
117      software->setCurrentIndex (a);
118      return;
119    }
120  }
121}
122
123
[396]124void GWt_sectionToExecute::manageWarningsAndErrors(){
125    if (warningsLabel_->text() == "") {
126        warningsContainer_->hide();
127    } else {
128        warningsContainer_->show();
129    }
130    if (errorsLabel_->text() == "") {
131        errorsContainer_->hide();
132    } else {
133        errorsContainer_->show();
134    }
[388]135
136}
Note: See TracBrowser for help on using the repository browser.