/** * Calculate the positions of the header and the body. * * @param header The header Figure * @param body The body Figure */ private void calculatePositions(IWidgetFigure header, IWidgetFigure body) { FigureConstants fc = getFigureConstants(); // We begin at widgetSpacing in order to add an equal spacing between the Column // and the Widgets that it contains. // If we do not do this we will be unable to select the Column. int xPos = fc.getWidgetSpacing(); int yPos = fc.getWidgetSpacing(); // Header Rectangle hb = header.getBounds(); hb.x = xPos; hb.y = yPos; header.setBounds(hb); // Body Rectangle bb = body.getBounds(); bb.x = xPos; bb.y = yPos + hb.height; body.setBounds(bb); }
/** * Calculate the size of the header and the body. * * @param header The header figure * @param body The body figure * @param cb The bounds of the container */ private void calculateSizes(IWidgetFigure header, IWidgetFigure body, Rectangle cb) { FigureConstants fc = getFigureConstants(); // The width of each Widget is equal to its containers width (minus the spacing). int allocatedWidth = cb.width - 2 * fc.getWidgetSpacing(); int minWidth = Math.max(header.getMinWidth(), body.getMinWidth()); // Header int hw = allocatedWidth; if (hw < minWidth) { hw = minWidth; } Rectangle nb = new Rectangle(0, 0, hw, header.getMinHeight()); header.setBounds(nb); // Body int bw = allocatedWidth; if (bw < minWidth) { bw = minWidth; } Rectangle bb = new Rectangle(0, 0, bw, cb.height - header.getMinHeight() - fc.getWidgetSpacing() * 2); body.setBounds(bb); }