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

Last change on this file since 310 was 310, checked in by garnier, 12 years ago

Bug #28 fixed

File size: 2.1 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(GWt_elementLigneFaisceau* elemLigne)
11:GWt_abstractElement(new elementSoleno())
12{
13    elementLigneFaiseauContainer_ = elemLigne;
14    initialize();
15}
16
17
18void GWt_soleno::initilializeDialog() {
19
20    string* param = beginDialog();
21   
22    new WText("length (cm) : ",dialog_->contents());
23    xlengthEdit_ = new WLineEdit( param->c_str(), dialog_->contents());
24    new WBreak(dialog_->contents());
25    new WText("aperture (cm) : ",dialog_->contents());
26    apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
27    new WBreak(dialog_->contents());
28    new WText("field (kG) : ",dialog_->contents());
29    B0Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
30    varyB0Edit_ = new WCheckBox(" : may vary ? ", dialog_->contents());
31    varyB0Edit_->setChecked(atoi( (++param)->c_str() ) );
32    new WBreak(dialog_->contents());
33    // Submit
34    WPushButton *submit = new WPushButton("OK",dialog_->contents());
35    submit->clicked().connect(dialog_, &Wt::WDialog::accept);
36    dialog_->finished().connect(this, &GWt_soleno::dialogDone);
37
38}
39
40
41
42void GWt_soleno::dialogDone()
43{
44    unsigned nbParam = abstractElement_->getNbParams();
45    string* envoi = new string[nbParam+1];
46    int compteur = -1;
47    envoi[++compteur] = mixedTools::intToString(nbParam);
48    envoi[++compteur] = labelEdit_->text().toUTF8();
49    envoi[++compteur] = xlengthEdit_->text().toUTF8();
50    envoi[++compteur] = apertureEdit_->text().toUTF8();
51    envoi[++compteur] = B0Edit_->text().toUTF8();
52    int varie;
53    if ( varyB0Edit_->checkState() == Checked ) varie = 1;
54    else varie = 0;
55    envoi[++compteur] = mixedTools::intToString(varie);
56    if ( compteur !=  (int)nbParam ) {
57        cerr << " GWt_bend::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
58        return;
59    }
60    abstractElement_->setParametersString(envoi);
61    delete [] envoi;
62}
63
64
65WImage* GWt_soleno::getImage() {
66    return image_;
67}
Note: See TracBrowser for help on using the repository browser.