Class VerticalGroup

  • All Implemented Interfaces:
    Cullable, Layout

    public class VerticalGroup
    extends WidgetGroup
    A group that lays out its children top to bottom vertically, with optional wrapping. Group.getChildren() can be sorted to change the order of the actors (eg Actor.setZIndex(int)). This can be easier than using Table when actors need to be inserted into or removed from the middle of the group. invalidate() must be called after changing the children order.

    The preferred width is the largest preferred width of any child. The preferred height is the sum of the children's preferred heights plus spacing. The preferred size is slightly different when wrap is enabled. The min size is the preferred size and the max size is 0.

    Widgets are sized using their preferred height, so widgets which return 0 as their preferred height will be given a height of 0.

    • Constructor Detail

      • VerticalGroup

        public VerticalGroup()
    • Method Detail

      • invalidate

        public void invalidate()
        Description copied from interface: Layout
        Invalidates this actor's layout, causing Layout.layout() to happen the next time Layout.validate() is called. This method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).
        Specified by:
        invalidate in interface Layout
        Overrides:
        invalidate in class WidgetGroup
      • layout

        public void layout()
        Description copied from interface: Layout
        Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls Layout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each child. This method should almost never be called directly, instead Layout.validate() should be used.
        Specified by:
        layout in interface Layout
        Overrides:
        layout in class WidgetGroup
      • getColumns

        public int getColumns()
        When wrapping is enabled, the number of columns may be > 1.
      • setRound

        public void setRound​(boolean round)
        If true (the default), positions and sizes are rounded to integers.
      • reverse

        public VerticalGroup reverse()
        The children will be displayed last to first.
      • reverse

        public VerticalGroup reverse​(boolean reverse)
        If true, the children will be displayed last to first.
      • getReverse

        public boolean getReverse()
      • space

        public VerticalGroup space​(float space)
        Sets the vertical space between children.
      • getSpace

        public float getSpace()
      • wrapSpace

        public VerticalGroup wrapSpace​(float wrapSpace)
        Sets the horizontal space between columns when wrap is enabled.
      • getWrapSpace

        public float getWrapSpace()
      • pad

        public VerticalGroup pad​(float pad)
        Sets the padTop, padLeft, padBottom, and padRight to the specified value.
      • pad

        public VerticalGroup pad​(float top,
                                 float left,
                                 float bottom,
                                 float right)
      • padBottom

        public VerticalGroup padBottom​(float padBottom)
      • getPadTop

        public float getPadTop()
      • getPadLeft

        public float getPadLeft()
      • getPadBottom

        public float getPadBottom()
      • getPadRight

        public float getPadRight()
      • center

        public VerticalGroup center()
        Sets the alignment of all widgets within the vertical group to Align.center. This clears any other alignment.
      • getAlign

        public int getAlign()
      • fill

        public VerticalGroup fill​(float fill)
        Parameters:
        fill - 0 will use preferred height.
      • getFill

        public float getFill()
      • expand

        public VerticalGroup expand​(boolean expand)
        When true and wrap is false, the columns will take up the entire vertical group width.
      • getExpand

        public boolean getExpand()
      • grow

        public VerticalGroup grow()
        Sets fill to 1 and expand to true.
      • wrap

        public VerticalGroup wrap()
        If false, the widgets are arranged in a single column and the preferred height is the widget heights plus spacing.

        If true, the widgets will wrap using the height of the vertical group. The preferred height of the group will be 0 as it is expected that something external will set the height of the group. Widgets are sized to their preferred height unless it is larger than the group's height, in which case they are sized to the group's height but not less than their minimum height. Default is false.

        When wrap is enabled, the group's preferred width depends on the height of the group. In some cases the parent of the group will need to layout twice: once to set the height of the group and a second time to adjust to the group's new preferred width.

      • getWrap

        public boolean getWrap()
      • columnCenter

        public VerticalGroup columnCenter()
        Sets the alignment of widgets within each column to Align.center. This clears any other alignment.