Package com.inductiveautomation.snap.ui
Class SpringLayout<T>
- java.lang.Object
-
- com.inductiveautomation.snap.ui.SpringLayout<T>
-
- All Implemented Interfaces:
java.lang.Cloneable
public abstract class SpringLayout<T> extends java.lang.Object implements java.lang.CloneableA 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 classSpringLayout.SPLayoutInfoLayoutInfo 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 voidaddChild(T aChild, java.lang.Object aLayoutInfo)Override to force LayoutInfoX to get set.SpringLayoutclone()Standard clone implementation.java.lang.StringgetAutosizing(T aChild)Returns the autosizing string for child.doublegetBestHeight(T aChild, double aValue)Returns child best height.abstract TgetChild(T aParent, int anIndex)Returns the individual child in this line.abstract intgetChildCount(T aParent)Returns the child count of given parent.abstract doublegetHeight(T aChild)Returns child height.abstract SPInsetsgetInsets(T aParent)Returns the insets of the parent.abstract java.lang.ObjectgetLayoutInfo(T aChild)Returns layout info (descriptor) for child.SpringLayout.SPLayoutInfogetLayoutInfoSP(T aChild)Return LayoutInfo for child.abstract java.lang.ObjectgetLayoutInfoX(T aChild)Returns the internal layout info for a child.doublegetMinHeight(double aWidth)The min height for layout.abstract doublegetMinHeight(T aChild, double aValue)Returns child max height.doublegetMinWidth(double aHeight)The min width for layout.abstract doublegetMinWidth(T aChild, double aValue)Returns child min width.TgetParent()Returns the parent.abstract doublegetParentHeight(T aParent)Returns parent height.abstract doublegetParentWidth(T aParent)Returns parent width.doublegetPrefHeight(double aWidth)The preferred height for layout.abstract doublegetPrefHeight(T aChild, double aValue)Returns child preferred height.doublegetPrefWidth(double aHeight)The preferred width for layout.abstract doublegetPrefWidth(T aChild, double aValue)Returns child preferred width.abstract doublegetWidth(T aChild)Returns child width.abstract doublegetX(T aChild)Returns child x.abstract doublegetY(T aChild)Returns child y.voidlayoutChildren(T aParent)Performs layout.voidremoveChild(T aChild)Override to clear LayoutInfoX.voidreset()Update LayoutInfo for all children.abstract voidsetBounds(T aChild, double anX, double aY, double aWidth, double aHeight)Set child bounds.abstract voidsetLayoutInfo(T aChild, java.lang.Object aLI)Sets layout info (descriptor) for child.abstract voidsetLayoutInfoX(T aChild, java.lang.Object aLIX)Sets the internal layout info for a child.voidsetParent(T aParent)Sets the parent.voidupdateChild(T aChild)Updates a child if its layout info has changed.
-
-
-
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.
-
getLayoutInfoSP
public SpringLayout.SPLayoutInfo getLayoutInfoSP(T aChild)
Return LayoutInfo for child.
-
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.
-
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:
clonein classjava.lang.Object
-
-