Changeset 431 in PSPA for Interface_Web/trunk/pspaWT/sources/userInterface
- Timestamp:
- Nov 15, 2013, 3:30:50 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources/userInterface
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_abstractElement.h
r365 r431 3 3 4 4 #include "GWt_draggableImage.h" 5 #include "GWt_console.h" 6 5 7 #include "abstractElement.h" 6 #include "GWt_console.h"7 8 #include "elementDrift.h" 8 9 #include "elementRfgun.h" … … 13 14 #include "elementFit.h" 14 15 #include "elementSnapshot.h" 16 #include "elementMultipole.h" 15 17 16 18 #include <Wt/WDialog> … … 33 35 class GWt_abstractElement : public WContainerWidget 34 36 { 35 37 protected : 36 38 37 39 abstractElement* abstractElement_; 38 40 39 40 41 42 43 41 WDialog* dialog_; 42 GWt_draggableImage* dropped_; 43 WContainerWidget* wc_; 44 WText* wc_item_; 45 WLineEdit* labelEdit_; 44 46 45 GWt_abstractElement() {;} 46 string* beginDialog(); 47 48 public : 49 50 GWt_abstractElement(abstractElement*); 51 52 void initialize(); 53 void showParameters(); 54 void deleteElement(); 47 GWt_abstractElement() {;} 48 string* beginDialog(); 49 50 public : 51 52 GWt_abstractElement(abstractElement*); 53 54 void initialize(); 55 void showParameters(); 56 void deleteElement(); 57 58 void updateLabelAndToolTipWidget(); 59 void FileInput(ifstream& ifs); 60 61 WContainerWidget* getWidget(); 62 abstractElement* getAbstractElement(); 55 63 56 void updateLabelAndToolTipWidget(); 57 void FileInput(ifstream& ifs); 58 59 // GWt_draggableImage* getImage(); 60 WContainerWidget* getWidget(); 61 abstractElement* getAbstractElement(); 62 63 virtual void dialogDone(WDialog::DialogCode code) = 0; 64 65 inline WString print() { 66 return abstractElement_->print(); 67 } 68 69 virtual string getMimeType() = 0; 70 virtual string getSmallImageURL() = 0; 71 virtual string getBigImageURL() = 0; 72 virtual string getName() = 0; 73 virtual void initilializeDialog() = 0; 74 75 void createDragImage(WContainerWidget*); 76 WImage* getImage(); 77 78 protected: 79 64 inline WString print() { 65 return abstractElement_->print(); 66 } 67 68 virtual void dialogDone(WDialog::DialogCode code) = 0; 69 virtual string getMimeType() = 0; 70 virtual string getSmallImageURL() = 0; 71 virtual string getBigImageURL() = 0; 72 virtual string getName() = 0; 73 virtual void initilializeDialog() = 0; 74 75 void createDragImage(WContainerWidget*); 76 WImage* getImage(); 77 78 protected: 79 80 80 WImage* image_; 81 81 GWt_elementLigneFaisceau* elementLigneFaiseauContainer_; … … 86 86 87 87 inline void registerParam(string name, variant<int, string, bool, float, NullType> value, string desc) { 88 89 88 parameterMapValue[name] = value; 89 parameterMapDescription[name] = desc; 90 90 } 91 91 92 variant<int, string, bool, float, NullType> getParamValue(string elem);93 string getParamDescription(string elem);92 variant<int, string, bool, float, NullType> getParamValue(string); 93 string getParamDescription(string); 94 94 }; 95 95 #endif -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_abstractElementFactory.h
r343 r431 18 18 #include "GWt_fit.h" 19 19 #include "GWt_snapshot.h" 20 #include "GWt_mpole.h" 20 21 21 22 using namespace Wt; … … 62 63 inline void setSnapshotEnable(bool a) { isSnapshotElementEnable = a;}; 63 64 65 /* Enable the mpole element creation 66 */ 67 inline void setMPoleEnable(bool a) { isMPoleElementEnable = a;}; 68 64 69 GWt_drift* createDriftElement(); 65 70 GWt_rfgun* createRFGunElement(); … … 70 75 GWt_fit* createFitElement(); 71 76 GWt_snapshot* createSnapshotElement(); 77 GWt_mpole* createMPoleElement(); 72 78 vector <GWt_abstractElement*> getAllElements(); 73 79 … … 82 88 bool isFitElementEnable; 83 89 bool isSnapshotElementEnable; 90 bool isMPoleElementEnable; 84 91 }; 85 92 #endif -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_globalParameters.h
r428 r431 39 39 void updateGlobals(); 40 40 void renew(); 41 void setText(W ContainerWidget*);41 void setText(WText*); 42 42 }; 43 43 #endif -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r426 r431 3 3 4 4 #include <cstdlib> 5 #include <list> 5 #include <string.h> 6 #include <vector> 6 7 7 8 #include <Wt/WApplication> … … 9 10 #include <Wt/WContainerWidget> 10 11 #include <Wt/WText> 12 #include <Wt/WLineEdit> 11 13 #include <Wt/WPanel> 12 14 #include <Wt/WComboBox> … … 24 26 #include "GWt_ligneFaisceau.h" 25 27 #include "GWt_globalParameters.h" 28 #include "GWt_sectorParameters.h" 26 29 27 30 #include "dataManager.h" … … 43 46 GWt_LigneFaisceau* beamLine_; 44 47 45 // WWidget* globalParam_;46 GWt_ globalParameters* globalParam_; // xx48 GWt_globalParameters* globalParam_; 49 GWt_sectorParameters* sectorParam_; 47 50 48 51 GWt_dialog* graphicsDialog_; … … 73 76 WContainerWidget* createDrawingWidget(); 74 77 75 //WWidget* createGlobalParamWidget(); 76 WWidget* createDashBoard(); // xx 77 void messageBox1(); // xx 78 void messageBox2(); // xx 78 WWidget* createDashBoard(); 79 void messageBox1(); 80 void messageBox2(); 79 81 80 82 // extensions (.001, .002,...) pour les fichiers "snapshot" … … 119 121 } 120 122 121 122 /* inline WWidget* getGlobalParam() { */123 /* return globalParam_; */124 /* } */125 126 123 inline GWt_softwarePanel* getExecuteWidget() { 127 124 return executeWidget_; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r407 r431 23 23 class GWt_softwarePanel : public WContainerWidget 24 24 { 25 public : 26 GWt_softwarePanel(dataManager*, PspaApplication*); 27 virtual ~GWt_softwarePanel(); 25 public : 26 27 GWt_softwarePanel(dataManager*, PspaApplication*); 28 virtual ~GWt_softwarePanel(); 28 29 29 30 30 void addSectionToExecuteW(); 31 void updateSections(); 31 32 32 private : 33 // void disableSectionExecute(); 34 // void checkSectionSelection(); 35 bool updateSectionSelection(); 36 void deleteSectionToExecuteW(int section); 37 string getSelection(); 38 void executer(); 39 bool areDataCoherent(); 40 void fillComboWithElements(Wt::WComboBox* cBox); 41 void fillComboWithSoftwares(Wt::WComboBox* cBox); 42 Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 33 private : 34 35 bool updateSectionSelection(); 36 void deleteSectionToExecuteW(int section); 37 string getSelection(); 38 void executer(); 39 bool areDataCoherent(); 40 void fillComboWithElements(Wt::WComboBox* cBox); 41 void fillComboWithSoftwares(Wt::WComboBox* cBox); 42 Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 43 43 44 45 46 47 44 dataManager* dtmanage_; 45 WPushButton *exec_go_; 46 WContainerWidget* contenuSections_; 47 PspaApplication* pspa_; 48 48 49 49 std::vector <GWt_sectionToExecute*> sections_; 50 50 }; 51 52 51 #endif /* defined(__PSPA__GWt_softwarePanel__) */ -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElement.cc
r418 r431 14 14 #include "GWt_beam.h" 15 15 #include "GWt_fit.h" 16 #include "GWt_snapshot.h" 16 //#include "GWt_snapshot.h" 17 17 18 #include "GWt_draggableImage.h" 18 19 #include "GWt_ligneFaisceau.h" … … 29 30 30 31 GWt_abstractElement::GWt_abstractElement(abstractElement* elem) 31 : WContainerWidget()32 : WContainerWidget() 32 33 { 33 34 abstractElement_ = elem; 34 35 } 35 36 36 37 37 void GWt_abstractElement::initialize() 38 38 { 39 // make image 40 image_ = new WImage(getBigImageURL(),this); 41 42 addWidget(image_); 43 updateLabelAndToolTipWidget(); 39 image_ = new WImage(getBigImageURL(),this); // make image 40 addWidget(image_); 41 updateLabelAndToolTipWidget(); 44 42 } 45 46 43 47 44 string* GWt_abstractElement::beginDialog() 48 45 { 49 string* param = abstractElement_-> getParametersString(); 50 51 if ( param == NULL ) 52 { 53 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 54 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 55 console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getExpandedName()); 56 } 46 string* param = abstractElement_->getParametersString(); 47 48 if ( param == NULL ) { 49 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 50 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 51 console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getExpandedName()); 57 52 } 58 // int compteur = -1; 53 } 54 55 int nbparam = atoi(param->c_str()); 56 if ( nbparam != abstractElement_->getNbParams()) { 57 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 58 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 59 console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getExpandedName()); 60 } 61 } 59 62 60 // int nbparam = atoi(param[++compteur].c_str()); 61 int nbparam = atoi(param->c_str()); 62 if ( nbparam != abstractElement_->getNbParams()) 63 { 64 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 65 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 66 console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getExpandedName()); 67 } 68 } 69 70 dialog_ = new WDialog("element " + abstractElement_->getNomdElement().getExpandedName()); 71 new WText(" label of the element : ",dialog_->contents()); 72 // labelEdit_ = new WLineEdit(param[++compteur].c_str(), dialog_->contents()); 73 74 labelEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); 75 new WBreak(dialog_->contents()); 76 return ++param; 63 dialog_ = new WDialog("element "+abstractElement_->getNomdElement().getExpandedName()); 64 new WText(" label of the element : ",dialog_->contents()); 65 labelEdit_ = new WLineEdit( (++param)->c_str(),dialog_->contents()); 66 new WBreak(dialog_->contents()); 67 return ++param; 77 68 } 78 69 79 70 void GWt_abstractElement::updateLabelAndToolTipWidget() 80 71 { 81 72 if (abstractElement_ != NULL) { 82 73 elementLigneFaiseauContainer_->setElementLabel(abstractElement_->getLabel()); 83 74 setToolTip(print()); 84 75 } 85 76 } 86 77 … … 91 82 } 92 83 93 94 84 void GWt_abstractElement::deleteElement() 95 85 { 96 StandardButton result = WMessageBox::show("PSPA : Delete element", WString("Delete '")+WString(getAbstractElement()->getLabel())+"' ?", Ok | Cancel); 86 StandardButton result = WMessageBox::show("PSPA : Delete element", WString("Delete '")+WString(getAbstractElement()->getLabel())+"' ?", Ok | Cancel); 87 88 if (result == Cancel) { 89 return; 90 } 91 // get LigneFaiseau widget and add new elementLigneFaiseau 92 GWt_LigneFaisceau* ligneFaisceau = NULL; 93 if ( static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) { 94 ligneFaisceau = static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau")); 95 } else { 96 return; 97 } 98 99 ligneFaisceau->removeElement(this); 100 } 97 101 98 if (result == Cancel ) { 99 return; 100 } 101 // get LigneFaiseau widget and add new elementLigneFaiseau 102 GWt_LigneFaisceau* ligneFaisceau = NULL; 103 if ( static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) { 104 ligneFaisceau = static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau")); 105 } else { 106 return; 107 } 108 109 ligneFaisceau->removeElement(this); 102 void GWt_abstractElement::createDragImage(WContainerWidget* w) 103 { 104 GWt_draggableImage *result= new GWt_draggableImage(getBigImageURL(),w); 105 106 /* 107 * Set the image to be draggable, showing the other image (dragImage) 108 * to be used as the widget that is visually dragged. 109 */ 110 result->setDraggable(getMimeType(),new WImage(getSmallImageURL(),w),true); 111 result->setToolTip(getName()); 112 } 113 114 void GWt_abstractElement::FileInput(ifstream& ifs) 115 { 116 getAbstractElement()->FileInput(ifs); 117 initilializeDialog(); 118 updateLabelAndToolTipWidget(); 119 120 // update parameters 121 GWt_LigneFaisceau* ligneFaisceau = NULL; 122 if ( static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) { 123 ligneFaisceau = static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau")); 124 ligneFaisceau->update(); 125 } 126 } 127 128 abstractElement* GWt_abstractElement::getAbstractElement() { 129 return abstractElement_; 110 130 } 111 131 112 132 WContainerWidget* GWt_abstractElement::getWidget() { 113 return wc_; 114 } 115 116 abstractElement* GWt_abstractElement::getAbstractElement() { 117 return abstractElement_; 118 } 119 120 121 void GWt_abstractElement::createDragImage(WContainerWidget* w){ 122 123 GWt_draggableImage *result = new GWt_draggableImage(getBigImageURL(),w); 124 125 /* 126 * Set the image to be draggable, showing the other image (dragImage) 127 * to be used as the widget that is visually dragged. 128 */ 129 result->setDraggable(getMimeType(),new WImage(getSmallImageURL(),w),true); 130 result->setToolTip(getName()); 131 133 return wc_; 132 134 } 133 135 134 136 WImage* GWt_abstractElement::getImage() { 135 137 return image_; 136 138 } 137 139 138 139 void GWt_abstractElement::FileInput(ifstream& ifs){ 140 getAbstractElement()->FileInput(ifs); 141 initilializeDialog(); 142 updateLabelAndToolTipWidget(); 143 144 // update parameters 145 GWt_LigneFaisceau* ligneFaisceau = NULL; 146 if ( static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) { 147 ligneFaisceau = static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau")); 148 ligneFaisceau->update(); 140 variant<int, string, bool, float, NullType> GWt_abstractElement::getParamValue(string elem) 141 { 142 if(parameterMapValue.find(elem) == parameterMapValue.end()) { 143 return new NullType(); 144 } 145 146 std::map<std::string, variant<int, string, bool, float, NullType> >::iterator it; 147 it = parameterMapValue.find(elem); 148 variant <int, string, bool, float, NullType> value = it->second; 149 150 try { 151 int pi = boost::get<int>(value); 152 printf("%s Type is int\n",elem.c_str()); 153 return pi; 154 } 155 catch (boost::bad_get v) { 156 try { 157 string si = boost::get<string>(value); 158 printf("%s Type is string\n",elem.c_str()); 159 return si; 149 160 } 161 catch (boost::bad_get v) { 162 try { 163 bool bi = boost::get<bool>(value); 164 printf("%s Type is bool\n",elem.c_str()); 165 return bi; 166 } 167 catch (boost::bad_get v) { 168 printf("%s Type is NULL\n",elem.c_str()); 169 return new NullType(); 170 } 171 } 172 } 173 printf("%s Type is NULL NULL\n",elem.c_str()); 174 return new NullType(); 150 175 } 151 176 152 153 154 variant<int, string, bool, float, NullType> GWt_abstractElement::getParamValue(string elem) { 155 156 if (parameterMapValue.find(elem) == parameterMapValue.end() ) 157 { 158 return new NullType(); 159 } 160 161 std::map<std::string, variant<int, string, bool, float, NullType> >::iterator it; 162 it = parameterMapValue.find(elem); 163 164 variant <int, string, bool, float, NullType> value = it->second; 165 166 try { 167 int pi = boost::get<int>(value); 168 printf("%s Type is int\n",elem.c_str()); 169 return pi; 170 } 171 catch (boost::bad_get v) { 172 try { 173 string si = boost::get<string>(value); 174 printf("%s Type is string\n",elem.c_str()); 175 return si; 176 } 177 catch (boost::bad_get v) { 178 try { 179 bool bi = boost::get<bool>(value); 180 printf("%s Type is bool\n",elem.c_str()); 181 return bi; 182 } 183 catch (boost::bad_get v) { 184 printf("%s Type is NULL\n",elem.c_str()); 185 return new NullType(); 186 } 187 } 188 } 189 printf("%s Type is NULL NULL\n",elem.c_str()); 190 return new NullType(); 177 string GWt_abstractElement::getParamDescription(string elem) 178 { 179 if(parameterMapDescription.find(elem) == parameterMapDescription.end() ) { 180 printf("%s Descr is NULL NULL\n",elem.c_str()); 181 return ""; 182 } else { 183 printf("%s Descr is %s\n",elem.c_str(),parameterMapDescription.find(elem)->second.c_str()); 184 return parameterMapDescription.find(elem)->second; 185 } 191 186 } 192 193 194 string GWt_abstractElement::getParamDescription(string elem) {195 196 if (parameterMapDescription.find(elem) == parameterMapDescription.end() )197 {198 printf("%s Descr is NULL NULL\n",elem.c_str());199 return "";200 } else {201 printf("%s Descr is %s\n",elem.c_str(),parameterMapDescription.find(elem)->second.c_str());202 return parameterMapDescription.find(elem)->second;203 }204 }205 206 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElementFactory.cc
r401 r431 17 17 isBeamElementEnable(false), 18 18 isFitElementEnable(false), 19 isSnapshotElementEnable(false) 19 isSnapshotElementEnable(false), 20 isMPoleElementEnable(false) 20 21 {} 21 22 … … 30 31 isFitElementEnable = false; 31 32 isSnapshotElementEnable = false; 33 isMPoleElementEnable = false; 32 34 } 33 35 … … 96 98 } 97 99 100 GWt_mpole* GWt_abstractElementFactory::createMPoleElement() 101 { 102 if (isMPoleElementEnable) { 103 return new GWt_mpole(); 104 } 105 return NULL; 106 } 107 98 108 vector <GWt_abstractElement*> GWt_abstractElementFactory::getAllElements() 99 109 { … … 123 133 elems.push_back(new GWt_snapshot()); 124 134 } 135 if (isMPoleElementEnable) { 136 elems.push_back(new GWt_mpole()); 137 } 125 138 126 139 return elems; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r418 r431 13 13 #include "GWt_fit.h" 14 14 #include "GWt_snapshot.h" 15 #include "GWt_mpole.h" 15 16 16 17 … … 55 56 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(nomdElements::typedElement eType) 56 57 { 57 cout <<"new GWt_elementLigneFaisceau : "<< this<< endl;58 cout << " new GWt_elementLigneFaisceau : "<< nomdElements::getLabelFromType(eType) << endl; 58 59 59 60 // set layout … … 113 114 case nomdElements::fit : 114 115 GWt_abstractElement_ = new GWt_fit(this); 116 break; 117 case nomdElements::mpole : 118 GWt_abstractElement_ = new GWt_mpole(this); 115 119 break; 116 120 case nomdElements::snapshot : -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc
r428 r431 15 15 } 16 16 17 void GWt_globalParameters::setText(W ContainerWidget* wt)17 void GWt_globalParameters::setText(WText *st) 18 18 { 19 status_ = new WText("Go ahead...",wt);19 status_ = st; 20 20 } 21 21 … … 105 105 void GWt_globalParameters::setStatus() 106 106 { 107 WString out= WString("<p>frequency ="+envoi_[1]+"</p>"108 "<p>step in phase ="+envoi_[2]+"</p>"109 "<p>max step number ="+envoi_[3]+"</p>"110 "<p>periodicity of s.c. computation ="+envoi_[4]+"</p>");107 WString out= WString("<p>frequency = "+envoi_[1]+"</p>" 108 "<p>step in phase = "+envoi_[2]+"</p>" 109 "<p>max step number = "+envoi_[3]+"</p>" 110 "<p>periodicity of s.c. computation = "+envoi_[4]+"</p>"); 111 111 status_->setText(out); 112 112 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r418 r431 59 59 60 60 GWt_abstractElement* GWtAbstractElem = NULL; 61 cout << " Entree addElement element" << nomdElements::getLabelFromType(eType) << endl;61 cout << " addElement::element : " << nomdElements::getLabelFromType(eType) << endl; 62 62 63 63 // 3 cases : … … 288 288 289 289 290 void GWt_LigneFaisceau::initializeSoftwares() {291 290 void GWt_LigneFaisceau::initializeSoftwares() 291 { 292 292 vector <abstractElement*> elems = getAllAbstractElements(); 293 for (int a=0; a< elems.size(); a++) { 294 // elems[a]->setSoftware(nomDeLogiciel::unknownSoftware); 295 elems[a]->setSoftware( NULL ); 296 } 297 } 298 299 293 cout << "GWt_LigneFaisceau::initializeSoftwares() " << elems.size() << endl; 294 295 for (int a = 0; a < elems.size(); a++) { 296 elems[a]->setSoftware( NULL ); 297 } 298 } 299 300 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r428 r431 1 1 #include <stdio.h> 2 #include <string.h>3 #include <vector>4 2 #include <ctime> 5 3 6 4 #include "GWt_pspaApplication.h" 7 #include "GWt_ligneFaisceau.h"8 #include "GWt_softwarePanel.h"9 #include "GWt_globalParameters.h"10 5 #include "GWt_draggableImage.h" 6 #include "GWt_serverFileSelector.h" 11 7 #include "particleBeam.h" 12 8 #include "bareParticle.h" … … 15 11 #include "nomdElements.h" 16 12 #include "environmentVariables.h" 17 #include "GWt_console.h"18 #include "GWt_serverFileSelector.h"19 13 #include "trivaluedBool.h" 20 14 … … 26 20 #include <Wt/WStackedWidget> 27 21 #include <Wt/WBreak> 28 #include <Wt/WDialog>29 22 #include <Wt/WStandardItemModel> 30 23 #include <Wt/WFileUpload> 31 24 #include <Wt/WPainter> 32 #include <Wt/WPdfImage>33 25 #include <Wt/WScrollArea> 34 #include <Wt/WLineEdit>35 26 #include <Wt/WRadioButton> 36 37 #include <Wt/WPanel>38 27 #include <Wt/WMessageBox> 39 28 … … 73 62 abstractElementFactory_->setFitEnable(true); 74 63 abstractElementFactory_->setSnapshotEnable(true); 75 76 // include the styleSheet 64 abstractElementFactory_->setMPoleEnable(true); 65 66 // include the styleSheetcd 77 67 WContainerWidget *widroot = root(); 78 68 useStyleSheet("htdocs/pspa.css"); … … 144 134 145 135 globalParam_ = new GWt_globalParameters(dtmanage_); 136 sectorParam_ = new GWt_sectorParameters(dtmanage_); 146 137 WWidget* dboard = createDashBoard(); 147 138 dboard->setMinimumSize(300,100); … … 171 162 } 172 163 173 // WWidget* PspaApplication::createGlobalParamWidget()174 // {175 // WContainerWidget* globalParam = new GWt_globalParameters(this);176 // globalParam->setMinimumSize(300,100);177 // return globalParam;178 // }179 180 164 WWidget* PspaApplication::createDashBoard() 181 165 { 182 WContainerWidget *result = new WContainerWidget(); 183 184 WPanel *panel = new WPanel(result); 185 panel->setTitle("dashboard"); 186 187 WContainerWidget *textdiv; 188 textdiv = new WContainerWidget(); 189 textdiv->setStyleClass("text"); 190 globalParam_->setText(textdiv); 191 192 WContainerWidget *cnt = new WContainerWidget(); 166 WContainerWidget *wt= new WContainerWidget(); 167 wt->setStyleClass("text"); 168 WText *st= new WText("Go ahead...",wt); 169 193 170 WContainerWidget *buttons = new WContainerWidget(); 194 171 buttons->setStyleClass("buttons"); 195 196 172 WPushButton *button; 197 button = new WPushButton("globalParameters", 173 button = new WPushButton("globalParameters",buttons); 198 174 button->clicked().connect(this, &PspaApplication::messageBox1); 199 200 button = new WPushButton("fodoCells", buttons); 175 button = new WPushButton("sectorParameters", buttons); 201 176 button->clicked().connect(this, &PspaApplication::messageBox2); 202 177 … … 205 180 styleSheet().addRule("body", "margin: 0px;"); 206 181 182 WContainerWidget *cnt = new WContainerWidget(); 207 183 cnt->addWidget(buttons); 208 cnt->addWidget(textdiv); 184 cnt->addWidget(wt); 185 186 WContainerWidget *result = new WContainerWidget(); 187 WPanel *panel = new WPanel(result); 188 panel->setTitle("dashboard"); 209 189 panel->setCentralWidget(cnt); 190 191 globalParam_->setText(st); 192 sectorParam_->setText(st); 210 193 return result; 211 194 } … … 219 202 void PspaApplication::messageBox2() 220 203 { 204 sectorParam_->execDialog(); 221 205 return; 222 206 } … … 382 366 void PspaApplication::sauver() 383 367 { 384 cout << " on sauve " << endl; 385 console_->addConsoleMessage("sauvegarde"); 386 368 cout << "***********************************" << endl; 369 cout << " on sauve " << endl<<endl; 370 371 console_->addConsoleMessage("sauvegarde \n"); 387 372 dialogSave_ = new WDialog("save"); 388 373 new WText("name of case : ",dialogSave_->contents()); … … 405 390 dialogSave_ = NULL; 406 391 407 globalParam_->updateGlobals();392 //globalParam_->updateGlobals(); 408 393 409 394 // dtmanage_->saveConfiguration(nameOfCase_); … … 416 401 void PspaApplication::restaurer() 417 402 { 403 cout << "***********************************" << endl; 404 cout << " on restaure " << endl<<endl; 405 418 406 GWt_serverFileSelector * fs = new GWt_serverFileSelector("Select a configuration file",workingDir_); 419 407 string fileName = fs->exec(); … … 423 411 } 424 412 425 removePathFromConfigName(nameOfCase_ 413 removePathFromConfigName(nameOfCase_); 426 414 cout << " nom sans path " << nameOfCase_ << endl; 427 415 removeExtensionFromConfigName(nameOfCase_); 428 416 cout << " nom sans extension " << nameOfCase_ << endl; 429 if (nameOfCase_ == "") 430 return; 431 cout << " PspaApplication:: restaure le fichier " << fileName << endl; 417 if (nameOfCase_ == "") return; 418 cout << " PspaApplication::restaure le fichier : " << fileName << endl; 432 419 dialogSave_ = NULL; 433 420 … … 442 429 } 443 430 444 globalParam_->renew(); 431 globalParam_->renew(); 432 sectorParam_->renew(); 445 433 console_->addConsoleMessage(string("restauration terminee \n")); 446 434 } … … 448 436 void PspaApplication::openFileSelector() 449 437 { 450 451 438 WContainerWidget *result = new WContainerWidget(); 452 WVBoxLayout* myLayout = new WVBoxLayout(); 453 439 WVBoxLayout* myLayout = new WVBoxLayout(); 454 440 uploadFileSelectorWidget_ = new WFileUpload(); 455 456 441 uploadFileSelectorWidget_->setFileTextSize(40); 457 458 442 myLayout->addWidget(new WText("Select the configuration file for pspa : ")); 459 443 myLayout->addWidget(uploadFileSelectorWidget_); 460 461 444 result->setLayout (myLayout); 462 445 … … 470 453 uploadFileSelectorWidget_->fileTooLarge().connect(this, &PspaApplication::fileTooLarge); 471 454 472 473 455 GWt_dialog* fileSelectorDialog = new GWt_dialog("Load a file",result,false); 474 475 456 fileSelectorDialog->exec(); 476 457 } … … 485 466 cout << " fichier client sans extension : " << nomDuFichier << endl; 486 467 487 if ( test ) 488 { 489 nameOfCase_ = nomDuFichier; 490 console_->addConsoleMessage(string("restauration...")); 468 if ( test ) { 469 nameOfCase_ = nomDuFichier; 470 console_->addConsoleMessage(string("restauration...")); 491 471 492 493 494 495 472 if ( !dtmanage_->restoreElements(uploadFileSelectorWidget_->spoolFileName()) ) { 473 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true); 474 restoreWarning.exec(); 475 } 496 476 497 GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_); 498 bibi->renew(); 499 500 console_->addConsoleMessage(string("rechargement de config termine")); 501 message->show(); 502 } 477 globalParam_->renew(); 478 sectorParam_->renew(); 479 console_->addConsoleMessage(string("rechargement de la config termine")); 480 message->show(); 481 } 503 482 } 504 483 … … 513 492 message += " bytes\n"; 514 493 515 GWt_dialog* messageBox= new GWt_dialog("Error during upload file" ,message ,GWt_dialog::Error,false,true); 516 494 GWt_dialog* messageBox= new GWt_dialog("Error during upload file" ,message ,GWt_dialog::Error,false,true); 517 495 messageBox->show(); 518 496 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r407 r431 16 16 softwarePanel(sPanel) 17 17 { 18 19 18 Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout(); 19 mainContainerLayout->setContentsMargins(0,0,0,0); 20 20 21 22 23 21 Wt::WContainerWidget* labelAndComboContainer = new Wt::WContainerWidget(); 22 Wt::WVBoxLayout* labelAndComboContainerLayout = new Wt::WVBoxLayout(); 23 labelAndComboContainerLayout->setContentsMargins(0,0,0,0); 24 24 25 Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget(); 26 Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout(); 27 labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0); 28 29 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from : ")); 30 labelAndComboInsideContainerLayout->addWidget(first); 31 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to : ")); 32 labelAndComboInsideContainerLayout->addWidget(last); 33 labelAndComboInsideContainerLayout->addWidget(soft); 25 Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget(); 26 Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout(); 27 labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0); 28 29 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from : ")); 30 labelAndComboInsideContainerLayout->addWidget(first); 31 labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to : ")); 32 labelAndComboInsideContainerLayout->addWidget(last); 33 labelAndComboInsideContainerLayout->addWidget(soft); 34 35 // add buttons 36 labelAndComboInsideContainerLayout->addWidget(buttonPanel); 37 labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout); 38 labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer); 39 labelAndComboContainerLayout->addStretch (10); 40 labelAndComboContainer->setLayout(labelAndComboContainerLayout); 41 42 // add errors and warning layout 43 warningsContainer_ = new Wt::WContainerWidget(); 44 errorsContainer_ = new Wt::WContainerWidget(); 45 46 Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget(); 47 Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout(); 48 49 Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout(); 50 Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout(); 51 52 53 warningsLabel_ = new Wt::WText("",XHTMLText); 54 errorsLabel_ = new Wt::WText("",XHTMLText); 55 hLayoutContainerWarnings->addWidget(warningsLabel_); 56 hLayoutContainerErrors->addWidget(errorsLabel_); 34 57 35 // add buttons 36 labelAndComboInsideContainerLayout->addWidget(buttonPanel); 37 38 labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout); 39 40 labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer); 41 labelAndComboContainerLayout->addStretch (10); 42 43 labelAndComboContainer->setLayout(labelAndComboContainerLayout); 44 45 46 // add errors and warning layout 47 warningsContainer_ = new Wt::WContainerWidget(); 48 errorsContainer_ = new Wt::WContainerWidget(); 49 50 Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget(); 51 Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout(); 52 53 Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout(); 54 Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout(); 55 56 57 warningsLabel_ = new Wt::WText("",XHTMLText); 58 errorsLabel_ = new Wt::WText("",XHTMLText); 59 hLayoutContainerWarnings->addWidget(warningsLabel_); 60 hLayoutContainerErrors->addWidget(errorsLabel_); 61 62 warningsAndErrorsContainer->addWidget(warningsLabel_); 63 warningsAndErrorsContainer->addWidget(errorsLabel_); 64 65 66 // set Layouts 67 warningsContainer_->setLayout(hLayoutContainerWarnings); 68 errorsContainer_->setLayout(hLayoutContainerErrors); 69 70 vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_); 71 vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_); 72 vWarningsAndErrorsLayoutContainer->addStretch (100); 73 74 warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer); 75 76 // add label and Combo containers 77 mainContainerLayout->addWidget(labelAndComboContainer,0,0); 78 // add warnings and errors containers 79 mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0); 80 81 // manage margins 82 vWarningsAndErrorsLayoutContainer->setContentsMargins(20,0,0,0); 83 hLayoutContainerWarnings->setContentsMargins(0,0,0,0); 84 hLayoutContainerErrors->setContentsMargins(0,0,0,0); 85 86 setLayout(mainContainerLayout); 87 warningsContainer_->setStyleClass("warningsContainer"); 88 errorsContainer_->setStyleClass("errorsContainer"); 89 90 // resize combo 91 firstElement->setMinimumSize(80,12); 92 lastElement->setMinimumSize(80,12); 93 software->setMinimumSize(80,12); 94 95 firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 96 lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 97 software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 98 99 manageWarningsAndErrors(); 58 warningsAndErrorsContainer->addWidget(warningsLabel_); 59 warningsAndErrorsContainer->addWidget(errorsLabel_); 60 61 62 // set Layouts 63 warningsContainer_->setLayout(hLayoutContainerWarnings); 64 errorsContainer_->setLayout(hLayoutContainerErrors); 65 66 vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_); 67 vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_); 68 vWarningsAndErrorsLayoutContainer->addStretch (100); 69 70 warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer); 71 72 // add label and Combo containers 73 mainContainerLayout->addWidget(labelAndComboContainer,0,0); 74 // add warnings and errors containers 75 mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0); 76 77 // manage margins 78 vWarningsAndErrorsLayoutContainer->setContentsMargins(20,0,0,0); 79 hLayoutContainerWarnings->setContentsMargins(0,0,0,0); 80 hLayoutContainerErrors->setContentsMargins(0,0,0,0); 81 82 setLayout(mainContainerLayout); 83 warningsContainer_->setStyleClass("warningsContainer"); 84 errorsContainer_->setStyleClass("errorsContainer"); 85 86 // resize combo 87 firstElement->setMinimumSize(80,12); 88 lastElement->setMinimumSize(80,12); 89 software->setMinimumSize(80,12); 90 91 firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 92 lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 93 software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 94 95 manageWarningsAndErrors(); 100 96 } 101 97 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r427 r431 21 21 #include "GWt_pspaApplication.h" 22 22 23 #define BAVARD 0 24 23 25 GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,PspaApplication* pspa) 24 26 : WContainerWidget() … … 49 51 void GWt_softwarePanel::addSectionToExecuteW() 50 52 { 53 #if BAVARD > 0 54 cout << "***********************************" << endl; 55 cout << " GWt_softwarePanel::addSectionToExecuteW() " << endl<<endl; 56 #endif 57 51 58 abstractElement* premierElement; 52 59 abstractElement* dernierElement; … … 55 62 int dernierIndex = 0; 56 63 64 cout << "sections_.size() = " << sections_.size() << endl; 65 57 66 // if there is no section 58 67 if(sections_.size() == 0) { … … 76 85 dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1); 77 86 dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1; 78 // cout << "PspaApplication::addSectionToExecute() : " << premierText << " ââ " << dernierText << endl; 79 80 // abstractSoftware* soft = NULL; 81 // dtmanage_->addSectionToExecute(premierElement,premierIndex, dernierElement, dernierIndex, soft); 82 dtmanage_->addSectionToExecute(premierElement,premierIndex, dernierElement, dernierIndex, nomDeLogiciel()); 87 88 dtmanage_->addSectionToExecute(premierElement,premierIndex,dernierElement,dernierIndex,nomDeLogiciel()); 83 89 84 90 std::string premierElementLabel = ""; … … 87 93 premierElementLabel = premierElement->getLabel(); 88 94 } 89 90 95 if (dernierElement) { 91 96 dernierElementLabel = dernierElement->getLabel(); … … 104 109 fillComboWithSoftwares(softCombo); 105 110 106 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this);111 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this); 107 112 108 113 stringstream st; … … 118 123 } 119 124 125 void GWt_softwarePanel::updateSections() 126 { 127 #if BAVARD > 0 128 cout << "***********************************" << endl; 129 cout << " GWt_softwarePanel::updateSections() " << endl<<endl; 130 #endif 131 132 // update all sections in order to manage new/deleted items 133 for (int a = 0; a < sections_.size(); a++) { 134 fillComboWithElements(sections_[a]->getFirstElement()); 135 fillComboWithElements(sections_[a]->getLastElement()); 136 sections_[a]->getFirstElement()->setEnabled (true); 137 sections_[a]->getLastElement()->setEnabled (true); 138 } 139 140 if (sections_.size() == 0) { 141 return; 142 } 143 144 // the first element will always be the first element of the beamLine 145 sections_[0]->getFirstElement()->setCurrentIndex(0); 146 sections_[0]->getFirstElement()->setEnabled (false); 147 148 // the last element will always be the last element of the beamLine 149 sections_[sections_.size()-1]->getLastElement()->setCurrentIndex(sections_[sections_.size()-1]->getLastElement()->count()); 150 sections_[sections_.size()-1]->getLastElement()->setEnabled(false); 151 152 // set default values 153 updateSectionSelection(); 154 } 155 120 156 bool GWt_softwarePanel::updateSectionSelection() 121 157 { 158 #if BAVARD > 0 159 cout << "***********************************" << endl; 160 cout << " GWt_softwarePanel::updateSectionSelection() " << endl<<endl; 161 #endif 162 122 163 if ( dtmanage_->getJobListSize() == 0 ) return false; 123 164 … … 134 175 // si la fin est mal definie on prend toute la config par defaut 135 176 if ( current <= 0 || current > dtmanage_->getBeamLineSize() ) 136 { 137 current = dtmanage_->getBeamLineSize(); 138 currentString = dtmanage_->getLabelFromElementNumero(current); 139 if (sections_.size() > 0) { 140 sections_[0]->setLastElementCurrentSelection(currentString); 141 //... 177 { 178 current = dtmanage_->getBeamLineSize(); 179 currentString = dtmanage_->getLabelFromElementNumero(current); 180 if (sections_.size() > 0) { 181 sections_[0]->setLastElementCurrentSelection(currentString); 182 //... 183 } 142 184 } 143 }144 185 current++; 145 186 currentString = dtmanage_->getLabelFromElementNumero(current); … … 184 225 185 226 if (!areDataCoherent()) { 227 #if BAVARD > 0 228 cout << " GWt_softwarePanel::addSectionToExecuteW() DISABLE" << endl; 229 #endif 186 230 exec_go_->disable(); 187 231 } else { 232 #if BAVARD > 0 233 cout << " GWt_softwarePanel::addSectionToExecuteW() ENABLE" << endl; 234 #endif 188 235 exec_go_->enable(); 189 236 } … … 192 239 } 193 240 194 195 241 bool GWt_softwarePanel::areDataCoherent() 196 242 { 243 #if BAVARD > 0 244 cout << "***********************************" << endl; 245 cout << " GWt_softwarePanel::areDataCoherent() " << endl<<endl; 246 #endif 247 197 248 bool caMarche = true; 198 249 … … 204 255 pspa_->getBeamLine()->initializeSoftwares(); 205 256 } 206 257 207 258 string diagnosticErrors; 208 259 string diagnosticWarnings; 209 210 for (int a = 0; a< sections_.size(); a++) 260 for (int a = 0; a < sections_.size(); a++) 211 261 { 212 string debString = sections_[a]->getFirstElementCurrentText().toUTF8(); 213 string finString = sections_[a]->getLastElementCurrentText().toUTF8(); 214 215 // int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1 216 // int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1 217 262 string debString= sections_[a]->getFirstElementCurrentText().toUTF8(); 263 string finString= sections_[a]->getLastElementCurrentText().toUTF8(); 218 264 int debut = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(debString); 219 265 int fin = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(finString); 220 221 nomDeLogiciel prog = nomDeLogiciel ( sections_[a]->getSoftwareCurrentText().toUTF8()); 222 // abstractSoftware* softToExec = dtmanage_->createSoftwareConnexion(prog); 223 sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut), 224 debut, 225 pspa_->getBeamLine()->getAbstractElement(fin), 226 fin, 227 prog); 266 267 string currentSoft= sections_[a]->getSoftwareCurrentText().toUTF8(); 268 nomDeLogiciel prog = nomDeLogiciel(currentSoft); 269 sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut),debut,pspa_->getBeamLine()->getAbstractElement(fin),fin,prog); 228 270 229 271 abstractSoftware* softToExec = sectToExec->getSoftware(); 230 272 diagnosticErrors = ""; 231 273 diagnosticWarnings = ""; 232 233 // check sections 234 for (int i=debut-1; i<fin; i++) { 235 if (pspa_->getBeamLine()) { 236 if (pspa_->getBeamLine()->getAbstractElement(i)) { 237 // trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString()); 238 239 240 trivaluedBool tb = softToExec->doAcceptElement(pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementType() ); 241 242 if (tb == TBoolOk ) { 243 pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(softToExec); 274 for(int i = debut-1; i < fin; i++) // check sections 275 { 276 if (!pspa_->getBeamLine()) continue; 277 abstractElement* elPtr= pspa_->getBeamLine()->getAbstractElement(i); 278 if (!elPtr) continue; 279 280 trivaluedBool tb = softToExec->doAcceptElement(elPtr->getNomdElement().getElementType()); 281 if (tb == TBoolOk ) { 282 elPtr->setSoftware(softToExec); 283 } else { 284 elPtr->setSoftware(NULL); 285 if (tb == TBoolIgnore) { 286 if(prog.getString() != "unknownSoftware") diagnosticWarnings += elPtr->getLabel() + " will be ignored by "+ prog.getString() + "<br /> "; 244 287 } else { 245 pspa_->getBeamLine()->getAbstractElement(i)->setSoftware( NULL ); 246 247 if ( tb == TBoolIgnore ) { 248 diagnosticWarnings += pspa_->getBeamLine()->getAbstractElement(i)->getLabel() + " will be ignored by "+ prog.getString()+"<br /> "; 249 } else { 250 // j'insiste pour remettre le nom generique de l'element refuse (glm / 30/03/2013) 251 diagnosticErrors += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getExpandedName() + " is not allowed with "+ prog.getString()+"<br /> "; 252 caMarche = false; 253 } 288 // j'insiste pour remettre le nom generique de l'element refuse (glm / 30/03/2013) 289 diagnosticErrors += elPtr->getNomdElement().getExpandedName() + " is not allowed with " + prog.getString() + "<br /> "; 290 caMarche = false; 254 291 } 255 pspa_->getBeamLine()->update(i);256 292 } 257 } 258 } 293 pspa_->getBeamLine()->update(i); 294 } //i 295 259 296 // set errors and warnings 260 297 sections_[a]->setErrors(diagnosticErrors); 261 298 sections_[a]->setWarnings(diagnosticWarnings); 262 } 299 }//a 263 300 264 301 return caMarche; … … 286 323 } 287 324 288 289 void GWt_softwarePanel::updateSections()290 {291 // update all sections in order to manage new/deleted items292 for (int a = 0; a< sections_.size(); a++) {293 fillComboWithElements(sections_[a]->getFirstElement());294 fillComboWithElements(sections_[a]->getLastElement());295 296 sections_[a]->getFirstElement()->setEnabled (true);297 sections_[a]->getLastElement()->setEnabled (true);298 }299 if (sections_.size() == 0) {300 return;301 }302 // the first element will always be the first element of the beamLine303 sections_[0]->getFirstElement()->setCurrentIndex(0);304 sections_[0]->getFirstElement()->setEnabled (false);305 306 // the last element will always be the last element of the beamLine307 sections_[sections_.size()-1]->getLastElement()->setCurrentIndex(sections_[sections_.size()-1]->getLastElement()->count());308 sections_[sections_.size()-1]->getLastElement()->setEnabled (false);309 310 // set default values311 312 // update313 updateSectionSelection();314 }315 316 325 void GWt_softwarePanel::executer() 317 326 { 318 327 cout << "***********************************" << endl; 328 cout << " GWt_softwarePanel::executer() " << endl<<endl; 329 319 330 if (!areDataCoherent()) { 320 331 return; 321 332 } 322 333 323 static_cast<GWt_globalParameters*>(pspa_->getGlobalParam())->updateGlobals();334 //static_cast<GWt_globalParameters*>(pspa_->getGlobalParam())->updateGlobals(); 324 335 325 336 GWt_dialog calculDialog("Calcul en cours", "Veuillez patienter...", GWt_dialog::Wait, true,false); … … 329 340 330 341 if (!dtmanage_->executeAll()) { 331 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exà cution !", GWt_dialog::Error, true,true);342 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exécution !", GWt_dialog::Error, true,true); 332 343 warningDialog.exec(); 333 344 } … … 338 349 } 339 350 340 341 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox){351 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) 352 { 342 353 if (cBox == NULL) return; 343 354 344 355 // get the last item selected 345 WString selectedString = cBox->currentText 356 WString selectedString = cBox->currentText(); 346 357 cBox->clear(); 347 358 348 for (int a=0; a< pspa_->getBeamLine()->getBeamLineSize(); a++) {359 for(int a = 0; a < pspa_->getBeamLine()->getBeamLineSize(); a++) { 349 360 abstractElement* abs = pspa_->getBeamLine()->getAbstractElement(a); 350 if (abs != NULL) {361 if (abs != NULL) { 351 362 cBox->addItem(abs->getLabel()); 352 363 } 353 364 } 354 365 355 for (int a=0; a<cBox->count(); a++) {366 for(int a = 0; a < cBox->count(); a++) { 356 367 if (cBox->itemText (a) == selectedString) { 357 368 cBox->setCurrentIndex(a); … … 361 372 } 362 373 363 364 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox) { 374 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox) 375 { 376 #if BAVARD > 0 377 cout << "***********************************" << endl; 378 cout << " GWt_softwarePanel::fillComboWithSoftwares " << endl<<endl; 379 #endif 380 365 381 if (cBox == NULL) return; 366 382 cBox->clear(); … … 368 384 unsigned nb = nomDeLogiciel::getNumberOfSoftwares(); 369 385 unsigned k; 370 for(k = 0; k < nb; k++) {386 for(k = 0; k <= nb; k++) { //xx 371 387 cBox->addItem(nomDeLogiciel(k).getString()); 372 388 } 389 cBox->setCurrentIndex(nb); // xx 373 390 cBox->refresh(); 374 391 } 375 392 376 377 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) { 378 393 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) 394 { 379 395 WContainerWidget* buttonContainer= new WContainerWidget(); 380 396 … … 399 415 buttonContainerLayout->addWidget(exec_add); 400 416 buttonContainerLayout->addWidget(exec_delete); 401 402 417 buttonContainer->setLayout(buttonContainerLayout); 403 418
Note: See TracChangeset
for help on using the changeset viewer.