Index: /Interface_Web/trunk/pspaWT/History
===================================================================
--- /Interface_Web/trunk/pspaWT/History	(revision 400)
+++ /Interface_Web/trunk/pspaWT/History	(revision 401)
@@ -6,14 +6,64 @@
      =========================================================
 
+27 Mars : Laurent Garnier
+- pspa.css : Ajout de styles pour divers containers (buttons...)
+- abstractElement.cc : Correction d'un bug dans setSoftware() qui ne mettait pas
+  le software a jour si celui ci était "unknow"
+- GWt_elementLigneFaisceau.cc : Correction d'un bug qui ne mettait pas à jour la 
+  couleur du sofware sur un chanegement
+- GWt_serverFileSelector,GWt_dialog : Améliorations de l'aspect visuel
+- GWt_sectionToExecute.cc : Mise en application des comboBox
+- GWt_pspaApplication.cc : Correction d'un bug qui ne remettait pas a jour les sections
+  lors de l'effacement des composants
+- GWt_softwarePanel.cc : Mise en place des comboBox et suppression des dialogBox
+
 24 mars 2013 : Guy Le Meur
 -supprimé des sorties inutiles dans l	a fenêtre console
 -localisation du fichier de sortie de parmela, parmout, dans workingarea 
 
+22 Mars : Laurent Garnier
+- GWt_sectionToExecute : Amélioration du layout
+- GWt_softwarePanel : Suppression de la version avec les lineEdit
+- Améliorations de l'interface graphique
+- Restructuration de la console
+- Remise en ordre des éléments de la barre d'icone à gauche
+- Toujours quelques problemes à regler sur les comboBox
+
+20 Mars : Laurent Garnier
+- GWt_LigneFaisceau : renommage
+- GWt_softwarePanel : Preparation des ComboBox
+- GWt_sectionToExecute : Ajout de qq méthodes pour manipuler les ComboBox
+
 18 mars : Francois Touze
 - GWt_pspaApplication : utilise/modifie chartPlot2vec pour le tracé des histogrammes (unification des tracés)
+
+
+13 Mars : Laurent Garnier
+- Etape 2 ok, test ok
+
+13 Mars : Laurent Garnier
+- dataManager: ajout clearSectionToExecute(int), getJobListAt(int), getJobListSize() functions
+- sectionToExecute : renommage
+- GWt_softwarePanel : Changements pour ne plus passer par la structure "selectedSections" et
+  passer par le vecteur de sections. Toutes les infos sont également cherchées directement dans 
+  la jobList du dataManager
 
 12 mars : Guy Le Meur
 -softwareXXX : changé l'indexation ders éléments pour tenir compte des éléments ignorés par les softwares.
 -dataManager : création d'une méthode getDiagnosticBeam(string elementLabel);
+
+12 Mars : Laurent Garnier
+- dataManager:
+  o ajout de paramètres à la méthode addSectionToExecute() en vue de se débarraser des index.
+  Mieux vaut passer par des elements abstraits plus simples à gérer.
+  o executeAll() : récupérations des éléments de la sections avec de nouvelles méthodes.
+  o Déplacement de createSoftwareConnexion() en "public"
+- sectionToExecute : Cette structure est désormais une classe avec toutes les méthodes qui vont avec.
+  Dans une étape intermédiare, j'ai laissé les index début et fin, mais ils devront êtres supprimés
+  au profil des abstractElements.
+- GWt_LigneFaisceau : Ajout d'une méthode getAbstractElementIndexFromLabel(string)
+- GWt_softwarePanel : Modifications pour attraper les bons éléments
+
+abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, abstractSoftware* prog)
 
 11 Mars : Laurent Garnier
Index: /Interface_Web/trunk/pspaWT/htdocs/pspa.css
===================================================================
--- /Interface_Web/trunk/pspaWT/htdocs/pspa.css	(revision 400)
+++ /Interface_Web/trunk/pspaWT/htdocs/pspa.css	(revision 401)
@@ -8,5 +8,5 @@
 
 #Wt-btn {
-   background-repeat: no;
+   background-repeat: no-repeat;
 }
 
@@ -145,5 +145,5 @@
 .beamLineElementActions .parameters {
     background-image: url("advanced.png");
-    background-repeat: no;
+    background-repeat: no-repeat;
     display: inline;
 }
@@ -151,5 +151,5 @@
 .beamLineElementActions .trash {
     background-image: url("trash.png");
-    background-repeat: no;
+    background-repeat: no-repeat;
     display: inline;
 }
@@ -180,4 +180,23 @@
 }
 
+.warningsContainer {
+    background-image: url("warning20_20.png");
+    border: 2px solid #FFDD88;
+    background-repeat: no-repeat;
+    padding: 0px 25px;
+}
+
+.errorsContainer {
+    background-image: url("error20_20.png");
+    border: 2px solid #FF0000;
+    background-repeat: no-repeat;
+    padding: 0px 25px;
+}
+
+.roundButton {
+    border: 1px solid #BBBBBB;
+    border-radius: 0.7em 0.7em 0.7em 0.7em;
+}
+
 *|*:-moz-any-link:not(svg|a) {
     text-decoration: underline;
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 401)
@@ -31,5 +31,5 @@
   particleBeam* getDiagnosticBeam(string elementLabel);
 
-  void addSectionToExecute(int debut, int fin, nomDeLogiciel prog);
+  void addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, abstractSoftware* prog);
 
     abstractElement* addElement(typedElement elemType);
@@ -65,4 +65,11 @@
     bool restoreElements(string inputFileName);
     
+    abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
+    
+    /** return the jobList size
+     */
+    inline int getJobListSize() {
+        return jobList_.size();
+    }
 
     // si newBeam = true, on cree un nouveau diag
@@ -76,4 +83,15 @@
     }
 
+    /** return a specific jobList index
+     return NULL if the index does not exist
+     */
+    inline sectionToExecute* getJobListAt(int a) {
+        if (a < 0) return NULL;
+        if (a >= getJobListSize()) return NULL;
+        return jobList_[a];
+    }
+    
+    /** Clear a specific jobList */
+    void clearSectionToExecute(int a);
     
 private:
@@ -93,5 +111,4 @@
     void removeFile(string nameOfFile);
     void clearSectionToExecute();
-    abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
  
   };
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h	(revision 401)
@@ -19,5 +19,5 @@
   };
 
-
+    
  private:
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h	(revision 401)
@@ -3,11 +3,46 @@
 
 #include "nomDeLogiciel.h"
+#include "abstractElement.h"
+#include "abstractSoftware.h"
 
-typedef struct  
+class sectionToExecute
 {
-  unsigned firstElement;  // numero premier element
-  unsigned lastElement;   // numero dernier element
-  nomDeLogiciel software;
-}  sectionToExecute;
+    public :
+    sectionToExecute(abstractElement*, abstractElement*, abstractSoftware*);
+
+    /** Deprecated : To be removed ! */
+    sectionToExecute(abstractElement*, int, abstractElement*, int, abstractSoftware*);
+    ~sectionToExecute() {;}
+
+    inline abstractElement* getFirstElement() {
+        return firstElement;
+    }
+    
+    inline abstractElement* getLastElement() {
+        return lastElement;
+    }
+    
+    /** Deprecated : To be removed ! */
+    inline int getElementNumberInSection() {
+        return firstElementNumberInBeamLine;
+    }
+    
+    /** Deprecated : To be removed ! */
+    inline int getLastElementNumberInSection()  {
+        return lastElementNumberInBeamLine;
+    }
+    inline abstractSoftware* getSoftware() {
+        return software;
+    }
+    
+    private :
+    abstractElement*  firstElement;
+    abstractElement*  lastElement;
+
+    int firstElementNumberInBeamLine;
+    int lastElementNumberInBeamLine;
+    
+    abstractSoftware* software;
+};
 
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc	(revision 401)
@@ -117,5 +117,9 @@
   }
   
-  if ((tb == TBoolOk) || (tb == TBoolIgnore)) {
+  if (prog == nomDeLogiciel::unknownSoftware){
+    tb = TBoolOk;
+  }
+    
+          if ((tb == TBoolOk) || (tb == TBoolIgnore)) {
     if (prog == nomDeLogiciel::parmela) {
       abstractSoftware_ = new softwareParmela();
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 401)
@@ -64,10 +64,7 @@
 }
 
-void dataManager::addSectionToExecute(int debut, int fin, nomDeLogiciel prog)
-{
-    jobList_.push_back(new sectionToExecute);
-    jobList_.back()->firstElement = debut;
-    jobList_.back()->lastElement = fin;
-    jobList_.back()->software  = prog;
+void dataManager::addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, abstractSoftware* prog)
+{
+    jobList_.push_back(new sectionToExecute(debut, debutIndex, fin, finIndex, prog));
 }
 
@@ -77,7 +74,14 @@
     for(k = 0; k < jobList_.size(); k++)
     {
-        if ( jobList_[k] != NULL ) delete jobList_[k];
+        if ( jobList_[k] != NULL ) clearSectionToExecute(k);
     }
     jobList_.clear();
+}
+
+
+void dataManager::clearSectionToExecute(int a) {
+  if (a<0) return;
+  if (a>= jobList_.size()) return;
+  delete jobList_[a];
 }
 
@@ -123,16 +127,16 @@
   for(unsigned k = 0; k < jobList_.size(); k++)
     {
-      cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl;
-      
-      int debut = jobList_[k]->firstElement;
-      int fin = jobList_[k]->lastElement;
-      softw = createSoftwareConnexion(jobList_[k]->software);
+      cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl;
+      
+      int debut = jobList_[k]->getElementNumberInSection();
+      int fin = jobList_[k]->getLastElementNumberInSection();
+      softw = jobList_[k]->getSoftware();
       
       if (softw == NULL) {
-	success = false;
-	consoleMessage("dataManager::executeAll : unknown software");
-	break;
-      }
-        
+        success = false;
+        consoleMessage("dataManager::executeAll : unknown software");
+        break;
+      }
+      
       success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
       if ( success ) {
@@ -141,6 +145,12 @@
 	  success = softw->buildBeamAfterElements(workingDir);
 	}
-      }
-        
+//=======
+//        success = softw->execute(debut,fin,workingDir);
+//        if ( success ) {
+//          success = softw->buildBeamAfterElements(debut,fin,diagnosticBeam_,workingDir);
+//        }
+//>>>>>>> .merge-right.r400
+      }
+      
       delete softw;
       if ( success ) {
@@ -306,4 +316,5 @@
 }
 
+
 abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi)
 {
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc	(revision 401)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc	(revision 401)
@@ -0,0 +1,19 @@
+#include "sectionToExecute.h"
+
+
+sectionToExecute::sectionToExecute(abstractElement* f, abstractElement* l , abstractSoftware* s) {
+    firstElement = f;
+    lastElement =l;
+    software = s;
+}
+
+
+sectionToExecute::sectionToExecute(abstractElement* f, int fI, abstractElement* l , int lI, abstractSoftware* s) {
+    firstElement = f;
+    lastElement =l;
+
+    firstElementNumberInBeamLine = fI;
+    lastElementNumberInBeamLine =lI;
+
+    software = s;
+}
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_console.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_console.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_console.h	(revision 401)
@@ -15,7 +15,9 @@
     
 public:
-    GWt_console();
-    virtual ~GWt_console();
-    void addConsoleMessage(WString msg);
+  GWt_console();
+  virtual ~GWt_console();
+  void addConsoleMessage(WString msg);
+private:
+  WText* output_;
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dialog.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dialog.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dialog.h	(revision 401)
@@ -38,4 +38,11 @@
      */
     GWt_dialog(WString titre, WString message, iconType icon=NoIcon, bool modal=false, bool okButton=false);
+
+    /** Add a v content to this widget
+    */
+    void addVContent(WContainerWidget* wc);
+    
+    private :
+    WVBoxLayout* vDialogLayout_;
 };
 #endif
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h	(revision 401)
@@ -54,4 +54,10 @@
      */
     abstractElement* getAbstractElement(int i);
+
+    /** return the index of the abstract element 
+     @param : label of this abstractElement in the beam line
+     */
+    int getAbstractElementIndexFromLabel(std::string str);
+
     //    void restoreElementCollectionFromDataManager();
     void clickEvent(WContainerWidget*);
@@ -75,4 +81,6 @@
     void update(int);
 
+    void initializeSoftwares();
+
     private :
     void manageLineFaisceauLayout();
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 401)
@@ -65,5 +65,5 @@
   WText* createTitle(const WString&);
   WWidget* createPalette();
-  void createBeamLine();
+  WWidget* createBeamLine();
   WWidget* createGlobalParamWidget();
   WWidget* createExecuteWidget();
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h	(revision 401)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h	(revision 401)
@@ -0,0 +1,69 @@
+#ifndef GWT_SECTIONTOEXECUTE_SEEN
+#define GWT_SECTIONTOEXECUTE_SEEN
+
+#include <Wt/WContainerWidget>
+#include <Wt/WComboBox>
+#include <Wt/WText>
+
+class GWt_softwarePanel;
+
+class GWt_sectionToExecute : public Wt::WContainerWidget
+{
+    public :
+    GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,GWt_softwarePanel* sPanel);
+
+    ~GWt_sectionToExecute() {;}
+
+    inline Wt::WString getFirstElementCurrentText() {
+        return firstElement->currentText();
+    }
+    
+    inline Wt::WString getLastElementCurrentText() {
+        return lastElement->currentText();
+    }
+    
+    inline Wt::WString getSoftwareCurrentText() {
+        return software->currentText();
+    }
+    
+    inline Wt::WComboBox * getFirstElement() {
+        return firstElement;
+    }
+    
+    inline Wt::WComboBox * getLastElement() {
+        return lastElement;
+    }
+    
+    inline Wt::WComboBox * getSoftware() {
+        return software;
+    }
+    void setFirstElementCurrentSelection(Wt::WString);
+    void setLastElementCurrentSelection(Wt::WString);
+    void setSoftwareElementCurrentSelection(Wt::WString);
+    
+    inline void setWarnings(Wt::WString warn){
+        warningsLabel_->setText(warn);
+        manageWarningsAndErrors();
+    }
+
+    inline void setErrors(Wt::WString err){
+        errorsLabel_->setText(err);
+        manageWarningsAndErrors();
+    }
+
+    private :
+    
+    void manageWarningsAndErrors();
+    Wt::WComboBox*  firstElement;
+    Wt::WComboBox*  lastElement;
+    Wt::WComboBox* software;
+    GWt_softwarePanel* softwarePanel;
+
+    Wt::WText* errorsLabel_;
+    Wt::WText* warningsLabel_;
+
+    Wt::WContainerWidget* warningsContainer_;
+    Wt::WContainerWidget* errorsContainer_;
+};
+
+#endif
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h	(revision 401)
@@ -13,5 +13,5 @@
 #include <Wt/WContainerWidget>
 #include <Wt/WPushButton>
-
+#include "GWt_sectionToExecute.h"
 #include "dataManager.h"
 
@@ -23,11 +23,4 @@
 class GWt_softwarePanel  : public WContainerWidget
 {
-    typedef struct {
-        WLineEdit* debut;
-        WLineEdit*  fin;
-        WComboBox* selection;
-        WContainerWidget* ligneDeWidget;
-    } GWt_sectionToExecute;
-
     public :
     GWt_softwarePanel(dataManager*, PspaApplication*);
@@ -35,5 +28,5 @@
 
     void addSectionToExecuteW();
-    void updateSelections();
+    void updateSections();
     
     private :
@@ -45,6 +38,8 @@
     void executer();
     bool areDataCoherent();
-    
-    list<GWt_sectionToExecute*> selectedSections_;
+    void fillComboWithElements(Wt::WComboBox* cBox);
+    void fillComboWithSoftwares(Wt::WComboBox* cBox);
+    Wt::WContainerWidget* createAddDeletePushButtons();
+
     dataManager* dtmanage_;
     WPushButton *exec_go_;
@@ -52,4 +47,5 @@
     PspaApplication* pspa_;
 
+    std::vector <GWt_sectionToExecute*> sections;
 };
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElementFactory.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElementFactory.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElementFactory.cc	(revision 401)
@@ -99,9 +99,12 @@
 {
   vector <GWt_abstractElement*> elems;
-  if (isDriftElementEnable) {
-    elems.push_back(new GWt_drift());
+  if (isRFGunElementEnable) {
+    elems.push_back(new GWt_rfgun());
   }
   if (isBeamElementEnable) {
     elems.push_back(new GWt_beam());
+  }
+  if (isDriftElementEnable) {
+    elems.push_back(new GWt_drift());
   }
   if (isBendElementEnable) {
@@ -111,12 +114,9 @@
     elems.push_back(new GWt_cell());
   }
+  if (isSolenoElementEnable) {
+    elems.push_back(new GWt_soleno());
+  }
   if (isFitElementEnable) {
     elems.push_back(new GWt_fit());
-  }
-  if (isRFGunElementEnable) {
-    elems.push_back(new GWt_rfgun());
-  }
-  if (isSolenoElementEnable) {
-    elems.push_back(new GWt_soleno());
   }
   if (isSnapshotElementEnable) {
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc	(revision 401)
@@ -3,4 +3,8 @@
 #include <Wt/WApplication>
 #include <Wt/WText>
+#include <Wt/WBorder>
+#include <Wt/WLayout>
+#include <Wt/WPanel>
+#include <Wt/WScrollArea>
 
 GWt_console::GWt_console()
@@ -8,4 +12,21 @@
 {
     setObjectName("console");
+
+    // le panel
+    WPanel *panelConsole = new WPanel(this);
+    WScrollArea* container = new  WScrollArea();
+    
+    panelConsole->setTitle(" output");
+    output_ = new WText(this);
+    output_->setTextFormat(PlainText);
+    output_->setInline(false);
+
+    container->setWidget(output_);
+
+    panelConsole->setCentralWidget(container);
+    output_->setMinimumSize(270,100);
+    output_->setMaximumSize(400,400);
+
+
 }
 
@@ -18,14 +39,11 @@
 void GWt_console::addConsoleMessage(WString msg) {
     
-    WText *w = new WText(this);
-    w->setTextFormat(PlainText);
-    w->setText(msg);
-    w->setInline(false);
+    output_->setText(output_->text()+msg);
     
     /*
      * Little javascript trick to make sure we scroll along with new content
      */
-    wApp->doJavaScript(this->jsRef() + ".scrollTop += "
-                       + this->jsRef() + ".scrollHeight;");
+    wApp->doJavaScript(output_->jsRef() + ".scrollTop += "
+                       + output_->jsRef() + ".scrollHeight;");
     
 }
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dialog.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dialog.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dialog.cc	(revision 401)
@@ -3,4 +3,5 @@
 #include <Wt/WText>
 #include <Wt/WBreak>
+#include <Wt/WVBoxLayout>
 #include <Wt/WHBoxLayout>
 #include <Wt/WPushButton>
@@ -19,13 +20,16 @@
     titleBar()->decorationStyle().setBackgroundColor (WColor(70,180,220));
     
-    if (wc != NULL) {
-        WContainerWidget* widgt = new WContainerWidget(contents());
-        WHBoxLayout* hLayout = new WHBoxLayout();
-        hLayout->addWidget(wc);
-        widgt->setLayout(hLayout);
-    }
+    WContainerWidget* widgt = new WContainerWidget(contents());
+    vDialogLayout_ = new WVBoxLayout();
+    widgt->setLayout(vDialogLayout_);
     
     setClosable(true);
     setModal (modal);
+    setResizable(true);
+    show();
+    
+    if (wc != NULL) {
+        addVContent(wc);
+    }
 }
 
@@ -111,3 +115,10 @@
 
 
+void GWt_dialog::addVContent(WContainerWidget* wc) {
 
+    if (vDialogLayout_) {
+        vDialogLayout_->addWidget(wc);
+    }
+}
+
+
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc	(revision 401)
@@ -18,5 +18,4 @@
 #include <Wt/WSignalMapper>
 #include <Wt/WText>
-#include <Wt/WImage>
 #include <Wt/WHBoxLayout>
 #include <Wt/WGridLayout>
@@ -210,4 +209,9 @@
       setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getColor()));
       softwareName_->setText(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getName());
+
+    // no abstract software
+    } else {
+      setBGColor(WColor("#FFFFFF"));
+      softwareName_->setText("");
     }
   }
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc	(revision 401)
@@ -18,5 +18,4 @@
     pspa_ = ps;
     WVBoxLayout* globLayout = new WVBoxLayout();
-    decorationStyle().setBackgroundColor (WColor("blue"));
     //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
     WContainerWidget *result = new WContainerWidget();
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc	(revision 401)
@@ -9,4 +9,5 @@
 #include "GWt_soleno.h"
 #include "GWt_bend.h"
+#include "nomDeLogiciel.h"
 
 #include "mixedTools.h"
@@ -24,10 +25,11 @@
   ligneFaisceauLayout_ = new WHBoxLayout();
   //  decorationStyle().setBackgroundColor (WColor(245,245,245));
-  setLayout(ligneFaisceauLayout_);
   ligneFaisceauLayout_->setContentsMargins(0,0,0,0);
   ligneFaisceauLayout_->setSpacing(0);
   
+  setLayout(ligneFaisceauLayout_);
+
   // set the object name
-  setObjectName("ligneFaisceau");  
+  setObjectName("ligneFaisceau");
   clear();
 }
@@ -157,5 +159,5 @@
   }
   
-  pspa_->getExecuteWidget()->updateSelections();
+  pspa_->getExecuteWidget()->updateSections();
 }
 
@@ -203,6 +205,4 @@
     }
     
-    // first if 1
-    //    i--;
     for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
         if (ligneFaisceauLayout_->itemAt(a)) {
@@ -222,4 +222,28 @@
 
 
+int GWt_LigneFaisceau::getAbstractElementIndexFromLabel(std::string txt){
+    int index = 0;
+    if (txt == "") {
+        return NULL;
+    }
+    
+    for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
+        if (ligneFaisceauLayout_->itemAt(a)) {
+            
+            if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
+                if (elem->getGWt_AbstractElement()) {
+                    if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) {
+                        return index;
+                    }
+                }
+                index ++;
+            }
+        }
+    }
+    return NULL;
+    
+}
+
+
 int GWt_LigneFaisceau::getBeamLineSize() {
   int count = 0;
@@ -260,2 +284,12 @@
 }
 
+
+void GWt_LigneFaisceau::initializeSoftwares(){
+    
+  vector <abstractElement*> elems = getAllAbstractElements();
+    for (int a=0; a< elems.size(); a++) {
+        elems[a]->setSoftware(nomDeLogiciel::unknownSoftware);
+    }
+}
+
+
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 401)
@@ -77,7 +77,7 @@
   
   /*
-   * The main layout is a 3x2 grid layout.
+   * The main layout is a 4x3 grid layout.
    */
-  WGridLayout *layout = new WGridLayout();
+  WGridLayout *mainGridLayout = new WGridLayout();
   //  layout->addWidget(createTitle("<a href='workingArea/parmin'> Menu (In future)</a>"), 0, 0, 1, 2);
   //  layout->addWidget(createTitle("Menu (In future)"), 0, 0, 1, 2);
@@ -131,15 +131,17 @@
   toolbarLayout->addWidget(new WText("") , 1,Wt::AlignMiddle);
   
-  WContainerWidget * layoutContainer = new WContainerWidget();
-  layoutContainer->setLayout(toolbarLayout);
-  layoutContainer->decorationStyle().setBackgroundImage ("/htdocs/fond_toolbar.png");
-  layout->addWidget(layoutContainer, 1, 0, 1, 2);
-  layout->addWidget(createPalette(), 2, 0, 4, 1);
-  
-  createBeamLine();
+  WContainerWidget * toolbarLayoutContainer = new WContainerWidget();
+  toolbarLayoutContainer->setLayout(toolbarLayout);
+  toolbarLayoutContainer->decorationStyle().setBackgroundImage ("/htdocs/fond_toolbar.png");
+    
+  mainGridLayout->addWidget(toolbarLayoutContainer, 1, 0, 1, 3);
+  mainGridLayout->addWidget(createPalette(), 2, 0, 4, 1);
+
   
   WScrollArea* scroll = new  WScrollArea();
-  scroll->setWidget(beamLine_);
-  layout->addWidget(scroll, 2, 1, 1, 1);
+  scroll->setWidget(createBeamLine());
+  scroll->setMinimumSize(300,150);
+
+  mainGridLayout->addWidget(scroll, 2, 1, 1, 2);
   
   
@@ -151,12 +153,4 @@
   // console_->setOverflow(WContainerWidget::OverflowAuto);
   
-  
-  console_ = new GWt_console();
-  console_->clear();
-  console_->decorationStyle().setBackgroundColor (WColor("lightgray"));
-  console_->setMaximumSize(600,200);
-  console_->setMinimumSize(300,100);
-  console_->setOverflow(WContainerWidget::OverflowAuto);
-  layout->addWidget(console_, 3, 2);
   
   //-----------
@@ -171,18 +165,29 @@
   executeWidget_ = new GWt_softwarePanel(dtmanage_,this);
   
-  layout->addWidget( globalParam_, 3, 1);
+  mainGridLayout->addWidget( globalParam_, 3, 1);
   //  layout->addWidget( leDessin_, 3, 2);
-  layout->addWidget( executeWidget_ , 4, 1);
+  mainGridLayout->addWidget( executeWidget_ , 4, 1);
   //-----------
   
-  layout->setColumnResizable(1);
-  layout->setRowResizable(2);
+  console_ = new GWt_console();
+
+  // manage sizes
+  console_->setMinimumSize(300,100);
+  executeWidget_->setMinimumSize(400,100);
+
+  mainGridLayout->addWidget(console_, 3, 2,2,1);
+  
+  
   /*
    * Let row 2 and column 1 take the excess space.
    */
-  layout->setRowStretch(2, 1);
-  layout->setColumnStretch(1, 1);
-  
-  widroot->setLayout(layout);
+  mainGridLayout->setRowStretch(4, 1);
+  mainGridLayout->setColumnStretch(2, 1);
+  
+  widroot->setLayout(mainGridLayout);
+
+  // set auto scrollbar if needed
+  widroot->setOverflow(WContainerWidget::OverflowAuto);
+
 }
 
@@ -210,5 +215,5 @@
 }
 
-void PspaApplication::createBeamLine()
+Wt::WWidget* PspaApplication::createBeamLine()
 {
   extensionFile_= 0;
@@ -220,4 +225,6 @@
   beamLine_->setMinimumSize(300,100);
   setTitle(applicationDefaultTitle_);
+
+  return beamLine_;
 }
 
@@ -225,6 +232,4 @@
 {
     WContainerWidget* globalParam = new GWt_globalParameters(this);
-    globalParam->setMaximumSize(600,150);
-    globalParam->setMinimumSize(600,150);
     return globalParam;
 }
@@ -980,4 +985,5 @@
 void PspaApplication::removeBeamLine() {
   createBeamLine();
+  executeWidget_->updateSections();
 }
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc	(revision 401)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc	(revision 401)
@@ -0,0 +1,136 @@
+#include <Wt/WText>
+#include <Wt/WVBoxLayout>
+#include <Wt/WHBoxLayout>
+#include <Wt/WGridLayout>
+#include <Wt/WContainerWidget>
+#include <Wt/WImage>
+
+#include "GWt_sectionToExecute.h"
+#include "GWt_softwarePanel.h"
+
+GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,GWt_softwarePanel* sPanel)
+:WContainerWidget(),
+firstElement(first),
+lastElement(last),
+software(soft),
+softwarePanel(sPanel)
+{
+    Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
+    mainContainerLayout->setContentsMargins(0,0,0,0);
+
+    Wt::WContainerWidget* labelAndComboContainer = new Wt::WContainerWidget();
+    Wt::WVBoxLayout* labelAndComboContainerLayout = new Wt::WVBoxLayout();
+    labelAndComboContainerLayout->setContentsMargins(0,0,0,0);
+
+    Wt::WContainerWidget* labelAndComboInsideContainer = new Wt::WContainerWidget();
+    Wt::WHBoxLayout* labelAndComboInsideContainerLayout = new Wt::WHBoxLayout();
+    labelAndComboInsideContainerLayout->setContentsMargins(0,0,0,0);
+    
+    labelAndComboInsideContainerLayout->addWidget(new Wt::WText("from&nbsp;:&nbsp;"));
+    labelAndComboInsideContainerLayout->addWidget(first);
+    labelAndComboInsideContainerLayout->addWidget(new Wt::WText("to&nbsp;:&nbsp;"));
+    labelAndComboInsideContainerLayout->addWidget(last);
+    labelAndComboInsideContainerLayout->addWidget(soft);
+
+    labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout);
+
+    labelAndComboContainerLayout->addWidget(labelAndComboInsideContainer);
+    labelAndComboContainerLayout->addStretch (10);
+    
+    labelAndComboContainer->setLayout(labelAndComboContainerLayout);
+    
+            
+    // add errors and warning layout
+    warningsContainer_ = new Wt::WContainerWidget();
+    errorsContainer_ = new Wt::WContainerWidget();
+
+    Wt::WContainerWidget* warningsAndErrorsContainer = new Wt::WContainerWidget();
+    Wt::WVBoxLayout* vWarningsAndErrorsLayoutContainer = new Wt::WVBoxLayout();
+    
+    Wt::WHBoxLayout* hLayoutContainerWarnings = new Wt::WHBoxLayout();
+    Wt::WHBoxLayout* hLayoutContainerErrors = new Wt::WHBoxLayout();
+
+    
+    warningsLabel_ = new Wt::WText("",XHTMLText);
+    errorsLabel_ = new Wt::WText("",XHTMLText);
+    hLayoutContainerWarnings->addWidget(warningsLabel_);
+    hLayoutContainerErrors->addWidget(errorsLabel_);
+
+    warningsAndErrorsContainer->addWidget(warningsLabel_);
+    warningsAndErrorsContainer->addWidget(errorsLabel_);
+    
+    
+    // set Layouts
+    warningsContainer_->setLayout(hLayoutContainerWarnings);
+    errorsContainer_->setLayout(hLayoutContainerErrors);
+    
+    vWarningsAndErrorsLayoutContainer->addWidget(errorsContainer_);
+    vWarningsAndErrorsLayoutContainer->addWidget(warningsContainer_);
+    vWarningsAndErrorsLayoutContainer->addStretch (100);
+
+    warningsAndErrorsContainer->setLayout(vWarningsAndErrorsLayoutContainer);
+
+    // add label and Combo containers
+    mainContainerLayout->addWidget(labelAndComboContainer,0,0);
+    // add warnings and errors containers
+    mainContainerLayout->addWidget(warningsAndErrorsContainer,1,0);
+
+    // manage margins
+    vWarningsAndErrorsLayoutContainer->setContentsMargins(20,0,0,0);
+    hLayoutContainerWarnings->setContentsMargins(0,0,0,0);
+    hLayoutContainerErrors->setContentsMargins(0,0,0,0);
+
+    setLayout(mainContainerLayout);
+    warningsContainer_->setStyleClass("warningsContainer");
+    errorsContainer_->setStyleClass("errorsContainer");
+
+    
+    firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
+    lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
+    software->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections);
+
+    manageWarningsAndErrors();
+}
+
+
+void GWt_sectionToExecute::setFirstElementCurrentSelection(Wt::WString txt){
+    for (int a=0; a< firstElement->count(); a++) {
+        if (firstElement->itemText(a) == txt) {
+            firstElement->setCurrentIndex (a);
+            return;
+        }
+    }
+}
+
+void GWt_sectionToExecute::setLastElementCurrentSelection(Wt::WString txt){
+    for (int a=0; a< lastElement->count(); a++) {
+        if (lastElement->itemText(a) == txt) {
+            lastElement->setCurrentIndex (a);
+            return;
+        }
+    }
+}
+
+void GWt_sectionToExecute::setSoftwareElementCurrentSelection(Wt::WString txt){
+  for (int a=0; a< software->count(); a++) {
+    if (software->itemText(a) == txt) {
+      software->setCurrentIndex (a);
+      return;
+    }
+  }
+}
+
+
+void GWt_sectionToExecute::manageWarningsAndErrors(){
+    if (warningsLabel_->text() == "") {
+        warningsContainer_->hide();
+    } else {
+        warningsContainer_->show();
+    }
+    if (errorsLabel_->text() == "") {
+        errorsContainer_->hide();
+    } else {
+        errorsContainer_->show();
+    }
+
+}
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc	(revision 401)
@@ -70,5 +70,4 @@
     WContainerWidget *buttonContainer = new WContainerWidget();
     WHBoxLayout* hButtonLayout = new WHBoxLayout();
-    buttonContainer->setLayout(hButtonLayout);
     
     WPushButton *annule = new WPushButton("cancel");
@@ -80,13 +79,14 @@
     submit->clicked().connect(this, &Wt::WDialog::accept);
     
+    buttonContainer->setLayout(hButtonLayout);
 
-    // overload the container already present
+    // add the container already present
     
-    WContainerWidget* widgt = new WContainerWidget(contents());
-    WVBoxLayout* vLayout = new WVBoxLayout();
-    vLayout->addWidget(treeContainer);
-    vLayout->addWidget(buttonContainer);
-    widgt->setLayout(vLayout);
+    addVContent(treeContainer);
+    addVContent(buttonContainer);
     
+    treeContainer->resize(400,300);
+    treeContainer->setOverflow(WContainerWidget::OverflowAuto);
+
 }
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 400)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc	(revision 401)
@@ -12,4 +12,5 @@
 #include <Wt/WBreak>
 #include <Wt/WApplication>
+#include <Wt/WVBoxLayout>
 
 #include "GWt_softwarePanel.h"
@@ -17,4 +18,5 @@
 #include "GWt_console.h"
 #include "GWt_globalParameters.h"
+#include "GWt_sectionToExecute.h"
 
 
@@ -24,7 +26,5 @@
   dtmanage_ = dataManager;
   pspa_ = pspa;
-  setMaximumSize(600,150);
-  setMinimumSize(600,150);
-    
+  
   // bouton execute
   exec_go_ = new WPushButton("execute!");
@@ -33,11 +33,4 @@
   exec_go_->clicked().connect(this, &GWt_softwarePanel::executer);
   
-  // preparation du bouton add
-  WPushButton* exec_add = new WPushButton("add");
-  exec_add->clicked().connect(this, &GWt_softwarePanel::addSectionToExecuteW);
-    
-  // preparation du bouton delete
-  WPushButton* exec_delete = new WPushButton("delete");
-  exec_delete->clicked().connect(this, &GWt_softwarePanel::deleteSectionToExecuteW);
     
   // preparation du bouton push_ok
@@ -47,9 +40,7 @@
   // le panel
   WPanel *panelLogiciels = new WPanel(this);
-  panelLogiciels->setTitle(" sections of beam Line for executing softwares ");
+  panelLogiciels->setTitle(" sections of beam line for executing softwares ");
   
   contenuSections_ = new WContainerWidget();
-  contenuSections_->addWidget(exec_add);
-  contenuSections_->addWidget(exec_delete);
   //  contenuSections_->addWidget(exec_ok);
   contenuSections_->addWidget(exec_go_);
@@ -66,47 +57,81 @@
 void GWt_softwarePanel::addSectionToExecuteW()
 {    
-  //  disableSectionExecute();
-  
-  string premierText, dernierText;
-  if(selectedSections_.size() == 0) {
-    premierText = dtmanage_->getLabelFromElementNumero(1); 
-    dernierText = dtmanage_->getLabelFromElementNumero(dtmanage_->getBeamLineSize());
+  
+  abstractElement* premierElement;
+  abstractElement* dernierElement;
+
+  int premierIndex = 0;
+  int dernierIndex = 0;
+
+    // if this is the first section
+  if(dtmanage_->getJobListSize() == 0) {
+      premierElement = pspa_->getBeamLine()->getAbstractElement(0);
+      dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1);
+      premierIndex = 0;
+      dernierIndex = pspa_->getBeamLine()->getBeamLineSize()-1;
+
+  // if this is not the first :
+  // - first element will be the last of the previous section
+  // (or the same if it is the last of the beam line)
+  // - lastElement will be the last of the beam line
+  // - software will be the first of the list
+      
   } else {
-    dernierText = selectedSections_.back()->fin->text().toUTF8();
-    int dernierNumero = dtmanage_->getNumeroFromElementLabel(dernierText);
-    dernierNumero++;
-    if ( dernierNumero <= dtmanage_->getBeamLineSize() ) {
-      premierText = dtmanage_->getLabelFromElementNumero(dernierNumero);
+    int indexOfLastElementOfLastSection = dtmanage_->getJobListAt(dtmanage_->getJobListSize()-1)->getLastElementNumberInSection();
+    if (pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1) != NULL ) {
+      premierIndex = indexOfLastElementOfLastSection+1;
+      premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection+1);
     } else {
-      premierText = dtmanage_->getLabelFromElementNumero(dtmanage_->getBeamLineSize());
+      premierIndex = indexOfLastElementOfLastSection;
+      premierElement = pspa_->getBeamLine()->getAbstractElement(indexOfLastElementOfLastSection);
+        
     }
-    dernierText = premierText;
+    dernierIndex = dtmanage_->getJobListSize()-1;
+    dernierElement = pspa_->getBeamLine()->getAbstractElement(pspa_->getBeamLine()->getBeamLineSize()-1);
   }
   
   //  cout << "PspaApplication::addSectionToExecute() : " << premierText << " ââ   " << dernierText << endl;
   
-  WContainerWidget* newSection = new WContainerWidget;
-    
-  selectedSections_.push_back(new GWt_sectionToExecute);
-  selectedSections_.back()->debut = new WLineEdit();
-  selectedSections_.back()->debut->setDisabled(true);
-  selectedSections_.back()->debut->setText(premierText);
-  selectedSections_.back()->fin = new WLineEdit();
-  //  selectedSections_.back()->fin->changed().connect(this,&GWt_softwarePanel::disableSectionExecute);
-  selectedSections_.back()->fin->setText(dernierText);
-  selectedSections_.back()->selection = new WComboBox();
-  selectedSections_.back()->ligneDeWidget = newSection;
-  newSection->addWidget(new WText(" from : "));
-  newSection->addWidget(selectedSections_.back()->debut);
-  newSection->addWidget(new WText(" to : "));
-  newSection->addWidget(selectedSections_.back()->fin);
-  newSection->addWidget(selectedSections_.back()->selection);
-  
-  contenuSections_->addWidget(newSection);
-  unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
-  unsigned k;
-  for(k = 0; k < nb; k++) {
-    selectedSections_.back()->selection->addItem(nomDeLogiciel(k).getString());
-  }
+  
+  abstractSoftware* soft = NULL;
+  dtmanage_->addSectionToExecute(premierElement,premierIndex, dernierElement, dernierIndex, soft);
+
+  std::string premierElementLabel = "";
+  std::string dernierElementLabel = "";
+  if (premierElement) {
+    premierElementLabel = premierElement->getLabel();
+  }
+
+  if (dernierElement) {
+    dernierElementLabel = dernierElement->getLabel();
+  }
+
+  WComboBox* lineFromCombo = new WComboBox();
+  WComboBox* lineToCombo = new WComboBox();
+  fillComboWithElements(lineFromCombo);
+  fillComboWithElements(lineToCombo);
+
+  WComboBox* softCombo = new WComboBox();
+  fillComboWithSoftwares(softCombo);
+
+  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,this);
+
+  // push back on sections vector
+  sections.push_back(newSection);
+
+  Wt::WContainerWidget* container = new Wt::WContainerWidget();
+  Wt::WGridLayout* containerLayout = new Wt::WGridLayout();
+  containerLayout->setContentsMargins(0,0,0,0);
+
+  // push back on User interface
+  containerLayout->addWidget(newSection,0,0);
+  
+  // add buttons
+  containerLayout->addWidget(createAddDeletePushButtons(),0,1);
+
+  container->setLayout(containerLayout);
+  
+  // add to sections
+  contenuSections_->addWidget(container);  
 }
 
@@ -206,41 +231,44 @@
 bool GWt_softwarePanel::updateSectionSelection()
 {
-  if ( selectedSections_.empty() ) return false;
+  if ( dtmanage_->getJobListSize() == 0 ) return false;
   
   // traitement de la premiere ligne
   // on impose le depart du calcul au premier element
   string premier = dtmanage_->getLabelFromElementNumero(1);
-  (*selectedSections_.begin())->debut->setText(premier);
-  
-  string currentString =  (*selectedSections_.begin())->fin->text().toUTF8();
-  int current = dtmanage_->getNumeroFromElementLabel(currentString);
-    
+  if (sections.size() > 0) {
+    sections[0]->setFirstElementCurrentSelection(premier);
+  }
+  
+  Wt::WString currentString =  sections[0]->getLastElementCurrentText();
+  int current = dtmanage_->getNumeroFromElementLabel(currentString.toUTF8());
+  
   // si la fin est mal definie on prend toute la config par defaut
   if ( current <= 0 || current > dtmanage_->getBeamLineSize() )
-    {
-      current = dtmanage_->getBeamLineSize();
-      currentString =  dtmanage_->getLabelFromElementNumero(current);
-      (*selectedSections_.begin())->fin->setText(currentString);
+  {
+    current = dtmanage_->getBeamLineSize();
+    currentString =  dtmanage_->getLabelFromElementNumero(current);
+    if (sections.size() > 0) {
+      sections[0]->setLastElementCurrentSelection(currentString);
+//...
     }
+  }
   current++;
   currentString = dtmanage_->getLabelFromElementNumero(current);
   
   // traitement des suivantes (on avance d'un cran dans la liste)
-  list<GWt_sectionToExecute*>::iterator itr, itr0;
-  itr0 = selectedSections_.begin();
-  itr0++;
-  for (itr = itr0; itr != selectedSections_.end(); itr++)
+  for (int a = 1; a< sections.size(); a++)
     {
       // debut
       if ( current > dtmanage_->getBeamLineSize() )
         {
-	  GWt_dialog warningDialog("PSPA :: verification des sections", " bad section definition !", GWt_dialog::Error,true,true);
+	  GWt_dialog warningDialog("PSPA :: verification des sections", " bad section definition 1 !", GWt_dialog::Error,true,true);
 	  warningDialog.exec();
 	  return false;
         }
       
-      (*itr)->debut->setText(currentString);
+      sections[a]->setFirstElementCurrentSelection(currentString);
+
       // fin
-      string finString =  (*itr)->fin->text().toUTF8();
+      string finString =  sections[a]->getLastElementCurrentText().toUTF8();
       
       int numeroFin = dtmanage_->getNumeroFromElementLabel( finString);
@@ -248,5 +276,5 @@
       if ( numeroFin < current || numeroFin > dtmanage_->getBeamLineSize())
         {
-	  GWt_dialog warningDialog("PSPA : Checking of sections", " bad section definition !", GWt_dialog::Error, true,true);
+	  GWt_dialog warningDialog("PSPA : Checking of sections", " bad section definition 2 !", GWt_dialog::Error, true,true);
 	  warningDialog.exec();
 	  return false;
@@ -258,4 +286,11 @@
     }
   //  exec_go_->setDisabled(false);
+
+  if (!areDataCoherent()) {
+    exec_go_->disable();
+  } else {
+    exec_go_->enable();
+  }
+
   return true;
 }
@@ -265,52 +300,60 @@
 {
   bool caMarche = true;
-  trivaluedBool tbResume = TBoolOk;
+
+  // initialize dataManager
   dtmanage_->initializeExecution();
-  string diagnostic;
-    
-  list<GWt_sectionToExecute*>::iterator itr;
-  for(itr = selectedSections_.begin(); itr != selectedSections_.end(); itr++)
-    {
-      string debString = (*itr)->debut->text().toUTF8();
-      string finString = (*itr)->fin->text().toUTF8();
-      
-      int debut = dtmanage_->getNumeroFromElementLabel(debString);
-      int fin = dtmanage_->getNumeroFromElementLabel(finString);
-      nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );
-      dtmanage_->addSectionToExecute(debut,fin,prog);
-        
-      // check sections
-      for (int i=debut-1; i<fin; i++) {
-	if (pspa_->getBeamLine()) {
-	  if (pspa_->getBeamLine()->getAbstractElement(i)) {
-	    trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
-	    if (tb  == TBoolError ) {
-	      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"\n ";
-	      caMarche = false;
-	      tbResume = tb;
-	    } else if ( tb == TBoolIgnore ) {
-	      diagnostic += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " will be ignored by  "+ prog.getString()+"\n ";
-	      if ( tbResume != TBoolError ) tbResume = tb;
-	    } else {
-	      pspa_->getBeamLine()->update(i);
-	    }
-	  }
-	}
+  
+  // intialize User Interface
+  if (pspa_->getBeamLine()) {
+    pspa_->getBeamLine()->initializeSoftwares();
+  }
+  
+  string diagnosticErrors;
+  string diagnosticWarnings;
+  
+  for (int a = 0; a< sections.size(); a++)
+  {
+    string debString = sections[a]->getFirstElementCurrentText().toUTF8();
+    string finString = sections[a]->getLastElementCurrentText().toUTF8();
+    
+    int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1
+    int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1
+    
+    nomDeLogiciel prog = nomDeLogiciel ( sections[a]->getSoftwareCurrentText().toUTF8());
+    dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut),
+                                   debut,
+                                   pspa_->getBeamLine()->getAbstractElement(fin),
+                                   fin,
+                                   dtmanage_->createSoftwareConnexion(prog));
+    
+    diagnosticErrors = "";
+    diagnosticWarnings = "";
+
+    // check sections
+    for (int i=debut-1; i<fin; i++) {
+      if (pspa_->getBeamLine()) {
+        if (pspa_->getBeamLine()->getAbstractElement(i)) {
+          trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
+          if (tb  == TBoolError ) {
+            diagnosticErrors += pspa_->getBeamLine()->getAbstractElement(i)->getLabel() + " is not allowed with "+ prog.getString()+"<br /> ";
+
+            caMarche = false;
+
+            // intialize thissoftware
+            pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(nomDeLogiciel::unknownSoftware);
+
+          } else if ( tb == TBoolIgnore ) {
+            diagnosticWarnings += pspa_->getBeamLine()->getAbstractElement(i)->getLabel() + " will be ignored by  "+ prog.getString()+"<br /> ";
+            
+
+          }
+          pspa_->getBeamLine()->update(i);
+        }
       }
     }
-
-  if ( tbResume == TBoolError ) {
-    GWt_dialog calculDialog("PSPA check execute : ERROR", diagnostic , GWt_dialog::Error,true,true);
-    calculDialog.exec();
-  } else if (tbResume == TBoolIgnore ) {
-    GWt_dialog calculDialog("PSPA check execute : WARNING", diagnostic , GWt_dialog::Warning,false,true);
-    calculDialog.exec();
-  }
-
-  /*
-    } else if ( essai == warning )  {
-    GWt_dialog calculDialog("PSPA check execute : warning ", diagnostic , GWt_dialog::Warning, false,true);
-    calculDialog.exec();
-  */
+    // set errors and warnings
+    sections[a]->setErrors(diagnosticErrors);
+    sections[a]->setWarnings(diagnosticWarnings);
+  }
     
   return caMarche;
@@ -319,28 +362,39 @@
 void GWt_softwarePanel::deleteSectionToExecuteW()
 {
-  if ( selectedSections_.empty() ) return;
-  //  disableSectionExecute();
-  selectedSections_.back()->ligneDeWidget->clear();
-  delete selectedSections_.back()->ligneDeWidget;
-  selectedSections_.pop_back();
-}
-
-
-void GWt_softwarePanel::updateSelections()
-{
-  string premierText, dernierText;
-  if ( selectedSections_.size() > 0 )
-    {
-      premierText = dtmanage_->getLabelFromElementNumero(1);
-      dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->getBeamLineSize() );
-      (*selectedSections_.begin())->debut->setText(premierText);
-      (*selectedSections_.begin())->fin->setText(dernierText);
-    }
-  
-  cout << "PspaApplication::updateSelections(): " << premierText << " ââ   " << dernierText << endl;
-}
-
-
-string GWt_softwarePanel::getSelection()
+  if ( dtmanage_->getJobListSize() == 0 ) return;
+  // delete from dataManager
+  dtmanage_->clearSectionToExecute(dtmanage_->getJobListSize()-1);
+
+  // delete from User Interface
+  sections.pop_back();
+}
+
+
+void GWt_softwarePanel::updateSections()
+{
+  // update all sections in order to manage new/deleted items
+  for (int a = 0; a< sections.size(); a++) {
+    fillComboWithElements(sections[a]->getFirstElement());
+    fillComboWithElements(sections[a]->getLastElement());
+  }
+  if (sections.size() == 0) {
+    return;
+  }
+  // the first element will always be the first element of the beamLine
+  sections[0]->getFirstElement()->setCurrentIndex(0);
+  
+  // the last element will always be the last element of the beamLine
+  sections[sections.size()-1]->getLastElement()->setCurrentIndex(sections[sections.size()-1]->getLastElement()->count());
+
+  // set default values
+
+  // update
+  updateSectionSelection();
+}
+
+
+
+/*
+ string GWt_softwarePanel::getSelection()
 {
   list<GWt_sectionToExecute*>::iterator itr = selectedSections_.begin();
@@ -348,19 +402,16 @@
   return str;
 }
-
+*/
 
 void GWt_softwarePanel::executer()
 {
 
-  if ( !updateSectionSelection() ) return;
-
-
-    if (!areDataCoherent()) {
-      //    GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true);
-      //    warningDialog.exec();
-      //    exec_go_->setDisabled(true);
+  if (!areDataCoherent()) {
+    //    GWt_dialog warningDialog("PSPA : verification des sections", " donnees incoherentes !", GWt_dialog::Error,true,true);
+    //    warningDialog.exec();
+    //    exec_go_->setDisabled(true);
     return;
-    }
-
+  }
+  
   // GWt_console* console = NULL;
   // if (static_cast<GWt_console*> (wApp->findWidget ("console"))) {
@@ -385,2 +436,67 @@
   pspa_->faireDessin();
 }
+
+
+void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) {
+  if (cBox == NULL) return;
+
+  // get the last item selected
+  WString selectedString = cBox->currentText ();
+  cBox->clear();
+
+  for (int a=0; a< pspa_->getBeamLine()->getBeamLineSize(); a++) {
+    abstractElement* abs = pspa_->getBeamLine()->getAbstractElement(a);
+    if (abs != NULL){
+      cBox->addItem(abs->getLabel());
+    }
+  }
+  
+  for (int a=0; a<cBox->count(); a++) {
+    if (cBox->itemText (a) == selectedString) {
+      cBox->setCurrentIndex(a);
+    }
+  }
+}
+
+
+void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox) {
+  if (cBox == NULL) return;
+  cBox->clear();
+
+  unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
+  unsigned k;
+  for(k = 0; k < nb; k++) {
+    cBox->addItem(nomDeLogiciel(k).getString());
+  }
+  
+}
+
+
+Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons() {
+
+  WContainerWidget* buttonContainer= new WContainerWidget();
+  
+  Wt::WHBoxLayout* buttonContainerLayout = new Wt::WHBoxLayout();
+  buttonContainerLayout->setContentsMargins(0,0,0,0);
+  // preparation du bouton add
+  WPushButton* exec_add = new WPushButton("+");
+  exec_add->clicked().connect(this, &GWt_softwarePanel::addSectionToExecuteW);
+  exec_add->setStyleClass("roundButton");
+  exec_add->setMaximumSize(20,20);
+  exec_add->setToolTip("Add new section");
+  
+  // preparation du bouton delete
+  WPushButton* exec_delete = new WPushButton("-");
+  //  warningsContainer_->setStyleClass("warningsContainer");
+  exec_delete->clicked().connect(this, &GWt_softwarePanel::deleteSectionToExecuteW);
+  exec_delete->setStyleClass("roundButton");
+  exec_delete->setMaximumSize(20,20);
+  exec_add->setToolTip("Remove this section");
+
+  buttonContainerLayout->addWidget(exec_add);
+  buttonContainerLayout->addWidget(exec_delete);
+
+  buttonContainer->setLayout(buttonContainerLayout);
+
+  return buttonContainer;
+}
