Class SpringLayout<T>

  • All Implemented Interfaces:
    java.lang.Cloneable

    public abstract class SpringLayout<T>
    extends java.lang.Object
    implements java.lang.Cloneable
    A class to layout children using springs/struts settings. Settings are described with strings using '~' (spring) and '-' (struts), eg.: "-~-,-~-" (horizontal,vertical).
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  SpringLayout.SPLayoutInfo
      LayoutInfo for SpringLayout.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpringLayout​(T aParent)
      Creates a new SpringLayout for adapter.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(T aChild, java.lang.Object aLayoutInfo)
      Override to force LayoutInfoX to get set.
      SpringLayout clone()
      Standard clone implementation.
      java.lang.String getAutosizing​(T aChild)
      Returns the autosizing string for child.
      double getBestHeight​(T aChild, double aValue)
      Returns child best height.
      abstract T getChild​(T aParent, int anIndex)
      Returns the individual child in this line.
      abstract int getChildCount​(T aParent)
      Returns the child count of given parent.
      abstract double getHeight​(T aChild)
      Returns child height.
      abstract SPInsets getInsets​(T aParent)
      Returns the insets of the parent.
      abstract java.lang.Object getLayoutInfo​(T aChild)
      Returns layout info (descriptor) for child.
      SpringLayout.SPLayoutInfo getLayoutInfoSP​(T aChild)
      Return LayoutInfo for child.
      abstract java.lang.Object getLayoutInfoX​(T aChild)
      Returns the internal layout info for a child.
      double getMinHeight​(double aWidth)
      The min height for layout.
      abstract double getMinHeight​(T aChild, double aValue)
      Returns child max height.
      double getMinWidth​(double aHeight)
      The min width for layout.
      abstract double getMinWidth​(T aChild, double aValue)
      Returns child min width.
      T getParent()
      Returns the parent.
      abstract double getParentHeight​(T aParent)
      Returns parent height.
      abstract double getParentWidth​(T aParent)
      Returns parent width.
      double getPrefHeight​(double aWidth)
      The preferred height for layout.
      abstract double getPrefHeight​(T aChild, double aValue)
      Returns child preferred height.
      double getPrefWidth​(double aHeight)
      The preferred width for layout.
      abstract double getPrefWidth​(T aChild, double aValue)
      Returns child preferred width.
      abstract double getWidth​(T aChild)
      Returns child width.
      abstract double getX​(T aChild)
      Returns child x.
      abstract double getY​(T aChild)
      Returns child y.
      void layoutChildren​(T aParent)
      Performs layout.
      void removeChild​(T aChild)
      Override to clear LayoutInfoX.
      void reset()
      Update LayoutInfo for all children.
      abstract void setBounds​(T aChild, double anX, double aY, double aWidth, double aHeight)
      Set child bounds.
      abstract void setLayoutInfo​(T aChild, java.lang.Object aLI)
      Sets layout info (descriptor) for child.
      abstract void setLayoutInfoX​(T aChild, java.lang.Object aLIX)
      Sets the internal layout info for a child.
      void setParent​(T aParent)
      Sets the parent.
      void updateChild​(T aChild)
      Updates a child if its layout info has changed.
      • Methods inherited from class java.lang.Object

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

      • SpringLayout

        public SpringLayout​(T aParent)
        Creates a new SpringLayout for adapter.
    • Method Detail

      • getParent

        public T getParent()
        Returns the parent.
      • setParent

        public void setParent​(T aParent)
        Sets the parent.
      • getAutosizing

        public java.lang.String getAutosizing​(T aChild)
        Returns the autosizing string for child.
      • addChild

        public void addChild​(T aChild,
                             java.lang.Object aLayoutInfo)
        Override to force LayoutInfoX to get set.
      • removeChild

        public void removeChild​(T aChild)
        Override to clear LayoutInfoX.
      • updateChild

        public void updateChild​(T aChild)
        Updates a child if its layout info has changed.
      • layoutChildren

        public void layoutChildren​(T aParent)
        Performs layout.
      • reset

        public void reset()
        Update LayoutInfo for all children.
      • getMinWidth

        public double getMinWidth​(double aHeight)
        The min width for layout.
      • getMinHeight

        public double getMinHeight​(double aWidth)
        The min height for layout.
      • getPrefWidth

        public double getPrefWidth​(double aHeight)
        The preferred width for layout.
      • getPrefHeight

        public double getPrefHeight​(double aWidth)
        The preferred height for layout.
      • getLayoutInfoX

        public abstract java.lang.Object getLayoutInfoX​(T aChild)
        Returns the internal layout info for a child.
      • setLayoutInfoX

        public abstract void setLayoutInfoX​(T aChild,
                                            java.lang.Object aLIX)
        Sets the internal layout info for a child.
      • getParentWidth

        public abstract double getParentWidth​(T aParent)
        Returns parent width.
      • getParentHeight

        public abstract double getParentHeight​(T aParent)
        Returns parent height.
      • getChildCount

        public abstract int getChildCount​(T aParent)
        Returns the child count of given parent.
      • getChild

        public abstract T getChild​(T aParent,
                                   int anIndex)
        Returns the individual child in this line.
      • getInsets

        public abstract SPInsets getInsets​(T aParent)
        Returns the insets of the parent.
      • getLayoutInfo

        public abstract java.lang.Object getLayoutInfo​(T aChild)
        Returns layout info (descriptor) for child.
      • setLayoutInfo

        public abstract void setLayoutInfo​(T aChild,
                                           java.lang.Object aLI)
        Sets layout info (descriptor) for child.
      • getX

        public abstract double getX​(T aChild)
        Returns child x.
      • getY

        public abstract double getY​(T aChild)
        Returns child y.
      • getWidth

        public abstract double getWidth​(T aChild)
        Returns child width.
      • getHeight

        public abstract double getHeight​(T aChild)
        Returns child height.
      • setBounds

        public abstract void setBounds​(T aChild,
                                       double anX,
                                       double aY,
                                       double aWidth,
                                       double aHeight)
        Set child bounds.
      • getMinWidth

        public abstract double getMinWidth​(T aChild,
                                           double aValue)
        Returns child min width.
      • getMinHeight

        public abstract double getMinHeight​(T aChild,
                                            double aValue)
        Returns child max height.
      • getPrefWidth

        public abstract double getPrefWidth​(T aChild,
                                            double aValue)
        Returns child preferred width.
      • getPrefHeight

        public abstract double getPrefHeight​(T aChild,
                                             double aValue)
        Returns child preferred height.
      • getBestHeight

        public double getBestHeight​(T aChild,
                                    double aValue)
        Returns child best height.
      • clone

        public SpringLayout clone()
        Standard clone implementation.
        Overrides:
        clone in class java.lang.Object