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
Line 
1
2#include "GWt_elementSnapshot.h"
3#include "mixedTools.h"
4
5#include <Wt/WText>
6#include <Wt/WBreak>
7#include <Wt/WLineEdit>
8#include <Wt/WDialog>
9#include <Wt/WPushButton>
10
11GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract, int num) :
12GWt_abstractElement(abstract)
13{
14  elementLigneFaiseauContainer_ = elemLigne;
15  initialize();
16}
17
18void GWt_elementSnapshot::initilializeDialog() 
19{
20  string* param = beginDialog();
21
22  new WText("name of user's program : ",dialog_->contents());
23  programFile_ = new WLineEdit(param->c_str(),dialog_->contents());
24  new WBreak(dialog_->contents());
25
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
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);
39  dialog_->finished().connect(this, &GWt_elementSnapshot::dialogDone);
40}
41
42void GWt_elementSnapshot::dialogDone(WDialog::DialogCode code)
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();
52  envoi[++compteur] = programFile_->text().toUTF8();
53  envoi[++compteur] = inputBeamFile_->text().toUTF8();
54  envoi[++compteur] = outputBeamFile_->text().toUTF8();
55
56
57  if ( compteur !=  (int)nbParam ) {
58    cerr << " GWt_elementSnapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
59    return;
60  }
61
62  abstractElement_->setParametersString(envoi);
63  delete [] envoi;
64}
Note: See TracBrowser for help on using the repository browser.