[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Draw2D PolylineConnection

PolyLineConnection is defined in Draw2D, so you should ask this in the
eclipse.tools.gef newsgroup.

Grant


"benjamin" <ben00ze@xxxxxxxxx> wrote in message
news:ef590513f1b8122737736f6fc411e3fb$1@xxxxxxxxxxxxxxxxxx
> I posted this thrad on eclipse.platform newsgroup, but maybe swt newsgroup
> is a better choice ....
>
>
>
>
> Hi all,
>
> I have a question about PolyLineConnection
>
>
> I made a class named SystemeFigure in which I can added some kind of
> Rectangle.
> In the class named SystemeFigure, I added a MouseMotion listener which
> allow me to move the RectangleSysteme selected and this works well.
> But I also tried to add a PolyLineConnection when a button is enabled.
>
> public class SystemeFigure extends Figure {
> .....
>
>    new MouseMotionListener()    {
>       .....
>       public void mouseDragged(MouseEvent me)       {
>           if ( me.getSource() instanceof RectangleSysteme){
> ((RectangleSysteme)me.getSource()).setLocation(me.getLocation());
>           }
>        }
>
>    }
>
>
>    new MouseListener() {
> public void mousePressed(MouseEvent me)         {
>            PolylineConnection c = new PolylineConnection();
>            ChopboxAnchor sourceAnchor = new ChopboxAnchor(source);
>    ChopboxAnchor targetAnchor = new
> ChopboxAnchor(((RectangleSysteme)me.getSource()));
>             c.setSourceAnchor(sourceAnchor);
> c.setTargetAnchor(targetAnchor);
> add(c);
> }
>
> }
>
>
>
>
> private class RectangleSysteme extends RectangleFigure
> {
>  .....
>
>   public void setLocation(Point p)
>  {
>     super.setLocation(p);
>     .... // some stuff to do
>  }
>  }
>
>
>
>
> But when I add the PolyLineConnection, my RectangleSysteme go to their
> first position, and it's impossible to move them again.
>
> Someone can help me please ?
>
>
> ps : sorry for my english
>