source: PSPA/Interface_Web/trunk/pspaWT/src/GWt_globalParameters.cc @ 242

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

Renommage de GWt_tools en GWt_console

File size: 4.7 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    decorationStyle().setBackgroundColor (WColor("blue"));
21    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
22    WContainerWidget *result = new WContainerWidget();
23    WPanel *panel = new WPanel(result);
24    panel->setTitle(" global parameters ");
25
26
27    WText* freqText = new WText("frequency (MHz) : ");
28    frequencyEdit_ = new WLineEdit();
29
30    WText *stepText = new WText("step in phase (deg.) : ");
31    stepEdit_ = new WLineEdit();
32
33    WText *nstepMaxText = new WText("max step number : ");
34    nstepMAxEdit_ = new WLineEdit();
35
36    WText *nscText = new WText("periodicity of s.c. computation : ");
37    nscEdit_ = new WLineEdit();
38
39
40
41    WContainerWidget* contenu = new WContainerWidget();
42    contenu->addWidget(freqText);
43    contenu->addWidget(frequencyEdit_);
44    contenu->addWidget(new WBreak());
45    contenu->addWidget(stepText);
46    contenu->addWidget(stepEdit_);
47    contenu->addWidget(new WBreak());
48    contenu->addWidget(nstepMaxText);
49    contenu->addWidget(nstepMAxEdit_);
50    contenu->addWidget(new WBreak());
51    contenu->addWidget(nscText);
52    contenu->addWidget(nscEdit_);
53
54
55
56    panel->setCentralWidget(contenu);
57    // panel->setCollapsible(true);
58
59
60    //  WPanel *panelModules = new WPanel(result);
61    // panelModules->setTitle(" sections of beam Line for executing softwres ");
62
63
64    // WPushButton* push_add = new WPushButton("add");
65
66
67    // contenuSections_ = new WContainerWidget();
68
69    // addSection();
70    // contenuSections_->addWidget( push_add);
71
72
73    // panelModules->setCentralWidget(contenuSections_);
74
75
76    globLayout->addWidget(result);
77
78    setLayout(globLayout);
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.