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

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

LigneFaisceau: Correction d un bug qui ne remplissqit pas les parametres des elements

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