Changeset 388 in PSPA for Interface_Web
- Timestamp:
- Mar 13, 2013, 11:23:31 AM (12 years ago)
- Location:
- Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/controler/include/dataManager.h
r385 r388 66 66 abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi); 67 67 68 /** return the jobList size 69 */ 70 inline int getJobListSize() { 71 return jobList_.size(); 72 } 68 73 74 /** return a specific jobList index 75 return NULL if the index does not exist 76 */ 77 inline sectionToExecute* getJobListAt(int a) { 78 if (a < 0) return NULL; 79 if (a >= getJobListSize()) return NULL; 80 return jobList_[a]; 81 } 82 83 /** Clear a specific jobList */ 84 void clearSectionToExecute(int a); 69 85 70 86 private: -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/controler/include/sectionToExecute.h
r385 r388 24 24 25 25 /** Deprecated : To be removed ! */ 26 inline int get FirstElementNumberInBeamLine() {26 inline int getElementNumberInSection() { 27 27 return firstElementNumberInBeamLine; 28 28 } 29 29 30 30 /** Deprecated : To be removed ! */ 31 inline int getLastElementNumberIn BeamLine() {31 inline int getLastElementNumberInSection() { 32 32 return lastElementNumberInBeamLine; 33 33 } -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/controler/src/dataManager.cc
r385 r388 74 74 for(k = 0; k < jobList_.size(); k++) 75 75 { 76 if ( jobList_[k] != NULL ) delete jobList_[k];76 if ( jobList_[k] != NULL ) clearSectionToExecute(k); 77 77 } 78 78 jobList_.clear(); 79 } 80 81 82 void dataManager::clearSectionToExecute(int a) { 83 if (a<0) return; 84 if (a>= jobList_.size()) return; 85 delete jobList_[a]; 79 86 } 80 87 … … 121 128 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl; 122 129 123 int debut = jobList_[k]->get FirstElementNumberInBeamLine();124 int fin = jobList_[k]->getLastElementNumberIn BeamLine();130 int debut = jobList_[k]->getElementNumberInSection(); 131 int fin = jobList_[k]->getLastElementNumberInSection(); 125 132 softw = jobList_[k]->getSoftware(); 126 133 -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r367 r388 13 13 #include <Wt/WContainerWidget> 14 14 #include <Wt/WPushButton> 15 15 #include "GWt_sectionToExecute.h" 16 16 #include "dataManager.h" 17 17 … … 23 23 class GWt_softwarePanel : public WContainerWidget 24 24 { 25 typedef struct {26 WLineEdit* debut;27 WLineEdit* fin;28 WComboBox* selection;29 WContainerWidget* ligneDeWidget;30 } GWt_sectionToExecute;31 32 25 public : 33 26 GWt_softwarePanel(dataManager*, PspaApplication*); … … 46 39 bool areDataCoherent(); 47 40 48 list<GWt_sectionToExecute*> selectedSections_;49 41 dataManager* dtmanage_; 50 42 WPushButton *exec_go_; … … 52 44 PspaApplication* pspa_; 53 45 46 std::vector <GWt_sectionToExecute*> sections; 54 47 }; 55 48 -
Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r385 r388 17 17 #include "GWt_console.h" 18 18 #include "GWt_globalParameters.h" 19 #include "GWt_sectionToExecute.h" 19 20 20 21 … … 66 67 void GWt_softwarePanel::addSectionToExecuteW() 67 68 { 68 // disableSectionExecute(); 69 70 string premierText, dernierText; 71 if(selectedSections_.size() == 0) { 72 premierText = dtmanage_->getLabelFromElementNumero(1); 73 dernierText = dtmanage_->getLabelFromElementNumero(dtmanage_->getBeamLineSize()); 69 70 abstractElement* premierElement; 71 abstractElement* dernierElement; 72 73 int premierIndex = 0; 74 int dernierIndex = 0; 75 76 // if this is the first section 77 if(dtmanage_->getJobListSize() == 0) { 78 premierElement = pspa_->getBeamLine()->getAbstractElement(0); 79 dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1); 80 premierIndex = 0; 81 dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1; 82 83 // if this is not the first : 84 // - first element will be the last of the previous section 85 // (or the same if it is the last of the beam line) 86 // - lastElement will be the last of the beam line 87 // - software will be the first of the list 88 74 89 } else { 75 dernierText = selectedSections_.back()->fin->text().toUTF8(); 76 int dernierNumero = dtmanage_->getNumeroFromElementLabel(dernierText); 77 dernierNumero++; 78 if ( dernierNumero <= dtmanage_->getBeamLineSize() ) { 79 premierText = dtmanage_->getLabelFromElementNumero(dernierNumero); 90 int indexOfLastElementOfLastSection = dtmanage_->getJobListAt(dtmanage_->getJobListSize()-1)->getLastElementNumberInSection(); 91 if (pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1) != NULL ) { 92 premierIndex = indexOfLastElementOfLastSection+1; 93 premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1); 80 94 } else { 81 premierText = dtmanage_->getLabelFromElementNumero(dtmanage_->getBeamLineSize()); 82 } 83 dernierText = premierText; 95 premierIndex = indexOfLastElementOfLastSection; 96 premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection); 97 98 } 99 dernierIndex = dtmanage_->getJobListSize()-1; 100 dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1); 84 101 } 85 102 86 103 // cout << "PspaApplication::addSectionToExecute() : " << premierText << " ââ " << dernierText << endl; 87 104 88 WContainerWidget* newSection = new WContainerWidget;89 90 selectedSections_.push_back(new GWt_sectionToExecute);91 selectedSections_.back()->debut = new WLineEdit(); 92 s electedSections_.back()->debut->setDisabled(true);93 s electedSections_.back()->debut->setText(premierText);94 selectedSections_.back()->fin = new WLineEdit();95 // selectedSections_.back()->fin->changed().connect(this,&GWt_softwarePanel::disableSectionExecute);96 selectedSections_.back()->fin->setText(dernierText);97 selectedSections_.back()->selection = new WComboBox(); 98 selectedSections_.back()->ligneDeWidget = newSection;99 newSection->addWidget(new WText(" from : "));100 newSection->addWidget(selectedSections_.back()->debut);101 newSection->addWidget(new WText(" to : ")); 102 newSection->addWidget(selectedSections_.back()->fin);103 newSection->addWidget(selectedSections_.back()->selection);104 105 contenuSections_->addWidget(newSection); 105 106 abstractSoftware* soft = NULL; 107 dtmanage_->addSectionToExecute(premierElement,premierIndex, dernierElement, dernierIndex, soft); 108 109 std::string premierElementLabel = ""; 110 std::string dernierElementLabel = ""; 111 if (premierElement) { 112 premierElementLabel = premierElement->getLabel(); 113 } 114 115 if (dernierElement) { 116 dernierElementLabel = dernierElement->getLabel(); 117 } 118 119 WLineEdit* lineFrom = new WLineEdit(premierElementLabel); 120 WLineEdit* lineTo = new WLineEdit(dernierElementLabel); 121 WComboBox* softCombo = new WComboBox(); 122 106 123 unsigned nb = nomDeLogiciel::getNumberOfSoftwares(); 107 124 unsigned k; 108 125 for(k = 0; k < nb; k++) { 109 selectedSections_.back()->selection->addItem(nomDeLogiciel(k).getString()); 110 } 126 softCombo->addItem(nomDeLogiciel(k).getString()); 127 } 128 129 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFrom, lineTo, softCombo); 130 sections.push_back(newSection); 131 contenuSections_->addWidget(newSection); 132 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 */ 177 178 111 179 } 112 180 … … 206 274 bool GWt_softwarePanel::updateSectionSelection() 207 275 { 208 if ( selectedSections_.empty()) return false;276 if ( dtmanage_->getJobListSize() == 0 ) return false; 209 277 210 278 // traitement de la premiere ligne 211 279 // on impose le depart du calcul au premier element 212 280 string premier = dtmanage_->getLabelFromElementNumero(1); 213 (*selectedSections_.begin())->debut->setText(premier); 214 215 string currentString = (*selectedSections_.begin())->fin->text().toUTF8(); 216 int current = dtmanage_->getNumeroFromElementLabel(currentString); 217 281 if (sections.size() > 0) { 282 sections[0]->setFirstElementLineEditCurrentText(premier); 283 } 284 285 Wt::WString currentString = sections[0]->getLastElementLineEditCurrentText(); 286 int current = dtmanage_->getNumeroFromElementLabel(currentString.toUTF8()); 287 218 288 // si la fin est mal definie on prend toute la config par defaut 219 289 if ( current <= 0 || current > dtmanage_->getBeamLineSize() ) 220 { 221 current = dtmanage_->getBeamLineSize(); 222 currentString = dtmanage_->getLabelFromElementNumero(current); 223 (*selectedSections_.begin())->fin->setText(currentString); 224 } 225 current++; 290 { 291 current = dtmanage_->getBeamLineSize(); 292 currentString = dtmanage_->getLabelFromElementNumero(current); 293 if (sections.size() > 0) { 294 sections[0]->setLastElementLineEditCurrentText(currentString); 295 } 296 } 297 // current++; 226 298 currentString = dtmanage_->getLabelFromElementNumero(current); 227 299 228 300 // traitement des suivantes (on avance d'un cran dans la liste) 229 list<GWt_sectionToExecute*>::iterator itr, itr0; 230 itr0 = selectedSections_.begin(); 231 itr0++; 232 for (itr = itr0; itr != selectedSections_.end(); itr++) 301 for (int a = 0; a< sections.size(); a++) 233 302 { 234 303 // debut … … 240 309 } 241 310 242 (*itr)->debut->setText(currentString);311 sections[a]->setFirstElementLineEditCurrentText(currentString); 243 312 // fin 244 string finString = (*itr)->fin->text().toUTF8();313 string finString = sections[a]->getLastElementLineEditCurrentText().toUTF8(); 245 314 246 315 int numeroFin = dtmanage_->getNumeroFromElementLabel( finString); … … 269 338 string diagnostic; 270 339 271 list<GWt_sectionToExecute*>::iterator itr; 272 for(itr = selectedSections_.begin(); itr != selectedSections_.end(); itr++) 340 for (int a = 0; a< sections.size(); a++) 273 341 { 274 string debString = (*itr)->debut->text().toUTF8();275 string finString = (*itr)->fin->text().toUTF8();342 string debString = sections[a]->getFirstElementLineEditCurrentText().toUTF8(); 343 string finString = sections[a]->getLastElementLineEditCurrentText().toUTF8(); 276 344 277 345 int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1 278 346 int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1 279 347 280 nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex());348 nomDeLogiciel prog = nomDeLogiciel ( sections[a]->getSoftwareCurrentText().toUTF8()); 281 349 dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut), 282 350 debut, … … 324 392 void GWt_softwarePanel::deleteSectionToExecuteW() 325 393 { 326 if ( selectedSections_.empty() ) return; 327 // disableSectionExecute(); 328 selectedSections_.back()->ligneDeWidget->clear(); 329 delete selectedSections_.back()->ligneDeWidget; 330 selectedSections_.pop_back(); 394 if ( dtmanage_->getJobListSize() == 0 ) return; 395 // delete from dataManager 396 dtmanage_->clearSectionToExecute(dtmanage_->getJobListSize()-1); 397 398 // delete from User Interface 399 sections.pop_back(); 331 400 } 332 401 … … 335 404 { 336 405 string premierText, dernierText; 337 if ( selectedSections_.size() > 0 )406 if ( dtmanage_->getJobListSize() > 0 ) 338 407 { 339 408 premierText = dtmanage_->getLabelFromElementNumero(1); 340 409 dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->getBeamLineSize() ); 341 (*selectedSections_.begin())->debut->setText(premierText); 342 (*selectedSections_.begin())->fin->setText(dernierText); 343 } 344 } 345 346 347 string GWt_softwarePanel::getSelection() 410 sections[0]->setFirstElementLineEditCurrentText(premierText); 411 sections[0]->setLastElementLineEditCurrentText(dernierText); 412 } 413 } 414 415 416 417 /* 418 string GWt_softwarePanel::getSelection() 348 419 { 349 420 list<GWt_sectionToExecute*>::iterator itr = selectedSections_.begin(); … … 351 422 return str; 352 423 } 353 424 */ 354 425 355 426 void GWt_softwarePanel::executer() … … 388 459 pspa_->faireDessin(); 389 460 } 461
Note: See TracChangeset
for help on using the changeset viewer.