1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g2d.diagram.handler;
\r
14 import java.awt.geom.Rectangle2D;
\r
16 import org.simantics.g2d.diagram.IDiagram;
\r
17 import org.simantics.g2d.diagram.handler.layout.BorderLayout;
\r
18 import org.simantics.g2d.diagram.handler.layout.FlowLayout;
\r
19 import org.simantics.g2d.diagram.handler.layout.GridLayout;
\r
22 * LayoutManager puts elements on diagram.
\r
23 * layout() method must be explicitely invoked.
\r
25 * Diagram must have size hint (DiagramHints.KEY_BOUNDS).
\r
27 * @See {@link FlowLayout}
\r
28 * @See {@link GridLayout}
\r
29 * @See {@link BorderLayout}
\r
30 * @author Toni Kalajainen
\r
32 public interface LayoutManager extends DiagramHandler {
\r
35 * Lay-out elements on the diagram.
\r
39 void layout(IDiagram diagram, Rectangle2D bounds);
\r
42 * Computes and returns the size of the specified
\r
43 * composite's client area according to this layout.
\r
45 * This method computes the size that the client area
\r
46 * of the composite must be in order to position all
\r
47 * children at their preferred size inside the
\r
48 * composite according to the layout algorithm
\r
49 * encoded by this layout.
\r
52 * When a width or height hint is supplied, it is
\r
53 * used to constrain the result. For example, if a
\r
54 * width hint is provided that is less than the
\r
55 * width of the client area, the layout may choose
\r
56 * to wrap and increase height, clip, overlap, or
\r
57 * otherwise constrain the children.
\r
60 * @param composite a composite widget using this layout
\r
61 * @param wHint width (<code>null</code> for preferred size)
\r
62 * @param hHint height (<code>null</code> for preferred size)
\r
63 * @return the computed size (width, height)
\r
65 Rectangle2D computeSize(IDiagram diagram, Double wHint, Double hHint);
\r