Class SpringLayout<T>

java.lang.Object
com.inductiveautomation.snap.ui.SpringLayout<T>
All Implemented Interfaces:
Cloneable

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

    • SpringLayout

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

    • getParent

      public T getParent()
      Returns the parent.
    • setParent

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

      public SpringLayout<T>.SPLayoutInfo getLayoutInfoSP(T aChild)
      Return LayoutInfo for child.
    • getAutosizing

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

      public void addChild(T aChild, 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 Object getLayoutInfoX(T aChild)
      Returns the internal layout info for a child.
    • setLayoutInfoX

      public abstract void setLayoutInfoX(T aChild, 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 Object getLayoutInfo(T aChild)
      Returns layout info (descriptor) for child.
    • setLayoutInfo

      public abstract void setLayoutInfo(T aChild, 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 Object