Ignore:
Timestamp:
Mar 22, 2013, 9:37:45 AM (11 years ago)
Author:
garnier
Message:

Passage a la version avec uniqquement des ComboBox. Tests en cours

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc

    r390 r396  
    11#include <Wt/WText>
     2#include <Wt/WVBoxLayout>
     3#include <Wt/WHBoxLayout>
     4#include <Wt/WContainerWidget>
     5#include <Wt/WImage>
     6
    27#include "GWt_sectionToExecute.h"
     8#include "GWt_softwarePanel.h"
    39
    4 
    5 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft)
     10GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,GWt_softwarePanel* sPanel)
    611:WContainerWidget(),
    712firstElement(first),
    813lastElement(last),
    9 software(soft)
     14software(soft),
     15softwarePanel(sPanel)
    1016{
    11     addWidget(new Wt::WText(" fromC : "));
    12     addWidget(first);
    13     addWidget(new Wt::WText(" toC : "));
    14     addWidget(last);
    15     addWidget(soft);
     17    Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
     18   
     19    mainContainerLayout->addWidget(new Wt::WText(" from : "),0,0);
     20    mainContainerLayout->addWidget(first,0,1);
     21    mainContainerLayout->addWidget(new Wt::WText(" to : "),0,2);
     22    mainContainerLayout->addWidget(last,0,3);
     23    mainContainerLayout->addWidget(soft,0,4);
     24
     25    // add errors and warning layout
     26    warningsContainer_ = new Wt::WContainerWidget();
     27    errorsContainer_ = new Wt::WContainerWidget();
     28
     29    Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget();
     30    Wt::WVBoxLayout* vLayoutContainer = new Wt::WVBoxLayout();
     31
     32    vLayoutContainer->addWidget(warningsContainer_);
     33    vLayoutContainer->addWidget(errorsContainer_);
     34    vLayoutContainer->addStretch (100);
     35   
     36    Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout();
     37    Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout();
     38
     39   
     40    // fill containers
     41    Wt::WImage* imgWarning = new WImage ("/htdocs/warning.png");
     42    Wt::WImage* imgError = new WImage ("/htdocs/error.png");
     43
     44    // resize images
     45    imgWarning->resize(20,20);
     46    imgError->resize(20,20);
     47   
     48    warningsLabel_ = new Wt::WLabel("--warnings---");
     49    errorsLabel_ = new Wt::WLabel("---errors--");
     50
     51    hLayoutContainerWarnings->addWidget(imgWarning);
     52    hLayoutContainerWarnings->addWidget(warningsLabel_);
     53    hLayoutContainerErrors->addWidget(imgError);
     54    hLayoutContainerErrors->addWidget(errorsLabel_);
     55
     56    warningsAndErrorsContainer->addWidget(warningsLabel_);
     57    warningsAndErrorsContainer->addWidget(errorsLabel_);
     58   
     59   
     60    // set Layouts
     61    warningsContainer_->setLayout(hLayoutContainerWarnings);
     62    errorsContainer_->setLayout(hLayoutContainerErrors);
     63   
     64    warningsAndErrorsContainer->setLayout(vLayoutContainer);
     65
     66    // add warnings and errors containers
     67    mainContainerLayout->addWidget(warningsAndErrorsContainer,0,5,2,1);
     68    mainContainerLayout->addWidget(new WLabel("--"),1,1);
     69
     70    this->setLayout(mainContainerLayout);
     71   
     72   
     73    firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     74    lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     75    software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
    1676}
    1777
    1878
    19 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WLineEdit* first,Wt::WLineEdit* last,Wt::WComboBox* soft)
    20 :WContainerWidget(),
    21 firstElementLineEdit(first),
    22 lastElementLineEdit(last),
    23 software(soft)
    24 {;
    25     addWidget(new Wt::WText(" fromLE : "));
    26     addWidget(first);
    27     addWidget(new Wt::WText(" toLE : "));
    28     addWidget(last);
    29     addWidget(soft);
    30 }
    31 
    32 
    33 
    3479void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){
     80    for (int a=0; a< firstElement->count(); a++) {
     81        if (firstElement->itemText(a) == txt) {
     82            firstElement->setCurrentIndex (a);
     83            return;
     84        }
     85    }
    3586}
    3687
    3788void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){
     89    for (int a=0; a< lastElement->count(); a++) {
     90        if (lastElement->itemText(a) == txt) {
     91            lastElement->setCurrentIndex (a);
     92            return;
     93        }
     94    }
    3895}
    3996
     
    48105
    49106
    50 void GWt_sectionToExecute::setFirstElementLineEditCurrentText(Wt::WString txt){
    51     firstElementLineEdit->setText(txt);
     107void GWt_sectionToExecute::manageWarningsAndErrors(){
     108    if (warningsLabel_->text() == "") {
     109        warningsContainer_->hide();
     110    } else {
     111        warningsContainer_->show();
     112    }
     113    if (errorsLabel_->text() == "") {
     114        errorsContainer_->hide();
     115    } else {
     116        errorsContainer_->show();
     117    }
     118
    52119}
    53 
    54 void GWt_sectionToExecute::setLastElementLineEditCurrentText(Wt::WString txt){
    55     lastElementLineEdit->setText(txt);
    56 }
    57 
Note: See TracChangeset for help on using the changeset viewer.