Package snap.view

Class SplitView

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

public class SplitView extends ParentView implements ViewHost
A View subclass to show children with user adjustable divider.
  • Field Details

  • Constructor Details

    • SplitView

      public SplitView()
      Creates a new SplitView.
  • Method Details

    • getItemCount

      public int getItemCount()
      Returns the number of items.
    • getItem

      public View getItem(int anIndex)
      Returns the individual item at given index.
    • addItem

      public void addItem(View aView)
      Override to make sure dividers are in place.
    • getItems

      public List<View> getItems()
      Returns the SplitView items.
    • addItem

      public void addItem(View aView, int anIndex)
      Override to make sure dividers are in place.
    • removeItem

      public View removeItem(int anIndex)
      Override to remove unused dividers.
    • removeItem

      public int removeItem(View aView)
      Override to remove unused dividers.
    • setItem

      public void setItem(View aView, int anIndex)
      Sets the item at index.
    • setItems

      public void setItems(View... theViews)
      Sets the splitview items to given views
    • removeItems

      public void removeItems()
      Sets the splitview items to given views
    • indexOfItem

      public int indexOfItem(View anItem)
      Returns the index of given item.
    • getDivider

      public Divider getDivider()
      Returns the default divider.
    • createDivider

      protected Divider createDivider()
      Creates a new divider.
    • getDividers

      public Divider[] getDividers()
      Returns the dividers.
    • getDividerCount

      public int getDividerCount()
      Returns the number of dividers.
    • getDivider

      public Divider getDivider(int anIndex)
      Returns the individual divider at given index.
    • addDivider

      protected void addDivider(Divider aDiv, int anIndex)
      Adds a new divider.
    • removeDivider

      protected void removeDivider(int anIndex)
      Removes a divider.
    • getDividerSpan

      public double getDividerSpan()
      Returns the default size of the dividers.
    • setDividerSpan

      public void setDividerSpan(double aValue)
      Sets the default size of the dividers.
    • getDividerForXY

      public Divider getDividerForXY(double aX, double aY)
      Returns the divider at given point.
    • addItemWithAnim

      public void addItemWithAnim(View aView, double aSize)
      Adds a child with animation.
    • addItemWithAnim

      public void addItemWithAnim(View aView, double aSize, int anIndex)
      Adds a item with animation.
    • removeItemWithAnim

      public void removeItemWithAnim(View aView)
      Removes a item with animation.
    • setItemVisibleWithAnim

      public void setItemVisibleWithAnim(View aView, boolean aValue)
      Sets a child visible with animation.
    • getPrefWidthImpl

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

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

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

      protected ParentViewProxy<?> getViewProxy()
      Override to return RowViewProxy or ColViewProxy.
      Overrides:
      getViewProxy in class ParentView
    • processDividerMouseEvent

      protected void processDividerMouseEvent(ViewEvent anEvent)
      Handle MouseDrag event: Calculate and set new location.
    • getDefaultBorder

      public Border getDefaultBorder()
      Returns the default border.
      Overrides:
      getDefaultBorder in class View
    • setVertical

      public void setVertical(boolean aValue)
      Override to forward to dividers.
      Overrides:
      setVertical in class View
    • getGuestCount

      public int getGuestCount()
      ViewHost method.
      Specified by:
      getGuestCount in interface ViewHost
    • getGuest

      public View getGuest(int anIndex)
      ViewHost method.
      Specified by:
      getGuest in interface ViewHost
    • addGuest

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

      public View removeGuest(int anIndex)
      ViewHost method.
      Specified by:
      removeGuest in interface ViewHost
    • toXMLView

      protected XMLElement toXMLView(XMLArchiver anArchiver)
      XML Archival of basic view.
      Overrides:
      toXMLView in class ParentView
    • fromXMLView

      protected void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival of basic view.
      Overrides:
      fromXMLView in class ParentView
    • toXMLChildren

      public void toXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML archival deep.
      Overrides:
      toXMLChildren in class ParentView
    • fromXMLChildren

      protected void fromXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival for shape children.
      Overrides:
      fromXMLChildren in class ParentView
    • makeSplitView

      public static SplitView makeSplitView(View aView)
      Replaces the given view with a SplitView.