source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_soleno.cc @ 257

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

refactoring

File size: 1.8 KB
Line 
1#include "GWt_soleno.h"
2#include "mixedTools.h"
3
4#include <Wt/WText>
5#include <Wt/WLineEdit>
6#include <Wt/WBreak>
7#include <Wt/WDialog>
8#include <Wt/WPushButton>
9
10GWt_soleno::GWt_soleno(abstractElement* elem) : GWt_abstractElement(elem)
11{
12  string* param = beginDialog();
13
14  new WText("length (cm) : ",dialog_->contents());
15  xlengthEdit_ = new WLineEdit( param->c_str(), dialog_->contents());
16  new WBreak(dialog_->contents());
17  new WText("aperture (cm) : ",dialog_->contents());
18  apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
19  new WBreak(dialog_->contents());
20  new WText("field (kG) : ",dialog_->contents());
21  B0Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
22  varyB0Edit_ = new WCheckBox(" : may vary ? ", dialog_->contents());
23  varyB0Edit_->setChecked(atoi( (++param)->c_str() ) );
24  new WBreak(dialog_->contents());
25  // Submit
26  WPushButton *submit = new WPushButton("OK",dialog_->contents());
27  submit->clicked().connect(dialog_, &Wt::WDialog::accept);
28  dialog_->finished().connect(this, &GWt_soleno::dialogDone);
29}
30
31
32void GWt_soleno::dialogDone()
33{
34  unsigned nbParam = element_->getNbParams();
35  string* envoi = new string[nbParam+1];
36  int compteur = -1;
37  envoi[++compteur] = mixedTools::intToString(nbParam);
38  envoi[++compteur] = labelEdit_->text().toUTF8();
39  envoi[++compteur] = xlengthEdit_->text().toUTF8();
40  envoi[++compteur] = apertureEdit_->text().toUTF8();
41  envoi[++compteur] = B0Edit_->text().toUTF8();
42  int varie;
43  if ( varyB0Edit_->checkState() == Checked ) varie = 1;
44  else varie = 0;
45  envoi[++compteur] = mixedTools::intToString(varie);
46  if ( compteur !=  (int)nbParam ) {
47    cerr << " GWt_bend::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
48    return;
49  }
50  element_->setParametersString(envoi);
51  updateLabelWidget();
52  delete [] envoi;
53}
Note: See TracBrowser for help on using the repository browser.