source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc @ 481

Last change on this file since 481 was 481, checked in by garnier, 10 years ago

Suppression de methodes deprecated et de quelques warning de compilation

File size: 3.7 KB
Line 
1#include "GWt_sector.h"
2#include "GWt_ligneFaisceau.h"
3
4#include <Wt/WPushButton>
5#include <Wt/WLabel>
6#include <Wt/WPanel>
7#include <Wt/WColor>
8#include <Wt/WVBoxLayout>
9#include <Wt/WHBoxLayout>
10#include <Wt/WComboBox>
11
12GWt_sector::GWt_sector(GWt_accelerator* parent,sector* sect) :
13UI_Accelerator_(parent),
14sectorControler_(sect)
15{
16  setIcon(UI_Accelerator_->getAcceleratorGlobalViewLayout());
17  displayWidgetBeamLine();
18}
19
20GWt_sector::~GWt_sector()
21{
22}
23
24void GWt_sector::setIcon(WLayout* parentLineLayout) {
25  WContainerWidget* sectorContainer = new WContainerWidget();
26
27  if (parentLineLayout->count() > 0) {
28    WContainerWidget* link = new WContainerWidget();
29    new WLabel("",link);
30    link->setStyleClass("elementLigneFaiseau_line");
31    parentLineLayout->addWidget(link);
32  }
33
34  sectorContainer->setStyleClass("beamLineIcon");
35  parentLineLayout->addWidget(sectorContainer);
36 
37  WLabel* icon = new WLabel(sectorControler_->getName(),sectorContainer);
38  icon->setStyleClass("sectionIcon");
39  icon->setHeight(100);
40  icon->setToolTip("clic to view details");
41
42  new WBreak(sectorContainer);
43
44  std::stringstream str;
45  str << sectorControler_->getRepetitionNumber();
46  std::string result;
47  str >> result;
48
49  // Add repetition times
50  WText* t = new WText(" x"+result+" ",sectorContainer);
51  if (sectorControler_->getRepetitionNumber() > 1) {
52    t->setToolTip("executed "+result+" times");
53  } else {
54    t->setToolTip("executed "+result+" time");
55  }
56  new WBreak(sectorContainer);
57
58  // Add refected
59  if (sectorControler_->getReflected()) {
60    new WText(" reflected from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
61  } else if (sectorControler_->getDuplicatedFrom() != NULL) {
62    new WText(" duplicated from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
63  }
64  new WBreak(sectorContainer);
65
66
67  sectorContainer->clicked().connect(this,&GWt_sector::displayWidgetBeamLine);
68}
69
70
71void GWt_sector::createWidgetBeamLine(WContainerWidget* parent) {
72
73  // suppress old detailled view if present
74  parent->clear();
75 
76  // add the detailled view
77  WContainerWidget* wdg = new WContainerWidget(parent);
78
79  wdg->setObjectName("sector");
80  wdg->addStyleClass("sectorPanel");
81  Wt::WVBoxLayout* vContainerLayout = new WVBoxLayout();
82  vContainerLayout->setContentsMargins(0,0,0,0);
83  Wt::WPanel *collapsiblePanel = new Wt::WPanel(wdg);
84  collapsiblePanel->setTitle("Sector panel");
85  collapsiblePanel->setCollapsible(true);
86 
87  WContainerWidget* menu = new WContainerWidget(wdg);
88  menu->addStyleClass("sectorMenu");
89 
90  //  Wt::WHBoxLayout* hmenuLayout = new WHBoxLayout();
91  //  menu->setLayout(hmenuLayout);
92 
93  new WLabel(sectorControler_->getName()+" ",menu);
94 
95  WPushButton* actionParameters = new WPushButton("",menu);
96  // set tooltips
97  actionParameters->setToolTip("change parameters");
98 
99  // Set class for actions elements
100  actionParameters->setStyleClass("Button WhiteButton parameters");
101  actionParameters->setMaximumSize(32,32);
102  actionParameters->setMinimumSize(32,32);
103 
104  new WLabel(" Type: ",menu);
105  WComboBox* typeWidget = new WComboBox(menu);
106  typeWidget->addItem("Linear");
107  typeWidget->addItem("Circular");
108 
109  menu->setWidth(20+7+7+1+1+2);
110 
111  vContainerLayout->addWidget(menu);
112 
113  // Add beamLine for this sector
114  UI_beamLine_ = new GWt_ligneFaisceau(getAccelerator()->getDataManager(),this);
115  vContainerLayout->addWidget(UI_beamLine_);
116 
117  // add the software panel
118  executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this);
119  vContainerLayout->addWidget(executeWidget_);
120 
121
122  wdg->setLayout(vContainerLayout);
123}
124
125
126void GWt_sector::displayWidgetBeamLine() {
127  createWidgetBeamLine(getAccelerator()->getAcceleratorDetailledView());
128}
Note: See TracBrowser for help on using the repository browser.