com.vaadin.client.ui.layout.

Class LayoutDependencyTree

  • public class LayoutDependencyTree
    extends Object

    Internal class used to keep track of layout dependencies during one layout run. This class is not intended to be used directly by applications.

    Since:

    7.0.0

    Author:

    Vaadin Ltd

    • Constructor Detail

      • LayoutDependencyTree

        public LayoutDependencyTree​(ApplicationConnection connection)

        Constructs a layout dependency helper class.

        Parameters:

        connection - the current application connection instance, should not be null

        See Also:

        LayoutDependencyTree

    • Method Detail

      • setNeedsMeasure

        public void setNeedsMeasure​(ComponentConnector connector,
                                    boolean needsMeasure)

        Informs this LayoutDependencyTree that the size of a component might have changed and it needs measuring in both directions, or that the measuring is no longer necessary. If there are blockers, measuring will be delayed and cannot be disabled before the blockers have been removed.

        Parameters:

        connector - the connector of the component whose size might have changed, should not be null

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsMeasure

        @Deprecated
        public void setNeedsMeasure​(String connectorId,
                                    boolean needsMeasure)
        Deprecated.
        As of 7.4.2, use setNeedsMeasure(ComponentConnector, boolean) for improved performance.

        Parameters:

        connectorId - the connector id of the component whose size might have changed

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsHorizontalMeasure

        public void setNeedsHorizontalMeasure​(ComponentConnector connector,
                                              boolean needsMeasure)

        Informs this LayoutDependencyTree that the horizontal size of a component might have changed and it needs measuring, or that the measuring is no longer necessary. If there are blockers, measuring will be delayed and cannot be disabled before the blockers have been removed.

        Parameters:

        connector - the connector of the component whose horizontal size might have changed, should not be null

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsHorizontalMeasure

        @Deprecated
        public void setNeedsHorizontalMeasure​(String connectorId,
                                              boolean needsMeasure)
        Deprecated.

        Parameters:

        connectorId - the connector id of the component whose horizontal size might have changed

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsVerticalMeasure

        public void setNeedsVerticalMeasure​(ComponentConnector connector,
                                            boolean needsMeasure)

        Informs this LayoutDependencyTree that the vertical size of a component might have changed and it needs measuring, or that the measuring is no longer necessary. If there are blockers, measuring will be delayed and cannot be disabled before the blockers have been removed.

        Parameters:

        connector - the connector of the component whose vertical size might have changed, should not be null

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsVerticalMeasure

        @Deprecated
        public void setNeedsVerticalMeasure​(String connectorId,
                                            boolean needsMeasure)
        Deprecated.

        Parameters:

        connectorId - the connector id of the component whose vertical size might have changed

        needsMeasure - true if measuring should be enabled, false if measuring should be disabled (disabling is only effective if there are no blockers)

      • setNeedsHorizontalLayout

        @Deprecated
        public void setNeedsHorizontalLayout​(ManagedLayout layout,
                                             boolean needsLayout)
        Deprecated.
        As of 7.0.1, use setNeedsHorizontalLayout(String, boolean) for improved performance.

        Parameters:

        layout - the managed layout whose horizontal size might have changed, should not be null

        needsLayout - true if layouting should be enabled, false if layouting should be disabled (disabling is only effective if there are no blockers)

      • setNeedsHorizontalLayout

        public void setNeedsHorizontalLayout​(String connectorId,
                                             boolean needsLayout)

        Informs this LayoutDependencyTree that the horizontal size of a managed layout might have changed and it needs layouting, or that the layouting is no longer necessary. If there are blockers, layouting will be delayed and cannot be disabled before the blockers have been removed. Logs a warning if no dependency is found.

        Parameters:

        connectorId - the connector id of the managed layout whose horizontal size might have changed

        needsLayout - true if layouting should be enabled, false if layouting should be disabled (disabling is only effective if there are no blockers)

      • setNeedsVerticalLayout

        @Deprecated
        public void setNeedsVerticalLayout​(ManagedLayout layout,
                                           boolean needsLayout)
        Deprecated.
        As of 7.0.1, use setNeedsVerticalLayout(String, boolean) for improved performance.

        Parameters:

        layout - the managed layout whose vertical size might have changed, should not be null

        needsLayout - true if layouting should be enabled, false if layouting should be disabled (disabling is only effective if there are no blockers)

      • setNeedsVerticalLayout

        public void setNeedsVerticalLayout​(String connectorId,
                                           boolean needsLayout)

        Informs this LayoutDependencyTree that the vertical size of a managed layout might have changed and it needs layouting, or that the layouting is no longer necessary. If there are blockers, layouting will be delayed and cannot be disabled before the blockers have been removed. Logs a warning if no dependency is found.

        Parameters:

        connectorId - the connector id of the managed layout whose vertical size might have changed

        needsLayout - true if layouting should be enabled, false if layouting should be disabled (disabling is only effective if there are no blockers)

      • markAsHorizontallyLayouted

        public void markAsHorizontallyLayouted​(ManagedLayout layout)

        Marks the managed layout as layouted horizontally and propagates the need of horizontal measuring for any components that might have got their size changed as a result. If there are blockers, nothing is done.

        Parameters:

        layout - the managed layout whose horizontal layouting has been done, should not be null

      • markAsVerticallyLayouted

        public void markAsVerticallyLayouted​(ManagedLayout layout)

        Marks the managed layout as layouted vertically and propagates the need of vertical measuring for any components that might have got their size changed as a result. If there are blockers, nothing is done.

        Parameters:

        layout - the managed layout whose vertical layouting has been done, should not be null

      • markHeightAsChanged

        public void markHeightAsChanged​(ComponentConnector connector)

        Marks the component's height as changed. Iterates through all components whose vertical size depends on this component's size. If the dependent is a managed layout triggers need for vertical layouting, otherwise triggers need for vertical measuring for any dependent components of that component in turn. Finally triggers horizontal measuring for the scrolling boundary, in case vertical scrollbar has appeared or disappeared due the height change.

        Parameters:

        connector - the connector of the component whose height has changed, should not be null

      • markWidthAsChanged

        public void markWidthAsChanged​(ComponentConnector connector)

        Marks the component's width as changed. Iterates through all components whose horizontal size depends on this component's size. If the dependent is a managed layout triggers need for horizontal layouting, otherwise triggers need for horizontal measuring for any dependent components of that component in turn. Finally triggers vertical measuring for the scrolling boundary, in case horizontal scrollbar has appeared or disappeared due the width change.

        Parameters:

        connector - the connector of the component whose width has changed, should not be null

      • hasConnectorsToMeasure

        public boolean hasConnectorsToMeasure()

        Returns whether there are any components waiting for either horizontal or vertical measuring.

        Returns:

        true if either measure queue contains anything, false otherwise

      • hasHorizontalConnectorToLayout

        public boolean hasHorizontalConnectorToLayout()

        Returns whether there are any managed layouts waiting for horizontal layouting.

        Returns:

        true if horizontal layouting queue is not empty, false otherwise

      • hasVerticaConnectorToLayout

        public boolean hasVerticaConnectorToLayout()

        Returns whether there are any managed layouts waiting for vertical layouting.

        Returns:

        true if vertical layouting queue is not empty, false otherwise

      • getHorizontalLayoutTargetsJsArray

        public com.google.gwt.core.client.JsArrayString getHorizontalLayoutTargetsJsArray()

        Returns a JsArrayString array of connectorIds for managed layouts that are waiting for horizontal layouting.

        Returns:

        JsArrayString of connectorIds

      • getVerticalLayoutTargetsJsArray

        public com.google.gwt.core.client.JsArrayString getVerticalLayoutTargetsJsArray()

        Returns a JsArrayString array of connectorIds for managed layouts that are waiting for vertical layouting.

        Returns:

        JsArrayString of connectorIds

      • getMeasureTargetsJsArray

        public com.google.gwt.core.client.JsArrayString getMeasureTargetsJsArray()

        Returns a JsArrayString array of connectorIds for components that are waiting for either horizontal or vertical measuring.

        Returns:

        JsArrayString of connectorIds

      • logDependencyStatus

        public void logDependencyStatus​(ComponentConnector connector)

        Logs horizontal and vertical LayoutDependencyTree.LayoutDependency state for the given connector.

        Parameters:

        connector - the connector whose state to log, should not be null

      • noMoreChangesExpected

        public boolean noMoreChangesExpected​(ComponentConnector connector)

        Returns whether all required layouting and measuring has been done for this component to both directions and there are no more blockers waiting for handling.

        Parameters:

        connector - the connector to check, should not be null

        Returns:

        true if nothing is pending, false otherwise

      • getScrollingBoundary

        public ComponentConnector getScrollingBoundary​(ComponentConnector connector)

        Returns the scrolling boundary for this component. If a cached value is available, the check isn't performed again. If no cached value exists, iterates through the component hierarchy until the closest parent that implements MayScrollChildren has been found.

        Parameters:

        connector - the connector to check, should not be null

        Returns:

        the closest scrolling parent or null if not found