Changeset 471 in PSPA


Ignore:
Timestamp:
Dec 19, 2013, 4:46:02 PM (10 years ago)
Author:
garnier
Message:

Modification du softwarePanel, on peut désormais ajouter plusieurs sections et en changer le logiciel. Reste à faire les suppression de sections et les modifications de début/fin

Location:
Interface_Web/trunk/pspaWT
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r469 r471  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     819 Décembre 2013 : Laurent Garnier
     9- GWt_softwarePanel:
     10  o Suppression de UIsectionsToExecute_, désormais le vecteur de sectionsToExcute est géré par le controleur
     11  o Modification du softwarePanel, on peut désormais ajouter plusieurs sections et en changer le logiciel. Reste à faire les suppression de sections et les modifications de début/fin
    712
    81319 Décembre 2013 : Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h

    r469 r471  
    4949  WContainerWidget* contenuSections_;
    5050  GWt_sector* UIsector_;
    51 
    52   std::vector <GWt_sectionToExecute*> UIsectionsToExecute_;
    5351};
    5452#endif /* defined(__PSPA__GWt_softwarePanel__) */
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r469 r471  
    6363    // FIXME : Add a message to tell the user to add first an element
    6464  } else {
     65
     66    unsigned long firstSectionToExecuteIndex = 0;
    6567    for (unsigned int a=0; a<UIsector_->getSectorControler()->getSectionsToExecute().size(); a++) {
    6668      abstractElement* premierElement = NULL;
     
    8284     
    8385      // set to first
    84       lineFromCombo->setCurrentIndex(0);
     86      lineFromCombo->setCurrentIndex(firstSectionToExecuteIndex);
    8587      // set to last
    86       lineToCombo->setCurrentIndex(lineToCombo->count());
     88      lineToCombo->setCurrentIndex(firstSectionToExecuteIndex + UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size() - 1);
    8789     
    8890      WComboBox* softCombo = new WComboBox();
     
    108110      GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(a),UIsector_->getSectorControler()->getSectionsToExecute()[a],UIsector_);
    109111     
    110       // FIXME ?
     112/*      // FIXME ?
    111113      stringstream st;
    112       st << UIsectionsToExecute_.size();
     114      st << UIsectionsToExecute_deprecated_.size();
    113115     
    114116      // this is the mean to identify this section!
     
    116118     
    117119      // push back on sections vector
    118       UIsectionsToExecute_.push_back(newSection);
     120      UIsectionsToExecute_deprecated_.push_back(newSection);
     121*/
    119122      contenuSections_->addWidget(newSection);
    120123//      updateSections();
    121124
    122      
     125      firstSectionToExecuteIndex += UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size();
    123126    }
    124127  }
     
    134137  /*
    135138  // update all sections in order to manage new/deleted items
    136   for (int a = 0; a < UIsectionsToExecute_.size(); a++) {
    137     fillComboWithElements(UIsectionsToExecute_[a]->getFirstElement());
    138     fillComboWithElements(UIsectionsToExecute_[a]->getLastElement());
    139     UIsectionsToExecute_[a]->getFirstElement()->setEnabled (true);
    140     UIsectionsToExecute_[a]->getLastElement()->setEnabled (true);
    141   }
    142  
    143   if (UIsectionsToExecute_.size() == 0) {
     139  for (int a = 0; a < UIsectionsToExecute_deprecated_.size(); a++) {
     140    fillComboWithElements(UIsectionsToExecute_deprecated_[a]->getFirstElement());
     141    fillComboWithElements(UIsectionsToExecute_deprecated_[a]->getLastElement());
     142    UIsectionsToExecute_deprecated_[a]->getFirstElement()->setEnabled (true);
     143    UIsectionsToExecute_deprecated_[a]->getLastElement()->setEnabled (true);
     144  }
     145 
     146  if (UIsectionsToExecute_deprecated_;.size() == 0) {
    144147    return;
    145148  }
    146149 
    147150  // the first element will always be the first element of the beamLine
    148   UIsectionsToExecute_[0]->getFirstElement()->setCurrentIndex(0);
    149   UIsectionsToExecute_[0]->getFirstElement()->setEnabled (false);
     151  UIsectionsToExecute_deprecated_[0]->getFirstElement()->setCurrentIndex(0);
     152  UIsectionsToExecute_deprecated_[0]->getFirstElement()->setEnabled (false);
    150153
    151154  // the last element will always be the last element of the beamLine
    152   UIsectionsToExecute_[UIsectionsToExecute_.size()-1]->getLastElement()->setCurrentIndex(UIsectionsToExecute_[UIsectionsToExecute_.size()-1]->getLastElement()->count());
    153   UIsectionsToExecute_[UIsectionsToExecute_.size()-1]->getLastElement()->setEnabled(false);
     155  UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_.size()-1]->getLastElement()->setCurrentIndex(UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_;.size()-1]->getLastElement()->count());
     156  UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_.size()-1]->getLastElement()->setEnabled(false);
    154157
    155158  // set default values
     
    180183  // FIXME :  A réécrire
    181184  /*
    182   if (UIsectionsToExecute_.size() > 0) {
    183     UIsectionsToExecute_[0]->setFirstElementCurrentSelection(premier);
    184   }
    185  
    186   Wt::WString currentString =  UIsectionsToExecute_[0]->getLastElementCurrentText();
     185  if (UIsectionsToExecute_deprecated_.size() > 0) {
     186    UIsectionsToExecute_deprecated_[0]->setFirstElementCurrentSelection(premier);
     187  }
     188 
     189  Wt::WString currentString =  UIsectionsToExecute_deprecated_[0]->getLastElementCurrentText();
    187190  int current = dtmanage_->getNumeroFromElementLabel(currentString.toUTF8());
    188191 
     
    192195      current = dtmanage_->getBeamLineSize();
    193196      currentString =  dtmanage_->getLabelFromElementNumero(current);
    194       if (UIsectionsToExecute_.size() > 0) {
    195         UIsectionsToExecute_[0]->setLastElementCurrentSelection(currentString);
     197      if (UIsectionsToExecute_deprecated_.size() > 0) {
     198        UIsectionsToExecute_deprecated_[0]->setLastElementCurrentSelection(currentString);
    196199        //...
    197200      }
     
    201204 
    202205  // traitement des suivantes (on avance d'un cran dans la liste)
    203   for (int a = 1; a< UIsectionsToExecute_.size(); a++)
     206  for (int a = 1; a< UIsectionsToExecute_deprecated_;.size(); a++)
    204207    {
    205208      // debut
    206209      if ( current > dtmanage_->getBeamLineSize() )
    207210        {
    208           UIsectionsToExecute_[a]->setErrors("This section element could not be after previous session last element");
     211          UIsectionsToExecute_deprecated_;[a]->setErrors("This section element could not be after previous session last element");
    209212          exec_go_->disable();
    210213          return false;
    211214        }
    212215     
    213       UIsectionsToExecute_[a]->setFirstElementCurrentSelection(currentString);
     216      UIsectionsToExecute_deprecated_;[a]->setFirstElementCurrentSelection(currentString);
    214217
    215218      // fin
    216       string finString =  UIsectionsToExecute_[a]->getLastElementCurrentText().toUTF8();
     219      string finString =  UIsectionsToExecute_deprecated_;[a]->getLastElementCurrentText().toUTF8();
    217220     
    218221      int numeroFin = dtmanage_->getNumeroFromElementLabel( finString);
     
    220223      if ( numeroFin < current)
    221224      {
    222         UIsectionsToExecute_[a]->setErrors("Last section element should be after first section element");
     225        UIsectionsToExecute_deprecated_;[a]->setErrors("Last section element should be after first section element");
    223226        exec_go_->disable();
    224227        return false;
     
    227230      if (numeroFin > dtmanage_->getBeamLineSize())
    228231      {
    229         UIsectionsToExecute_[a]->setErrors("Last section element number is greater than the beam line size");
     232        UIsectionsToExecute_deprecated_;[a]->setErrors("Last section element number is greater than the beam line size");
    230233        exec_go_->disable();
    231234        return false;
     
    261264    return;
    262265  }
    263   unsigned int s = UIsector_->getSectorControler()->getSectionsToExecute().size();
     266  unsigned long s = UIsector_->getSectorControler()->getSectionsToExecute().size();
    264267  if (s > 0) {
    265268    abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement();
    266269    UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL));
    267     UIsector_->getSectorControler()->getSectionsToExecute()[s]->removeLastElement();
     270    UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->removeLastElement();
    268271  }
    269272
    270273 
    271274  displayFromControler();
     275  UIsector_->getBeamLineWidget()->buildBeamLineWidget();
    272276}
    273277
     
    283287  st << sectionLabel;
    284288  std::string sectionName = st.str();
    285  
    286   if ( dtmanage_->getJobListSize() == 0 ) return;
    287   for (unsigned int sectionIndex = 0; sectionIndex< UIsectionsToExecute_.size(); sectionIndex++) {
    288     if (UIsectionsToExecute_[sectionIndex]->objectName() == sectionName) {
     289  //FIXME
     290 
     291/*  if ( dtmanage_->getJobListSize() == 0 ) return;
     292  for (unsigned int sectionIndex = 0; sectionIndex< UIsectionsToExecute_deprecated_.size(); sectionIndex++) {
     293    if (UIsectionsToExecute_deprecated_[sectionIndex]->objectName() == sectionName) {
    289294
    290295      // delete from dataManager
     
    292297
    293298      // delete from User Interface
    294       contenuSections_->removeWidget(UIsectionsToExecute_[sectionIndex]);
    295       delete UIsectionsToExecute_[sectionIndex];
    296       UIsectionsToExecute_.erase (UIsectionsToExecute_.begin()+sectionIndex);
     299      contenuSections_->removeWidget(UIsectionsToExecute_deprecated_[sectionIndex]);
     300      delete UIsectionsToExecute_deprecated_[sectionIndex];
     301      UIsectionsToExecute_deprecated_.erase (UIsectionsToExecute_deprecated_.begin()+sectionIndex);
    297302    }
    298303  } 
     304*/
    299305  displayFromControler();
    300306}
Note: See TracChangeset for help on using the changeset viewer.