java.lang.Object | |
↳ | com.google.gwt.layout.client.Layout |
Helper class for laying out a container element and its children.
This class is typically used by higher-level widgets to implement layout on their behalf. It is intended to wrap an element (usually a <div>), and lay its children out in a predictable fashion, automatically accounting for changes to the parent's size, and for all elements' margins, borders, and padding.
To use this class, create a container element (again, usually a <div>)
and pass it to Layout(Element)
. Rather than attaching child elements
directly to the element managed by this Layout
, use the
attachChild(Element)
method. This will attach the child
element and return a Layout.Layer
object which is used to manage the
child.
A separate Layout.Layer
instance is associated with each child
element. There is a set of methods available on this class to manipulate the
child element's position and size. In order for changes to a layer to take
effect, you must finally call one of layout()
or
layout(int)
. This allows many changes to different layers to be
applied efficiently, and to be animated.
On most browsers, this is implemented using absolute positioning. It also contains extra logic to make IE6 work properly.
NOTE: This class will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.
NOTE: This class is still very new, and its interface may change without warning. Use at your own risk.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Layout.Alignment | Used to specify the alignment of child elements within a layer. | ||||||||||
Layout.AnimationCallback | Callback interface used by layout(int, AnimationCallback)
to provide updates on animation progress. |
||||||||||
Layout.Layer | This class is used to set the position and size of child elements. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new layout associated with the given parent element.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Asserts that the given child element is managed by this layout.
| |||||||||||
Attaches a child element to this layout.
| |||||||||||
Attaches a child element to this layout.
| |||||||||||
Attaches a child element to this layout.
| |||||||||||
Attaches a child element to this layout.
| |||||||||||
Causes the parent element to fill its own parent.
| |||||||||||
Returns the size of one unit, in pixels, in the context of this layout.
| |||||||||||
Updates the layout by animating it over time, with a callback on each frame
of the animation, and upon completion.
| |||||||||||
Updates the layout by animating it over time.
| |||||||||||
Updates this layout's children immediately.
| |||||||||||
This method must be called when the parent element becomes attached to the
document.
| |||||||||||
This method must be called when the parent element becomes detached from
the document.
| |||||||||||
Removes a child element from this layout.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs a new layout associated with the given parent element.
parent | the element to serve as the layout parent |
---|
Asserts that the given child element is managed by this layout.
elem | the element to be tested |
---|
Attaches a child element to this layout.
This method will attach the child to the layout, removing it from its
current parent element. Use the Layout.Layer
it returns to manipulate the
child.
child | the child to be attached |
---|---|
before | the child element before which to insert |
Layout.Layer
associated with the element
Attaches a child element to this layout.
This method will attach the child to the layout, removing it from its
current parent element. Use the Layout.Layer
it returns to manipulate the
child.
child | the child to be attached |
---|
Layout.Layer
associated with the element
Attaches a child element to this layout.
This method will attach the child to the layout, removing it from its
current parent element. Use the Layout.Layer
it returns to manipulate the
child.
child | the child to be attached |
---|---|
before | the child element before which to insert |
userObject | an arbitrary object to be associated with this layer |
Layout.Layer
associated with the element
Attaches a child element to this layout.
This method will attach the child to the layout, removing it from its
current parent element. Use the Layout.Layer
it returns to manipulate the
child.
child | the child to be attached |
---|---|
userObject | an arbitrary object to be associated with this layer |
Layout.Layer
associated with the element
Causes the parent element to fill its own parent.
This is most useful for top-level layouts that need to follow the size of another element, such as the <body>.
Returns the size of one unit, in pixels, in the context of this layout.
This will work for any unit type, but be aware that certain unit types,
such as EM
, and EX
, will return different values
based upon the parent's associated font size. PCT
is dependent
upon the parent's actual size, and the axis to be measured.
unit | the unit type to be measured |
---|---|
vertical | whether the unit to be measured is on the vertical or
horizontal axis (this matters only for PCT ) |
Updates the layout by animating it over time, with a callback on each frame of the animation, and upon completion.
duration | the duration of the animation |
---|---|
callback | the animation callback |
Updates the layout by animating it over time.
duration | the duration of the animation |
---|
Updates this layout's children immediately. This method must be
called after updating any of its children's layers
.
This method must be called when the parent element becomes attached to the document.
This method must be called when the parent element becomes detached from the document.
Removes a child element from this layout.
layer | the layer associated with the child to be removed |
---|