|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.woody.formmodel.AbstractWidget
org.apache.cocoon.woody.formmodel.Repeater
public class Repeater
A repeater is a widget that repeats a number of other widgets.
Technically, the Repeater widget is a ContainerWidget whose children are
Repeater.RepeaterRows, and the RepeaterRows in turn are ContainerWidgets
containing the actual repeated widgets. However, in practice, you won't need
to use the RepeaterRow widget directly.
Using the methods getSize() and getWidget(int, java.lang.String)
you can access all of the repeated widget instances.
| Nested Class Summary | |
|---|---|
class |
Repeater.RepeaterRow
|
| Field Summary |
|---|
| Fields inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget |
|---|
definition |
| Constructor Summary | |
|---|---|
Repeater(RepeaterDefinition repeaterDefinition)
|
|
| Method Summary | |
|---|---|
Repeater.RepeaterRow |
addRow()
|
Repeater.RepeaterRow |
addRow(int index)
|
void |
addWidget(Widget widget)
Adds a child widget. |
void |
generateLabel(ContentHandler contentHandler)
Generates SAX events for the label of this widget. |
void |
generateSaxFragment(ContentHandler contentHandler,
Locale locale)
Generates an XML representation of this widget. |
void |
generateSize(ContentHandler contentHandler)
Generates a repeater-size element with a size attribute indicating the size of this repeater. |
void |
generateWidgetLabel(String widgetId,
ContentHandler contentHandler)
Generates the label of a certain widget in this repeater. |
Iterator |
getChildren()
Returns an iterator over the widgets this object contains |
String |
getId()
Gets the id of this widget. |
static Repeater.RepeaterRow |
getParentRow(Widget widget)
Crawls up the parents of a widget up to finding a repeater row. |
Repeater.RepeaterRow |
getRow(int index)
|
int |
getSize()
|
Widget |
getWidget(int rowIndex,
String id)
Gets a widget on a certain row. |
Widget |
getWidget(String id)
Gets the child widget of this widget with the given id, or null if there isn't such a child. |
boolean |
hasWidget(String id)
Checks if there is a child widget with the given id. |
int |
indexOf(Repeater.RepeaterRow row)
Get the position of a row in this repeater. |
void |
moveRowLeft(int index)
|
void |
moveRowRight(int index)
|
void |
readFromRequest(FormContext formContext)
Lets this widget read its data from a request. |
void |
removeRow(int index)
|
void |
removeRows()
Clears all rows from the repeater and go back to the initial size |
boolean |
validate(FormContext formContext)
Validates this widget and returns the outcome. |
| Methods inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget |
|---|
addValidator, broadcastEvent, generateItemSaxFragment, generateSaxFragment, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getValue, isRequired, removeValidator, setDefinition, setLocation, setParent, setValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.cocoon.woody.formmodel.Widget |
|---|
broadcastEvent, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getValue, isRequired, setParent, setValue |
| Constructor Detail |
|---|
public Repeater(RepeaterDefinition repeaterDefinition)
| Method Detail |
|---|
public String getId()
AbstractWidget
getId in interface WidgetgetId in class AbstractWidgetpublic int getSize()
public void addWidget(Widget widget)
ContainerWidget
addWidget in interface ContainerWidgetpublic Repeater.RepeaterRow addRow()
public Repeater.RepeaterRow addRow(int index)
public Repeater.RepeaterRow getRow(int index)
public static Repeater.RepeaterRow getParentRow(Widget widget)
widget - the widget whose row is to be found
public int indexOf(Repeater.RepeaterRow row)
row - the row which we search the index for
public void removeRow(int index)
IndexOutOfBoundsException - if the the index is outside the range of existing rows.public void moveRowLeft(int index)
public void moveRowRight(int index)
public void removeRows()
public Widget getWidget(int rowIndex,
String id)
rowIndex - startin from 0id - a widget id
public boolean hasWidget(String id)
ContainerWidget
hasWidget in interface ContainerWidgetpublic Widget getWidget(String id)
Widget
getWidget in interface ContainerWidgetgetWidget in interface WidgetgetWidget in class AbstractWidgetpublic void readFromRequest(FormContext formContext)
Widget
readFromRequest in interface Widgetpublic boolean validate(FormContext formContext)
WidgetWidget.generateSaxFragment(ContentHandler, Locale) method.
validate in interface Widgetvalidate in class AbstractWidget
public void generateSaxFragment(ContentHandler contentHandler,
Locale locale)
throws SAXException
Widget
generateSaxFragment in interface WidgetSAXException
public void generateLabel(ContentHandler contentHandler)
throws SAXException
Widget
generateLabel in interface WidgetgenerateLabel in class AbstractWidgetSAXException
public void generateWidgetLabel(String widgetId,
ContentHandler contentHandler)
throws SAXException
SAXException
public void generateSize(ContentHandler contentHandler)
throws SAXException
SAXExceptionpublic Iterator getChildren()
ContainerWidget
getChildren in interface ContainerWidget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||