Skip to main content



      Home
Home » Eclipse Projects » GEF » How can i draw a connection with lables?
How can i draw a connection with lables? [message #100740] Mon, 20 October 2003 02:23 Go to next message
Eclipse UserFriend
Originally posted by: eeoo_lee.hotmail.com

I want to use some lables to descirbe the realtionship between the source
and target model.I intend to place the labels on the connetion which can
move together with the connection. How can I do that?
Thanks!
Re: How can i draw a connection with lables? [message #101059 is a reply to message #100740] Mon, 20 October 2003 12:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jpl.remotejava.com

lianglee wrote:

> I want to use some lables to descirbe the realtionship between the source
> and target model.I intend to place the labels on the connetion which can
> move together with the connection. How can I do that?

This is how I did it:

1. My own class LabeledPolylineConnection extends PolylineConnection.
2. In the constructor, it creates a Label.
3. Because PolylineConnection uses DelegatingLayout, I add the label
as a child with a Locator constraint: add(label, new LabelLocator());
3. The LabelLocator class implements Locator; it computes and sets
the label's bounds based on the connection's start and end points.

-JPL
Re: How can i draw a connection with lables? [message #101071 is a reply to message #100740] Mon, 20 October 2003 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

There is an article that shows how to do this in draw2d. The link is off
the GEF homepage.

"lianglee" <eeoo_lee@hotmail.com> wrote in message
news:bmvv06$bo9$1@eclipse.org...
> I want to use some lables to descirbe the realtionship between the source
> and target model.I intend to place the labels on the connetion which can
> move together with the connection. How can I do that?
> Thanks!
>
>
Re: How can i draw a connection with lables? [message #101180 is a reply to message #101059] Mon, 20 October 2003 23:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eeoo_lee.hotmail.com

Jan Ploski wrote:

> lianglee wrote:

> > I want to use some lables to descirbe the realtionship between the source
> > and target model.I intend to place the labels on the connetion which can
> > move together with the connection. How can I do that?

> This is how I did it:

> 1. My own class LabeledPolylineConnection extends PolylineConnection.
> 2. In the constructor, it creates a Label.
> 3. Because PolylineConnection uses DelegatingLayout, I add the label
> as a child with a Locator constraint: add(label, new LabelLocator());
> 3. The LabelLocator class implements Locator; it computes and sets
> the label's bounds based on the connection's start and end points.

> -JPL


Thanks for your reply ,but I still have a question. The label I want to
creat e is an editable one. I don't know the label on the connection in
your case is a figure or a model? If it's a figure,can it be edited on
the connection?
Re: How can i draw a connection with lables? [message #101193 is a reply to message #101180] Mon, 20 October 2003 23:31 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Even if there is no model, you can still create an editpart for the label.
This has been discussed before, but one solution is to use a spurious model
object. Perhaps a tuple consising of the connection model object and some
string.

Once you have an editpart, everything else is easier.

"lianglee" <eeoo_lee@hotmail.com> wrote in message
news:bn28mq$jvg$1@eclipse.org...
> Jan Ploski wrote:
>
> > lianglee wrote:
>
> > > I want to use some lables to descirbe the realtionship between the
source
> > > and target model.I intend to place the labels on the connetion which
can
> > > move together with the connection. How can I do that?
>
> > This is how I did it:
>
> > 1. My own class LabeledPolylineConnection extends PolylineConnection.
> > 2. In the constructor, it creates a Label.
> > 3. Because PolylineConnection uses DelegatingLayout, I add the label
> > as a child with a Locator constraint: add(label, new LabelLocator());
> > 3. The LabelLocator class implements Locator; it computes and sets
> > the label's bounds based on the connection's start and end points.
>
> > -JPL
>
>
> Thanks for your reply ,but I still have a question. The label I want to
> creat e is an editable one. I don't know the label on the connection in
> your case is a figure or a model? If it's a figure,can it be edited on
> the connection?
>
Previous Topic:NullPointerException at org.eclipse.gef.ui.parts.GraphicalEditor.getCommandStack(GraphicalEditor.ja
Next Topic:what's the process of a container adding an element
Goto Forum:
  


Current Time: Wed Nov 05 10:51:33 EST 2025

Powered by FUDForum. Page generated in 0.03611 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top