Package org.zkoss.zk.ui.select.impl
Class ComponentIterator
- java.lang.Object
-
- org.zkoss.zk.ui.select.impl.ComponentIterator
-
- All Implemented Interfaces:
java.util.Iterator<Component>
public class ComponentIterator extends java.lang.Object implements java.util.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 Summary
Constructors Constructor Description ComponentIterator(Component root, java.lang.String selector)
Create an iterator which selects from all the descendants of a given component, including itself.ComponentIterator(Page page, java.lang.String selector)
Create an iterator which selects from all the components in the page.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearPseudoClassDefs()
Clear all custom pseudo class definitions.boolean
hasNext()
Return true if it has next component.Component
next()
Return the next matched component.int
nextIndex()
Return the index of the next component.Component
peek()
Return the next matched component, but the iteration is not proceeded.void
remove()
Throws UnsupportedOperationException.PseudoClassDef
removePseudoClassDef(java.lang.String name)
Remove a pseudo class definition.void
setPseudoClassDef(java.lang.String name, PseudoClassDef def)
Add or set pseudo class definition.
-
-
-
Constructor Detail
-
ComponentIterator
public ComponentIterator(Page page, java.lang.String selector)
Create an iterator which selects from all the components in the page.- Parameters:
page
- the reference page for selectorselector
- the selector string
-
ComponentIterator
public ComponentIterator(Component root, java.lang.String selector)
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 Detail
-
setPseudoClassDef
public void setPseudoClassDef(java.lang.String name, PseudoClassDef def)
Add or set pseudo class definition.- Parameters:
name
- the pseudo class namedef
- the pseudo class definition
-
removePseudoClassDef
public PseudoClassDef removePseudoClassDef(java.lang.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 interfacejava.util.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 interfacejava.util.Iterator<Component>
-
remove
public void remove()
Throws UnsupportedOperationException.- Specified by:
remove
in interfacejava.util.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.
-
-