Bug 213696 - ToolbarLayout and hidden figures
Summary: ToolbarLayout and hidden figures
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-21 09:29 EST by Alexey Markevich CLA
Modified: 2007-12-21 09:29 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Markevich CLA 2007-12-21 09:29:08 EST
I implement collapsible composite control and found problems with hidden figures:

class MyEditPart extends AbstractGraphicalEditPart {

boolean isExpanded = true;

protected IFigure createFigure() {
	Figure figure = new Figure();
	ToolbarLayout toolbarLayout = new ToolbarLayout(false);   
	figure.setLayoutManager(toolbarLayout);
	
	Figure contentPane = new Figure();
	figure.add(contentPane);
	...
	return figure;
}
...
public void performRequest(Request request) {  
	if (request.getType() == equestConstants.REQ_OPEN) {
		isExpanded = !isExpanded;
		contentPane.setVisible(isExpanded);
		refresh();
	}
}
};	

If figure is collapsed it still have space as if its visible.
I found 2 solutions:

1) Override getMinimumSize and getPreferredSize in contentPane figure:
contentPane = new Figure() {
public Dimension getMinimumSize(int hint, int hint2) {
	Dimension d = new Dimension(super.getMinimumSize(hint, hint2));
	if(!isVisible()) {
		d.height = 0;
	}
	return d;
}
public Dimension getPreferredSize(int hint, int hint2) {
	Dimension d = new Dimension(super.getPreferredSize(hint, hint2));
	if(!isVisible()) {
		d.height = 0;
	}
	return d;
}
};

2) Override ToolbarLayout methods layout and calculateChildrenSize - check children visibility before calculation.

Is this a bug or 'by design'?