Changeset 407 in PSPA for Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
- Timestamp:
- Mar 28, 2013, 4:32:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r406 r407 129 129 fillComboWithSoftwares(softCombo); 130 130 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()); 132 138 133 139 // push back on sections vector 134 140 sections_.push_back(newSection); 135 141 136 Wt::WContainerWidget* container = new Wt::WContainerWidget();142 /* Wt::WContainerWidget* container = new Wt::WContainerWidget(); 137 143 Wt::WGridLayout* containerLayout = new Wt::WGridLayout(); 138 144 containerLayout->setContentsMargins(0,0,0,0); … … 142 148 143 149 // add buttons 144 containerLayout->addWidget(createAddDeletePushButtons( ),0,1);150 containerLayout->addWidget(createAddDeletePushButtons(sections_.size()-1),0,1); 145 151 146 152 container->setLayout(containerLayout); 153 */ 147 154 148 155 // add to sections 149 contenuSections_->addWidget(container); 156 // contenuSections_->addWidget(container); 157 contenuSections_->addWidget(newSection); 150 158 } 151 159 … … 374 382 } 375 383 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 */ 384 void 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 } 385 403 } 386 404 … … 494 512 495 513 496 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons( ) {514 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) { 497 515 498 516 WContainerWidget* buttonContainer= new WContainerWidget(); … … 510 528 WPushButton* exec_delete = new WPushButton("-"); 511 529 // 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)); 513 532 exec_delete->setStyleClass("roundButton"); 514 533 exec_delete->setMaximumSize(20,20);
Note: See TracChangeset
for help on using the changeset viewer.