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

Last change on this file since 455 was 455, checked in by garnier, 10 years ago

grosse modification pour intégrer les sections

File size: 5.0 KB
Line 
1#include <Wt/WText>
2#include <Wt/WVBoxLayout>
3#include <Wt/WHBoxLayout>
4#include <Wt/WGridLayout>
5#include <Wt/WContainerWidget>
6#include <Wt/WImage>
7
8#include "GWt_sectionToExecute.h"
9#include "GWt_softwarePanel.h"
10
11GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect)
12:WContainerWidget(),
13firstElement(first),
14lastElement(last),
15software(soft),
16softwarePanel(sPanel),
17UI_sector_(sect)
18{
19  Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
20  mainContainerLayout->setContentsMargins(0,0,0,0);
21
22  Wt::WContainerWidget* labelAndComboContainer = new Wt::WContainerWidget();
23  Wt::WVBoxLayout* labelAndComboContainerLayout = new Wt::WVBoxLayout();
24  labelAndComboContainerLayout->setContentsMargins(0,0,0,0);
25
26  Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget();
27  Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout();
28  labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0);
29 
30  labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from&nbsp;:&nbsp;"));
31  labelAndComboInsideContainerLayout->addWidget(first);
32  labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to&nbsp;:&nbsp;"));
33  labelAndComboInsideContainerLayout->addWidget(last);
34  labelAndComboInsideContainerLayout->addWidget(soft);
35 
36    // add buttons
37  labelAndComboInsideContainerLayout->addWidget(buttonPanel);
38  labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout);
39  labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer);
40  labelAndComboContainerLayout->addStretch (10);
41  labelAndComboContainer->setLayout(labelAndComboContainerLayout);
42 
43  // add errors and warning layout
44  warningsContainer_ = new Wt::WContainerWidget();
45  errorsContainer_ = new Wt::WContainerWidget();
46 
47  Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget();
48  Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout();
49 
50  Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout();
51  Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout();
52 
53 
54  warningsLabel_ = new Wt::WText("",XHTMLText);
55  errorsLabel_ = new Wt::WText("",XHTMLText);
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 
67  vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_);
68  vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_);
69  vWarningsAndErrorsLayoutContainer->addStretch (100);
70 
71  warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer);
72 
73  // add label and Combo containers
74  mainContainerLayout->addWidget(labelAndComboContainer,0,0);
75  // add warnings and errors containers
76  mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0);
77 
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 
87  // resize combo
88  firstElement->setMinimumSize(80,12);
89  lastElement->setMinimumSize(80,12);
90  software->setMinimumSize(80,12);
91 
92  firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
93  lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
94  software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
95 
96  manageWarningsAndErrors();
97}
98
99
100void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){
101    for (int a=0; a< firstElement->count(); a++) {
102        if (firstElement->itemText(a) == txt) {
103            firstElement->setCurrentIndex (a);
104            return;
105        }
106    }
107}
108
109void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){
110    for (int a=0; a< lastElement->count(); a++) {
111        if (lastElement->itemText(a) == txt) {
112            lastElement->setCurrentIndex (a);
113            return;
114        }
115    }
116}
117
118void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){
119  for (int a=0; a< software->count(); a++) {
120    if (software->itemText(a) == txt) {
121      software->setCurrentIndex (a);
122      return;
123    }
124  }
125}
126
127
128void GWt_sectionToExecute::manageWarningsAndErrors(){
129    if (warningsLabel_->text() == "") {
130        warningsContainer_->hide();
131    } else {
132        warningsContainer_->show();
133    }
134    if (errorsLabel_->text() == "") {
135        errorsContainer_->hide();
136    } else {
137        errorsContainer_->show();
138    }
139
140}
141
142/*
143 void GWt_sectionToExecute::setSoftware(nomDeLogiciel logiciel)
144{
145  UI_sector_->getSectorControler()->setSoftware(logiciel);
146
147}
148
149*/
Note: See TracBrowser for help on using the repository browser.