public class LayoutManager extends Object
Constructor and Description |
---|
LayoutManager() |
Modifier and Type | Method and Description |
---|---|
void |
addElementResizeListener(com.google.gwt.dom.client.Element element,
ElementResizeListener listener)
Adds a listener that will be notified whenever the size of a specific
element changes.
|
void |
cleanMeasuredSizes()
Clean measured sizes which are no longer needed.
|
void |
forceLayout() |
static LayoutManager |
get(ApplicationConnection connection)
Gets the layout manager associated with the given
ApplicationConnection . |
int |
getBorderBottom(com.google.gwt.dom.client.Element element)
Gets the bottom border of the given element, provided that it has been
measured.
|
int |
getBorderHeight(com.google.gwt.dom.client.Element element)
Gets the border height (top border + bottom border) of the given element,
provided that it has been measured.
|
int |
getBorderLeft(com.google.gwt.dom.client.Element element)
Gets the left border of the given element, provided that it has been
measured.
|
int |
getBorderRight(com.google.gwt.dom.client.Element element)
Gets the right border of the given element, provided that it has been
measured.
|
int |
getBorderTop(com.google.gwt.dom.client.Element element)
Gets the top border of the given element, provided that it has been
measured.
|
int |
getBorderWidth(com.google.gwt.dom.client.Element element)
Gets the border width (left border + right border) of the given element,
provided that it has been measured.
|
protected ApplicationConnection |
getConnection()
Returns the application connection for this layout manager.
|
int |
getInnerHeight(com.google.gwt.dom.client.Element element)
Gets the inner height (excluding margins, paddings and borders) of the
given element, provided that it has been measured.
|
double |
getInnerHeightDouble(com.google.gwt.dom.client.Element element)
Gets the inner height (excluding margins, paddings and borders) of the
given element, provided that it has been measured.
|
int |
getInnerWidth(com.google.gwt.dom.client.Element element)
Gets the inner width (excluding margins, paddings and borders) of the
given element, provided that it has been measured.
|
double |
getInnerWidthDouble(com.google.gwt.dom.client.Element element)
Gets the inner width (excluding margins, paddings and borders) of the
given element, provided that it has been measured.
|
int |
getMarginBottom(com.google.gwt.dom.client.Element element)
Gets the bottom margin of the given element, provided that it has been
measured.
|
int |
getMarginHeight(com.google.gwt.dom.client.Element element)
Gets the combined top & bottom margin of the given element, provided that
they have been measured.
|
int |
getMarginLeft(com.google.gwt.dom.client.Element element)
Gets the left margin of the given element, provided that it has been
measured.
|
int |
getMarginRight(com.google.gwt.dom.client.Element element)
Gets the right margin of the given element, provided that it has been
measured.
|
int |
getMarginTop(com.google.gwt.dom.client.Element element)
Gets the top margin of the given element, provided that it has been
measured.
|
int |
getMarginWidth(com.google.gwt.dom.client.Element element)
Gets the combined left & right margin of the given element, provided that
they have been measured.
|
protected MeasuredSize |
getMeasuredSize(com.google.gwt.dom.client.Element element,
MeasuredSize defaultSize)
Gets the measured size for an element.
|
int |
getOuterHeight(com.google.gwt.dom.client.Element element)
Gets the outer height (including margins, paddings and borders) of the
given element, provided that it has been measured.
|
double |
getOuterHeightDouble(com.google.gwt.dom.client.Element element)
Gets the outer height (including margins, paddings and borders) of the
given element, provided that it has been measured.
|
int |
getOuterWidth(com.google.gwt.dom.client.Element element)
Gets the outer width (including margins, paddings and borders) of the
given element, provided that it has been measured.
|
double |
getOuterWidthDouble(com.google.gwt.dom.client.Element element)
Gets the outer width (including margins, paddings and borders) of the
given element, provided that it has been measured.
|
int |
getPaddingBottom(com.google.gwt.dom.client.Element element)
Gets the bottom padding of the given element, provided that it has been
measured.
|
int |
getPaddingHeight(com.google.gwt.dom.client.Element element)
Gets the padding height (top padding + bottom padding) of the given
element, provided that it has been measured.
|
int |
getPaddingLeft(com.google.gwt.dom.client.Element element)
Gets the left padding of the given element, provided that it has been
measured.
|
int |
getPaddingRight(com.google.gwt.dom.client.Element element)
Gets the right padding of the given element, provided that it has been
measured.
|
int |
getPaddingTop(com.google.gwt.dom.client.Element element)
Gets the top padding of the given element, provided that it has been
measured.
|
int |
getPaddingWidth(com.google.gwt.dom.client.Element element)
Gets the padding width (left padding + right padding) of the given
element, provided that it has been measured.
|
boolean |
isLayoutNeeded()
Checks if there is something waiting for a layout to take place.
|
boolean |
isLayoutRunning() |
void |
layoutLater() |
void |
layoutNow() |
protected void |
performBrowserLayoutHacks()
Called once per iteration in the layout loop before size calculations so
different browsers quirks can be handled.
|
void |
registerDependency(ManagedLayout owner,
com.google.gwt.dom.client.Element element)
Registers that a ManagedLayout is depending on the size of an Element.
|
void |
removeElementResizeListener(com.google.gwt.dom.client.Element element,
ElementResizeListener listener)
Removes an element resize listener from the provided element.
|
void |
reportHeightAssignedToRelative(ComponentConnector component,
int assignedHeight)
Registers the height reserved for a relatively sized component.
|
void |
reportOuterHeight(ComponentConnector component,
int outerHeight)
Registers the outer height (including margins, borders and paddings) of a
component.
|
void |
reportOuterWidth(ComponentConnector component,
int outerWidth)
Registers the outer width (including margins, borders and paddings) of a
component.
|
void |
reportWidthAssignedToRelative(ComponentConnector component,
int assignedWidth)
Registers the width reserved for a relatively sized component.
|
void |
setConnection(ApplicationConnection connection)
Sets the application connection this instance is connected to.
|
void |
setEverythingNeedsMeasure() |
protected void |
setMeasuredSize(com.google.gwt.dom.client.Element element,
MeasuredSize measuredSize)
Assigns a measured size to an element.
|
void |
setNeedsHorizontalLayout(ManagedLayout layout)
Marks that a ManagedLayout should be layouted horizontally in the next
layout phase even if none of the elements managed by the layout have been
resized horizontally.
|
void |
setNeedsLayout(ManagedLayout layout)
Marks that a ManagedLayout should be layouted in the next layout phase
even if none of the elements managed by the layout have been resized.
|
void |
setNeedsMeasure(ComponentConnector component)
Informs this LayoutManager that the size of a component might have
changed.
|
void |
setNeedsMeasureRecursively(ComponentConnector component)
Informs this LayoutManager that some sizes in a component hierarchy might
have changed.
|
void |
setNeedsVerticalLayout(ManagedLayout layout)
Marks that a ManagedLayout should be layouted vertically in the next
layout phase even if none of the elements managed by the layout have been
resized vertically.
|
void |
unregisterDependency(ManagedLayout owner,
com.google.gwt.dom.client.Element element)
Registers that a ManagedLayout is no longer depending on the size of an
Element.
|
public void setConnection(ApplicationConnection connection)
connection
- the application connection this instance is connected toprotected ApplicationConnection getConnection()
public static LayoutManager get(ApplicationConnection connection)
ApplicationConnection
.connection
- the application connection to get a layout manager forpublic void registerDependency(ManagedLayout owner, com.google.gwt.dom.client.Element element)
owner
- the ManagedLayout that depends on an elementelement
- the Element that should be measuredprotected void setMeasuredSize(com.google.gwt.dom.client.Element element, MeasuredSize measuredSize)
element
- the dom element to attach the measured size tomeasuredSize
- the measured size to attach to the element. If
null
, any previous measured size is removed.protected MeasuredSize getMeasuredSize(com.google.gwt.dom.client.Element element, MeasuredSize defaultSize)
element
- The element to get measured size fordefaultSize
- The size to return if no measured size could be foundpublic void unregisterDependency(ManagedLayout owner, com.google.gwt.dom.client.Element element)
owner
- the ManagedLayout no longer depends on an elementelement
- the Element that that no longer needs to be measuredregisterDependency(ManagedLayout, Element)
public boolean isLayoutRunning()
public void layoutLater()
public void layoutNow()
protected void performBrowserLayoutHacks()
public void forceLayout()
public final void setNeedsLayout(ManagedLayout layout)
This method should not be invoked during a layout phase since it only
controls what will happen in the beginning of the next phase. If you want
to explicitly cause some layout to be considered in an ongoing layout
phase, you should use setNeedsMeasure(ComponentConnector)
instead.
layout
- the managed layout that should be layoutedpublic final void setNeedsHorizontalLayout(ManagedLayout layout)
For SimpleManagedLayout which is always layouted in both directions, this
has the same effect as setNeedsLayout(ManagedLayout)
.
This method should not be invoked during a layout phase since it only
controls what will happen in the beginning of the next phase. If you want
to explicitly cause some layout to be considered in an ongoing layout
phase, you should use setNeedsMeasure(ComponentConnector)
instead.
layout
- the managed layout that should be layoutedpublic final void setNeedsVerticalLayout(ManagedLayout layout)
For SimpleManagedLayout which is always layouted in both directions, this
has the same effect as setNeedsLayout(ManagedLayout)
.
This method should not be invoked during a layout phase since it only
controls what will happen in the beginning of the next phase. If you want
to explicitly cause some layout to be considered in an ongoing layout
phase, you should use setNeedsMeasure(ComponentConnector)
instead.
layout
- the managed layout that should be layoutedpublic final int getOuterHeight(com.google.gwt.dom.client.Element element)
The value returned by this method is always rounded up. To get the exact
outer width, use getOuterHeightDouble(Element)
element
- the element to get the measured size forpublic final double getOuterHeightDouble(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic final int getOuterWidth(com.google.gwt.dom.client.Element element)
The value returned by this method is always rounded up. To get the exact
outer width, use getOuterWidthDouble(Element)
element
- the element to get the measured size forpublic final double getOuterWidthDouble(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic final int getInnerHeight(com.google.gwt.dom.client.Element element)
The value returned by this method is always rounded up. To get the exact
outer width, use getInnerHeightDouble(Element)
element
- the element to get the measured size forpublic final double getInnerHeightDouble(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic final int getInnerWidth(com.google.gwt.dom.client.Element element)
The value returned by this method is always rounded up. To get the exact
outer width, use getOuterHeightDouble(Element)
element
- the element to get the measured size forpublic final double getInnerWidthDouble(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic final int getBorderHeight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingHeight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getBorderWidth(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getBorderTop(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getBorderLeft(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getBorderBottom(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getBorderRight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingWidth(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingTop(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingLeft(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingBottom(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getPaddingRight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getMarginTop(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getMarginRight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getMarginBottom(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getMarginLeft(com.google.gwt.dom.client.Element element)
element
- the element to get the measured size forpublic int getMarginHeight(com.google.gwt.dom.client.Element element)
element
- the element to get the measured margin forpublic int getMarginWidth(com.google.gwt.dom.client.Element element)
element
- the element to get the measured margin forpublic void reportOuterHeight(ComponentConnector component, int outerHeight)
component
- the component for which the size is reportedouterHeight
- the new outer height (including margins, borders and paddings)
of the component in pixelspublic void reportHeightAssignedToRelative(ComponentConnector component, int assignedHeight)
component
- the relatively sized component for which the size is reportedassignedHeight
- the inner height of the relatively sized component's parent
element in pixelspublic void reportWidthAssignedToRelative(ComponentConnector component, int assignedWidth)
component
- the relatively sized component for which the size is reportedassignedWidth
- the inner width of the relatively sized component's parent
element in pixelspublic void reportOuterWidth(ComponentConnector component, int outerWidth)
component
- the component for which the size is reportedouterWidth
- the new outer width (including margins, borders and paddings)
of the component in pixelspublic void addElementResizeListener(com.google.gwt.dom.client.Element element, ElementResizeListener listener)
element
- the element that should be checked for size changeslistener
- an ElementResizeListener that will be informed whenever the
size of the target element has changedpublic void removeElementResizeListener(com.google.gwt.dom.client.Element element, ElementResizeListener listener)
element
- the element to which the element resize listener was
previously addedlistener
- the ElementResizeListener that should no longer get informed
about size changes to the target element.public void setNeedsMeasure(ComponentConnector component)
To set an entire component hierarchy to be measured, use
setNeedsMeasureRecursively(ComponentConnector)
instead.
If there is no upcoming layout phase, a new layout phase is scheduled.
component
- the component whose size might have changed.public void setNeedsMeasureRecursively(ComponentConnector component)
To set a single component to be measured, use
setNeedsMeasure(ComponentConnector)
instead.
If there is no upcoming layout phase, a new layout phase is scheduled.
component
- the component at the root of the component hierarchy to
measurepublic void setEverythingNeedsMeasure()
public void cleanMeasuredSizes()
public boolean isLayoutNeeded()
Copyright © 2019 Vaadin Ltd. All rights reserved.