Package snap.view

Class ViewList

All Implemented Interfaces:
Iterable<View>, Collection<View>, List<View>

public class ViewList extends AbstractList<View>
A class to manage a list of views.
  • Field Details

    • _managed

      protected View[] _managed
  • Constructor Details

    • ViewList

      public ViewList()
      Constructor.
  • Method Details

    • size

      public int size()
      Returns the number of views in this list.
      Specified by:
      size in interface Collection<View>
      Specified by:
      size in interface List<View>
      Specified by:
      size in class AbstractCollection<View>
    • get

      public View get(int anIndex)
      Returns the view at the given index.
      Specified by:
      get in interface List<View>
      Specified by:
      get in class AbstractList<View>
    • addView

      protected void addView(View aView, int anIndex)
      Adds the given view to this list at given index.
    • removeView

      protected View removeView(int anIndex)
      Remove's the view at the given index from this list.
    • indexOf

      public int indexOf(View aView)
      Returns the index of the given child in this node's children list.
    • getFirst

      public View getFirst()
      Returns the last view of this list.
    • getLast

      public View getLast()
      Returns the last view of this list.
    • getAll

      public View[] getAll()
      Returns the contained views as an array.
    • getViewAtXY

      public View getViewAtXY(double aX, double aY)
      Returns the view at given point X/Y.
    • getViewIntersectingShape

      public <T extends View> T getViewIntersectingShape(Shape aShape, Class<T> aClass, View aView)
      Returns the first view of given class (optional) hit by given shape, excluding given view (optional).
    • getViewsIntersectingShape

      public <T extends View> T[] getViewsIntersectingShape(Shape aShape, Class<T> aClass)
      Returns the views of given class (optional) hit by given shape.
    • getHitView

      public <T extends View> T getHitView(View aView, Class<T> aClass, double anInset)
      Returns the first view of given class (optional) intersecting given view.
    • getManaged

      public View[] getManaged()
      Returns the managed children.
    • iterator

      public Iterator<View> iterator()
      Override to iterate directly on internal array to avoid co-modification when children added/removed during iterating.
      Specified by:
      iterator in interface Collection<View>
      Specified by:
      iterator in interface Iterable<View>
      Specified by:
      iterator in interface List<View>
      Overrides:
      iterator in class AbstractList<View>