From: Artur Signell
- * Orientation of the ordered layout declared whether the children are layouted
- * horizontally or vertically.
- *
- * Spacing determines if there should be space between the children. Note that
- * this does not imply margin.
- *
- * Margin determines if there should be margin around children. Note that this
- * does not imply spacing.
- *
- * If the child lets the layout to handle captions, by icon, caption, required
- * marker (*) and error icon are placed on top of the component area. Icon will
- * be first and is followed by the caption. Required marker is placed right
- * after the caption text and error icon is placed last. Note that all of these
- * are optional:
- *
- * If the child lets the layout to handle captions, but the caption and icon are
- * both missing, no line is reserved for the required marker (*) and error icon.
- * Instead they are placed on the right side of the top of the component area.
- * Required marker is placed right after the component text and error icon is
- * placed last. If the component is tall, the indicators are aligned along the
- * top of the component. Note that both of these indicators are optional:
- *
- * In case the child want to handle the caption by itself, layout does not
- * repeat the caption.
- *
- * The children of the layout can be aligned horizontally and vertically:
- *
- * When no size is explicitly specified, the size of the layout depends on the
- * size of its children. If the size if specified, either explicitly or as
- * percertages of the parent size, the size is equally divided between the
- * children. In case some children might overflow out of the given space, they
- * are cut to fit the given space. Note that the size can be independently
- * specified for horizontal and vertical dimensions and is independent of the
- * orientation. For example, layout can be horizontal and have fixed 300px
- * height, but still measure its width from the child sizes.
- *
- * Horizontal layout with fixed width of 300px and height of 150px:
- *
- * Horizontal layout with fixed width of 300px:
- *
- * Horizontal layout with fixed height of 150px:
- *
- * Sizes for marginals and spacing can be specified for the ordered layout in
- * CSS. For example, here are the defaults for OrderedLayout:
- *
- * When a style-name is set for the layout, this name is included in the style.
- * Note that the unspecified dimensions still default to the values given for
- * the layout without style. For example, if we would like to give each layout
- * with "tested-layout" style quite a bit larger right margin:
- *
- * Here is the rendering with getMargin(true). Note that all the other margins
- * are set to the default values defined for the layout without stylename:
- *
- * Notes:
- * Features
- *
- * Orientation
- *
- * Spacing
- *
- * Margin
- *
- * Positioning the caption, icon, required indicator and error
- *
- * Aligning the children
- *
- * Fixed height, width or both
- *
- * CSS attributes
- *
- *
- * .i-orderedlayout-margin-top {
- * padding-top: 15px;
- * }
- * .i-orderedlayout-margin-right {
- * padding-right: 18px;
- * }
- * .i-orderedlayout-margin-bottom {
- * padding-bottom: 15px;
- * }
- * .i-orderedlayout-margin-left {
- * padding-left: 18px;
- * }
- *
- * .i-orderedlayout-vspacing {
- * margin-top: 8px;
- * }
- * .i-orderedlayout-hspacing {
- * padding-left: 8px;
- * }
- *
- *
- *
- * .i-orderedlayout-tested-layout-margin-right {
- * padding-right: 100px;
- * }
- *
- *
- * DOM-structure
- *
- * Note that DOM-structure is an implementation specific and might change in the
- * future versions of IT Mill Toolkit. The purpose of this documentation is to
- * to ease reading of the implementation and thus to make implementation of your
- * own layouts easier.
- *
- *
- *
- *
- * There are two modes - vertical and horizontal. - *
"
- + "
|
false
if it is not.
- */
- if (!childWidgets.contains(child)) {
- return false;
- }
-
- /*
- * Orphan: Call {@link #orphan(Widget)} first while the child
- * Widget is still attached.
- */
- orphan(child);
-
- /*
- * Physical Detach: Adjust the DOM to account for the removal of
- * the child Widget. The Widget's Element must be physically removed
- * from the DOM.
- */
- final int index = childWidgets.indexOf(child);
- final WidgetWrapper wrapper = childWidgetWrappers.get(index);
- DOM.removeChild(wrappedChildContainer, wrapper.getElement());
- childWidgetWrappers.remove(index);
-
- /*
- * Logical Detach: Update the Panel's state variables to reflect
- * the removal of the child Widget. Example: the Widget is removed from
- * the Panel's {@link WidgetCollection}.
- */
- childWidgets.remove(index);
-
- if (child instanceof Paintable) {
- client.unregisterPaintable((Paintable) child);
- }
-
- return true;
- }
-
- /* documented at super */
- public boolean hasChildComponent(Widget component) {
- return childWidgets.contains(component);
- }
-
- /* documented at super */
- public void replaceChildComponent(Widget oldComponent, Widget newComponent) {
- final int index = childWidgets.indexOf(oldComponent);
- if (index >= 0) {
- client.unregisterPaintable((Paintable) oldComponent);
- remove(oldComponent);
- add(newComponent, index);
- }
- }
-
- /* documented at super */
- public void updateCaption(Paintable component, UIDL uidl) {
- final int index = childWidgets.indexOf(component);
- if (index >= 0) {
- childWidgetWrappers.get(index).updateCaption(uidl, component);
- }
- }
-
- /* documented at super */
- public Iterator iterator() {
- return childWidgets.iterator();
- }
-
- /* documented at super */
- public void iLayout() {
- if (isRendering) {
- return;
- }
-
- updateChildSizes();
- if (client != null) {
- client.runDescendentsLayout(this);
- }
- childLayoutsHaveChanged = false;
- }
-
- public boolean requestLayout(Set