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

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

Renommage de toutes les classes d’élément dans le GWt_ par GWt_elementXXX

File size: 1.6 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, int num) : GWt_abstractElement(new elementSnapshot(num))
12{
13  elementLigneFaiseauContainer_ = elemLigne;
14  initialize();
15}
16
17void GWt_elementSnapshot::initilializeDialog() 
18{
19  string* param = beginDialog();
20
21  new WText("name of file for snapshot : ",dialog_->contents());
22  snapshotFile_ = new WLineEdit(param->c_str(),dialog_->contents());
23  new WBreak(dialog_->contents());
24
25  WPushButton *annule= new WPushButton("cancel",dialog_->contents()); 
26  annule->clicked().connect(dialog_,&Wt::WDialog::reject);
27  WPushButton *submit= new WPushButton("OK",dialog_->contents());
28  submit->clicked().connect(dialog_,&Wt::WDialog::accept);
29  dialog_->finished().connect(this, &GWt_elementSnapshot::dialogDone);
30}
31
32void GWt_elementSnapshot::dialogDone(WDialog::DialogCode code)
33{
34  if (code != Wt::WDialog::Accepted) return;
35 
36  unsigned nbParam = abstractElement_->getNbParams();
37  string* envoi = new string[nbParam+1];
38  int compteur = -1;
39 
40  envoi[++compteur] = mixedTools::intToString(nbParam);
41  envoi[++compteur] = labelEdit_->text().toUTF8();
42  envoi[++compteur] = snapshotFile_->text().toUTF8();
43  if ( compteur !=  (int)nbParam ) {
44    cerr << " GWt_elementSnapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
45    return;
46  }
47
48  abstractElement_->setParametersString(envoi);
49  delete [] envoi;
50}
Note: See TracBrowser for help on using the repository browser.