Package snap.view

Class SpringView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable, ViewHost

public class SpringView extends ChildView
A View subclass that lays out children using auto sizing settings.
  • Constructor Details

    • SpringView

      public SpringView()
  • Method Details

    • addChild

      public void addChild(View aChild, int anIndex)
      Override to add layout info.
      Overrides:
      addChild in class ChildView
    • removeChild

      public View removeChild(int anIndex)
      Override to remove layout info.
      Overrides:
      removeChild in class ChildView
    • resetSpringInfo

      public void resetSpringInfo(View aChild)
      Resets spring info for given child (or all children if null).
    • getSpringInfo

      protected SpringView.SpringInfo getSpringInfo(View aChild)
      Returns spring info for child.
    • addSpringInfo

      protected void addSpringInfo(View aChild)
      Adds spring info for child.
    • removeSpringInfo

      protected void removeSpringInfo(View aChild)
      Removes spring info for child.
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to perform layout.
      Overrides:
      layoutImpl in class ParentView
    • layoutChild

      protected void layoutChild(View aChild, double newPW, double newPH)
      Returns the child rects for given parent height.
    • childPropChange

      protected void childPropChange(PropChange aPCE)
      Called when child property changes.
    • fromXMLView

      public void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML Archival.
      Overrides:
      fromXMLView in class ParentView
    • getAutosizing

      public static String getAutosizing(View aView)
      Returns the autosizing settings as a string with hyphens for struts and tilde for sprints (horiz,vert).