Changeset 396 in PSPA for Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
- Timestamp:
- Mar 22, 2013, 9:37:45 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.