Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » EditPart resize on children setVisible
EditPart resize on children setVisible [message #897259] Mon, 23 July 2012 12:40 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
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 15:02 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
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 15:03]

Report message to a moderator

Re: EditPart resize on children setVisible [message #897499 is a reply to message #897317] Tue, 24 July 2012 10:07 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
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 12:02 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
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 12:11 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 501
Registered: June 2011
Senior Member
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 14:10 Go to previous message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
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: Thu Oct 02 16:43:04 GMT 2014

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

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