source: PSPA/Interface_Web/branches/insertionsElements/src/GWt_soleno.cc @ 432

Last change on this file since 432 was 153, checked in by lemeur, 12 years ago

normalisation de l'usage de nomdElements

File size: 1.5 KB
Line 
1#include "GWt_soleno.h"
2
3#include <Wt/WText>
4#include <Wt/WLineEdit>
5#include <Wt/WBreak>
6#include <Wt/WDialog>
7#include <Wt/WPushButton>
8
9GWt_soleno::GWt_soleno(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem)
10{
11  string* param = element_-> getParametersString();
12  if ( param == NULL )
13    {
14      pspa_->addConsoleMessage(" GWt_soleno : empty parameter set");
15    }
16  int nbparam = atoi(param[0].c_str());
17  if ( nbparam != 3 ) 
18    {
19      pspa_->addConsoleMessage(" element seems not to be a SOLENOID");
20    }
21
22  dialog_ = new WDialog("element SOLENOID");
23
24  new WText("length (cm) : ",dialog_->contents());
25  xlengthEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents());
26  new WBreak(dialog_->contents());
27  new WText("aperture (cm) : ",dialog_->contents());
28  apertureEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents());
29  new WBreak(dialog_->contents());
30  new WText("fielg (kG) : ",dialog_->contents());
31  B0Edit_ = new WLineEdit(param[3].c_str(), dialog_->contents());
32  new WBreak(dialog_->contents());
33
34  // Submit
35  WPushButton *submit = new WPushButton("OK",dialog_->contents());
36  submit->clicked().connect(dialog_, &Wt::WDialog::accept);
37  dialog_->finished().connect(this, &GWt_soleno::dialogDone);
38}
39
40void GWt_soleno::dialogDone()
41{
42  string envoi[4];
43  envoi[0] = string("3");
44  envoi[1] = xlengthEdit_->text().toUTF8();
45  envoi[2] = apertureEdit_->text().toUTF8();
46  envoi[3] = B0Edit_->text().toUTF8();
47
48  element_->setParametersString(envoi);
49}
Note: See TracBrowser for help on using the repository browser.