Index: Interface_Web/trunk/pspaWT/include/GWt_dropZoneLigneFaisceau.h
===================================================================
--- Interface_Web/trunk/pspaWT/include/GWt_dropZoneLigneFaisceau.h	(revision 249)
+++ Interface_Web/trunk/pspaWT/include/GWt_dropZoneLigneFaisceau.h	(revision 249)
@@ -0,0 +1,26 @@
+#ifndef GWT_DROPZONELIGNEFAISEAU_SEEN
+#define GWT_DROPZONELIGNEFAISEAU_SEEN
+
+#include "GWt_dropZoneLigneFaisceau.h"
+
+#include <Wt/WContainerWidget>
+
+using namespace Wt;
+
+
+class GWt_dropZoneLigneFaisceau : public WContainerWidget
+{
+ public : 
+
+  GWt_dropZoneLigneFaisceau();
+  ~GWt_dropZoneLigneFaisceau();
+
+ private:
+  void mouseOver(const WMouseEvent &e );
+  void mouseOut(const WMouseEvent &e );
+  void mouseUp(const WMouseEvent &e );
+  void mouseDown(const WMouseEvent &e );
+  void mouseIsDragged(const WMouseEvent &e );
+  void dropEvent(WDropEvent evt);
+};
+#endif
Index: Interface_Web/trunk/pspaWT/src/GWt_dropZoneLigneFaisceau.cc
===================================================================
--- Interface_Web/trunk/pspaWT/src/GWt_dropZoneLigneFaisceau.cc	(revision 249)
+++ Interface_Web/trunk/pspaWT/src/GWt_dropZoneLigneFaisceau.cc	(revision 249)
@@ -0,0 +1,234 @@
+#include <iostream>
+
+#include <Wt/WCssDecorationStyle>
+#include <Wt/WApplication>
+
+#include "GWt_dropZoneLigneFaisceau.h"
+#include "GWt_LigneFaisceau.h"
+#include "GWt_console.h"
+#include "nomdElements.h"
+
+
+#define PSPA_DEBUG 1
+
+GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau()
+  : WContainerWidget(){
+
+  // connect mouse events
+
+  mouseWentOver().connect(this, &GWt_dropZoneLigneFaisceau::mouseOver);
+  mouseWentUp().connect(this, &GWt_dropZoneLigneFaisceau::mouseUp);
+  mouseWentDown().connect(this, &GWt_dropZoneLigneFaisceau::mouseDown);
+  mouseWentOut().connect(this, &GWt_dropZoneLigneFaisceau::mouseOut);
+  mouseDragged().connect(this, &GWt_dropZoneLigneFaisceau::mouseIsDragged);
+
+  decorationStyle().setBorder (WBorder (WBorder::Dotted));
+
+  // accept drops
+  int nElts= nomdElements::getNumberOfElements(); 
+  for(int k = 0; k < nElts; k++) {
+    typedElement eType= (typedElement)k;
+    acceptDrops(nomdElements::getImageFromType(eType));
+  }
+
+}
+
+
+GWt_dropZoneLigneFaisceau::~GWt_dropZoneLigneFaisceau()
+{
+}
+
+
+void GWt_dropZoneLigneFaisceau::mouseOver(const WMouseEvent& e)
+{
+  // Add text
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage("GWt_dropZoneLigneFaisceau::mouseOver ");
+    console->addConsoleMessage("button "+WMouseEvent::LeftButton);
+  }
+#endif
+}
+
+void GWt_dropZoneLigneFaisceau::mouseOut(const WMouseEvent& e)
+{
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage("GWt_dropZoneLigneFaisceau::mouseOut");
+  }
+#endif
+}
+
+void GWt_dropZoneLigneFaisceau::mouseIsDragged(const WMouseEvent& e)
+{
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage(" GWt_dropZoneLigneFaisceau::mouseDragged");
+  }
+#endif
+}
+
+void GWt_dropZoneLigneFaisceau::mouseUp(const WMouseEvent& e)
+{
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage("GWt_dropZoneLigneFaisceau::mouseOut up");
+  }
+#endif
+}
+
+void GWt_dropZoneLigneFaisceau::mouseDown(const WMouseEvent& e)
+{
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage("GWt_dropZoneLigneFaisceau::mouseDown up");
+  }
+#endif
+}
+
+void GWt_dropZoneLigneFaisceau::dropEvent(WDropEvent evt)
+{
+
+#ifdef PSPA_DEBUG
+  if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+    GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+    console->addConsoleMessage(" GWt_dropZoneLigneFaisceau::dropEvent");
+  }
+#endif
+
+  // get LigneFaiseau widget and add new elementLigneFaiseau
+  GWt_LigneFaisceau* ligneFaisceau = NULL;
+  if ( static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) {
+    ligneFaisceau = static_cast<GWt_LigneFaisceau*> (wApp->findWidget ("ligneFaisceau"));
+  } else {
+    return;
+  }
+
+  // get the type of element
+  nomdElements e(evt.mimeType());
+  typedElement eType = e.getElementType();
+
+  ligneFaisceau->addElement(eType);
+
+
+  /*
+  nomdElements e(evt.mimeType());
+  typedElement eType = e.getElementType();
+
+  // update source if necessary
+  cout<<"dynamic_cast SOURCE------" << evt.source() << endl;
+  if (dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source())) {
+    cout<<"OKIKKKIIII" << dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()) << endl;
+    removeOtherDropZone(dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()));
+  }
+
+  if(eType == inconnu) {
+    cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl;
+    return;
+  }
+
+    if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+        GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+        console->addConsoleMessage(e.getElementName());
+    }
+
+  abstractElement* ptr = pspa_->getDataManager()->addElement(eType);
+
+  ptr->setLabel(getElementNumberInBeamLine(e));
+
+  GWt_abstractElement* insertedAbstractElement = GWt_abstractElement::ajoute(ptr);
+  cout << " je vais ajouter l'element  " << ptr->getNomdElement().getElementName() << " de type " << ptr->getNomdElement().getElementType() << "ID "<< insertedAbstractElement << endl;
+
+  if(insertedAbstractElement == NULL) return;
+  insertedAbstractElement->setLabelWidget();
+
+  WSignalMapper<GWt_abstractElement *> *mapper= new WSignalMapper<GWt_abstractElement *>(this);
+  mapper->mapped().connect(this,&GWt_dropZoneLigneFaisceau::onClick);
+  mapper->mapConnect(insertedAbstractElement->getImage()->doubleClicked(),insertedAbstractElement);
+
+  //////////////////////////////////////////////////////////////////
+
+  // add the dropped widget
+  printf("add the dropped widget\n");
+
+  // add drop zone before and after
+  if (static_cast <WContainerWidget*> (parent())) {
+    WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
+
+    cout<<"add the dropped parent %d"<< wc << " COUNT:"<< count () <<"<---------------"<< endl;
+    // do not insert new element if some element is already present
+
+    WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));
+    bool replaceElement = false;
+
+    if (abstractElement_) {
+      replaceElement = true;
+    }
+
+    // insert one before
+    if (!replaceElement) {
+      // if it the first element of the beam line
+      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))) == 0) {
+        layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,false));
+      
+      } else {
+        layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,true));
+      }
+    }
+    // FIXME Replace
+
+    // complete widget
+    clear();
+    arrowImage_ = NULL;
+    abstractElement_ = insertedAbstractElement->getWidget();
+    addWidget(abstractElement_);
+    // change strech (useful if it was the last one)
+    layout->setStretchFactor(this,0);		
+
+    // change background
+    decorationStyle().setBackgroundColor (WColor("white"));
+
+    // remove border
+    decorationStyle().setBorder (WBorder (WBorder::None));
+
+
+    // insert after
+    // if it is the last, add a strech factor and no link image
+    cout<<" nb elem:"<< layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 << " COUNT:"<< wc->count () <<"<---------------ID:"<< abstractElement_ << endl;
+    if (!replaceElement) {
+      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 == wc->count()) {
+        layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_,false),1);
+      } else {
+        layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_));
+      }
+    }
+  */
+
+    /*
+     * Set the image to be draggable, showing the other image (dragImage)
+     * to be used as the widget that is visually dragged.
+     */
+  /*
+    WImage *dragImage = new WImage(e.getImageFromType(eType).c_str(),this);
+
+    //    setDraggable(evt.mimeType(),dragImage,true);//,insertedAbstractElement->getButton(),true);
+    abstractElement_->setDraggable(evt.mimeType(),dragImage,true, this);
+
+    
+    cout<<"add the dropped parent %d"<< wc << " COUNT:"<< wc->count () <<"<---------------"<< endl;
+  }
+
+
+
+  //insertedAbstractElement->getWidget()->decorationStyle().setBackgroundColor (WColor("blue")); 
+  pspa_->updateSelections();
+
+  */  
+}
+
+
