how do i create a selectable anchor? [message #188552] |
Thu, 21 July 2005 14:10 |
Sapna George Messages: 76 Registered: July 2009 |
Member |
|
|
i need to create a Figure that has the following:
1. An Image enclosed in a Rectangle.
2. On the sides on this Rectangle, i need to create anchors to which
connections can be made. Functionally, these anchors represent ports
having specific characteristics (sort of like the interfaces on a network
router).
3. Each of these anchors should be represented by a tiny square Image that
is selectable.
4. Upon mouse hover over each anchor, i need to display a tool tip showing
the properties of this port.
5. Upon selection of the Image, i need to show a detailed figure of this
port.
I looked into the Logic example and the FixedConnectionAnchor and
CircuitFigure seems like a good starting point. But, in these, the figures
are painted manually as lines and polygons, which are not selectable.
So, what kind of layout can i use to create a Figure like this? Especially
since the number of ports on a figure is set as a property and is not
fixed. Obviously, if i need select capability on the anchor, it has to be
a Figure class. But, how to i draw a Figure on the side of a Rectangle???
Is there another exmaple/sample code that i could look at?
thanks in advance,
Sapna
|
|
|
Re: how do i create a selectable anchor? [message #188613 is a reply to message #188552] |
Thu, 21 July 2005 17:15 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> 3. Each of these anchors should be represented by a tiny square Image that
> is selectable.
Why does it need to be selectable? Can you drag it or delete it? If so,
could you make them children?
> 4. Upon mouse hover over each anchor, i need to display a tool tip showing
> the properties of this port. 5. Upon selection of the Image, i need to
> show a detailed figure of this port.
|
|
|
|
Re: how do i create a selectable anchor? [message #188706 is a reply to message #188634] |
Fri, 22 July 2005 14:38 |
Eclipse User |
|
|
|
Originally posted by: nospam.gmx.net
"Sapna George" <sgeorge@vt.edu> wrote in message
news:ea96f58b245c5889b0f30a88f8700ab4$1@www.eclipse.org...
> It has to be selectable so that upon clicking it, i can display another
> figure, which shows the detailed information of that port - much like you
> click on a folder to expand/fold the tree. In my case, i have to show
> another figure on the diagram.
>
> Well, i did manage to create the visuals of the Figure through clever use
> of ToolbarLayout, FlowLayout and ImageFigures. So, each of my port is now
> an ImageFigure to which i added a MouseListener. I arranged these
> ImageFigures in another Figure that has horizontal Flowlayout. Then i put
> this Figure and the Image enclosed in the Rectangle in a vertical
> ToolbarLayout.
>
> It looks ok, i guess. The only problem is that these anchor ImageFigures
> lie OUTSIDE the Rectangle. It wasn't the effect i wanted. I wanted these
> Figures to be arranged along the Rectangle's line like: -I---I---I--. I'm
> not very good with SWT Graphics drawing and this is all i could manage.
>
> My current problem is how to make map these ImageFigures to the anchors!!!
>
> Sapna
>
>
Hi Sapna
The way we do this is the following:
- paint the rectangle figure a little smaller than the original constraint
- implement a child editPart/Figure/Model
- attach the anchor to this child
- you will have to create a layout for the rectangle figure which lets the
children snap to the border
HTH, Ingo
|
|
|
Powered by
FUDForum. Page generated in 0.03605 seconds