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

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

refactoring

File size: 2.5 KB
Line 
1
2#include "GWt_bend.h"
3#include "mixedTools.h"
4
5#include <Wt/WText>
6#include <Wt/WLineEdit>
7#include <Wt/WBreak>
8#include <Wt/WDialog>
9#include <Wt/WPushButton>
10
11GWt_bend::GWt_bend(abstractElement* elem) : GWt_abstractElement(elem)
12{
13
14  string* param = beginDialog();
15
16  new WText("angle (deg.) : ",dialog_->contents());
17  angleEdit_ = new WLineEdit( param->c_str(), dialog_->contents());
18  new WBreak(dialog_->contents());
19
20  new WText("radius (m) : ",dialog_->contents());
21  radiusEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
22  new WBreak(dialog_->contents());
23
24  new WText("momentum (MeV/c) : ",dialog_->contents());
25  momentumEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
26  new WBreak(dialog_->contents());
27
28  new WText("length (cm) : ",dialog_->contents());
29  xlengthEdit_ = new WLineEdit("0", dialog_->contents());
30  xlengthEdit_->setDisabled(true);
31  new WBreak(dialog_->contents());
32
33  new WText("aperture (cm) : ",dialog_->contents());
34  apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
35  apertureEdit_->setDisabled(true);
36  new WBreak(dialog_->contents());
37
38  new WText("pole face rotations (deg.) entrance : ",dialog_->contents());
39  beta1Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
40  new WText("exit : ",dialog_->contents());
41  beta2Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
42  new WBreak(dialog_->contents());
43
44  WPushButton *submit = new WPushButton("OK",dialog_->contents());
45  submit->clicked().connect(dialog_, &Wt::WDialog::accept);
46  dialog_->finished().connect(this, &GWt_bend::dialogDone);
47}
48
49void GWt_bend::dialogDone()
50{
51  unsigned nbParam = element_->getNbParams();
52  string* envoi = new string[nbParam+1];
53  int compteur = -1;
54  envoi[++compteur] = string(mixedTools::intToString(nbParam) );
55  envoi[++compteur] = labelEdit_->text().toUTF8();
56  cout << " GWt_bend::dialogDone() j'envoie " << envoi[compteur] << endl;
57  envoi[++compteur] = angleEdit_->text().toUTF8();
58  envoi[++compteur] = radiusEdit_->text().toUTF8();
59  envoi[++compteur] = momentumEdit_->text().toUTF8();
60  envoi[++compteur] = apertureEdit_->text().toUTF8();
61  envoi[++compteur] = beta1Edit_->text().toUTF8();
62  envoi[++compteur] = beta2Edit_->text().toUTF8();
63 
64  if ( compteur !=  (int)nbParam ) {
65    cerr << " GWt_bend::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
66    return;
67  }
68  element_->setParametersString(envoi);
69  updateLabelWidget();
70  delete [] envoi;
71}
Note: See TracBrowser for help on using the repository browser.