Skip to main content



      Home
Home » Eclipse Projects » GEF » Draw2D Label preferred size(Label text cut via "...")
Draw2D Label preferred size [message #656327] Fri, 25 February 2011 02:12 Go to next message
Eclipse UserFriend
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 16:08 Go to previous messageGo to next message
Eclipse UserFriend
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 16:13] by Moderator

Re: Draw2D Label preferred size [message #656685 is a reply to message #656327] Mon, 28 February 2011 02:30 Go to previous messageGo to next message
Eclipse UserFriend
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 01:55 Go to previous messageGo to next message
Eclipse UserFriend
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 07:41 Go to previous message
Eclipse UserFriend
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: Tue Jul 22 18:37:15 EDT 2025

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

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

Back to the top