Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with moving Label/Figure in Connection
Problems with moving Label/Figure in Connection [message #158299] Wed, 17 November 2004 08:56 Go to next message
Eclipse UserFriend
Originally posted by: pengfai81.mail.yahoo.com

Hi , all..
I have created a connection between two figures. What can i do to move the
label along the conn in "every certain distance"?

Here is portion of the code:

PolylineConnection conn = new PolylineConnection();
ChopboxAnchor sourceAnchor = new
ChopboxAnchor(nodeFigure1); ChopboxAnchor targetAnchor = new
ChopboxAnchor(nodeFigure2);
conn.setSourceAnchor(sourceAnchor);
conn.setTargetAnchor(targetAnchor);

Label label = new Label(" ");
label.setOpaque(true);
label.setBackgroundColor(ColorConstants.blue);
label.setVisible(true);

// just display the label located at source
conn.add(label, new ConnectionLocator(conn,2));

Thanks in advance....
Re: Problems with moving Label/Figure in Connection [message #158619 is a reply to message #158299] Thu, 18 November 2004 21:59 Go to previous messageGo to next message
uhclem is currently offline uhclemFriend
Messages: 17
Registered: July 2009
Junior Member
Funny I should come across this - I was just working on exactly the same
problem.
I'm not sure a ConnectionLocator is what you want to use...I found that
MidpointLocator works and will locate the label in the middle of the
connection line. Of course, I could be wrong :(

"Jack" <pengfai81@mail.yahoo.com> wrote in message
news:cnf3n6$agh$1@www.eclipse.org...
> Hi , all..
> I have created a connection between two figures. What can i do to move the
> label along the conn in "every certain distance"?
>
> Here is portion of the code:
>
> PolylineConnection conn = new PolylineConnection();
> ChopboxAnchor sourceAnchor = new ChopboxAnchor(nodeFigure1);
> ChopboxAnchor targetAnchor = new ChopboxAnchor(nodeFigure2);
> conn.setSourceAnchor(sourceAnchor);
> conn.setTargetAnchor(targetAnchor);
>
> Label label = new Label(" ");
> label.setOpaque(true);
> label.setBackgroundColor(ColorConstants.blue);
> label.setVisible(true);
> // just display the label located at source
> conn.add(label, new ConnectionLocator(conn,2));
>
> Thanks in advance....
>
>
Re: Problems with moving Label/Figure in Connection [message #158643 is a reply to message #158619] Fri, 19 November 2004 08:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pengfai81.mail.yahoo.com

Bob Brodt wrote:

Yes.I tried ConnectionLocator before, it can locate the label in the start
,middle and also end point. I faced problem when need to move the label
attached to the connection in various points but with same distance .Any
suggestion??

Thanks a lot....
Re: Problems with moving Label/Figure in Connection [message #158647 is a reply to message #158619] Fri, 19 November 2004 08:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pengfai81.mail.yahoo.com

Bob Brodt wrote:

Yes.I tried ConnectionLocator before, it can locate the label in the start
,middle and also end point. I faced problem when need to move the label
attached to the connection in various points but with same distance .Any
suggestion??

Thanks a lot....
Re: Problems with moving Label/Figure in Connection [message #158655 is a reply to message #158619] Fri, 19 November 2004 08:17 Go to previous message
Eclipse UserFriend
Originally posted by: pengfai81.mail.yahoo.com

Bob Brodt wrote:

Yes.I tried ConnectionLocator before, it can locate the label in the start
,middle and also end point. I faced problem when need to move the label
attached to the connection in various points but with same distance .Any
suggestion??

Thanks a lot....
Re: Problems with moving Label/Figure in Connection [message #158663 is a reply to message #158619] Fri, 19 November 2004 08:17 Go to previous message
Eclipse UserFriend
Originally posted by: pengfai81.mail.yahoo.com

Bob Brodt wrote:

Yes.I tried ConnectionLocator before, it can locate the label in the start
,middle and also end point. I faced problem when need to move the label
attached to the connection in various points but with same distance .Any
suggestion??

Thanks a lot....
Previous Topic:getLocation() of ConnectionAnchor is not called
Next Topic:Undo in RCP application
Goto Forum:
  


Current Time: Wed Feb 05 15:05:36 GMT 2025

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

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

Back to the top