Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw2D Label preferred size(Label text cut via "...")
Draw2D Label preferred size [message #656327] Fri, 25 February 2011 07:12 Go to next message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Hello,
I am working on an editor based on GEF.

I have a parent container which is able to get some childs.
The childs are simple labels with text and an icon.

The problem is, that if I add a child and the text is "too long", the parent container woun't be resized. Instead of resizing the parent container Draw2D cuts the label like "labeltex...".

Same problem if I add a childfigure which fits and change the text afterwards so that the label figure is bigger than the parent figure. No refresh, just a textcut.


I would appreciate any help, I tried to override getPreferredSize in the labelfigure and so on it didn't work at all.

Thanks in advance
Alex
Re: Draw2D Label preferred size [message #656487 is a reply to message #656327] Fri, 25 February 2011 21:08 Go to previous messageGo to next message
Bryan Mising name is currently offline Bryan Mising nameFriend
Messages: 3
Registered: February 2011
Junior Member
Is your parent figure using an XYLayout layout and has children can be dragged and moved within the container?

If yes, check out the Logic Designer example. In this example, if a Circuit is resized smaller than its children, then the children are not visible until the Circuit figure is resizes or its contents are scrolled.

This is done by having the Circuit's figure contain a ScrollPane containing a FreeformViewport with a FreeformLayer. The Circuit's edit part returns the FreeformLayer as the content pane in the EditorPart's getContentPane() method.

The contents of the scrollable figure can be made visible when the figure is selected by using the ScrollableFeedbackSelectionPolicy which gives additional visual feedback (other than the scrollbars) that something else is there.

Alternatively, if you don't want to bother with the scrolling you can try to do what I did to get my containers to fit the bounds of their children: Howto move/resize parent figure when child is moved.

[Updated on: Fri, 25 February 2011 21:13]

Report message to a moderator

Re: Draw2D Label preferred size [message #656685 is a reply to message #656327] Mon, 28 February 2011 07:30 Go to previous messageGo to next message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Hello and first of all thanks for your answer.

The parent figure has a ToolbarLayout and the children cannot be moved within its parent.

The parent should just be as wide as its widest children. Therefore I need to refresh the parent somehow if a child is added....
Re: Draw2D Label preferred size [message #722896 is a reply to message #656685] Wed, 07 September 2011 05:55 Go to previous messageGo to next message
karthick9686@gmail.com Missing nameFriend
Messages: 41
Registered: July 2011
Member
have you found the solution for resizing the parent figure when the child label text increases . i am also using toolbarlayout. if you have the solution please let me know
Re: Draw2D Label preferred size [message #722990 is a reply to message #722896] Wed, 07 September 2011 11:41 Go to previous message
karthick9686@gmail.com Missing nameFriend
Messages: 41
Registered: July 2011
Member
The solution is you should get the gettextbounds method from the label and schage your container size in the refreshvisuals
Previous Topic:seperating label text and image in a label
Next Topic:GEF: scrolling?
Goto Forum:
  


Current Time: Sat Apr 27 03:16:10 GMT 2024

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

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

Back to the top