Class SimpleDock


  • public class SimpleDock
    extends ej.mwt.Container
    Lays out three children vertically or horizontally.

    The three children are laid out on the same horizontal or vertical line, one at the center and the two others on each side.

    In a horizontal simple dock, the first and last widgets will have the height of the available space and will have their optimal width. In a vertical simple dock, the first and last widgets will have the width of the available space and will have their optimal height. Regardless of the orientation of the simple dock, the center widget will have the size of the remaining space.

    Horizontal:

    Horizontal simple dock.

    Vertical:

    Vertical simple dock.

    • Field Summary

      • Fields inherited from class ej.mwt.Widget

        NO_CONSTRAINT
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleDock​(boolean orientation)
      Creates a simple dock specifying its orientation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void computeContentOptimalSize​(ej.mwt.util.Size size)  
      ej.mwt.Widget getCenterChild()
      Gets the center widget of this simple dock.
      ej.mwt.Widget getFirstChild()
      Gets the first widget of this simple dock.
      ej.mwt.Widget getLastChild()
      Gets the last widget of this simple dock.
      boolean getOrientation()
      Gets the orientation of this simple dock.
      protected void layOutChildren​(int contentWidth, int contentHeight)  
      void removeAllChildren()  
      void removeChild​(ej.mwt.Widget widget)  
      void setCenterChild​(ej.mwt.Widget child)
      Sets the center widget of this simple dock.
      void setFirstChild​(ej.mwt.Widget child)
      Sets the first widget of this simple dock.
      void setLastChild​(ej.mwt.Widget child)
      Sets the last widget of this simple dock.
      void setOrientation​(boolean orientation)
      Sets the orientation of this simple dock.
      • Methods inherited from class ej.mwt.Container

        addChild, changeChildIndex, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, insertChild, layOutAlignedChild, layOutChild, renderChild, renderContent, replaceChild, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyle
      • Methods inherited from class ej.mwt.Widget

        addClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getDesktop, getHeight, getParent, getStyle, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onAttached, onDetached, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleDock

        public SimpleDock​(boolean orientation)
        Creates a simple dock specifying its orientation.
        Parameters:
        orientation - the orientation of the simple dock (see LayoutOrientation).
    • Method Detail

      • setOrientation

        public void setOrientation​(boolean orientation)
        Sets the orientation of this simple dock.
        Parameters:
        orientation - the orientation to set (see LayoutOrientation).
      • getOrientation

        public boolean getOrientation()
        Gets the orientation of this simple dock.
        Returns:
        the orientation of this simple dock (see LayoutOrientation).
      • setFirstChild

        public void setFirstChild​(ej.mwt.Widget child)
        Sets the first widget of this simple dock. If this simple dock is horizontal, the first widget is on the left side, otherwise it is on the top side.
        Parameters:
        child - the widget to add.
        Throws:
        java.lang.NullPointerException - if the given widget is null.
        java.lang.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).
        See Also:
        Container.addChild(Widget)
      • getFirstChild

        @Nullable
        public ej.mwt.Widget getFirstChild()
        Gets the first widget of this simple dock.
        Returns:
        the first widget of this simple dock, or null is it has not been set.
      • setLastChild

        public void setLastChild​(ej.mwt.Widget child)
        Sets the last widget of this simple dock. If this simple dock is horizontal, the last widget is on the right side, otherwise it is on the bottom side.
        Parameters:
        child - the widget to add.
        Throws:
        java.lang.NullPointerException - if the given widget is null.
        java.lang.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).
        See Also:
        Container.addChild(Widget)
      • getLastChild

        @Nullable
        public ej.mwt.Widget getLastChild()
        Gets the last widget of this simple dock.
        Returns:
        the last widget of this simple dock, or null is it has not been set.
      • setCenterChild

        public void setCenterChild​(ej.mwt.Widget child)
        Sets the center widget of this simple dock.
        Parameters:
        child - the widget to add.
        Throws:
        java.lang.NullPointerException - if the given widget is null.
        java.lang.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).
        See Also:
        Container.addChild(Widget)
      • getCenterChild

        @Nullable
        public ej.mwt.Widget getCenterChild()
        Gets the center widget of this simple dock.
        Returns:
        the center widget of this simple dock, or null is it has not been set.
      • removeChild

        public void removeChild​(ej.mwt.Widget widget)
        Overrides:
        removeChild in class ej.mwt.Container
      • removeAllChildren

        public void removeAllChildren()
        Overrides:
        removeAllChildren in class ej.mwt.Container
      • computeContentOptimalSize

        protected void computeContentOptimalSize​(ej.mwt.util.Size size)
        Specified by:
        computeContentOptimalSize in class ej.mwt.Widget
      • layOutChildren

        protected void layOutChildren​(int contentWidth,
                                      int contentHeight)
        Specified by:
        layOutChildren in class ej.mwt.Container