Class ComponentIterator

java.lang.Object
org.zkoss.zk.ui.select.impl.ComponentIterator
All Implemented Interfaces:
Iterator<Component>

public class ComponentIterator extends Object implements Iterator<Component>
An implementation of Iterator<Component> that realizes the selector matching algorithm. The iteration is lazily evaluated. i.e. The iterator will not perform extra computation until .next() is called.
Since:
6.0.0
Author:
simonpai
  • Constructor Details

    • ComponentIterator

      public ComponentIterator(Page page, String selector)
      Create an iterator which selects from all the components in the page.
      Parameters:
      page - the reference page for selector
      selector - the selector string
    • ComponentIterator

      public ComponentIterator(Component root, String selector)
      Create an iterator which selects from all the descendants of a given component, including itself.
      Parameters:
      root - the reference component for selector
      selector - the selector string
  • Method Details

    • setPseudoClassDef

      public void setPseudoClassDef(String name, PseudoClassDef def)
      Add or set pseudo class definition.
      Parameters:
      name - the pseudo class name
      def - the pseudo class definition
    • removePseudoClassDef

      public PseudoClassDef removePseudoClassDef(String name)
      Remove a pseudo class definition.
      Parameters:
      name - the pseudo class name
      Returns:
      the original definition
    • clearPseudoClassDefs

      public void clearPseudoClassDefs()
      Clear all custom pseudo class definitions.
    • hasNext

      public boolean hasNext()
      Return true if it has next component.
      Specified by:
      hasNext in interface Iterator<Component>
    • next

      public Component next()
      Return the next matched component. A NoSuchElementException will be throw if next component is not available.
      Specified by:
      next in interface Iterator<Component>
    • remove

      public void remove()
      Throws UnsupportedOperationException.
      Specified by:
      remove in interface Iterator<Component>
    • peek

      public Component peek()
      Return the next matched component, but the iteration is not proceeded.
    • nextIndex

      public int nextIndex()
      Return the index of the next component.