com.vaadin.client.ui.layout.

Class VLayoutSlot

  • Direct Known Subclasses:

    ComponentConnectorLayoutSlot

    public abstract class VLayoutSlot
    extends Object

    An abstract slot class for ManagedLayout cells.

    Author:

    Vaadin Ltd

    • Constructor Summary

      Constructors
      Constructor Description
      VLayoutSlot​(String baseClassName, com.google.gwt.user.client.ui.Widget widget)

      Constructs a slot instance for a ManagedLayout cell.

    • Method Summary

      All Methods
      Modifier and Type Method Description
      AlignmentInfo getAlignment()

      Returns the alignment data for this slot.

      VCaption getCaption()

      Returns the caption element for this slot.

      protected abstract int getCaptionHeight()

      Returns the height of the caption, or zero if there is no caption.

      protected abstract int getCaptionWidth()

      Returns the width of the caption, or zero if there is no caption.

      double getExpandRatio()

      Deprecated.

      this value isn't used for anything by default

      int getUsedHeight()

      Returns how much vertical space the widget and its caption use.

      int getUsedSizeInDirection​(boolean isVertical)

      Returns how much vertical or horizontal space the widget and its caption use depending on the indicated direction.

      int getUsedWidth()

      Returns how much horizontal space the widget and its caption use.

      com.google.gwt.user.client.ui.Widget getWidget()

      Returns the widget that this slot contains.

      abstract int getWidgetHeight()

      Returns the height of the widget, or zero if there is no caption.

      int getWidgetSizeInDirection​(boolean isVertical)

      Returns the widget's height if the indicated direction is vertical, and width if horizontal.

      abstract int getWidgetWidth()

      Returns the width of the widget, or zero if there is no caption.

      com.google.gwt.user.client.Element getWrapperElement()

      Returns the wrapper element for the contents of this slot.

      abstract boolean isRelativeHeight()

      Returns whether the height of the widget has been set as relative.

      boolean isRelativeInDirection​(boolean isVertical)

      Returns whether the height or the width of the widget has been set as relative depending on the indicated direction.

      abstract boolean isRelativeWidth()

      Returns whether the width of the widget has been set as relative.

      abstract boolean isUndefinedHeight()

      Returns whether the height of the widget has been set as undefined.

      boolean isUndefinedInDirection​(boolean isVertical)

      Returns whether the height or the width of the widget has been set as undefined depending on the indicated direction.

      abstract boolean isUndefinedWidth()

      Returns whether the width of the widget has been set as undefined.

      void positionHorizontally​(double currentLocation, double allocatedSpace, double marginRight)

      Position the slot horizontally and set the width and the right margin.

      void positionInDirection​(double currentLocation, double allocatedSpace, double endingMargin, boolean isVertical)

      Position the slot vertically and set the height and the bottom margin, or horizontally and set the width and the right margin, depending on the indicated direction.

      void positionVertically​(double currentLocation, double allocatedSpace, double marginBottom)

      Position the slot vertically and set the height and the bottom margin.

      protected void reportActualRelativeHeight​(int allocatedHeight)

      Override this method to report the expected outer height to the LayoutManager.

      protected void reportActualRelativeWidth​(int allocatedWidth)

      Override this method to report the expected outer width to the LayoutManager.

      void setAlignment​(AlignmentInfo alignment)

      Sets the alignment data for this slot.

      void setCaption​(VCaption caption)

      Sets the caption element for this slot.

      void setExpandRatio​(double expandRatio)

      Deprecated.

      this value isn't used for anything by default

    • Constructor Detail

      • VLayoutSlot

        public VLayoutSlot​(String baseClassName,
                           com.google.gwt.user.client.ui.Widget widget)

        Constructs a slot instance for a ManagedLayout cell.

        Parameters:

        baseClassName - the base class name of the layout

        widget - the widget that should be set to this slot, should not be null

    • Method Detail

      • getCaption

        public VCaption getCaption()

        Returns the caption element for this slot.

        Returns:

        the caption element, can be null

      • setCaption

        public void setCaption​(VCaption caption)

        Sets the caption element for this slot.

        Parameters:

        caption - the caption element, can be null

      • getAlignment

        public AlignmentInfo getAlignment()

        Returns the alignment data for this slot.

        Returns:

        the alignment data, can be null

      • getWidget

        public com.google.gwt.user.client.ui.Widget getWidget()

        Returns the widget that this slot contains.

        Returns:

        the child widget, cannot be null

      • setAlignment

        public void setAlignment​(AlignmentInfo alignment)

        Sets the alignment data for this slot.

        Parameters:

        alignment - the alignment data, can be null

      • positionHorizontally

        public void positionHorizontally​(double currentLocation,
                                         double allocatedSpace,
                                         double marginRight)

        Position the slot horizontally and set the width and the right margin.

        Parameters:

        currentLocation - the left position for this slot

        allocatedSpace - how much horizontal space is available for this slot

        marginRight - the right margin this slot should have (removed if negative)

      • positionVertically

        public void positionVertically​(double currentLocation,
                                       double allocatedSpace,
                                       double marginBottom)

        Position the slot vertically and set the height and the bottom margin.

        Parameters:

        currentLocation - the top position for this slot

        allocatedSpace - how much vertical space is available for this slot

        marginBottom - the bottom margin this slot should have (removed if negative)

      • reportActualRelativeHeight

        protected void reportActualRelativeHeight​(int allocatedHeight)

        Override this method to report the expected outer height to the LayoutManager. By default does nothing.

        Parameters:

        allocatedHeight - the height to set (including margins, borders and paddings) in pixels

      • reportActualRelativeWidth

        protected void reportActualRelativeWidth​(int allocatedWidth)

        Override this method to report the expected outer width to the LayoutManager. By default does nothing.

        Parameters:

        allocatedWidth - the width to set (including margins, borders and paddings) in pixels

      • positionInDirection

        public void positionInDirection​(double currentLocation,
                                        double allocatedSpace,
                                        double endingMargin,
                                        boolean isVertical)

        Position the slot vertically and set the height and the bottom margin, or horizontally and set the width and the right margin, depending on the indicated direction.

        Parameters:

        currentLocation - the top position or the left position for this slot depending on the indicated direction

        allocatedSpace - how much space is available for this slot in the indicated direction

        endingMargin - the bottom margin or the right margin this slot should have depending on the indicated direction (removed if negative)

        isVertical - true if the positioning should be done vertically, false if horizontally

      • getWidgetSizeInDirection

        public int getWidgetSizeInDirection​(boolean isVertical)

        Returns the widget's height if the indicated direction is vertical, and width if horizontal.

        Parameters:

        isVertical - true if the requested dimension is height, false if width

        Returns:

        the widget height or width depending on the indicated direction

      • getUsedWidth

        public int getUsedWidth()

        Returns how much horizontal space the widget and its caption use.

        Returns:

        the width of the contents in pixels

      • getUsedHeight

        public int getUsedHeight()

        Returns how much vertical space the widget and its caption use.

        Returns:

        the height of the contents in pixels

      • getUsedSizeInDirection

        public int getUsedSizeInDirection​(boolean isVertical)

        Returns how much vertical or horizontal space the widget and its caption use depending on the indicated direction.

        Parameters:

        isVertical - true if the requested dimension is height, false if width

        Returns:

        the height or the width of the contents in pixels

      • getCaptionHeight

        protected abstract int getCaptionHeight()

        Returns the height of the caption, or zero if there is no caption.

        Returns:

        the height of the caption, or zero if not found

      • getCaptionWidth

        protected abstract int getCaptionWidth()

        Returns the width of the caption, or zero if there is no caption.

        Returns:

        the width of the caption, or zero if not found

      • getWidgetHeight

        public abstract int getWidgetHeight()

        Returns the height of the widget, or zero if there is no caption.

        Returns:

        the height of the widget, or zero if not found

      • getWidgetWidth

        public abstract int getWidgetWidth()

        Returns the width of the widget, or zero if there is no caption.

        Returns:

        the width of the widget, or zero if not found

      • isUndefinedHeight

        public abstract boolean isUndefinedHeight()

        Returns whether the height of the widget has been set as undefined.

        Returns:

        true if the widget height is undefined, false otherwise

      • isUndefinedWidth

        public abstract boolean isUndefinedWidth()

        Returns whether the width of the widget has been set as undefined.

        Returns:

        true if the widget width is undefined, false otherwise

      • isUndefinedInDirection

        public boolean isUndefinedInDirection​(boolean isVertical)

        Returns whether the height or the width of the widget has been set as undefined depending on the indicated direction.

        Parameters:

        isVertical - true if the requested dimension check is about height, false if about width

        Returns:

        true if the widget height or the widget width is undefined depending on the indicated direction, false otherwise

      • isRelativeHeight

        public abstract boolean isRelativeHeight()

        Returns whether the height of the widget has been set as relative.

        Returns:

        true if the widget height is relative, false otherwise

      • isRelativeWidth

        public abstract boolean isRelativeWidth()

        Returns whether the width of the widget has been set as relative.

        Returns:

        true if the widget width is relative, false otherwise

      • isRelativeInDirection

        public boolean isRelativeInDirection​(boolean isVertical)

        Returns whether the height or the width of the widget has been set as relative depending on the indicated direction.

        Parameters:

        isVertical - true if the requested dimension check is about height, false if about width

        Returns:

        true if the widget height or the widget width is relative depending on the indicated direction, false otherwise

      • getWrapperElement

        public com.google.gwt.user.client.Element getWrapperElement()

        Returns the wrapper element for the contents of this slot.

        Returns:

        the wrapper element

      • setExpandRatio

        @Deprecated
        public void setExpandRatio​(double expandRatio)
        Deprecated.
        this value isn't used for anything by default

        Set how the slot should be expanded relative to the other slots.

        Parameters:

        expandRatio - The ratio of the space the slot should occupy

      • getExpandRatio

        @Deprecated
        public double getExpandRatio()
        Deprecated.
        this value isn't used for anything by default

        Get the expand ratio for the slot. The expand ratio describes how the slot should be resized compared to other slots in the layout.

        Returns:

        the expand ratio of the slot

        See Also:

        setExpandRatio(double)