Changeset 396 in PSPA
- Timestamp:
- Mar 22, 2013, 9:37:45 AM (12 years ago)
- Location:
- Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
r395 r396 4 4 #include <Wt/WContainerWidget> 5 5 #include <Wt/WComboBox> 6 #include <Wt/WLineEdit> 6 #include <Wt/WLabel> 7 8 class GWt_softwarePanel; 7 9 8 10 class GWt_sectionToExecute : public Wt::WContainerWidget 9 11 { 10 12 public : 11 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*); 12 13 /** DEPRECATED */ 14 GWt_sectionToExecute(Wt::WLineEdit*,Wt::WLineEdit*,Wt::WComboBox*); 13 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,GWt_softwarePanel* sPanel); 15 14 16 15 ~GWt_sectionToExecute() {;} … … 22 21 inline Wt::WString getLastElementCurrentText() { 23 22 return lastElement->currentText(); 24 }25 26 inline Wt::WString getFirstElementLineEditCurrentText() {27 return firstElementLineEdit->text();28 }29 30 inline Wt::WString getLastElementLineEditCurrentText() {31 return lastElementLineEdit->text();32 23 } 33 24 … … 51 42 void setSoftwareElementCurrentSelection(Wt::WString); 52 43 53 void setFirstElementLineEditCurrentText(Wt::WString); 54 void setLastElementLineEditCurrentText(Wt::WString); 44 inline void setWarnings(Wt::WString warn){ 45 warningsLabel_->setText(warn); 46 manageWarningsAndErrors(); 47 } 48 49 inline void setErrors(Wt::WString err){ 50 errorsLabel_->setText(err); 51 manageWarningsAndErrors(); 52 } 55 53 56 54 private : 55 56 void manageWarningsAndErrors(); 57 57 Wt::WComboBox* firstElement; 58 58 Wt::WComboBox* lastElement; 59 59 Wt::WComboBox* software; 60 GWt_softwarePanel* softwarePanel; 60 61 61 /** DEPRECATED */ 62 Wt::WLineEdit* firstElementLineEdit; 63 Wt::WLineEdit* lastElementLineEdit; 62 Wt::WLabel* errorsLabel_; 63 Wt::WLabel* warningsLabel_; 64 64 65 Wt::WContainerWidget* warningsContainer_; 66 Wt::WContainerWidget* errorsContainer_; 65 67 }; 66 68 -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r382 r396 18 18 #include <Wt/WSignalMapper> 19 19 #include <Wt/WText> 20 #include <Wt/WImage>21 20 #include <Wt/WHBoxLayout> 22 21 #include <Wt/WGridLayout> -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r390 r396 1 1 #include <Wt/WText> 2 #include <Wt/WVBoxLayout> 3 #include <Wt/WHBoxLayout> 4 #include <Wt/WContainerWidget> 5 #include <Wt/WImage> 6 2 7 #include "GWt_sectionToExecute.h" 8 #include "GWt_softwarePanel.h" 3 9 4 5 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft) 10 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,GWt_softwarePanel* sPanel) 6 11 :WContainerWidget(), 7 12 firstElement(first), 8 13 lastElement(last), 9 software(soft) 14 software(soft), 15 softwarePanel(sPanel) 10 16 { 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); 16 76 } 17 77 18 78 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 34 79 void 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 } 35 86 } 36 87 37 88 void 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 } 38 95 } 39 96 … … 48 105 49 106 50 void GWt_sectionToExecute::setFirstElementLineEditCurrentText(Wt::WString txt){ 51 firstElementLineEdit->setText(txt); 107 void 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 52 119 } 53 54 void GWt_sectionToExecute::setLastElementLineEditCurrentText(Wt::WString txt){55 lastElementLineEdit->setText(txt);56 }57 -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r395 r396 128 128 fillComboWithSoftwares(softCombo); 129 129 130 GWt_sectionToExecute* newSectionOld = new GWt_sectionToExecute(lineFrom, lineTo, softCombo); 131 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo); 130 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,this); 132 131 133 132 // push back on sections vector 134 sections.push_back(newSectionOld);135 133 sections.push_back(newSection); 136 134 137 135 // push back on User interface 138 contenuSections_->addWidget(newSectionOld);139 136 contenuSections_->addWidget(newSection); 140 141 142 137 143 138 } … … 244 239 string premier = dtmanage_->getLabelFromElementNumero(1); 245 240 if (sections.size() > 0) { 246 sections[0]->setFirstElementLineEditCurrentText(premier); 247 //... 248 } 249 250 Wt::WString currentString = sections[0]->getLastElementLineEditCurrentText(); 241 sections[0]->setFirstElementCurrentSelection(premier); 242 } 243 244 Wt::WString currentString = sections[0]->getLastElementCurrentText(); 251 245 int current = dtmanage_->getNumeroFromElementLabel(currentString.toUTF8()); 252 246 … … 257 251 currentString = dtmanage_->getLabelFromElementNumero(current); 258 252 if (sections.size() > 0) { 259 sections[0]->setLastElement LineEditCurrentText(currentString);253 sections[0]->setLastElementCurrentSelection(currentString); 260 254 //... 261 255 } … … 275 269 } 276 270 277 sections[a]->setFirstElement LineEditCurrentText(currentString);278 //... 271 sections[a]->setFirstElementCurrentSelection(currentString); 272 279 273 // fin 280 string finString = sections[a]->getLastElement LineEditCurrentText().toUTF8();274 string finString = sections[a]->getLastElementCurrentText().toUTF8(); 281 275 282 276 int numeroFin = dtmanage_->getNumeroFromElementLabel( finString); … … 294 288 } 295 289 // exec_go_->setDisabled(false); 290 291 if (!areDataCoherent()) { 292 exec_go_->disable(); 293 } else { 294 exec_go_->enable(); 295 } 296 296 297 return true; 297 298 } … … 306 307 307 308 for (int a = 0; a< sections.size(); a++) 308 { 309 string debString = sections[a]->getFirstElementLineEditCurrentText().toUTF8(); 310 string finString = sections[a]->getLastElementLineEditCurrentText().toUTF8(); 311 312 int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1 313 int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1 314 315 nomDeLogiciel prog = nomDeLogiciel ( sections[a]->getSoftwareCurrentText().toUTF8()); 316 dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut), 317 debut, 318 pspa_->getBeamLine()->getAbstractElement(fin), 319 fin, 320 dtmanage_->createSoftwareConnexion(prog)); 321 322 // check sections 323 for (int i=debut-1; i<fin; i++) { 324 if (pspa_->getBeamLine()) { 325 if (pspa_->getBeamLine()->getAbstractElement(i)) { 326 trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString()); 327 if (tb == TBoolError ) { 328 diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"\n "; 329 caMarche = false; 330 tbResume = tb; 331 } else if ( tb == TBoolIgnore ) { 332 diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " will be ignored by "+ prog.getString()+"\n "; 333 if ( tbResume != TBoolError ) tbResume = tb; 334 } else { 335 pspa_->getBeamLine()->update(i); 336 } 337 } 338 } 309 { 310 string debString = sections[a]->getFirstElementCurrentText().toUTF8(); 311 string finString = sections[a]->getLastElementCurrentText().toUTF8(); 312 313 int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1 314 int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1 315 316 nomDeLogiciel prog = nomDeLogiciel ( sections[a]->getSoftwareCurrentText().toUTF8()); 317 dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut), 318 debut, 319 pspa_->getBeamLine()->getAbstractElement(fin), 320 fin, 321 dtmanage_->createSoftwareConnexion(prog)); 322 323 // check sections 324 for (int i=debut-1; i<fin; i++) { 325 if (pspa_->getBeamLine()) { 326 if (pspa_->getBeamLine()->getAbstractElement(i)) { 327 trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString()); 328 if (tb == TBoolError ) { 329 diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"\n "; 330 caMarche = false; 331 tbResume = tb; 332 } else if ( tb == TBoolIgnore ) { 333 diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " will be ignored by "+ prog.getString()+"\n "; 334 if ( tbResume != TBoolError ) tbResume = tb; 335 } else { 336 pspa_->getBeamLine()->update(i); 337 } 338 } 339 339 } 340 340 } 341 341 } 342 342 343 if ( tbResume == TBoolError ) { 343 344 GWt_dialog calculDialog("PSPA check execute : ERROR", diagnostic , GWt_dialog::Error,true,true); … … 375 376 fillComboWithElements(sections[a]->getLastElement()); 376 377 } 377 378 string premierText, dernierText; 379 if ( dtmanage_->getJobListSize() > 0 ) 380 { 381 premierText = dtmanage_->getLabelFromElementNumero(1); 382 dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->getBeamLineSize() ); 383 sections[0]->setFirstElementLineEditCurrentText(premierText); 384 sections[0]->setLastElementLineEditCurrentText(dernierText); 385 //... 386 } 378 if (sections.size() == 0) { 379 return; 380 } 381 // the first element will always be the first element of the beamLine 382 sections[0]->getFirstElement()->setCurrentIndex(0); 383 384 // the last element will always be the last element of the beamLine 385 sections[sections.size()-1]->getLastElement()->setCurrentIndex(sections[sections.size()-1]->getLastElement()->count()); 386 387 // set default values 388 389 // update 390 updateSectionSelection(); 387 391 } 388 392 … … 401 405 { 402 406 403 if ( !updateSectionSelection() ) return; 404 405 406 if (!areDataCoherent()) { 407 // GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true); 408 // warningDialog.exec(); 409 // exec_go_->setDisabled(true); 407 if (!areDataCoherent()) { 408 // GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true); 409 // warningDialog.exec(); 410 // exec_go_->setDisabled(true); 410 411 return; 411 412 412 } 413 413 414 GWt_console* console = NULL; 414 415 if (static_cast<GWt_console*> (wApp->findWidget ("console"))) { … … 437 438 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) { 438 439 if (cBox == NULL) return; 440 441 // get the last item selected 442 WString selectedString = cBox->currentText (); 439 443 cBox->clear(); 440 444 … … 445 449 } 446 450 } 451 452 for (int a=0; a<cBox->count(); a++) { 453 if (cBox->itemText (a) == selectedString) { 454 cBox->setCurrentIndex(a); 455 } 456 } 447 457 } 448 458
Note: See TracChangeset
for help on using the changeset viewer.