Changeset 446 in PSPA


Ignore:
Timestamp:
Dec 12, 2013, 12:11:53 PM (10 years ago)
Author:
garnier
Message:

ajout des classes GWt_sector et GWt_accelerator

Location:
Interface_Web/trunk/pspaWT/sources/userInterface
Files:
3 added
1 copied

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc

    r436 r446  
    1 //
    2 //  File.cpp
    3 //  PSPA
    4 //
    5 //  Created by Garnier Laurent on 02/03/13.
    6 //  Copyright (c) 2013 Garnier Laurent. All rights reserved.
    7 //
     1#include "GWt_sector.h"
     2#include "GWt_LigneFaisceau.h"
    83
    9 #include "File.h"
     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) :
     13parent_(parent),
     14sector_(sect)
     15{
     16  setIcon(parent->getAcceleratorGlobalViewLayout());
     17}
     18
     19GWt_sector::~GWt_sector()
     20{
     21}
     22
     23void GWt_sector::setIcon(WLayout* parentLineLayout) {
     24  WContainerWidget* sectorContainer = new WContainerWidget();
     25
     26  if (parentLineLayout->count() > 0) {
     27    WContainerWidget* link = new WContainerWidget();
     28    new WLabel("",link);
     29    link->setStyleClass("elementLigneFaiseau_line");
     30    parentLineLayout->addWidget(link);
     31  }
     32
     33  sectorContainer->setStyleClass("beamLineIcon");
     34  parentLineLayout->addWidget(sectorContainer);
     35 
     36  WLabel* icon = new WLabel(sector_->getName(),sectorContainer);
     37  icon->setStyleClass("sectionIcon");
     38  icon->setHeight(100);
     39  icon->setToolTip("clic to view details");
     40
     41  new WBreak(sectorContainer);
     42
     43  std::stringstream str;
     44  str << sector_->getRepetitionNumber();
     45  std::string result;
     46  str >> result;
     47
     48  // Add repetition times
     49  WText* t = new WText(" x"+result+" ",sectorContainer);
     50  if (sector_->getRepetitionNumber() > 1) {
     51    t->setToolTip("repeted "+result+" times");
     52  } else {
     53    t->setToolTip("repeted "+result+" time");
     54  }
     55  new WBreak(sectorContainer);
     56
     57  // Add refected
     58  if (sector_->getReflected()) {
     59    WText* t = new WText(" reflected from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
     60  } else if (sector_->getDuplicatedFrom() != NULL) {
     61    WText* t = new WText(" duplicated from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
     62  }
     63  new WBreak(sectorContainer);
     64
     65
     66  sectorContainer->clicked().connect(this,&GWt_sector::displayWidgetBeamLine);
     67}
     68
     69
     70void GWt_sector::createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent) {
     71
     72  // suppress old detailled view if present
     73  parent->clear();
     74 
     75  WContainerWidget* wdg = new WContainerWidget(parent);
     76
     77  wdg->setObjectName("sector");
     78  wdg->addStyleClass("sectorPanel");
     79  Wt::WVBoxLayout* vContainerLayout = new WVBoxLayout();
     80  vContainerLayout->setContentsMargins(0,0,0,0);
     81  Wt::WPanel *collapsiblePanel = new Wt::WPanel(wdg);
     82  collapsiblePanel->setTitle("Sector panel");
     83  collapsiblePanel->setCollapsible(true);
     84 
     85  WContainerWidget* menu = new WContainerWidget(wdg);
     86  menu->addStyleClass("sectorMenu");
     87 
     88  //  Wt::WHBoxLayout* hmenuLayout = new WHBoxLayout();
     89  //  menu->setLayout(hmenuLayout);
     90 
     91  new WLabel(sector_->getName()+" ",menu);
     92 
     93  WPushButton* actionParameters = new WPushButton("",menu);
     94  // set tooltips
     95  actionParameters->setToolTip("change parameters");
     96 
     97  // Set class for actions elements
     98  actionParameters->setStyleClass("Button WhiteButton parameters");
     99  actionParameters->setMaximumSize(32,32);
     100  actionParameters->setMinimumSize(32,32);
     101 
     102  new WLabel(" Type: ",menu);
     103  WComboBox* typeWidget = new WComboBox(menu);
     104  typeWidget->addItem("Linear");
     105  typeWidget->addItem("Circular");
     106 
     107  menu->setWidth(20+7+7+1+1+2);
     108 
     109  vContainerLayout->addWidget(menu);
     110 
     111  // Add beamLine for this sector
     112  beamLine_ = new GWt_LigneFaisceau(pspa);
     113  vContainerLayout->addWidget(beamLine_);
     114  wdg->setLayout(vContainerLayout);
     115}
     116
     117
     118void GWt_sector::displayWidgetBeamLine() {
     119  createWidgetBeamLine(parent_->getControler(),parent_->getAcceleratorDetailledView());
     120}
Note: See TracChangeset for help on using the changeset viewer.