Package snap.view

Class BoxView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable, ViewHost
Direct Known Subclasses:
ScaleBox

public class BoxView extends ParentView implements ViewHost
A View that holds another view.
  • Field Details

  • Constructor Details

    • BoxView

      public BoxView()
      Constructor.
    • BoxView

      public BoxView(View aContent)
      Constructor for content.
    • BoxView

      public BoxView(View aContent, boolean isFillWidth, boolean isFillHeight)
      Constructor for content with FillWidth, FillHeight params.
  • Method Details

    • getContent

      public View getContent()
      Returns the box content.
    • setContent

      public void setContent(View aView)
      Sets the box content.
    • isFillWidth

      public boolean isFillWidth()
      Returns whether children will be resized to fill width.
    • setFillWidth

      public void setFillWidth(boolean aValue)
      Sets whether children will be resized to fill width.
    • isFillHeight

      public boolean isFillHeight()
      Returns whether children will be resized to fill height.
    • setFillHeight

      public void setFillHeight(boolean aValue)
      Sets whether children will be resized to fill height.
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Override.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Override.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override.
      Overrides:
      layoutImpl in class ParentView
    • getViewProxy

      protected BoxViewProxy<?> getViewProxy()
      Override to return BoxViewProxy.
      Overrides:
      getViewProxy in class ParentView
    • getGuestCount

      public int getGuestCount()
      ViewHost method: Override to return 1 if content is present.
      Specified by:
      getGuestCount in interface ViewHost
    • getGuest

      public View getGuest(int anIndex)
      ViewHost method: Override to return content (and complain if index beyond 0).
      Specified by:
      getGuest in interface ViewHost
    • addGuest

      public void addGuest(View aChild, int anIndex)
      ViewHost method: Override to set content.
      Specified by:
      addGuest in interface ViewHost
    • removeGuest

      public View removeGuest(int anIndex)
      ViewHost method: Override to clear content (and complain if index beyond 0).
      Specified by:
      removeGuest in interface ViewHost
    • setContentWithAnim

      public void setContentWithAnim(View aView)
      Sets the content with animation.
    • toXMLView

      public XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ParentView
    • fromXMLView

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

      public static double getPrefWidth(ParentView aParent, View aChild, double aH)
      Returns preferred width of layout.
    • getPrefHeight

      public static double getPrefHeight(ParentView aParent, View aChild, double aW)
      Returns preferred height of layout.
    • layout

      public static void layout(ParentView aPar, View aChild, boolean isFillWidth, boolean isFillHeight)
      Performs Box layout for given parent, child and fill width/height.