Changeset 395 in PSPA for Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
- Timestamp:
- Mar 20, 2013, 3:15:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r391 r395 119 119 WLineEdit* lineFrom = new WLineEdit(premierElementLabel); 120 120 WLineEdit* lineTo = new WLineEdit(dernierElementLabel); 121 122 WComboBox* lineFromCombo = new WComboBox(); 123 WComboBox* lineToCombo = new WComboBox(); 124 fillComboWithElements(lineFromCombo); 125 fillComboWithElements(lineToCombo); 126 121 127 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); 130 135 sections.push_back(newSection); 136 137 // push back on User interface 138 contenuSections_->addWidget(newSectionOld); 131 139 contenuSections_->addWidget(newSection); 132 140 133 134 135 // ______________test !!!!! _______________________136 /*137 138 139 140 // create a new section141 WContainerWidget* addedSection = new WContainerWidget;142 143 // add components144 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 elements150 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 selection158 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 vector165 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 */177 141 178 142 … … 404 368 405 369 406 void GWt_softwarePanel::updateSelections() 407 { 370 void 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 408 378 string premierText, dernierText; 409 379 if ( dtmanage_->getJobListSize() > 0 ) 410 411 380 { 381 premierText = dtmanage_->getLabelFromElementNumero(1); 412 382 dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->getBeamLineSize() ); 413 383 sections[0]->setFirstElementLineEditCurrentText(premierText); … … 464 434 } 465 435 436 437 void 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 450 void 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.