Changeset 395 in PSPA


Ignore:
Timestamp:
Mar 20, 2013, 3:15:11 PM (11 years ago)
Author:
garnier
Message:

Preparation des ComboBox

Location:
Interface_Web/branches/12_03_12-managerComboBox/pspaWT
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/History

    r392 r395  
    66     =========================================================
    77
     820 Mars : Laurent Garnier
     9- GWt_LigneFaisceau : renommage
     10- GWt_softwarePanel : Preparation des ComboBox
     11- GWt_sectionToExecute : Ajout de qq méthodes pour manipuler les ComboBox
    81213 Mars : Laurent Garnier
    913- Etape 2 ok, test ok
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h

    r388 r395  
    3636    }
    3737   
     38    inline Wt::WComboBox * getFirstElement() {
     39        return firstElement;
     40    }
     41   
     42    inline Wt::WComboBox * getLastElement() {
     43        return lastElement;
     44    }
     45   
     46    inline Wt::WComboBox * getSoftware() {
     47        return software;
     48    }
    3849    void setFirstElementCurrentSelection(Wt::WString);
    3950    void setLastElementCurrentSelection(Wt::WString);
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/include/GWt_softwarePanel.h

    r388 r395  
    2828
    2929    void addSectionToExecuteW();
    30     void updateSelections();
     30    void updateSections();
    3131   
    3232    private :
     
    3838    void executer();
    3939    bool areDataCoherent();
     40    void fillComboWithElements(Wt::WComboBox* cBox);
     41    void fillComboWithSoftwares(Wt::WComboBox* cBox);
    4042   
    4143    dataManager* dtmanage_;
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r385 r395  
    157157  }
    158158 
    159   pspa_->getExecuteWidget()->updateSelections();
     159  pspa_->getExecuteWidget()->updateSections();
    160160}
    161161
  • Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r391 r395  
    119119  WLineEdit* lineFrom = new WLineEdit(premierElementLabel);
    120120  WLineEdit* lineTo = new WLineEdit(dernierElementLabel);
     121
     122  WComboBox* lineFromCombo = new WComboBox();
     123  WComboBox* lineToCombo = new WComboBox();
     124  fillComboWithElements(lineFromCombo);
     125  fillComboWithElements(lineToCombo);
     126
    121127  WComboBox* softCombo = new WComboBox();
    122 
    123   unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
    124   unsigned k;
    125   for(k = 0; k < nb; k++) {
    126     softCombo->addItem(nomDeLogiciel(k).getString());
    127   }
    128 
    129   GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFrom, lineTo, softCombo);
     128  fillComboWithSoftwares(softCombo);
     129
     130  GWt_sectionToExecute* newSectionOld = new GWt_sectionToExecute(lineFrom, lineTo, softCombo);
     131  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo);
     132
     133  // push back on sections vector
     134  sections.push_back(newSectionOld);
    130135  sections.push_back(newSection);
     136
     137  // push back on User interface
     138  contenuSections_->addWidget(newSectionOld);
    131139  contenuSections_->addWidget(newSection);
    132140
    133    
    134    
    135     // ______________test !!!!! _______________________
    136 /*
    137  
    138    
    139      
    140     // create a new section
    141     WContainerWidget* addedSection = new WContainerWidget;
    142 
    143     // add components
    144     addedSection->addWidget(new WText("TEST from : "));
    145     WComboBox* debCombo = new WComboBox();
    146     WComboBox* finCombo = new WComboBox();
    147     WComboBox* softwareCombo = new WComboBox();
    148 
    149     // fill the combo with all elements
    150     for (int a=0; a< pspa_->getBeamLine()->getBeamLineSize(); a++) {
    151         abstractElement* abs = pspa_->getBeamLine()->getAbstractElement(a);
    152         if (abs != NULL){
    153             debCombo->addItem(abs->getLabel());
    154             finCombo->addItem(abs->getLabel());
    155         }
    156     }
    157     // set selection
    158     int index = 0;
    159     if (debut_section.size() > 0) {
    160         index = finCombo->currentIndex ()+1;
    161     }
    162     debCombo->setCurrentIndex(index);
    163 //...
    164     // push it in the vector
    165     debut_section.push_back(debCombo);
    166     fin_section.push_back(finCombo);
    167     software_section.push_back(softwareCombo);
    168    
    169     addedSection->addWidget(debCombo);
    170     addedSection->addWidget(new WText("TEST to : "));
    171     addedSection->addWidget(finCombo);
    172     addedSection->addWidget(softwareCombo);
    173    
    174     contenuSections_->addWidget(addedSection);
    175     }
    176 */
    177141   
    178142
     
    404368
    405369
    406 void GWt_softwarePanel::updateSelections()
    407 {
     370void GWt_softwarePanel::updateSections()
     371{
     372  // update all sections in order to manage new/deleted items
     373  for (int a = 0; a< sections.size(); a++) {
     374    fillComboWithElements(sections[a]->getFirstElement());
     375    fillComboWithElements(sections[a]->getLastElement());
     376  }
     377 
    408378  string premierText, dernierText;
    409379  if ( dtmanage_->getJobListSize() > 0 )
    410     {
    411       premierText = dtmanage_->getLabelFromElementNumero(1);
     380  {
     381    premierText = dtmanage_->getLabelFromElementNumero(1);
    412382      dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->getBeamLineSize() );
    413383      sections[0]->setFirstElementLineEditCurrentText(premierText);
     
    464434}
    465435
     436
     437void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) {
     438  if (cBox == NULL) return;
     439  cBox->clear();
     440
     441  for (int a=0; a< pspa_->getBeamLine()->getBeamLineSize(); a++) {
     442    abstractElement* abs = pspa_->getBeamLine()->getAbstractElement(a);
     443    if (abs != NULL){
     444      cBox->addItem(abs->getLabel());
     445    }
     446  }
     447}
     448
     449
     450void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox) {
     451  if (cBox == NULL) return;
     452  cBox->clear();
     453
     454  unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
     455  unsigned k;
     456  for(k = 0; k < nb; k++) {
     457    cBox->addItem(nomDeLogiciel(k).getString());
     458  }
     459 
     460}
Note: See TracChangeset for help on using the changeset viewer.