Skip to main content



      Home
Home » Eclipse Projects » GEF » EditPart resize on children setVisible
EditPart resize on children setVisible [message #897259] Mon, 23 July 2012 08:40 Go to next message
Eclipse UserFriend
Hi,

I have a editpart with multiple children. When i hide children using setVisible method the editpart does not resize. I want it to decrease size when children are hidden and increase size when chidren are visible.

I have tried repaint and revalidate method but it does not change size.

Any idea?

Cheers,
Re: EditPart resize on children setVisible [message #897317 is a reply to message #897259] Mon, 23 July 2012 11:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi, could you post some code here?

Changing the size is about the validation and setVisible on a Figure kicks the validation process for you.

So basically there are two options

  1. You have a layout manager on the parent and you're doing something wrong with its constraints
  2. You don't have any layout manager on the parent and you have to set the bounds manually


[Updated on: Mon, 23 July 2012 11:03] by Moderator

Re: EditPart resize on children setVisible [message #897499 is a reply to message #897317] Tue, 24 July 2012 06:07 Go to previous messageGo to next message
Eclipse UserFriend
Here is code snippt from figure's constructor

ToolbarLayout layout = new ToolbarLayout();
layout.setSpacing(2);
setLayoutManager(layout);
labelName.setForegroundColor(ColorConstants.darkGray);
labelName.setFont(new Font(PlatformUI.getWorkbench

className.setForegroundColor(ColorConstants.darkGray);
className.setFont(new Font(PlatformUI.getWorkbench


add(labelName, ToolbarLayout.ALIGN_CENTER);
add(className, ToolbarLayout.ALIGN_CENTER);


setBorder(new LineBorder(1));
setOpaque(true);
Re: EditPart resize on children setVisible [message #897523 is a reply to message #897499] Tue, 24 July 2012 08:02 Go to previous messageGo to next message
Eclipse UserFriend
What is this figure? It's the parent figure?
How do you get the visible state and where and how do you set it?
Re: EditPart resize on children setVisible [message #897526 is a reply to message #897523] Tue, 24 July 2012 08:11 Go to previous messageGo to next message
Eclipse UserFriend
This was parent figure.

Child figure which is being hidden is

FlowLayout layout = new FlowLayout();
layout.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
layout.setHorizontal(false);
setLayoutManager(layout);
labelName.setForegroundColor(ColorConstants.darkGray);
add(labelName, ToolbarLayout.ALIGN_CENTER);
setForegroundColor(ColorConstants.darkGray);

I have a hashtable which contains the references to all editparts and have one method in editpart to show/hide contains following statement.

getFigure().setVisible(visible);

thanks for assistance
Re: EditPart resize on children setVisible [message #897567 is a reply to message #897526] Tue, 24 July 2012 10:10 Go to previous message
Eclipse UserFriend
And the figure being invisible is getting invisible, but the parent has the same size, so there is a "hole", right?

Well, I think the parent figure's layout manager (ToolBarLayout) asks the child figure's layout manager (FlowLayout) for the child figure's preferred size.
And since it doesn't take the visible state into account, it returns the same size as if the figure was visible.

Could you remove/add the figure from the parent figure instead of setting it invisible?
Previous Topic:Zest2 release date?
Next Topic:Replace GEF Designer Editor with Browser
Goto Forum:
  


Current Time: Wed Jul 23 12:14:22 EDT 2025

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

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

Back to the top