public void layout(IFigure container) { boolean consumed = false; for (int i = 0; i < listeners.size(); i++) consumed |= ((LayoutListener) listeners.get(i)).layout(container); if (realLayout != null && !consumed) realLayout.layout(container); for (int i = 0; i < listeners.size(); i++) ((LayoutListener) listeners.get(i)).postLayout(container); }
public Map<JRElement, Rectangle> layout(JRElement[] elements, Dimension c) { Map<JRElement, Rectangle> map = new HashMap<JRElement, Rectangle>(); int x = 0; int y = 0; int w = c.width; int h = (int) Math.floor((float) c.height / elements.length); int rest = c.height - h * elements.length; for (JRElement el : elements) { JRDesignElement del = (JRDesignElement) el; map.put(el, new Rectangle(el.getX(), el.getY(), el.getWidth(), el.getHeight())); del.setX(x); del.setY(y); del.setWidth(w); del.setHeight(h + rest); // if last grab free pixels y += h + rest; if (rest > 0) rest = 0; LayoutManager.layout(map, el); } return map; }
@Override public synchronized void layout(final DisplayDimensions dims) { displayDims = dims; layoutManager.layout(displayDims); }
/** * Lays out this Figure using its {@link LayoutManager}. * * @since 2.0 */ protected void layout() { if (layoutManager != null) layoutManager.layout(this); }