#include #include #include #include #include #include #include "GWt_sectionToExecute.h" #include "GWt_softwarePanel.h" GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,GWt_softwarePanel* sPanel) :WContainerWidget(), firstElement(first), lastElement(last), software(soft), softwarePanel(sPanel) { Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout(); mainContainerLayout->setContentsMargins(0,0,0,0); Wt::WContainerWidget* labelAndComboContainer = new Wt::WContainerWidget(); Wt::WVBoxLayout* labelAndComboContainerLayout = new Wt::WVBoxLayout(); labelAndComboContainerLayout->setContentsMargins(0,0,0,0); Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget(); Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout(); labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0); labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from : ")); labelAndComboInsideContainerLayout->addWidget(first); labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to : ")); labelAndComboInsideContainerLayout->addWidget(last); labelAndComboInsideContainerLayout->addWidget(soft); labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout); labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer); labelAndComboContainerLayout->addStretch (10); labelAndComboContainer->setLayout(labelAndComboContainerLayout); // add errors and warning layout warningsContainer_ = new Wt::WContainerWidget(); errorsContainer_ = new Wt::WContainerWidget(); Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget(); Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout(); Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout(); Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout(); warningsLabel_ = new Wt::WText("",XHTMLText); errorsLabel_ = new Wt::WText("",XHTMLText); hLayoutContainerWarnings->addWidget(warningsLabel_); hLayoutContainerErrors->addWidget(errorsLabel_); warningsAndErrorsContainer->addWidget(warningsLabel_); warningsAndErrorsContainer->addWidget(errorsLabel_); // set Layouts warningsContainer_->setLayout(hLayoutContainerWarnings); errorsContainer_->setLayout(hLayoutContainerErrors); vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_); vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_); vWarningsAndErrorsLayoutContainer->addStretch (100); warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer); // add label and Combo containers mainContainerLayout->addWidget(labelAndComboContainer,0,0); // add warnings and errors containers mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0); // manage margins vWarningsAndErrorsLayoutContainer->setContentsMargins(20,0,0,0); hLayoutContainerWarnings->setContentsMargins(0,0,0,0); hLayoutContainerErrors->setContentsMargins(0,0,0,0); setLayout(mainContainerLayout); warningsContainer_->setStyleClass("warningsContainer"); errorsContainer_->setStyleClass("errorsContainer"); firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); manageWarningsAndErrors(); } void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){ for (int a=0; a< firstElement->count(); a++) { if (firstElement->itemText(a) == txt) { firstElement->setCurrentIndex (a); return; } } } void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){ for (int a=0; a< lastElement->count(); a++) { if (lastElement->itemText(a) == txt) { lastElement->setCurrentIndex (a); return; } } } void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){ for (int a=0; a< software->count(); a++) { if (software->itemText(a) == txt) { software->setCurrentIndex (a); return; } } } void GWt_sectionToExecute::manageWarningsAndErrors(){ if (warningsLabel_->text() == "") { warningsContainer_->hide(); } else { warningsContainer_->show(); } if (errorsLabel_->text() == "") { errorsContainer_->hide(); } else { errorsContainer_->show(); } }