Ignore:
Timestamp:
Mar 28, 2013, 4:32:42 PM (11 years ago)
Author:
garnier
Message:

Correction dans les comboBox

File:
1 edited

Legend:

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

    r406 r407  
    129129  fillComboWithSoftwares(softCombo);
    130130
    131   GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,this);
     131  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,createAddDeletePushButtons(sections_.size()),this);
     132
     133  stringstream st;
     134  st << sections_.size();
     135
     136  // this is the mean to identify this section!
     137  newSection->setObjectName(st.str());
    132138
    133139  // push back on sections vector
    134140  sections_.push_back(newSection);
    135141
    136   Wt::WContainerWidget* container = new Wt::WContainerWidget();
     142/*  Wt::WContainerWidget* container = new Wt::WContainerWidget();
    137143  Wt::WGridLayout* containerLayout = new Wt::WGridLayout();
    138144  containerLayout->setContentsMargins(0,0,0,0);
     
    142148 
    143149  // add buttons
    144   containerLayout->addWidget(createAddDeletePushButtons(),0,1);
     150  containerLayout->addWidget(createAddDeletePushButtons(sections_.size()-1),0,1);
    145151
    146152  container->setLayout(containerLayout);
     153*/
    147154 
    148155  // add to sections
    149   contenuSections_->addWidget(container); 
     156//  contenuSections_->addWidget(container);
     157  contenuSections_->addWidget(newSection);
    150158}
    151159
     
    374382}
    375383
    376 void GWt_softwarePanel::deleteSectionToExecuteW()
    377 {
    378 /*  if ( dtmanage_->getJobListSize() == 0 ) return;
    379   // delete from dataManager
    380   dtmanage_->clearSectionToExecute(dtmanage_->getJobListSize()-1);
    381 
    382   // delete from User Interface
    383   sections_.pop_back();
    384 */
     384void GWt_softwarePanel::deleteSectionToExecuteW(int sectionLabel)
     385{
     386  stringstream st;
     387  st << sectionLabel;
     388  std::string sectionName = st.str();
     389 
     390  if ( dtmanage_->getJobListSize() == 0 ) return;
     391  for (unsigned int sectionIndex = 0; sectionIndex< sections_.size(); sectionIndex++) {
     392    if (sections_[sectionIndex]->objectName() == sectionName) {
     393
     394      // delete from dataManager
     395      dtmanage_->clearSectionToExecute(sectionIndex);
     396
     397      // delete from User Interface
     398      contenuSections_->removeWidget(sections_[sectionIndex]);
     399      delete sections_[sectionIndex];
     400      sections_.erase (sections_.begin()+sectionIndex);
     401    }
     402  } 
    385403}
    386404
     
    494512
    495513
    496 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons() {
     514Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) {
    497515
    498516  WContainerWidget* buttonContainer= new WContainerWidget();
     
    510528  WPushButton* exec_delete = new WPushButton("-");
    511529  //  warningsContainer_->setStyleClass("warningsContainer");
    512   exec_delete->clicked().connect(this, &GWt_softwarePanel::deleteSectionToExecuteW);
     530
     531  exec_delete->clicked().connect(boost::bind(&GWt_softwarePanel::deleteSectionToExecuteW, this, sectionNumber));
    513532  exec_delete->setStyleClass("roundButton");
    514533  exec_delete->setMaximumSize(20,20);
Note: See TracChangeset for help on using the changeset viewer.