Skip to main content



      Home
Home » Eclipse Projects » GEF » Label to connector disappears.
Label to connector disappears. [message #125208] Wed, 31 March 2004 21:05 Go to next message
Eclipse UserFriend
Hi,

I have created a figure for my connectors.

public class XFigure
extends PolylineConnection {

private Label label;
private ConnectionLocator locator;

public XFigure() {
super();
}

public XFigure() {
super();

label = new Label("Connector label text");
locator = new ConnectionLocator(this);
locator.setRelativePosition(PositionConstants.SOUTH);
locator.setGap(15);
this.add(label);
}

public void paintFigure(Graphics g) {
super.paintFigure(g);
locator.relocate(label);
}

}

The text "Connector label text" appears fine just below the connector line.
When I move my source or target, sometimes half the text disappears but when
I select the connector the text appears. Can somebody help me with the
problem.

thanks
Khurrum
Re: Label to connector disappears. [message #125363 is a reply to message #125208] Thu, 01 April 2004 10:31 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You cannot relocate the figure during painting. The connections bounds have
already been calculated, and they will clip the child.
Instead, use a DelegatingLayoutManager on the connection. This will get
tied in before the new bounds are calculated.


"Khurrum" <khurrum.abdullah@certive.com> wrote in message
news:c4ft3k$pq5$1@eclipse.org...
> Hi,
>
> I have created a figure for my connectors.
>
> public class XFigure
> extends PolylineConnection {
>
> private Label label;
> private ConnectionLocator locator;
>
> public XFigure() {
> super();
> }
>
> public XFigure() {
> super();
>
> label = new Label("Connector label text");
> locator = new ConnectionLocator(this);
> locator.setRelativePosition(PositionConstants.SOUTH);
> locator.setGap(15);
> this.add(label);
> }
>
> public void paintFigure(Graphics g) {
> super.paintFigure(g);
> locator.relocate(label);
> }
>
> }
>
> The text "Connector label text" appears fine just below the connector
line.
> When I move my source or target, sometimes half the text disappears but
when
> I select the connector the text appears. Can somebody help me with the
> problem.
>
> thanks
> Khurrum
>
>
Previous Topic:Rulers - units, etc.
Next Topic:Returning null or UnexecutableCommand.INSTANCE
Goto Forum:
  


Current Time: Fri Jun 06 23:00:33 EDT 2025

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

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

Back to the top