Changeset 469 in PSPA


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

Désormais il est de nouveau possible d'ajouter des sections et dy affecter des softwares (ne marche pour le moment quavec la 1ere sectionToExecute. Autres améliorations et renommages

Location:
Interface_Web/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/Interfaces/aml/v1r0p0/cmt/requirements

    r422 r469  
    99
    1010macro aml_home "" \
    11       Darwin "/usr/local/accelerator-ml-code" \
    12       Linux  "/usr/local/accelerator-ml-code/uap/trunk"
     11      Darwin "/Users/garnier/Work/PSPA/accelerator-ml-code/uap/trunk/" \
     12      Linux  "/Users/garnier/Work/PSPA/accelerator-ml-code/uap/trunk"
    1313
    1414macro aml_cflags   "" \
    15       Darwin " -I $(aml_home) -I/usr/local/include" \
     15      Darwin " -I $(aml_home) -I/usr/local/include -I/sw/include" \
    1616      Linux  " -I $(aml_home) -I/usr/include"
    1717macro aml_cppflags "" \
     
    2020
    2121macro aml_linkopts "" \
    22       Darwin " -L${aml_home}/lib/ -lantlr -luap -L/usr/local/lib -lxerces-c-3.1"\
     22      Darwin " -L${aml_home}/lib/ -lantlr -luap -L/sw/lib -lxerces-c-3.1"\
    2323      Linux  " -L${aml_home}/lib/ -lantlr -luap -L/usr/lib -lxerces-c"
    2424
  • Interface_Web/trunk/pspaWT/History

    r468 r469  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     819 Décembre 2013 : Laurent Garnier
     9- abstractElement :
     10  o Suppression des méthodes relatives aux softwares, ils sont désormais traités dans les sectionToExecute.
     11    getAbstractSoftware(), setSoftware, abstractSoftware_
     12
     13- softwareUnknown :
     14  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     15   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     16
     17- sectionToExecute :
     18  o Suppression de sectionToExecute(abstractElement*), désormais il faut obligatoirement passer le nom du sofware associé (ou sofwareUnknown si besoin)
     19  o Ajout de la méthode setSoftware(std::string) afin de gérer tout les select/case de sofware uniquement dans le controller
     20  o Ajout de insertAtFirst(abstractElement* abs)
     21
     22- dataManager : Renommage de pspa_->getBeamLine() en pspa_->getBeamLine_deprecated(), en effet la beamLine n'existe plus dans cette classe, elle se trouve désormais dans la section.
     23
     24- GWt_elementLigneFaisceau :
     25  o Passage de setBGColor() en méthode publique
     26  o Suppression de updateSoftware() qui n'a plus lien d'être
     27
     28- GWt_sectionToExecute :
     29  o Un peu de renommage pour une meilleure clarté
     30  o Ajout d'un argument vers la sectionToExecute du controler
     31
     32- GWt_ligneFaisceau :
     33  o Suppression de initializeSoftwares() qui est désormais automatiquement fait à la création d'un composant de la beamLine
     34
     35- PspaApplication :
     36  o Renommage degetBeamLine() en getBeamLine_deprecated(), en effet la beamLine n'existe plus dans cette classe, elle se trouve désormais dans la section.
     37
     38- GWt_sector :
     39  o Ajout d'une méthode pour récupérer le widget de la beamLine : getBeamLineWidget()
     40
     41- GWt_softwarePanel :
     42  o Désormais il est de nouveau possible d'ajouter des sections et d'y affecter des softwares (ne marche pour le moment qu'avec la 1ere sectionToExecute)
     43
    744
    84518 Décembre 2013 : Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h

    r431 r469  
    6161  virtual string print() = 0;
    6262  virtual void InputRep(UAPNode* root) = 0;
    63 
    64   /* Return the abstractSofware associated with this element
    65    */
    66   inline abstractSoftware* getAbstractSoftware() {
    67     return abstractSoftware_;
    68   }
    69  
    70   /* Set the software to this element
    71      @param abstractSoftware a pointer to the abstract software
    72   */
    73   inline void setSoftware(abstractSoftware* prog) {
    74     abstractSoftware_ = prog;
    75   }
    76  
    77  private :
    78 
    79   abstractSoftware *abstractSoftware_;
    80  
     63   
    8164};
    8265#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h

    r468 r469  
    99{
    1010 public :
    11   /** Create a new sectionToExecute and initialize it with the given element
    12    */
    13   sectionToExecute(abstractElement*);
    1411
    1512  /** Create a new sectionToExecute and initialize it with the given element and software
     
    2623  }
    2724 
    28   inline abstractSoftware* setSoftware(abstractSoftware* soft) {
     25  inline void setSoftware(abstractSoftware* soft) {
    2926    software_ = soft;
    3027  }
    3128 
     29/**
     30 Set a software according to the corresponding given string.
     31 If not found, set a softwareUnknown
     32 */
     33  void setSoftware(std::string);
     34
    3235  /**
    3336   Get the vector of elements of this sector
     
    4750  bool insertAfter(abstractElement*,abstractElement*);
    4851
     52  inline bool insertAtFirst(abstractElement* abs) {
     53    elements_.insert ( elements_.begin() ,abs);
     54  };
     55 
    4956  private :
    5057
  • Interface_Web/trunk/pspaWT/sources/controler/include/sector.h

    r455 r469  
    6969  /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL
    7070   it will create a new sectionToExecute and put it inside.
     71   if the previous element is NULL, it will try to add at the beginning of the first section
    7172   */
    7273  void addElementAfter(abstractElement*,abstractElement*);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h

    r455 r469  
    1111  virtual ~softwareUnknown() {;}
    1212
    13   virtual bool createInputFile(particleBeam*,sectionToExecute* sectionToExe, string);
     13  virtual bool createInputFile(particleBeam* beamBefore, string workingDir);
    1414  virtual bool execute(string);
    1515  virtual bool buildBeamAfterElements(string);
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc

    r431 r469  
    55#include "abstractElement.h"
    66
    7 abstractElement::abstractElement() : abstractSoftware_(NULL)
     7abstractElement::abstractElement()
    88{
    99  setDefaultValues();
     
    1212}
    1313
    14 abstractElement::abstractElement(string lab) : abstractSoftware_(NULL)
     14abstractElement::abstractElement(string lab)
    1515{
    1616  specificName_ = lab;
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r455 r469  
    4141{
    4242/*
    43  abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1);
     43 abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(numero-1);
    4444  if ( ptr == NULL ) return "";
    4545  return ptr->getLabel();
     
    5252/*  int index = -1;
    5353  for (int k = 0; k < getBeamLineSize() ; k++) {
    54     if (pspa_->getBeamLine()->getAbstractElement(k) != NULL) {
    55       if ( pspa_->getBeamLine()->getAbstractElement(k)->getLabel() == label )
     54    if (pspa_->getBeamLine_deprecated()->getAbstractElement(k) != NULL) {
     55      if ( pspa_->getBeamLine_deprecated()->getAbstractElement(k)->getLabel() == label )
    5656        {
    5757          index = (int)k + 1;
     
    264264  //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
    265265 
    266   pspa_->getBeamLine()->clear();
     266  pspa_->getBeamLine_deprecated()->clear();
    267267  nomdElements::typedElement elementType;
    268268  string elementLabel;
     
    278278    } else {
    279279      elementType = nomdElements::getTypeFromLabel(elementLabel);
    280       GWt_abstractElement* nouveau = pspa_->getBeamLine()->addElement(elementType);
     280      GWt_abstractElement* nouveau = pspa_->getBeamLine_deprecated()->addElement(elementType);
    281281      if ( nouveau == NULL ) {
    282282        cerr << " dataManager::restoreElements() : restore element " << elementLabel << " failed " << endl;
     
    291291  unsigned k;
    292292  for(k = 0; k < getBeamLineSize(); k++) {
    293     abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(k);
     293    abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(k);
    294294    cout << "recupere " << ptr->getLabel() << endl;
    295295  }
  • Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc

    r455 r469  
    11#include "sectionToExecute.h"
    2 
    3 
    4 sectionToExecute::sectionToExecute(abstractElement* a) {
    5   elements_.push_back(a);
    6 }
     2#include "softwareUnknown.h"
     3#include "softwareParmela.h"
     4#include "softwareTransport.h"
     5#include "softwareGenerator.h"
     6#include "softwareGenerator.h"
     7#include "softwareUsersprogram.h"
     8#include "softwareTest.h"
     9#include "softwareMadx.h" //xx
    710
    811
    912sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) {
    1013  elements_.push_back(f);
     14  if (s == NULL) {
     15    software_ = new softwareUnknown();
     16  } else {
    1117    software_ = s;
     18  }
    1219}
    1320
     
    2532}
    2633
    27 /*
    28 bool sectionToExecute::setSoftware(nomDeLogiciel logiciel) {
    29  
    30   if (sectionToExecuteNumber >= sectionToExecute_.size()) {
    31     return false;
     34
     35void sectionToExecute::setSoftware(std::string logiciel) {
     36 
     37  abstractSoftware* prog;
     38  string inputFileName;
     39  if(logiciel == "parmela") {
     40    inputFileName = "parmin";
     41    prog = new softwareParmela(inputFileName, this);
     42  } else if (logiciel  == "transport") {
     43    inputFileName = "transport.input";
     44    prog =  new softwareTransport(inputFileName, this);
     45  } else if (logiciel == "generator") {
     46    inputFileName = "generator.in";
     47    prog = new softwareGenerator(inputFileName, this);
     48  } else if (logiciel  == "madx") {
     49    inputFileName = "madx.input";
     50    prog = new softwareMadx(inputFileName,this);
     51  } else if (logiciel  == "usersprogram") {
     52    inputFileName = "dummy";
     53    prog = new softwareUsersprogram(inputFileName, this);
     54  } else if (logiciel  == "test") {
     55    prog = new softwareTest(inputFileName, this);
     56  } else {
     57    prog = new softwareUnknown();
    3258  }
    3359 
    34   abstractSoftware* prog;
    35   string inputFileName;
    36   if(logiciel == nomDeLogiciel::parmela) {
    37     inputFileName = "parmin";
    38     prog = new softwareParmela(inputFileName, this);
    39   } else if (logiciel  == nomDeLogiciel::transport) {
    40     inputFileName = "transport.input";
    41     prog =  new softwareTransport(inputFileName, this);
    42   } else if (logiciel == nomDeLogiciel::generator) {
    43     inputFileName = "generator.in";
    44     prog = new softwareGenerator(inputFileName, this);
    45   } else if (logiciel  == nomDeLogiciel::madx) {
    46     inputFileName = "madx.input";
    47     prog = new softwareMadx(inputFileName,this);
    48   } else if (logiciel  == nomDeLogiciel::usersprogram) {
    49     inputFileName = "dummy";
    50     prog = new softwareUsersprogram(inputFileName, this);
    51   } else if (logiciel  == nomDeLogiciel::test) {
    52     prog = new softwareTest(inputFileName, this);
    53   } else {
    54     prog = new softwareUnknown(); // xx
    55   }
    56  
    57   sectionToExecute_[sectionToExecuteNumber]->setSoftware(prog);
    58   return true;
     60  setSoftware(prog);
    5961}
    60 */
     62
  • Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc

    r455 r469  
    88
    99#include "sector.h"
    10 #include "softwareParmela.h"
    11 #include "softwareTransport.h"
    12 #include "softwareGenerator.h"
    13 #include "softwareGenerator.h"
    14 #include "softwareUsersprogram.h"
    15 #include "softwareTest.h"
    16 #include "softwareMadx.h" //xx
    17 #include "softwareUnknown.h" //xx
    1810
    1911#include "sectionToExecute.h"
     
    3527
    3628void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){
     29// if the previous element is NULL, it will try to add at the beginning of the first section
     30 
    3731  if (previousElement == NULL) {
    3832    if (sectionToExecute_.size() == 0) {
    39       sectionToExecute_.push_back(new sectionToExecute(currentElement));
     33      sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL));
    4034    } else {
    41       sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) );
     35        sectionToExecute* section = sectionToExecute_.front();
     36      section->insertAtFirst(currentElement);
    4237    }
    4338  } else {
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc

    r455 r469  
    1717}
    1818
    19 bool softwareUnknown::createInputFile(particleBeam* beamBefore,sectionToExecute* sectionToExe, string workingDir)
     19bool softwareUnknown::createInputFile(particleBeam* beamBefore, string workingDir)
    2020{
    2121  return true;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h

    r455 r469  
    3131     */
    3232   
    33     GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem);
     33  GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem, std::string);
    3434   
    3535    ~GWt_elementLigneFaisceau();
     
    6161        softwareName_ =new WText(name);
    6262    }
     63 
     64  /**
     65   Set the background color for this element
     66   */
     67  void setBGColor(const WColor);
     68
    6369
    6470private:
     
    6672    void removeDone(GWt_abstractElement*);
    6773    std::string getElementNumberInBeamLine(nomdElements el);
    68     void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem);
     74    void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem, std::string);
    6975    void mouseWentOut();
    7076    void mouseWentOver();
    71   /**
    72    Update the software of this element according to the sectionToExecute software. Will change the color of this object
    73    */
    74   void updateSoftware();
    75     void setBGColor(const WColor);
     77
    7678    GWt_dialog* messageDropZone_;
    7779    WText* firstTimeInsertMessage_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h

    r455 r469  
    7979   */
    8080  void update_deprecated(int);
    81  
    82     void initializeSoftwares();
    83  
     81   
    8482  /** Return the sector of this beamLine */
    8583  inline GWt_sector* getUISector() { return UI_sector_;};
    8684 
     85  void buildBeamLineWidget();
     86
    8787  private :
    8888  void manageLineFaisceauLayout_deprecated();
    89   void buildBeamLineWidget();
    9089 
    9190  GWt_dropZoneLigneFaisceau* allDropZone_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r455 r469  
    9393  }
    9494
    95   inline GWt_ligneFaisceau* getBeamLine() {
     95  inline GWt_ligneFaisceau* getBeamLine_deprecated() {
    9696    return beamLine_deprecated_;
    9797  }
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h

    r455 r469  
    88class GWt_softwarePanel;
    99class GWt_sector;
     10class sectionToExecute;
    1011
    1112class GWt_sectionToExecute : public Wt::WContainerWidget
    1213{
    1314    public :
    14     GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel,GWt_sector*);
     15    GWt_sectionToExecute(Wt::WComboBox* ,Wt::WComboBox* ,Wt::WComboBox*,Wt::WContainerWidget* ,sectionToExecute*,GWt_sector* );
    1516
    1617    ~GWt_sectionToExecute() {;}
    1718
     19    void setSoftware();
     20
    1821    inline Wt::WString getFirstElementCurrentText() {
    19         return firstElement->currentText();
     22        return firstElement_->currentText();
    2023    }
    2124   
    2225    inline Wt::WString getLastElementCurrentText() {
    23         return lastElement->currentText();
    24     }
    25    
    26     inline Wt::WString getSoftwareCurrentText() {
    27         return software->currentText();
     26        return lastElement_->currentText();
    2827    }
    2928   
    3029    inline Wt::WComboBox * getFirstElement() {
    31         return firstElement;
     30        return firstElement_;
    3231    }
    3332   
    3433    inline Wt::WComboBox * getLastElement() {
    35         return lastElement;
     34        return lastElement_;
    3635    }
    3736   
    38     inline Wt::WComboBox * getSoftware() {
    39         return software;
    40     }
    4137    void setFirstElementCurrentSelection(Wt::WString);
    4238    void setLastElementCurrentSelection(Wt::WString);
     
    5652   
    5753    void manageWarningsAndErrors();
    58     Wt::WComboBox*  firstElement;
    59     Wt::WComboBox*  lastElement;
    60     Wt::WComboBox* software;
    61     GWt_softwarePanel* softwarePanel;
     54    Wt::WComboBox*  firstElement_;
     55    Wt::WComboBox*  lastElement_;
     56    Wt::WComboBox*  softElement_;
     57    sectionToExecute* section_;
     58    GWt_sector* UIsector_;
    6259
    6360    Wt::WText* errorsLabel_;
     
    6663    Wt::WContainerWidget* warningsContainer_;
    6764    Wt::WContainerWidget* errorsContainer_;
    68     GWt_sector* UI_sector_;
    6965};
    7066
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h

    r455 r469  
    3232  }
    3333 
     34  /**
     35   Get the beam line widget
     36   */
     37  inline GWt_ligneFaisceau* getBeamLineWidget() {
     38    return UI_beamLine_;
     39  };
     40 
    3441  private :
    3542  GWt_ligneFaisceau* UI_beamLine_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h

    r468 r469  
    3939  string getSelection();
    4040  void fillComboWithElements(Wt::WComboBox* cBox);
    41   void fillComboWithSoftwares(Wt::WComboBox* cBox);
     41
     42  /** Fill a ComboBox with the software list
     43   By default, will setup the default text to the last software
     44   */
     45  void fillComboWithSoftwares(Wt::WComboBox* cBox, std::string );
    4246  Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex);
    4347
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc

    r468 r469  
    669669   
    670670   // intialize User Interface
    671    if (pspa_->getBeamLine()) {
    672    pspa_->getBeamLine()->initializeSoftwares();
     671   if (pspa_->getBeamLine_deprecated()) {
     672   pspa_->getBeamLine_deprecated()->initializeSoftwares();
    673673   }
    674674   
     
    679679   string debString= sections_[a]->getFirstElementCurrentText().toUTF8();
    680680   string finString= sections_[a]->getLastElementCurrentText().toUTF8();
    681    int debut = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(debString);
    682    int fin = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(finString);
     681   int debut = pspa_->getBeamLine_deprecated()->getAbstractElementNumeroFromLabel(debString);
     682   int fin = pspa_->getBeamLine_deprecated()->getAbstractElementNumeroFromLabel(finString);
    683683   
    684684   string currentSoft= sections_[a]->getSoftwareCurrentText().toUTF8();
    685685   nomDeLogiciel prog = nomDeLogiciel(currentSoft);
    686    sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut),debut,pspa_->getBeamLine()->getAbstractElement(fin),fin,prog);
     686   sectionToExecute* sectToExec = dtmanage_->addSectionToExecute(pspa_->getBeamLine_deprecated()->getAbstractElement(debut),debut,pspa_->getBeamLine_deprecated()->getAbstractElement(fin),fin,prog);
    687687   
    688688   abstractSoftware* softToExec = sectToExec->getSoftware();
     
    691691   for(int i = debut-1; i < fin; i++) // check sections
    692692   {
    693    if (!pspa_->getBeamLine()) continue;
    694    abstractElement* elPtr= pspa_->getBeamLine()->getAbstractElement(i);
     693   if (!pspa_->getBeamLine_deprecated()) continue;
     694   abstractElement* elPtr= pspa_->getBeamLine_deprecated()->getAbstractElement(i);
    695695   if (!elPtr) continue;
    696696   
     
    709709   }
    710710   }
    711    pspa_->getBeamLine()->update(i);
     711   pspa_->getBeamLine_deprecated()->update(i);
    712712   } //i
    713713   
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r455 r469  
    2020
    2121
    22 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
     22GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem,std::string bgcolor)
    2323  : WContainerWidget(),
    2424    firstTimeInsertMessage_(NULL),
     
    3131  // set the css name
    3232  setObjectName("elementLigneFaisceau");
    33   initialize_ligneFaisceau(ligne,abstractElem);
    34 }
    35 
    36 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
     33  initialize_ligneFaisceau(ligne,abstractElem,bgcolor);
     34}
     35
     36void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem,std::string bgcolor)
    3737{   
    3838  // set layout
     
    173173  gridLayout->setColumnStretch (2,1);
    174174 
     175  // Change background color
     176  setBGColor(WColor(bgcolor));
     177
    175178  // set layout
    176179  setLayout(gridLayout);
     
    182185  actionTrash_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::deleteElement);
    183186
    184   updateSoftware();
    185187}
    186188
     
    188190{}
    189191
    190 void GWt_elementLigneFaisceau::updateSoftware()
    191 {
    192   if (getGWt_AbstractElement()->getAbstractElement()) {
    193     if (getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()) {
    194       //      setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getColor()));
    195       setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getNomDeLogiciel()->getColor()));
    196       softwareName_->setText(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getName());
    197 
    198     // no abstract software
    199     } else {
    200       setBGColor(WColor("#FFFFFF"));
    201       softwareName_->setText("");
    202     }
    203   }
    204 }
    205192
    206193void GWt_elementLigneFaisceau::setBGColor(const WColor c) {
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r468 r469  
    178178      elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_,
    179179                                                       this,
    180                                                        abstractElem[j]);
     180                                                       abstractElem[j],UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getSoftware()->getColor());
    181181     
    182182      // remove default text
     
    328328    }
    329329}
    330 
    331 
    332 void GWt_ligneFaisceau::initializeSoftwares()
    333 {   
    334   vector <abstractElement*> elems = getAllAbstractElements();
    335   cout << "GWt_ligneFaisceau::initializeSoftwares() " << elems.size() << endl;
    336 
    337   for (int a = 0; a < elems.size(); a++) {
    338     elems[a]->setSoftware( NULL );
    339   }
    340 }
    341 
    342 
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc

    r455 r469  
    88#include "GWt_sectionToExecute.h"
    99#include "GWt_softwarePanel.h"
     10#include "GWt_sector.h"
    1011
    11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect)
     12GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, sectionToExecute* section,GWt_sector* sector)
    1213:WContainerWidget(),
    13 firstElement(first),
    14 lastElement(last),
    15 software(soft),
    16 softwarePanel(sPanel),
    17 UI_sector_(sect)
     14firstElement_(first),
     15lastElement_(last),
     16softElement_(soft),
     17section_(section),
     18UIsector_(sector)
    1819{
    1920  Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
     
    2930 
    3031  labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from&nbsp;:&nbsp;"));
    31   labelAndComboInsideContainerLayout->addWidget(first);
     32  labelAndComboInsideContainerLayout->addWidget(firstElement_);
    3233  labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to&nbsp;:&nbsp;"));
    33   labelAndComboInsideContainerLayout->addWidget(last);
    34   labelAndComboInsideContainerLayout->addWidget(soft);
     34  labelAndComboInsideContainerLayout->addWidget(lastElement_);
     35  labelAndComboInsideContainerLayout->addWidget(softElement_);
    3536 
    3637    // add buttons
     
    8687 
    8788  // resize combo
    88   firstElement->setMinimumSize(80,12);
    89   lastElement->setMinimumSize(80,12);
    90   software->setMinimumSize(80,12);
     89  firstElement_->setMinimumSize(80,12);
     90  lastElement_->setMinimumSize(80,12);
     91  softElement_->setMinimumSize(80,12);
    9192 
    92   firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
    93   lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
    94   software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     93//  firstElement_->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     94//  lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
     95  softElement_->activated().connect(this,&GWt_sectionToExecute::setSoftware);
    9596 
    9697  manageWarningsAndErrors();
     
    99100
    100101void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){
    101     for (int a=0; a< firstElement->count(); a++) {
    102         if (firstElement->itemText(a) == txt) {
    103             firstElement->setCurrentIndex (a);
     102    for (int a=0; a< firstElement_->count(); a++) {
     103        if (firstElement_->itemText(a) == txt) {
     104            firstElement_->setCurrentIndex (a);
    104105            return;
    105106        }
     
    108109
    109110void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){
    110     for (int a=0; a< lastElement->count(); a++) {
    111         if (lastElement->itemText(a) == txt) {
    112             lastElement->setCurrentIndex (a);
     111    for (int a=0; a< lastElement_->count(); a++) {
     112        if (lastElement_->itemText(a) == txt) {
     113            lastElement_->setCurrentIndex (a);
    113114            return;
    114115        }
     
    117118
    118119void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){
    119   for (int a=0; a< software->count(); a++) {
    120     if (software->itemText(a) == txt) {
    121       software->setCurrentIndex (a);
     120  for (int a=0; a< softElement_->count(); a++) {
     121    if (softElement_->itemText(a) == txt) {
     122      softElement_->setCurrentIndex (a);
    122123      return;
    123124    }
     
    140141}
    141142
    142 /*
    143  void GWt_sectionToExecute::setSoftware(nomDeLogiciel logiciel)
     143
     144 void GWt_sectionToExecute::setSoftware()
    144145{
    145   UI_sector_->getSectorControler()->setSoftware(logiciel);
    146 
     146  section_->setSoftware(softElement_->currentText().toUTF8());
     147  UIsector_->getBeamLineWidget()->buildBeamLineWidget();
    147148}
    148149
    149 */
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r468 r469  
    6767      abstractElement* dernierElement = NULL;
    6868     
    69       int premierIndex = 0;
    70       int dernierIndex = 0;
    71      
    7269      std::string premierElementLabel = "";
    7370      std::string dernierElementLabel = "";
     
    8481      fillComboWithElements(lineToCombo);
    8582     
    86       // set selection
    87       lineFromCombo->setCurrentIndex(premierIndex);
    88       lineToCombo->setCurrentIndex(dernierIndex);
     83      // set to first
     84      lineFromCombo->setCurrentIndex(0);
     85      // set to last
     86      lineToCombo->setCurrentIndex(lineToCombo->count());
    8987     
    9088      WComboBox* softCombo = new WComboBox();
    91       fillComboWithSoftwares(softCombo);
     89      sector * sector = UIsector_->getSectorControler();
     90      sectionToExecute* sect = UIsector_->getSectorControler()->getSectionsToExecute()[a];
     91      abstractSoftware* abs = sect->getSoftware();
     92     
     93      fillComboWithSoftwares(softCombo,UIsector_->getSectorControler()->getSectionsToExecute()[a]->getSoftware()->getName());
     94
     95      // disable the "to" comboBox
     96      lineToCombo->disable();
     97
     98      // disable the first "from" comboBox
     99      if (a==0) {
     100        lineFromCombo->disable();
     101      }
     102      // disable the last "to" comboBox
     103      if (a==UIsector_->getSectorControler()->getSectionsToExecute().size()-1) {
     104        lineToCombo->disable();
     105      }
    92106     
    93107      // Add the sectionToExecute Widget
    94       GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(UIsectionsToExecute_.size()),this,UIsector_);
    95      
     108      GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(a),UIsector_->getSectorControler()->getSectionsToExecute()[a],UIsector_);
     109     
     110      // FIXME ?
    96111      stringstream st;
    97112      st << UIsectionsToExecute_.size();
     
    103118      UIsectionsToExecute_.push_back(newSection);
    104119      contenuSections_->addWidget(newSection);
    105       updateSections();
     120//      updateSections();
    106121
    107122     
     
    116131  cout << " GWt_softwarePanel::updateSections() " << endl<<endl;
    117132#endif
    118   return;
    119  
     133
     134  /*
    120135  // update all sections in order to manage new/deleted items
    121136  for (int a = 0; a < UIsectionsToExecute_.size(); a++) {
     
    140155  // set default values
    141156  updateSectionSelection();
     157*/
    142158}
    143159
     
    248264  if (s > 0) {
    249265    abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement();
    250     UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs));
     266    UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL));
    251267    UIsector_->getSectorControler()->getSectionsToExecute()[s]->removeLastElement();
    252268  }
     
    290306  if (cBox == NULL) return;
    291307
    292   // get the last item selected
    293   WString selectedString = cBox->currentText();
    294   cBox->clear();
    295 
    296308  if (!UIsector_->getSectorControler()) {
    297309    return;
     
    306318    }
    307319  }
    308  
    309   for(int a = 0; a < cBox->count(); a++) {
    310     if (cBox->itemText (a) == selectedString) {
    311       cBox->setCurrentIndex(a);
    312     }
    313   }
    314   cBox->refresh();
    315 }
    316 
    317 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox)
     320}
     321
     322void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox, std::string selected)
    318323{
    319324#if BAVARD > 0
     
    329334  for(k = 0; k <= nb; k++) { //xx
    330335    cBox->addItem(nomDeLogiciel(k).getString());
    331   }
    332   cBox->setCurrentIndex(nb); // xx
     336    if (nomDeLogiciel(k).getString() == selected) {
     337      cBox->setCurrentIndex(cBox->count()-1);
     338    }
     339  }
    333340  cBox->refresh();
    334341}
Note: See TracChangeset for help on using the changeset viewer.