Community
Participate
Working Groups
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'?