Enum LayoutPolicy
- All Implemented Interfaces:
ValueEnum
,Serializable
,Comparable<LayoutPolicy>
,Constable
Note that, by default, Layouts do not automatically expand the size of all members
to match a member that overflows the layout on the breadth axis. This means that a
DynamicForm
or other component that can't shrink beyond a minimum width will
"stick out" of the Layout, wider than any other member and wider than automatically
generated components like resizeBars or sectionHeaders (in a SectionStack
).
This is by design: matching the size of overflowing members would cause expensive redraws of all members in the Layout, and with two or more members potentially overflowing, could turn minor browser size reporting bugs or minor glitches in custom components into infinite resizing loops.
If you run into this situation, you can either:
- set the overflowing member to
overflow
: "auto", so that it scrolls if it needs more space - set the Layout as a whole to
overflow
:"auto", so that the whole Layout scrolls when the member overflows - define a
resized()
handler to manually update the breadth of the layout - set
Layout.minBreadthMember
to ensure that the available breadth used to expand all (other) members is artificially increased to match the current breadth of theminBreadthMember
member; the layout will still be overflowed in this case and the reported size fromCanvas.getWidth()
orCanvas.getHeight()
won't change, but all members should fill the visible width or height along the breadth axis
For the last approach, given the VLayout myLayout
and a member
myWideMember
, then we could define the following resized()
handler on myLayout
:
myLayout.addResizedHandler(new ResizedHandler() { @Override public void onResized(ResizedEvent event) { int memberWidth = myWideMember.getVisibleWidth(); myLayout.setWidth(Math.max(myLayout.getWidth(), memberWidth + offset)); }where
offset
reflects the difference in width (due to margins, padding,
etc.) between the layout and its widest member. In most cases, a fixed offset can
be used, but it can also be computed via the calculation:
myLayout.getWidth() - myLayout.getViewportWidth()by adding a
draw handler
for myLayout
. (That calculation is not always valid inside the
resized()
handler itself.)
Note: the HLayout case is similar- just substitute height where width appears above.
See also Layout.overflow
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetValue()
static LayoutPolicy
Returns the enum constant of this type with the specified name.static LayoutPolicy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NONE
Layout does not try to size members on the axis at all, merely stacking them (length axis) and leaving them at default breadth.If this enumerated value is used in a
Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "none". -
FILL
Layout sizes members so that they fill the specified size of the layout. The rules are:- Any component given an initial pixel size, programmatically resized to a specific pixel size, or drag resized by user action is left at that exact size
- Any component that
autofits
is given exactly the space it needs, never forced to take up more. - All other components split the remaining space equally, or according to their relative percentages.
- Any component that declares a
Canvas.minWidth
orCanvas.minHeight
will never be sized smaller than that size - Any component that declares a
Canvas.maxWidth
orCanvas.maxHeight
will never be sized larger than that size
adaptive sizing
, and may coordinate with the Layout to render at different sizes according to the amount of available space.If this enumerated value is used in a
Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "fill".
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
-