Changeset 474 in PSPA


Ignore:
Timestamp:
Jan 2, 2014, 10:15:24 PM (10 years ago)
Author:
garnier
Message:

prise en charge de la restauration dun fichier de sauvegarde

Location:
Interface_Web/trunk/pspaWT/sources
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h

    r472 r474  
    55#include "abstractElement.h"
    66#include "abstractSoftware.h"
     7#include "sector.h"
    78
    89class sectionToExecute
     
    1213  /** Create a new sectionToExecute and initialize it with the given element and software
    1314   */
    14   sectionToExecute(abstractElement*,abstractSoftware*,dataManager*);
     15  sectionToExecute(abstractElement*,abstractSoftware*,dataManager*,sector*);
    1516 
    1617  /** Deprecated : To be removed ! */
     
    5354    elements_.insert ( elements_.begin() ,abs);
    5455  };
     56
     57  /** Set the first element of this section.
     58   If needed, it will change the last element of the previous section
     59   */
     60  void setFirstElement(std::string);
    5561 
    5662  private :
     
    5965  dataManager* dataManager_;
    6066  std::vector< abstractElement* > elements_;
     67  sector* sector_;
    6168};
    6269#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/sector.h

    r472 r474  
    7575  void addElementAfter(abstractElement*,abstractElement*);
    7676 
    77   /**
     77  /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL
     78   it will create a new sectionToExecute and put it inside.
     79   if the previous element is NULL, it will try to add at the beginning of the first section
     80   @return : the new element
     81   */
     82  abstractElement* addElementAfter(nomdElements::typedElement, abstractElement* );
     83
     84    /**
    7885 set the specific software for the given sectionToExecute number
    7986 */
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r472 r474  
    261261  //NOTE:: je ne sais pas si les "secteurs" seront conservés, aussi pour ne pas trop changer les fichiers je lis les données aprÚs "globals" dans la boucle
    262262 
    263   pspa_->getBeamLine_deprecated()->clear();
     263  // Clear the BeamLine
     264  jobList_.clear();
     265
     266  // FIXME : For test purpose !!!
     267  sector* mySect = addNewSector();
     268 
    264269  nomdElements::typedElement elementType;
    265270  string elementLabel;
     
    275280    } else {
    276281      elementType = nomdElements::getTypeFromLabel(elementLabel);
    277       GWt_abstractElement* nouveau = pspa_->getBeamLine_deprecated()->addElement(elementType);
     282      abstractElement* nouveau = mySect->addElementAfter(elementType,NULL);
    278283      if ( nouveau == NULL ) {
    279284        cerr << " dataManager::restoreElements() : restore element " << elementLabel << " failed " << endl;
     
    286291 
    287292#if BAVARD > 1
    288   unsigned k;
     293/*  unsigned k;
    289294  for(k = 0; k < getBeamLineSize(); k++) {
    290295    abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(k);
    291296    cout << "recupere " << ptr->getLabel() << endl;
    292297  }
     298*/
    293299#endif
    294300
  • Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc

    r472 r474  
    1010
    1111
    12 sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s,dataManager* data) {
     12sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s,dataManager* data,sector* sect) {
    1313  dataManager_ = data;
     14  sector_ = sect;
    1415 
    1516  elements_.push_back(f);
     
    6364}
    6465
     66
     67void sectionToExecute::setFirstElement(std::string name) {
     68// Possible cases :
     69
     70  // | section 1 | section 2 |
     71  // |  a b c d  |  e f g h  |  i X j k l  |  m n o p  | Before : X is in the 3rd sectionToExcute
     72  // |  a b c d e f g h i | X j k l  ||  m n o p  | Case 1 : X move in the 2nd
     73  // |  a b c d  |  e f g h  |  i  |  X j k l m n o p  | Case 2 : X move in the 4nd
     74
     75  // Case 1 : Have to change X and
     76 
     77  std::vector <sectionToExecute*> sectVect = sector_->getSectionsToExecute();
     78  sectionToExecute* previousSection = NULL;
     79
     80  for (unsigned int a=0; a< sectVect.size(); a++) {
     81    if (sectVect[a] == this) {
     82      if (a >= 1) {
     83        previousSection = sectVect[a-1];
     84      }
     85    }
     86  }
     87  if (previousSection == NULL) {
     88    return;
     89  }
     90  // FIXME : NOt finished !! 02/2014
     91}
  • Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc

    r472 r474  
    1111#include "sectionToExecute.h"
    1212#include "dataManager.h"
     13#include "elementDrift.h"
     14#include "elementRfgun.h"
     15#include "elementCell.h"
     16#include "elementSoleno.h"
     17#include "elementBend.h"
     18#include "elementBeam.h"
     19#include "elementFit.h"
     20#include "elementSnapshot.h"
     21#include "elementMultipole.h"
    1322
    1423sector::sector(dataManager* data, std::string name):
     
    2736}
    2837
     38abstractElement* sector::addElementAfter(nomdElements::typedElement eType ,abstractElement* previousElement){
     39
     40  // create a new abstractElement
     41  // FIXME : To be move in an abstractFactory in the controler !!
     42  abstractElement* currentElement = NULL;
     43  switch (  eType ) {
     44    case nomdElements::RFgun :
     45      currentElement = new elementRfgun();
     46      break;
     47    case nomdElements::drift :
     48      currentElement = new elementDrift();
     49      break;
     50    case nomdElements::cell  :
     51      currentElement = new elementCell();
     52      break;
     53    case nomdElements::bend  :
     54      currentElement = new elementBend();
     55      break;
     56    case nomdElements::soleno  :
     57      currentElement = new elementSoleno();
     58      break;
     59    case nomdElements::beam  :
     60      currentElement = new elementBeam();
     61      break;
     62    case nomdElements::fit  :
     63      currentElement = new elementFit();
     64      break;
     65    case nomdElements::mpole  :
     66      currentElement = new elementMultipole();
     67      break;
     68    case nomdElements::snapshot :
     69    {
     70      // FIXME : Snapshot a gérér
     71      /*        int incr = dataManager_->getPspaApplication()->getExtensionFile();
     72       incr++;
     73       dataManager_->getPspaApplication()->setExtensionFile(incr);
     74       */
     75      currentElement = new elementSnapshot();
     76      break;
     77    }
     78  }
     79  if (!currentElement) {
     80    return NULL;
     81  }
     82  addElementAfter(currentElement,previousElement);
     83  return currentElement;
     84 
     85}
     86
     87
    2988void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){
    3089// if the previous element is NULL, it will try to add at the beginning of the first section
     
    3291  if (previousElement == NULL) {
    3392    if (sectionToExecute_.size() == 0) {
    34       sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL,dataManager_));
     93      sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL,dataManager_,this));
    3594    } else {
    3695        sectionToExecute* section = sectionToExecute_.front();
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h

    r468 r474  
    3535  WContainerWidget* acceleratorDetailledView_;
    3636  void addSector();
     37  void readConfiguration();
    3738  void run();
    3839  void closeGraphicDialog();
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r469 r474  
    5353  GWt_console* console_;
    5454  GWt_abstractElementFactory* abstractElementFactory_;
    55      
     55  WContainerWidget* acceleratorContainerWidget_;
     56 
    5657  WText* createTitle(const WString&);
    5758  WWidget* createPalette(WContainerWidget* parent);
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h

    r469 r474  
    1818
    1919    void setSoftware();
    20 
     20  void changeFirstElement();
     21 
    2122    inline Wt::WString getFirstElementCurrentText() {
    2223        return firstElement_->currentText();
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc

    r469 r474  
    1515#include <string>
    1616
     17//- Ouvrir le premier secteur quand il est chargé
     18//- Ajouter les sectionToExecute
     19//- Fixer le addConsoleMessage()
     20//- remise a jour des éléments si on on change un bout de section
     21
    1722GWt_accelerator::GWt_accelerator(WContainerWidget* parent, dataManager* dt) :
    1823WContainerWidget(parent),
     
    8489  acceleratorGlobalView->setLayout(acceleratorGlobalViewLayout_);
    8590
    86   // Add the first sector
    87   addSector();
     91  // read configuration
     92  readConfiguration();
    8893
    8994  // Actions
     
    107112{
    108113  sector* sect = getDataManager()->addNewSector();
    109   GWt_sector* addedSector = new GWt_sector(this,sect);
    110 }
     114  new GWt_sector(this,sect);
     115}
     116
     117
     118void GWt_accelerator::readConfiguration()
     119{
     120  std::vector <sector*> sect = dataManager_->getSectors();
     121  if (sect.size() == 0) {
     122    // Add the first sector
     123    addSector();
     124  } else {
     125    for (unsigned long a=0; a< sect.size(); a++) {
     126      new GWt_sector(this,sect[a]);
     127    }
     128  }
     129}
     130
    111131
    112132void GWt_accelerator::run()
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc

    r449 r474  
    129129 
    130130  // apply filter, will modify outputCurrent
     131// FIXME !!!
     132  return;
    131133  searchFilter();
    132134  /*
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r455 r474  
    120120 
    121121  // create accelerator main widget
    122   WContainerWidget* acceleratorContainerWidget = new WContainerWidget();
    123   gridLayout->addWidget(acceleratorContainerWidget, 2, 1);
     122  acceleratorContainerWidget_ = new WContainerWidget();
     123  gridLayout->addWidget(acceleratorContainerWidget_, 2, 1);
    124124
    125125  // Let column 2 take the excess space.
     
    129129
    130130 
    131   new GWt_accelerator(acceleratorContainerWidget,dtmanage_);
    132   new WBreak(acceleratorContainerWidget);
     131  new GWt_accelerator(acceleratorContainerWidget_,dtmanage_);
     132  new WBreak(acceleratorContainerWidget_);
    133133
    134134
     
    138138  beamLine_deprecated_ = NULL;
    139139  /*
    140    WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget);
     140   WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget_);
    141141   scroll->setWidget(createBeamLine__deprecated());
    142142   scroll->setMinimumSize(300,150);
    143143   */
    144144 
    145   new WBreak(acceleratorContainerWidget);
     145  new WBreak(acceleratorContainerWidget_);
    146146  //-----------
    147147
     
    152152  globalParam_ = new GWt_globalParameters(dtmanage_);
    153153  sectorParam_ = new GWt_sectorParameters();
    154   WWidget* dboard = createDashBoard(acceleratorContainerWidget);
     154  WWidget* dboard = createDashBoard(acceleratorContainerWidget_);
    155155  dboard->setMinimumSize(300,100);
    156156
    157   new WBreak(acceleratorContainerWidget);
     157  new WBreak(acceleratorContainerWidget_);
    158158
    159159  //-----------
    160160
    161161 
    162   new WBreak(acceleratorContainerWidget);
    163  
    164   console_ = new GWt_console(acceleratorContainerWidget);
     162  new WBreak(acceleratorContainerWidget_);
     163 
     164  console_ = new GWt_console(acceleratorContainerWidget_);
    165165  console_->setMinimumSize(300,100);
    166166
     
    317317  }
    318318 
    319   globalParam_->renew();
     319  // reload new elements in the GUI
     320// FIXME : Don't do that in the futur !
     321  // In the futur, we should be able to have lot of accelerator at the same time and each with ONE datamanager
     322  acceleratorContainerWidget_->clear();
     323  new GWt_accelerator(acceleratorContainerWidget_,dtmanage_);
     324
     325  globalParam_->renew();
    320326  //sectorParam_->renew();
    321327  console_->addConsoleMessage(string("restauration terminee \n"));
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc

    r469 r474  
    9191  softElement_->setMinimumSize(80,12);
    9292 
    93 //  firstElement_->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     93  firstElement_->activated().connect(this,&GWt_sectionToExecute::changeFirstElement);
    9494//  lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
    9595  softElement_->activated().connect(this,&GWt_sectionToExecute::setSoftware);
     
    148148}
    149149
     150
     151void GWt_sectionToExecute::changeFirstElement()
     152{
     153  section_->setFirstElement(firstElement_->currentText().toUTF8());
     154  UIsector_->getExecuteWidget()->displayFromControler();
     155}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r472 r474  
    6464  } else {
    6565
    66     unsigned long firstSectionToExecuteIndex = 0;
     66    unsigned int firstSectionToExecuteIndex = 0;
    6767    for (unsigned int a=0; a<UIsector_->getSectorControler()->getSectionsToExecute().size(); a++) {
    6868      abstractElement* premierElement = NULL;
     
    8686      lineFromCombo->setCurrentIndex(firstSectionToExecuteIndex);
    8787      // set to last
    88       lineToCombo->setCurrentIndex(firstSectionToExecuteIndex + UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size() - 1);
     88      lineToCombo->setCurrentIndex(firstSectionToExecuteIndex + (unsigned int)UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size() - 1);
    8989     
    9090      WComboBox* softCombo = new WComboBox();
    91       sector * sector = UIsector_->getSectorControler();
    9291      sectionToExecute* sect = UIsector_->getSectorControler()->getSectionsToExecute()[a];
    93       abstractSoftware* abs = sect->getSoftware();
    9492     
    9593      fillComboWithSoftwares(softCombo,UIsector_->getSectorControler()->getSectionsToExecute()[a]->getSoftware()->getName());
     
    267265  if (s > 0) {
    268266    abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement();
    269     UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL,dtmanage_));
     267    UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL,dtmanage_,UIsector_->getSectorControler()));
    270268    UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->removeLastElement();
    271269  }
Note: See TracChangeset for help on using the changeset viewer.