Changeset 469 in PSPA for Interface_Web/trunk/pspaWT
- Timestamp:
- Dec 19, 2013, 3:53:53 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r468 r469 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 19 Décembre 2013 : Laurent Garnier 9 - abstractElement : 10 o Suppression des méthodes relatives aux softwares, ils sont désormais traités dans les sectionToExecute. 11 getAbstractSoftware(), setSoftware, abstractSoftware_ 12 13 - softwareUnknown : 14 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 15 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 16 17 - sectionToExecute : 18 o Suppression de sectionToExecute(abstractElement*), désormais il faut obligatoirement passer le nom du sofware associé (ou sofwareUnknown si besoin) 19 o Ajout de la méthode setSoftware(std::string) afin de gérer tout les select/case de sofware uniquement dans le controller 20 o Ajout de insertAtFirst(abstractElement* abs) 21 22 - dataManager : Renommage de pspa_->getBeamLine() en pspa_->getBeamLine_deprecated(), en effet la beamLine n'existe plus dans cette classe, elle se trouve désormais dans la section. 23 24 - GWt_elementLigneFaisceau : 25 o Passage de setBGColor() en méthode publique 26 o Suppression de updateSoftware() qui n'a plus lien d'être 27 28 - GWt_sectionToExecute : 29 o Un peu de renommage pour une meilleure clarté 30 o Ajout d'un argument vers la sectionToExecute du controler 31 32 - GWt_ligneFaisceau : 33 o Suppression de initializeSoftwares() qui est désormais automatiquement fait à la création d'un composant de la beamLine 34 35 - PspaApplication : 36 o Renommage degetBeamLine() en getBeamLine_deprecated(), en effet la beamLine n'existe plus dans cette classe, elle se trouve désormais dans la section. 37 38 - GWt_sector : 39 o Ajout d'une méthode pour récupérer le widget de la beamLine : getBeamLineWidget() 40 41 - GWt_softwarePanel : 42 o Désormais il est de nouveau possible d'ajouter des sections et d'y affecter des softwares (ne marche pour le moment qu'avec la 1ere sectionToExecute) 43 7 44 8 45 18 Décembre 2013 : Laurent Garnier -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h
r431 r469 61 61 virtual string print() = 0; 62 62 virtual void InputRep(UAPNode* root) = 0; 63 64 /* Return the abstractSofware associated with this element 65 */ 66 inline abstractSoftware* getAbstractSoftware() { 67 return abstractSoftware_; 68 } 69 70 /* Set the software to this element 71 @param abstractSoftware a pointer to the abstract software 72 */ 73 inline void setSoftware(abstractSoftware* prog) { 74 abstractSoftware_ = prog; 75 } 76 77 private : 78 79 abstractSoftware *abstractSoftware_; 80 63 81 64 }; 82 65 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h
r468 r469 9 9 { 10 10 public : 11 /** Create a new sectionToExecute and initialize it with the given element12 */13 sectionToExecute(abstractElement*);14 11 15 12 /** Create a new sectionToExecute and initialize it with the given element and software … … 26 23 } 27 24 28 inline abstractSoftware*setSoftware(abstractSoftware* soft) {25 inline void setSoftware(abstractSoftware* soft) { 29 26 software_ = soft; 30 27 } 31 28 29 /** 30 Set a software according to the corresponding given string. 31 If not found, set a softwareUnknown 32 */ 33 void setSoftware(std::string); 34 32 35 /** 33 36 Get the vector of elements of this sector … … 47 50 bool insertAfter(abstractElement*,abstractElement*); 48 51 52 inline bool insertAtFirst(abstractElement* abs) { 53 elements_.insert ( elements_.begin() ,abs); 54 }; 55 49 56 private : 50 57 -
Interface_Web/trunk/pspaWT/sources/controler/include/sector.h
r455 r469 69 69 /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL 70 70 it will create a new sectionToExecute and put it inside. 71 if the previous element is NULL, it will try to add at the beginning of the first section 71 72 */ 72 73 void addElementAfter(abstractElement*,abstractElement*); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h
r455 r469 11 11 virtual ~softwareUnknown() {;} 12 12 13 virtual bool createInputFile(particleBeam* ,sectionToExecute* sectionToExe, string);13 virtual bool createInputFile(particleBeam* beamBefore, string workingDir); 14 14 virtual bool execute(string); 15 15 virtual bool buildBeamAfterElements(string); -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
r431 r469 5 5 #include "abstractElement.h" 6 6 7 abstractElement::abstractElement() : abstractSoftware_(NULL)7 abstractElement::abstractElement() 8 8 { 9 9 setDefaultValues(); … … 12 12 } 13 13 14 abstractElement::abstractElement(string lab) : abstractSoftware_(NULL)14 abstractElement::abstractElement(string lab) 15 15 { 16 16 specificName_ = lab; -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r455 r469 41 41 { 42 42 /* 43 abstractElement* ptr = pspa_->getBeamLine ()->getAbstractElement(numero-1);43 abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(numero-1); 44 44 if ( ptr == NULL ) return ""; 45 45 return ptr->getLabel(); … … 52 52 /* int index = -1; 53 53 for (int k = 0; k < getBeamLineSize() ; k++) { 54 if (pspa_->getBeamLine ()->getAbstractElement(k) != NULL) {55 if ( pspa_->getBeamLine ()->getAbstractElement(k)->getLabel() == label )54 if (pspa_->getBeamLine_deprecated()->getAbstractElement(k) != NULL) { 55 if ( pspa_->getBeamLine_deprecated()->getAbstractElement(k)->getLabel() == label ) 56 56 { 57 57 index = (int)k + 1; … … 264 264 //NOTE:: je ne sais pas si les "secteurs" seront conservés, aussi pour ne pas trop changer les fichiers je lis les données aprÚs "globals" dans la boucle 265 265 266 pspa_->getBeamLine ()->clear();266 pspa_->getBeamLine_deprecated()->clear(); 267 267 nomdElements::typedElement elementType; 268 268 string elementLabel; … … 278 278 } else { 279 279 elementType = nomdElements::getTypeFromLabel(elementLabel); 280 GWt_abstractElement* nouveau = pspa_->getBeamLine ()->addElement(elementType);280 GWt_abstractElement* nouveau = pspa_->getBeamLine_deprecated()->addElement(elementType); 281 281 if ( nouveau == NULL ) { 282 282 cerr << " dataManager::restoreElements() : restore element " << elementLabel << " failed " << endl; … … 291 291 unsigned k; 292 292 for(k = 0; k < getBeamLineSize(); k++) { 293 abstractElement* ptr = pspa_->getBeamLine ()->getAbstractElement(k);293 abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(k); 294 294 cout << "recupere " << ptr->getLabel() << endl; 295 295 } -
Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc
r455 r469 1 1 #include "sectionToExecute.h" 2 3 4 sectionToExecute::sectionToExecute(abstractElement* a) { 5 elements_.push_back(a); 6 } 2 #include "softwareUnknown.h" 3 #include "softwareParmela.h" 4 #include "softwareTransport.h" 5 #include "softwareGenerator.h" 6 #include "softwareGenerator.h" 7 #include "softwareUsersprogram.h" 8 #include "softwareTest.h" 9 #include "softwareMadx.h" //xx 7 10 8 11 9 12 sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) { 10 13 elements_.push_back(f); 14 if (s == NULL) { 15 software_ = new softwareUnknown(); 16 } else { 11 17 software_ = s; 18 } 12 19 } 13 20 … … 25 32 } 26 33 27 /* 28 bool sectionToExecute::setSoftware(nomDeLogiciel logiciel) { 29 30 if (sectionToExecuteNumber >= sectionToExecute_.size()) { 31 return false; 34 35 void sectionToExecute::setSoftware(std::string logiciel) { 36 37 abstractSoftware* prog; 38 string inputFileName; 39 if(logiciel == "parmela") { 40 inputFileName = "parmin"; 41 prog = new softwareParmela(inputFileName, this); 42 } else if (logiciel == "transport") { 43 inputFileName = "transport.input"; 44 prog = new softwareTransport(inputFileName, this); 45 } else if (logiciel == "generator") { 46 inputFileName = "generator.in"; 47 prog = new softwareGenerator(inputFileName, this); 48 } else if (logiciel == "madx") { 49 inputFileName = "madx.input"; 50 prog = new softwareMadx(inputFileName,this); 51 } else if (logiciel == "usersprogram") { 52 inputFileName = "dummy"; 53 prog = new softwareUsersprogram(inputFileName, this); 54 } else if (logiciel == "test") { 55 prog = new softwareTest(inputFileName, this); 56 } else { 57 prog = new softwareUnknown(); 32 58 } 33 59 34 abstractSoftware* prog; 35 string inputFileName; 36 if(logiciel == nomDeLogiciel::parmela) { 37 inputFileName = "parmin"; 38 prog = new softwareParmela(inputFileName, this); 39 } else if (logiciel == nomDeLogiciel::transport) { 40 inputFileName = "transport.input"; 41 prog = new softwareTransport(inputFileName, this); 42 } else if (logiciel == nomDeLogiciel::generator) { 43 inputFileName = "generator.in"; 44 prog = new softwareGenerator(inputFileName, this); 45 } else if (logiciel == nomDeLogiciel::madx) { 46 inputFileName = "madx.input"; 47 prog = new softwareMadx(inputFileName,this); 48 } else if (logiciel == nomDeLogiciel::usersprogram) { 49 inputFileName = "dummy"; 50 prog = new softwareUsersprogram(inputFileName, this); 51 } else if (logiciel == nomDeLogiciel::test) { 52 prog = new softwareTest(inputFileName, this); 53 } else { 54 prog = new softwareUnknown(); // xx 55 } 56 57 sectionToExecute_[sectionToExecuteNumber]->setSoftware(prog); 58 return true; 60 setSoftware(prog); 59 61 } 60 */ 62 -
Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc
r455 r469 8 8 9 9 #include "sector.h" 10 #include "softwareParmela.h"11 #include "softwareTransport.h"12 #include "softwareGenerator.h"13 #include "softwareGenerator.h"14 #include "softwareUsersprogram.h"15 #include "softwareTest.h"16 #include "softwareMadx.h" //xx17 #include "softwareUnknown.h" //xx18 10 19 11 #include "sectionToExecute.h" … … 35 27 36 28 void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){ 29 // if the previous element is NULL, it will try to add at the beginning of the first section 30 37 31 if (previousElement == NULL) { 38 32 if (sectionToExecute_.size() == 0) { 39 sectionToExecute_.push_back(new sectionToExecute(currentElement ));33 sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL)); 40 34 } else { 41 sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) ); 35 sectionToExecute* section = sectionToExecute_.front(); 36 section->insertAtFirst(currentElement); 42 37 } 43 38 } else { -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc
r455 r469 17 17 } 18 18 19 bool softwareUnknown::createInputFile(particleBeam* beamBefore, sectionToExecute* sectionToExe,string workingDir)19 bool softwareUnknown::createInputFile(particleBeam* beamBefore, string workingDir) 20 20 { 21 21 return true; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h
r455 r469 31 31 */ 32 32 33 GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem);33 GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem, std::string); 34 34 35 35 ~GWt_elementLigneFaisceau(); … … 61 61 softwareName_ =new WText(name); 62 62 } 63 64 /** 65 Set the background color for this element 66 */ 67 void setBGColor(const WColor); 68 63 69 64 70 private: … … 66 72 void removeDone(GWt_abstractElement*); 67 73 std::string getElementNumberInBeamLine(nomdElements el); 68 void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem );74 void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem, std::string); 69 75 void mouseWentOut(); 70 76 void mouseWentOver(); 71 /** 72 Update the software of this element according to the sectionToExecute software. Will change the color of this object 73 */ 74 void updateSoftware(); 75 void setBGColor(const WColor); 77 76 78 GWt_dialog* messageDropZone_; 77 79 WText* firstTimeInsertMessage_; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h
r455 r469 79 79 */ 80 80 void update_deprecated(int); 81 82 void initializeSoftwares(); 83 81 84 82 /** Return the sector of this beamLine */ 85 83 inline GWt_sector* getUISector() { return UI_sector_;}; 86 84 85 void buildBeamLineWidget(); 86 87 87 private : 88 88 void manageLineFaisceauLayout_deprecated(); 89 void buildBeamLineWidget();90 89 91 90 GWt_dropZoneLigneFaisceau* allDropZone_; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r455 r469 93 93 } 94 94 95 inline GWt_ligneFaisceau* getBeamLine () {95 inline GWt_ligneFaisceau* getBeamLine_deprecated() { 96 96 return beamLine_deprecated_; 97 97 } -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
r455 r469 8 8 class GWt_softwarePanel; 9 9 class GWt_sector; 10 class sectionToExecute; 10 11 11 12 class GWt_sectionToExecute : public Wt::WContainerWidget 12 13 { 13 14 public : 14 GWt_sectionToExecute(Wt::WComboBox* ,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel,GWt_sector*);15 GWt_sectionToExecute(Wt::WComboBox* ,Wt::WComboBox* ,Wt::WComboBox*,Wt::WContainerWidget* ,sectionToExecute*,GWt_sector* ); 15 16 16 17 ~GWt_sectionToExecute() {;} 17 18 19 void setSoftware(); 20 18 21 inline Wt::WString getFirstElementCurrentText() { 19 return firstElement ->currentText();22 return firstElement_->currentText(); 20 23 } 21 24 22 25 inline Wt::WString getLastElementCurrentText() { 23 return lastElement->currentText(); 24 } 25 26 inline Wt::WString getSoftwareCurrentText() { 27 return software->currentText(); 26 return lastElement_->currentText(); 28 27 } 29 28 30 29 inline Wt::WComboBox * getFirstElement() { 31 return firstElement ;30 return firstElement_; 32 31 } 33 32 34 33 inline Wt::WComboBox * getLastElement() { 35 return lastElement ;34 return lastElement_; 36 35 } 37 36 38 inline Wt::WComboBox * getSoftware() {39 return software;40 }41 37 void setFirstElementCurrentSelection(Wt::WString); 42 38 void setLastElementCurrentSelection(Wt::WString); … … 56 52 57 53 void manageWarningsAndErrors(); 58 Wt::WComboBox* firstElement; 59 Wt::WComboBox* lastElement; 60 Wt::WComboBox* software; 61 GWt_softwarePanel* softwarePanel; 54 Wt::WComboBox* firstElement_; 55 Wt::WComboBox* lastElement_; 56 Wt::WComboBox* softElement_; 57 sectionToExecute* section_; 58 GWt_sector* UIsector_; 62 59 63 60 Wt::WText* errorsLabel_; … … 66 63 Wt::WContainerWidget* warningsContainer_; 67 64 Wt::WContainerWidget* errorsContainer_; 68 GWt_sector* UI_sector_;69 65 }; 70 66 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h
r455 r469 32 32 } 33 33 34 /** 35 Get the beam line widget 36 */ 37 inline GWt_ligneFaisceau* getBeamLineWidget() { 38 return UI_beamLine_; 39 }; 40 34 41 private : 35 42 GWt_ligneFaisceau* UI_beamLine_; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r468 r469 39 39 string getSelection(); 40 40 void fillComboWithElements(Wt::WComboBox* cBox); 41 void fillComboWithSoftwares(Wt::WComboBox* cBox); 41 42 /** Fill a ComboBox with the software list 43 By default, will setup the default text to the last software 44 */ 45 void fillComboWithSoftwares(Wt::WComboBox* cBox, std::string ); 42 46 Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 43 47 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc
r468 r469 669 669 670 670 // intialize User Interface 671 if (pspa_->getBeamLine ()) {672 pspa_->getBeamLine ()->initializeSoftwares();671 if (pspa_->getBeamLine_deprecated()) { 672 pspa_->getBeamLine_deprecated()->initializeSoftwares(); 673 673 } 674 674 … … 679 679 string debString= sections_[a]->getFirstElementCurrentText().toUTF8(); 680 680 string finString= sections_[a]->getLastElementCurrentText().toUTF8(); 681 int debut = pspa_->getBeamLine ()->getAbstractElementNumeroFromLabel(debString);682 int fin = pspa_->getBeamLine ()->getAbstractElementNumeroFromLabel(finString);681 int debut = pspa_->getBeamLine_deprecated()->getAbstractElementNumeroFromLabel(debString); 682 int fin = pspa_->getBeamLine_deprecated()->getAbstractElementNumeroFromLabel(finString); 683 683 684 684 string currentSoft= sections_[a]->getSoftwareCurrentText().toUTF8(); 685 685 nomDeLogiciel prog = nomDeLogiciel(currentSoft); 686 sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine ()->getAbstractElement(debut),debut,pspa_->getBeamLine()->getAbstractElement(fin),fin,prog);686 sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine_deprecated()->getAbstractElement(debut),debut,pspa_->getBeamLine_deprecated()->getAbstractElement(fin),fin,prog); 687 687 688 688 abstractSoftware* softToExec = sectToExec->getSoftware(); … … 691 691 for(int i = debut-1; i < fin; i++) // check sections 692 692 { 693 if (!pspa_->getBeamLine ()) continue;694 abstractElement* elPtr= pspa_->getBeamLine ()->getAbstractElement(i);693 if (!pspa_->getBeamLine_deprecated()) continue; 694 abstractElement* elPtr= pspa_->getBeamLine_deprecated()->getAbstractElement(i); 695 695 if (!elPtr) continue; 696 696 … … 709 709 } 710 710 } 711 pspa_->getBeamLine ()->update(i);711 pspa_->getBeamLine_deprecated()->update(i); 712 712 } //i 713 713 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r455 r469 20 20 21 21 22 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem )22 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem,std::string bgcolor) 23 23 : WContainerWidget(), 24 24 firstTimeInsertMessage_(NULL), … … 31 31 // set the css name 32 32 setObjectName("elementLigneFaisceau"); 33 initialize_ligneFaisceau(ligne,abstractElem );34 } 35 36 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem )33 initialize_ligneFaisceau(ligne,abstractElem,bgcolor); 34 } 35 36 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem,std::string bgcolor) 37 37 { 38 38 // set layout … … 173 173 gridLayout->setColumnStretch (2,1); 174 174 175 // Change background color 176 setBGColor(WColor(bgcolor)); 177 175 178 // set layout 176 179 setLayout(gridLayout); … … 182 185 actionTrash_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::deleteElement); 183 186 184 updateSoftware();185 187 } 186 188 … … 188 190 {} 189 191 190 void GWt_elementLigneFaisceau::updateSoftware()191 {192 if (getGWt_AbstractElement()->getAbstractElement()) {193 if (getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()) {194 // setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getColor()));195 setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getNomDeLogiciel()->getColor()));196 softwareName_->setText(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getName());197 198 // no abstract software199 } else {200 setBGColor(WColor("#FFFFFF"));201 softwareName_->setText("");202 }203 }204 }205 192 206 193 void GWt_elementLigneFaisceau::setBGColor(const WColor c) { -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r468 r469 178 178 elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_, 179 179 this, 180 abstractElem[j] );180 abstractElem[j],UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getSoftware()->getColor()); 181 181 182 182 // remove default text … … 328 328 } 329 329 } 330 331 332 void GWt_ligneFaisceau::initializeSoftwares()333 {334 vector <abstractElement*> elems = getAllAbstractElements();335 cout << "GWt_ligneFaisceau::initializeSoftwares() " << elems.size() << endl;336 337 for (int a = 0; a < elems.size(); a++) {338 elems[a]->setSoftware( NULL );339 }340 }341 342 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r455 r469 8 8 #include "GWt_sectionToExecute.h" 9 9 #include "GWt_softwarePanel.h" 10 #include "GWt_sector.h" 10 11 11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect)12 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, sectionToExecute* section,GWt_sector* sector) 12 13 :WContainerWidget(), 13 firstElement (first),14 lastElement (last),15 soft ware(soft),16 s oftwarePanel(sPanel),17 UI _sector_(sect)14 firstElement_(first), 15 lastElement_(last), 16 softElement_(soft), 17 section_(section), 18 UIsector_(sector) 18 19 { 19 20 Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout(); … … 29 30 30 31 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from : ")); 31 labelAndComboInsideContainerLayout->addWidget(first );32 labelAndComboInsideContainerLayout->addWidget(firstElement_); 32 33 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to : ")); 33 labelAndComboInsideContainerLayout->addWidget(last );34 labelAndComboInsideContainerLayout->addWidget(soft );34 labelAndComboInsideContainerLayout->addWidget(lastElement_); 35 labelAndComboInsideContainerLayout->addWidget(softElement_); 35 36 36 37 // add buttons … … 86 87 87 88 // resize combo 88 firstElement ->setMinimumSize(80,12);89 lastElement ->setMinimumSize(80,12);90 soft ware->setMinimumSize(80,12);89 firstElement_->setMinimumSize(80,12); 90 lastElement_->setMinimumSize(80,12); 91 softElement_->setMinimumSize(80,12); 91 92 92 firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);93 lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);94 soft ware->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);93 // firstElement_->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 94 // lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 95 softElement_->activated().connect(this,&GWt_sectionToExecute::setSoftware); 95 96 96 97 manageWarningsAndErrors(); … … 99 100 100 101 void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){ 101 for (int a=0; a< firstElement ->count(); a++) {102 if (firstElement ->itemText(a) == txt) {103 firstElement ->setCurrentIndex (a);102 for (int a=0; a< firstElement_->count(); a++) { 103 if (firstElement_->itemText(a) == txt) { 104 firstElement_->setCurrentIndex (a); 104 105 return; 105 106 } … … 108 109 109 110 void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){ 110 for (int a=0; a< lastElement ->count(); a++) {111 if (lastElement ->itemText(a) == txt) {112 lastElement ->setCurrentIndex (a);111 for (int a=0; a< lastElement_->count(); a++) { 112 if (lastElement_->itemText(a) == txt) { 113 lastElement_->setCurrentIndex (a); 113 114 return; 114 115 } … … 117 118 118 119 void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){ 119 for (int a=0; a< soft ware->count(); a++) {120 if (soft ware->itemText(a) == txt) {121 soft ware->setCurrentIndex (a);120 for (int a=0; a< softElement_->count(); a++) { 121 if (softElement_->itemText(a) == txt) { 122 softElement_->setCurrentIndex (a); 122 123 return; 123 124 } … … 140 141 } 141 142 142 /* 143 void GWt_sectionToExecute::setSoftware( nomDeLogiciel logiciel)143 144 void GWt_sectionToExecute::setSoftware() 144 145 { 145 UI_sector_->getSectorControler()->setSoftware(logiciel);146 146 section_->setSoftware(softElement_->currentText().toUTF8()); 147 UIsector_->getBeamLineWidget()->buildBeamLineWidget(); 147 148 } 148 149 149 */ -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r468 r469 67 67 abstractElement* dernierElement = NULL; 68 68 69 int premierIndex = 0;70 int dernierIndex = 0;71 72 69 std::string premierElementLabel = ""; 73 70 std::string dernierElementLabel = ""; … … 84 81 fillComboWithElements(lineToCombo); 85 82 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()); 89 87 90 88 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 } 92 106 93 107 // 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 ? 96 111 stringstream st; 97 112 st << UIsectionsToExecute_.size(); … … 103 118 UIsectionsToExecute_.push_back(newSection); 104 119 contenuSections_->addWidget(newSection); 105 updateSections();120 // updateSections(); 106 121 107 122 … … 116 131 cout << " GWt_softwarePanel::updateSections() " << endl<<endl; 117 132 #endif 118 return; 119 133 134 /* 120 135 // update all sections in order to manage new/deleted items 121 136 for (int a = 0; a < UIsectionsToExecute_.size(); a++) { … … 140 155 // set default values 141 156 updateSectionSelection(); 157 */ 142 158 } 143 159 … … 248 264 if (s > 0) { 249 265 abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement(); 250 UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs ));266 UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL)); 251 267 UIsector_->getSectorControler()->getSectionsToExecute()[s]->removeLastElement(); 252 268 } … … 290 306 if (cBox == NULL) return; 291 307 292 // get the last item selected293 WString selectedString = cBox->currentText();294 cBox->clear();295 296 308 if (!UIsector_->getSectorControler()) { 297 309 return; … … 306 318 } 307 319 } 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 322 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox, std::string selected) 318 323 { 319 324 #if BAVARD > 0 … … 329 334 for(k = 0; k <= nb; k++) { //xx 330 335 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 } 333 340 cBox->refresh(); 334 341 }
Note: See TracChangeset
for help on using the changeset viewer.