|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.forms.util.WidgetFinder
public class WidgetFinder
An utility class to manage list of widgets.
The Widget.lookupWidget(String) method is able
to only return one widget, while this class returns a list of widgets. It uses a path syntax containing a /./,
repeater/./foo, which repreesents all the instances of the foo widget inside the repeater,
one per row. Note that it also supports finding a widgets inside multi level repeaters, something like
invoices/./movements/./amount or courseYears/./exams/./preparatoryCourses/./title .
Class has been designed to offer good performances, since the widget list is built only once and
is automatically updated when a repeater row is added or removed.
RepeaterListeners can be attached directly to receive notifications
of widget additions or removals.
This class is used in CalculatedFields and
CalculatedFieldAlgorithms.
| Constructor Summary | |
|---|---|
WidgetFinder(Widget context,
Iterator paths,
boolean keepUpdated)
Searches for widgets. |
|
WidgetFinder(Widget context,
String path,
boolean keepUpdated)
Searches for widgets. |
|
| Method Summary | |
|---|---|
void |
addRepeaterListener(RepeaterListener listener)
Adds a repeater listener. |
List |
getNewAdditions()
Gets the new widgets that has been added to the list, as a consequence of new repeater rows additions, since last time this method was called or the finder was initialized. |
Collection |
getWidgets()
Return all widgets found for the given paths. |
boolean |
hasNewAdditions()
|
boolean |
hasRepeaterListeners()
|
boolean |
isMutable()
|
protected void |
refreshForAdd(Repeater repeater,
int index)
Called when a new row addition event is received from a monitored repeater. |
protected void |
refreshForClear(Repeater repeater)
Called when a repeater clear event is received from a monitored repeater. |
protected void |
refreshForDelete(Repeater repeater,
int index)
Called when a row deletion event is received from a monitored repeater. |
void |
removeRepeaterListener(RepeaterListener listener)
Removes a listener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WidgetFinder(Widget context,
Iterator paths,
boolean keepUpdated)
context - The context widget to start from.paths - An iterator of Strings containing the paths.keepUpdated - If true, listeners will be installed on repeaters
to keep lists updated without polling.
public WidgetFinder(Widget context,
String path,
boolean keepUpdated)
context - The context widget to start from.path - Path to search for..keepUpdated - If true, listeners will be installed on repeaters
to keep lists updated without polling.| Method Detail |
|---|
protected void refreshForAdd(Repeater repeater,
int index)
repeater - The repeated that generated the event.index - The new row index.
protected void refreshForDelete(Repeater repeater,
int index)
repeater - The repeated that generated the event.index - The deleted row index.protected void refreshForClear(Repeater repeater)
repeater - The repeated that generated the event.public Collection getWidgets()
Widgets.public boolean isMutable()
public boolean hasNewAdditions()
public List getNewAdditions()
Widgets.public void addRepeaterListener(RepeaterListener listener)
getNewAdditions() to retrieve new widgets).
listener - The listener to add.public void removeRepeaterListener(RepeaterListener listener)
addRepeaterListener(RepeaterListener).
listener - The listener to remove.public boolean hasRepeaterListeners()
addRepeaterListener(RepeaterListener).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||