Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How can I add some text to a connection?
How can I add some text to a connection? [message #164893] Fri, 21 January 2005 05:21 Go to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

I want to add some text to a connection,when the connection is moved the
text will move correspondingly.
What should I do?
Thanks a lot.
Re: How can I add some text to a connection? [message #164915 is a reply to message #164893] Fri, 21 January 2005 07:28 Go to previous messageGo to next message
Marion Schmid is currently offline Marion SchmidFriend
Messages: 35
Registered: July 2009
Member
Add a figure (as the label) to the Connection (in createFigure() of your
edit part) with a ConnectionLocator/ MidpointLocator,...
(myConnection.add(labelFigure, locator) )
and then set the text in your refreshVisuals() to the figure.
regards, Marion

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:csq3fu$h8c$1@www.eclipse.org...
> I want to add some text to a connection,when the connection is moved the
> text will move correspondingly.
> What should I do?
> Thanks a lot.
>
Re: How can I add some text to a connection? [message #164922 is a reply to message #164915] Fri, 21 January 2005 09:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

What is ConnectionLocator/MidpointLocator?

I write :
label.setText("Test");
connection.add(label);
in createFigure(),but it doesn't display the text.

Marion Schmid wrote:

> Add a figure (as the label) to the Connection (in createFigure() of your
> edit part) with a ConnectionLocator/ MidpointLocator,...
> (myConnection.add(labelFigure, locator) )
> and then set the text in your refreshVisuals() to the figure.
> regards, Marion

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:csq3fu$h8c$1@www.eclipse.org...
>> I want to add some text to a connection,when the connection is moved the
>> text will move correspondingly.
>> What should I do?
>> Thanks a lot.
>>
Re: How can I add some text to a connection? [message #165026 is a reply to message #164922] Fri, 21 January 2005 16:59 Go to previous messageGo to next message
Brian Fernandes is currently offline Brian FernandesFriend
Messages: 68
Registered: July 2009
Member
use

label.setText("Test");
connection.add(label, new ConnectionLocator(connection,
ConnectionLocator.MIDDLE));

Best,
Brian.
zhlmmc wrote:

> What is ConnectionLocator/MidpointLocator?

> I write :
> label.setText("Test");
> connection.add(label);
> in createFigure(),but it doesn't display the text.

> Marion Schmid wrote:

>> Add a figure (as the label) to the Connection (in createFigure() of your
>> edit part) with a ConnectionLocator/ MidpointLocator,...
>> (myConnection.add(labelFigure, locator) )
>> and then set the text in your refreshVisuals() to the figure.
>> regards, Marion
Re: How can I add some text to a connection? [message #165209 is a reply to message #165026] Sat, 22 January 2005 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

I did as your suggestion,but it seems doesn't work.
protected IFigure createFigure() {
PolylineConnection connection = new PolylineConnection();
Label label = new Label();
label.setText("line");
connection.setConnectionRouter(new BendpointConnectionRouter());
connection.add(label,new
ConnectionLocator(connection,ConnectionLocator.MIDDLE));
return connection;
}
Any problem with this method?

Brian Fernandes wrote:

> use

> label.setText("Test");
> connection.add(label, new ConnectionLocator(connection,
> ConnectionLocator.MIDDLE));

> Best,
> Brian.
> zhlmmc wrote:

>> What is ConnectionLocator/MidpointLocator?

>> I write :
>> label.setText("Test");
>> connection.add(label);
>> in createFigure(),but it doesn't display the text.

>> Marion Schmid wrote:

>>> Add a figure (as the label) to the Connection (in createFigure() of your
>>> edit part) with a ConnectionLocator/ MidpointLocator,...
>>> (myConnection.add(labelFigure, locator) )
>>> and then set the text in your refreshVisuals() to the figure.
>>> regards, Marion
Re: How can I add some text to a connection? [message #165216 is a reply to message #165209] Sat, 22 January 2005 17:50 Go to previous messageGo to next message
Brian Fernandes is currently offline Brian FernandesFriend
Messages: 68
Registered: July 2009
Member
Your code seems fine.

What exactly is going wrong? Is your connection line being displayed
correctly?

Try removing the BendpointConnectionRouter OR maybe you can use the
ManhattanConnectionRouter just to check.

Best,
Brian.

zhlmmc wrote:

> I did as your suggestion,but it seems doesn't work.
> protected IFigure createFigure() {
> PolylineConnection connection = new PolylineConnection();
> Label label = new Label();
> label.setText("line");
> connection.setConnectionRouter(new BendpointConnectionRouter());
> connection.add(label,new
> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
> return connection;
> }
> Any problem with this method?

> Brian Fernandes wrote:

>> use

>> label.setText("Test");
>> connection.add(label, new ConnectionLocator(connection,
>> ConnectionLocator.MIDDLE));

>> Best,
>> Brian.
>> zhlmmc wrote:

>>> What is ConnectionLocator/MidpointLocator?

>>> I write :
>>> label.setText("Test");
>>> connection.add(label);
>>> in createFigure(),but it doesn't display the text.

>>> Marion Schmid wrote:

>>>> Add a figure (as the label) to the Connection (in createFigure() of your
>>>> edit part) with a ConnectionLocator/ MidpointLocator,...
>>>> (myConnection.add(labelFigure, locator) )
>>>> and then set the text in your refreshVisuals() to the figure.
>>>> regards, Marion
Re: How can I add some text to a connection? [message #165232 is a reply to message #165216] Sun, 23 January 2005 05:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

My connection line is displayed correctly,but the text is not displayed.
I have tried to remove the BendpointConnectionRouter,but it didn't help.

Brian Fernandes wrote:

> Your code seems fine.

> What exactly is going wrong? Is your connection line being displayed
> correctly?

> Try removing the BendpointConnectionRouter OR maybe you can use the
> ManhattanConnectionRouter just to check.

> Best,
> Brian.

> zhlmmc wrote:

>> I did as your suggestion,but it seems doesn't work.
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> Label label = new Label();
>> label.setText("line");
>> connection.setConnectionRouter(new BendpointConnectionRouter());
>> connection.add(label,new
>> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>> return connection;
>> }
>> Any problem with this method?

>> Brian Fernandes wrote:

>>> use

>>> label.setText("Test");
>>> connection.add(label, new ConnectionLocator(connection,
>>> ConnectionLocator.MIDDLE));

>>> Best,
>>> Brian.
>>> zhlmmc wrote:

>>>> What is ConnectionLocator/MidpointLocator?

>>>> I write :
>>>> label.setText("Test");
>>>> connection.add(label);
>>>> in createFigure(),but it doesn't display the text.

>>>> Marion Schmid wrote:

>>>>> Add a figure (as the label) to the Connection (in createFigure() of your
>>>>> edit part) with a ConnectionLocator/ MidpointLocator,...
>>>>> (myConnection.add(labelFigure, locator) )
>>>>> and then set the text in your refreshVisuals() to the figure.
>>>>> regards, Marion
Re: How can I add some text to a connection? [message #165240 is a reply to message #165216] Sun, 23 January 2005 05:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

It works OK now.
thank you.
Brian Fernandes wrote:

> Your code seems fine.

> What exactly is going wrong? Is your connection line being displayed
> correctly?

> Try removing the BendpointConnectionRouter OR maybe you can use the
> ManhattanConnectionRouter just to check.

> Best,
> Brian.

> zhlmmc wrote:

>> I did as your suggestion,but it seems doesn't work.
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> Label label = new Label();
>> label.setText("line");
>> connection.setConnectionRouter(new BendpointConnectionRouter());
>> connection.add(label,new
>> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>> return connection;
>> }
>> Any problem with this method?

>> Brian Fernandes wrote:

>>> use

>>> label.setText("Test");
>>> connection.add(label, new ConnectionLocator(connection,
>>> ConnectionLocator.MIDDLE));

>>> Best,
>>> Brian.
>>> zhlmmc wrote:

>>>> What is ConnectionLocator/MidpointLocator?

>>>> I write :
>>>> label.setText("Test");
>>>> connection.add(label);
>>>> in createFigure(),but it doesn't display the text.

>>>> Marion Schmid wrote:

>>>>> Add a figure (as the label) to the Connection (in createFigure() of your
>>>>> edit part) with a ConnectionLocator/ MidpointLocator,...
>>>>> (myConnection.add(labelFigure, locator) )
>>>>> and then set the text in your refreshVisuals() to the figure.
>>>>> regards, Marion
Re: How can I add some text to a connection? [message #165256 is a reply to message #165240] Sun, 23 January 2005 12:17 Go to previous messageGo to next message
Brian Fernandes is currently offline Brian FernandesFriend
Messages: 68
Registered: July 2009
Member
If it isn't too much trouble, could you tell us what the problem was?

It would help others who could have the same problem in the future.

Thanks,
Brian.

zhlmmc wrote:

> It works OK now.
> thank you.
Re: How can I add some text to a connection? [message #165264 is a reply to message #165256] Sun, 23 January 2005 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

Sorry,I really don't know what the problem is.I didn't change any code,
but it works OK now.Maybe the restart of my computer did some help.

Brian Fernandes wrote:

> If it isn't too much trouble, could you tell us what the problem was?

> It would help others who could have the same problem in the future.

> Thanks,
> Brian.

> zhlmmc wrote:

>> It works OK now.
>> thank you.
Re: How can I add some text to a connection? [message #165271 is a reply to message #165256] Sun, 23 January 2005 14:33 Go to previous message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

Sorry,I really don't know what the problem is.I didn't modify any code but
it works OK now.Maybe the restart of my computer did some help.

Brian Fernandes wrote:

> If it isn't too much trouble, could you tell us what the problem was?

> It would help others who could have the same problem in the future.

> Thanks,
> Brian.

> zhlmmc wrote:

>> It works OK now.
>> thank you.
Previous Topic:Help with my version of flowEditor
Next Topic:XYLayoutEditPolicy - I don't get it to work
Goto Forum:
  


Current Time: Tue Apr 16 14:04:19 GMT 2024

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

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

Back to the top