Package snap.view

Class ParentView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
ArrowView, BorderView, BoxView, BrowserView, ButtonBase, CameraView, ChildView, CollapseView, ComboBox, DocView, DrawerView, GradientStopPicker, Label, ListArea, ListView, MenuBar, RootView, Scroller, ScrollGroup, ScrollView, Spinner, SplitView, TabBar, TableView, TabView, TextField, TextView, TitleView, TitleView.TitleArea, Trackball, TransitionPane, TreeView, WindowView, WrapView

public class ParentView extends View
A View subclass for views with children.
  • Field Details

  • Constructor Details

    • ParentView

      public ParentView()
      Constructor.
  • Method Details

    • getViewList

      public ViewList getViewList()
      Returns the ViewList that holds children.
    • getChildCount

      public int getChildCount()
      Returns the number of children associated with this view.
    • getChild

      public View getChild(int anIndex)
      Returns the child at the given index.
    • getChildren

      public View[] getChildren()
      Returns the array of children associated with this view.
    • addChild

      protected void addChild(View aChild)
      Adds the given child to the end of this view's children list.
    • addChild

      protected void addChild(View aChild, int anIndex)
      Adds the given child to this view's children list at the given index.
    • removeChild

      protected View removeChild(int anIndex)
      Remove's the child at the given index from this view's children list.
    • removeChild

      protected int removeChild(View aChild)
      Removes the given child from this view's children list.
    • removeChildren

      protected void removeChildren()
      Removes all children from this view (in reverse order).
    • setChildren

      protected void setChildren(View... theChildren)
      Sets children to given list.
    • getChildForName

      public View getChildForName(String aName)
      Returns the child with given name.
    • indexOfChild

      public int indexOfChild(View aChild)
      Returns the index of the given child in this view's children list.
    • getChildLast

      public View getChildLast()
      Returns the last child of this view.
    • getChildForClass

      public <E extends View> E getChildForClass(Class<E> aClass)
      Returns the child for given component class.
    • getChildrenForClass

      public <E extends View> E[] getChildrenForClass(Class<E> aClass)
      Returns the children for given component class.
    • getChildAt

      public View getChildAt(Point aPnt)
      Returns the child at given point.
    • getChildAt

      public View getChildAt(double aX, double aY)
      Returns the child at given point.
    • getChildCountManaged

      public int getChildCountManaged()
      Returns the number of managed children.
    • getChildrenManaged

      public View[] getChildrenManaged()
      Returns the managed children.
    • getFocusNext

      protected View getFocusNext(View aChild)
      Returns the next focus View after given view (null to return first).
    • getFocusPrev

      protected View getFocusPrev(View aChild)
      Returns the next focus View after given view (null to return last).
    • setFont

      public void setFont(Font aFont)
      Override to propagate to children.
      Overrides:
      setFont in class View
    • parentFontChanged

      protected void parentFontChanged()
      Override to forward to children that inherit font.
      Overrides:
      parentFontChanged in class View
    • setShowing

      protected void setShowing(boolean aValue)
      Override to send to children.
      Overrides:
      setShowing in class View
    • setOwner

      public void setOwner(ViewOwner anOwner)
      Override to send to children.
      Overrides:
      setOwner in class View
    • setOwnerChildren

      protected void setOwnerChildren(ViewOwner anOwner)
      Forwards setOwner() call to children.
    • intersects

      public boolean intersects(Shape aShape)
      Override to forward to children.
      Overrides:
      intersects in class View
    • paintAll

      protected void paintAll(Painter aPntr)
      Override to add call to paintChildren.
      Overrides:
      paintAll in class View
    • paintChildren

      protected void paintChildren(Painter aPntr)
      Paint children.
    • paintAbove

      protected void paintAbove(Painter aPntr)
      Paints above children.
    • isNeedsRepaintDeep

      public boolean isNeedsRepaintDeep()
      Returns whether any children need repaint.
    • setNeedsRepaintDeep

      protected void setNeedsRepaintDeep(boolean aVal)
      Sets whether any children need repaint.
    • relayout

      public void relayout()
      Override to really request layout from RootView.
      Overrides:
      relayout in class View
    • isNeedsLayout

      public boolean isNeedsLayout()
      Returns whether needs layout.
    • setNeedsLayout

      protected void setNeedsLayout(boolean aVal)
      Sets whether needs layout.
    • isNeedsLayoutDeep

      public boolean isNeedsLayoutDeep()
      Returns whether any children need layout.
    • setNeedsLayoutDeep

      protected void setNeedsLayoutDeep(boolean aVal)
      Sets whether any children need layout.
    • isInLayout

      public boolean isInLayout()
      Returns whether view is currently performing layout.
    • layout

      public void layout()
      Override to layout children.
    • layoutImpl

      protected void layoutImpl()
      Actual method to layout children.
    • layoutFloatingViews

      protected void layoutFloatingViews()
      Called to layout floating children (those unmanaged with lean) according to their Lean, Grow and Margin.
    • layoutDeep

      public void layoutDeep()
      Lays out children deep.
    • layoutDeepImpl

      protected void layoutDeepImpl()
      Lays out children deep.
    • getViewProxy

      protected ViewProxy<?> getViewProxy()
      Returns a ViewProxy for this View. Some classes already have this, but I'm hoping to do something really clever with this one day, like maybe caching PrefSize info.
    • processPropChange

      public void processPropChange(PropChange aPC, Object oldVal, Object newVal)
      Override to handle ParentView changes.
      Specified by:
      processPropChange in interface PropChange.DoChange
      Overrides:
      processPropChange in class PropObject
    • addDeepChangeListener

      public void addDeepChangeListener(DeepChangeListener aDCL)
      Override to add this view as change listener to children on first call.
      Overrides:
      addDeepChangeListener in class PropObject
    • removeDeepChangeListener

      public void removeDeepChangeListener(DeepChangeListener aDCL)
      Override to remove this view as change listener to children when not needed.
      Overrides:
      removeDeepChangeListener in class PropObject
    • childDidPropChange

      protected void childDidPropChange(PropChange aPC)
      Property change listener implementation to forward changes on to deep listeners.
    • childDidDeepChange

      protected void childDidDeepChange(Object aLsnr, PropChange aPC)
      Deep property change listener implementation to forward to this View's deep listeners.
    • themeChanged

      protected void themeChanged()
      Called when ViewTheme changes.
      Overrides:
      themeChanged in class View
    • initProps

      protected void initProps(PropSet aPropSet)
      Override to support props for this class.
      Overrides:
      initProps in class View
    • getPropValue

      public Object getPropValue(String aPropName)
      Override to support props for this class.
      Overrides:
      getPropValue in class View
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override to support props for this class.
      Overrides:
      setPropValue in class View
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      Override to break toXML into toXMLView and toXMLChildren.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class View
    • toXMLView

      protected XMLElement toXMLView(XMLArchiver anArchiver)
      XML Archival of basic view.
    • toXMLChildren

      protected void toXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML archival of children.
    • fromXML

      public View fromXML(XMLArchiver anArchiver, XMLElement anElement)
      Override to break fromXML into fromXMLView and fromXMLChildren.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class View
    • fromXMLView

      protected void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival of basic view.
    • fromXMLChildren

      protected void fromXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival for shape children.