Package org.zkoss.zk.ui.select.impl
Class ComponentIterator
java.lang.Object
org.zkoss.zk.ui.select.impl.ComponentIterator
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 Summary
ConstructorsConstructorDescriptionComponentIterator(Component root, String selector) Create an iterator which selects from all the descendants of a given component, including itself.ComponentIterator(Page page, String selector) Create an iterator which selects from all the components in the page. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all custom pseudo class definitions.booleanhasNext()Return true if it has next component.next()Return the next matched component.intReturn the index of the next component.peek()Return the next matched component, but the iteration is not proceeded.voidremove()Throws UnsupportedOperationException.removePseudoClassDef(String name) Remove a pseudo class definition.voidsetPseudoClassDef(String name, PseudoClassDef def) Add or set pseudo class definition.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ComponentIterator
Create an iterator which selects from all the components in the page.- Parameters:
page- the reference page for selectorselector- the selector string
-
ComponentIterator
Create an iterator which selects from all the descendants of a given component, including itself.- Parameters:
root- the reference component for selectorselector- the selector string
-
-
Method Details
-
setPseudoClassDef
Add or set pseudo class definition.- Parameters:
name- the pseudo class namedef- the pseudo class definition
-
removePseudoClassDef
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. -
next
Return the next matched component. A NoSuchElementException will be throw if next component is not available. -
remove
public void remove()Throws UnsupportedOperationException. -
peek
Return the next matched component, but the iteration is not proceeded. -
nextIndex
public int nextIndex()Return the index of the next component.
-