source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc @ 408

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

Alignement des composants

File size: 4.8 KB
Line 
1#include "GWt_globalParameters.h"
2#include <Wt/WVBoxLayout>
3#include <Wt/WGroupBox>
4#include <Wt/WText>
5#include <Wt/WLineEdit>
6#include <Wt/WBreak>
7#include <Wt/WPushButton>
8
9#include <Wt/WComboBox>
10
11#include "mixedTools.h"
12#include "GWt_console.h"
13
14
15GWt_globalParameters::GWt_globalParameters(PspaApplication* ps)
16{
17   
18    pspa_ = ps;
19    WVBoxLayout* globLayout = new WVBoxLayout();
20    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
21    WContainerWidget *result = new WContainerWidget();
22    WPanel *panel = new WPanel(result);
23    panel->setTitle(" global parameters ");
24   
25   
26    WText* freqText = new WText("frequency (MHz) : ");
27    frequencyEdit_ = new WLineEdit();
28   
29    WText *stepText = new WText("step in phase (deg.) : ");
30    stepEdit_ = new WLineEdit();
31   
32    WText *nstepMaxText = new WText("max step number : ");
33    nstepMAxEdit_ = new WLineEdit();
34   
35    WText *nscText = new WText("periodicity of s.c. computation : ");
36    nscEdit_ = new WLineEdit();
37   
38   
39   
40    WContainerWidget* contenu = new WContainerWidget();
41    contenu->addWidget(freqText);
42    contenu->addWidget(frequencyEdit_);
43    contenu->addWidget(new WBreak());
44    contenu->addWidget(stepText);
45    contenu->addWidget(stepEdit_);
46    contenu->addWidget(new WBreak());
47    contenu->addWidget(nstepMaxText);
48    contenu->addWidget(nstepMAxEdit_);
49    contenu->addWidget(new WBreak());
50    contenu->addWidget(nscText);
51    contenu->addWidget(nscEdit_);
52   
53   
54   
55    panel->setCentralWidget(contenu);
56    // panel->setCollapsible(true);
57   
58   
59    //  WPanel *panelModules = new WPanel(result);
60    // panelModules->setTitle(" sections of beam Line for executing softwres ");
61   
62   
63    // WPushButton* push_add = new WPushButton("add");
64   
65   
66    // contenuSections_ = new WContainerWidget();
67   
68    // addSection();
69    // contenuSections_->addWidget( push_add);
70   
71   
72    // panelModules->setCentralWidget(contenuSections_);
73   
74   
75    globLayout->addWidget(result);
76   
77    setLayout(globLayout);
78    globLayout->setContentsMargins(0,0,0,0);
79    renew();
80}
81
82// void GWt_globalParameters::addSection()
83// {
84//   unsigned k;
85//   //   WComboBox* selectionBox = new WComboBox();
86
87//     sectionSelection_.push_back(new WComboBox());
88
89//     contenuSections_->addWidget(new WBreak());
90
91//     contenuSections_->addWidget(new WText(" from : "));
92//     contenuSections_->addWidget(new WLineEdit());
93//     contenuSections_->addWidget(new WText(" to : "));
94//     contenuSections_->addWidget(new WLineEdit());
95
96
97//     contenuSections_->addWidget(sectionSelection_.back());
98
99//     unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
100//     for ( k=0; k < nb; k++) sectionSelection_.back()->addItem( nomDeLogiciel(k).getString() );
101//     //    selectionBox->addItem("Transport");
102// }
103
104
105void GWt_globalParameters::renew()
106{
107    string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
108    if ( param == NULL )
109    {
110        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
111            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
112            console->addConsoleMessage(" GWt_globalParameters : empty parameter set");
113        }
114    }
115    int nbparam = atoi(param[0].c_str());
116    if ( nbparam != 4 )
117    {
118        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
119            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
120            console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
121        }
122    }
123    frequencyEdit_->setText(param[1].c_str());
124    stepEdit_->setText(param[2].c_str());
125    nstepMAxEdit_->setText(param[3].c_str());
126    nscEdit_->setText(param[4].c_str());
127}
128
129void GWt_globalParameters::updateGlobals()
130{
131    string envoi[5];
132    envoi[0] = string("4");
133    envoi[1] = frequencyEdit_->text().toUTF8();
134    envoi[2] = stepEdit_->text().toUTF8();
135    envoi[3] = nstepMAxEdit_->text().toUTF8();
136    envoi[4] = nscEdit_->text().toUTF8();
137    pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi);
138}
139
140// void GWt_globalParameters::getExecute(unsigned index, unsigned& first, unsigned& last, int& programm)
141// {
142//   string debut;
143//   string fin;
144//   if ( index == 1)
145//     {
146//       debut = origineEdit1_->text().toUTF8();
147//       fin = extremiteEdit1_->text().toUTF8();
148//       programm = selectionBox1_->currentIndex();
149//       cout << " current index " << programm << endl;
150//     }
151//   else
152//     {
153//       debut = origineEdit2_->text().toUTF8();
154//       fin = extremiteEdit2_->text().toUTF8();
155//     }
156//   first = atoi ( debut.c_str() );
157//   last = atoi ( fin.c_str() );
158//   programm++;
159
160// }
161
162// void GWt_globalParameters::addElem()
163// {
164//     int dernier = pspa_->getDataManager()->beamLineSize();
165//     extremiteEdit1_->setText( mixedTools::intToString(dernier) );
166// }
167
168
Note: See TracBrowser for help on using the repository browser.