Package jexer.layout

Class AnchoredLayoutManager

  • All Implemented Interfaces:
    LayoutManager

    public class AnchoredLayoutManager
    extends java.lang.Object
    implements LayoutManager
    AnchoredLayoutManager repositions child widgets based on their coordinates when added, an anchor point, and the current widget size.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AnchoredLayoutManager.Anchor
      Available relative corners of another widget to anchor to.
    • Constructor Summary

      Constructors 
      Constructor Description
      AnchoredLayoutManager​(int width, int height)
      Public constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(TWidget child)
      Add a child widget to manage.
      void onResize​(TResizeEvent resize)
      Process the parent widget's resize event, and resize/reposition child widgets.
      void remove​(TWidget child)
      Remove a child widget from those managed by this LayoutManager.
      void resetSize​(TWidget child)
      Reset a child widget's original/preferred size.
      void setAnchor​(TWidget child, TWidget relativeWidget, AnchoredLayoutManager.Anchor anchor)
      Set a child widget's anchor.
      • Methods inherited from class java.lang.Object

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

      • AnchoredLayoutManager

        public AnchoredLayoutManager​(int width,
                                     int height)
        Public constructor.
        Parameters:
        width - the width of the parent widget
        height - the height of the parent widget
    • Method Detail

      • onResize

        public void onResize​(TResizeEvent resize)
        Process the parent widget's resize event, and resize/reposition child widgets.
        Specified by:
        onResize in interface LayoutManager
        Parameters:
        resize - resize event
      • add

        public void add​(TWidget child)
        Add a child widget to manage.
        Specified by:
        add in interface LayoutManager
        Parameters:
        child - the widget to manage
      • remove

        public void remove​(TWidget child)
        Remove a child widget from those managed by this LayoutManager.
        Specified by:
        remove in interface LayoutManager
        Parameters:
        child - the widget to remove
      • resetSize

        public void resetSize​(TWidget child)
        Reset a child widget's original/preferred size.
        Specified by:
        resetSize in interface LayoutManager
        Parameters:
        child - the widget to manage
      • setAnchor

        public void setAnchor​(TWidget child,
                              TWidget relativeWidget,
                              AnchoredLayoutManager.Anchor anchor)
        Set a child widget's anchor.
        Parameters:
        child - the widget to manage
        relativeWidget - widget to anchor relative to, or null to anchor to the containing widget
        anchor - one of Anchor.TOP_LEFT, Anchor.TOP_RIGHT, etc.