Ignore:
Timestamp:
Dec 19, 2013, 3:53:53 PM (10 years ago)
Author:
garnier
Message:

Désormais il est de nouveau possible d'ajouter des sections et dy affecter des softwares (ne marche pour le moment quavec la 1ere sectionToExecute. Autres améliorations et renommages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r468 r469  
    6767      abstractElement* dernierElement = NULL;
    6868     
    69       int premierIndex = 0;
    70       int dernierIndex = 0;
    71      
    7269      std::string premierElementLabel = "";
    7370      std::string dernierElementLabel = "";
     
    8481      fillComboWithElements(lineToCombo);
    8582     
    86       // set selection
    87       lineFromCombo->setCurrentIndex(premierIndex);
    88       lineToCombo->setCurrentIndex(dernierIndex);
     83      // set to first
     84      lineFromCombo->setCurrentIndex(0);
     85      // set to last
     86      lineToCombo->setCurrentIndex(lineToCombo->count());
    8987     
    9088      WComboBox* softCombo = new WComboBox();
    91       fillComboWithSoftwares(softCombo);
     89      sector * sector = UIsector_->getSectorControler();
     90      sectionToExecute* sect = UIsector_->getSectorControler()->getSectionsToExecute()[a];
     91      abstractSoftware* abs = sect->getSoftware();
     92     
     93      fillComboWithSoftwares(softCombo,UIsector_->getSectorControler()->getSectionsToExecute()[a]->getSoftware()->getName());
     94
     95      // disable the "to" comboBox
     96      lineToCombo->disable();
     97
     98      // disable the first "from" comboBox
     99      if (a==0) {
     100        lineFromCombo->disable();
     101      }
     102      // disable the last "to" comboBox
     103      if (a==UIsector_->getSectorControler()->getSectionsToExecute().size()-1) {
     104        lineToCombo->disable();
     105      }
    92106     
    93107      // Add the sectionToExecute Widget
    94       GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(UIsectionsToExecute_.size()),this,UIsector_);
    95      
     108      GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(a),UIsector_->getSectorControler()->getSectionsToExecute()[a],UIsector_);
     109     
     110      // FIXME ?
    96111      stringstream st;
    97112      st << UIsectionsToExecute_.size();
     
    103118      UIsectionsToExecute_.push_back(newSection);
    104119      contenuSections_->addWidget(newSection);
    105       updateSections();
     120//      updateSections();
    106121
    107122     
     
    116131  cout << " GWt_softwarePanel::updateSections() " << endl<<endl;
    117132#endif
    118   return;
    119  
     133
     134  /*
    120135  // update all sections in order to manage new/deleted items
    121136  for (int a = 0; a < UIsectionsToExecute_.size(); a++) {
     
    140155  // set default values
    141156  updateSectionSelection();
     157*/
    142158}
    143159
     
    248264  if (s > 0) {
    249265    abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement();
    250     UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs));
     266    UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL));
    251267    UIsector_->getSectorControler()->getSectionsToExecute()[s]->removeLastElement();
    252268  }
     
    290306  if (cBox == NULL) return;
    291307
    292   // get the last item selected
    293   WString selectedString = cBox->currentText();
    294   cBox->clear();
    295 
    296308  if (!UIsector_->getSectorControler()) {
    297309    return;
     
    306318    }
    307319  }
    308  
    309   for(int a = 0; a < cBox->count(); a++) {
    310     if (cBox->itemText (a) == selectedString) {
    311       cBox->setCurrentIndex(a);
    312     }
    313   }
    314   cBox->refresh();
    315 }
    316 
    317 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox)
     320}
     321
     322void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox, std::string selected)
    318323{
    319324#if BAVARD > 0
     
    329334  for(k = 0; k <= nb; k++) { //xx
    330335    cBox->addItem(nomDeLogiciel(k).getString());
    331   }
    332   cBox->setCurrentIndex(nb); // xx
     336    if (nomDeLogiciel(k).getString() == selected) {
     337      cBox->setCurrentIndex(cBox->count()-1);
     338    }
     339  }
    333340  cBox->refresh();
    334341}
Note: See TracChangeset for help on using the changeset viewer.