source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc @ 496

Last change on this file since 496 was 455, checked in by garnier, 11 years ago

grosse modification pour intégrer les sections

File size: 2.1 KB
RevLine 
[343]1
[437]2#include "GWt_elementSnapshot.h"
[343]3#include "mixedTools.h"
4
[374]5#include <Wt/WText>
[343]6#include <Wt/WBreak>
7#include <Wt/WLineEdit>
8#include <Wt/WDialog>
9#include <Wt/WPushButton>
10
[455]11GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract, int num) :
12GWt_abstractElement(abstract)
[343]13{
14  elementLigneFaiseauContainer_ = elemLigne;
15  initialize();
16}
17
[437]18void GWt_elementSnapshot::initilializeDialog() 
[343]19{
20  string* param = beginDialog();
[374]21
[442]22  new WText("name of user's program : ",dialog_->contents());
23  programFile_ = new WLineEdit(param->c_str(),dialog_->contents());
[343]24  new WBreak(dialog_->contents());
25
[442]26
27  new WText("name of input beam file, output from pspa : ",dialog_->contents());
28  inputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents());
29  new WBreak(dialog_->contents());
30
31  new WText("name of output beam file (input for pspa) : ",dialog_->contents());
32  outputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents());
33  new WBreak(dialog_->contents());
34
[343]35  WPushButton *annule= new WPushButton("cancel",dialog_->contents()); 
36  annule->clicked().connect(dialog_,&Wt::WDialog::reject);
37  WPushButton *submit= new WPushButton("OK",dialog_->contents());
38  submit->clicked().connect(dialog_,&Wt::WDialog::accept);
[437]39  dialog_->finished().connect(this, &GWt_elementSnapshot::dialogDone);
[343]40}
41
[437]42void GWt_elementSnapshot::dialogDone(WDialog::DialogCode code)
[343]43{
44  if (code != Wt::WDialog::Accepted) return;
45 
46  unsigned nbParam = abstractElement_->getNbParams();
47  string* envoi = new string[nbParam+1];
48  int compteur = -1;
49 
50  envoi[++compteur] = mixedTools::intToString(nbParam);
51  envoi[++compteur] = labelEdit_->text().toUTF8();
[442]52  envoi[++compteur] = programFile_->text().toUTF8();
53  envoi[++compteur] = inputBeamFile_->text().toUTF8();
54  envoi[++compteur] = outputBeamFile_->text().toUTF8();
55
56
[343]57  if ( compteur !=  (int)nbParam ) {
[437]58    cerr << " GWt_elementSnapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
[343]59    return;
60  }
61
62  abstractElement_->setParametersString(envoi);
63  delete [] envoi;
64}
Note: See TracBrowser for help on using the repository browser.