Interface Repeater
- All Known Subinterfaces:
IndexableRepeater,ModifiableIndexableRepeater,ModifiableRepeater
- All Known Implementing Classes:
DefaultIndexableRepeater,DefaultModifiableIndexableRepeater,DefaultModifiableRepeater,DefaultRepeater
public interface Repeater
Interface for repeaters
Here is the format of generated SAX events for data in a repeater:
<entry name="<entry position>">
<sax events for data1 in the current entry>
<sax events for data2 in the current entry>
...
<\entry>
...
Here is the format of JSON object for data in a repeater:
{
"entryCount" : <size>,
"entries" : [
{
"position" : <entry position>,
"values" : {
"<data1>" : <value of data1 in current entry>
"<data2>" : <value of data2 in current entry>
...
}
},
...
]
}
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcopyTo(ModifiableRepeater repeater) Copies the currentRepeaterto the givenModifiableRepeater.voidcopyTo(ModifiableRepeater repeater, DataContext context) Copies the currentRepeaterto the givenModifiableRepeater.Convert into a JSON object the data in the model of the currentRepeaterdataToJSON(String dataPath) Convert the data at the given path into a JSON objectdataToJSON(String dataPath, DataContext context) Convert the data at the given path into a JSON objectdataToJSON(DataContext context) Convert into a JSON object the data in the model of the currentRepeaterdataToJSON(ViewItemAccessor viewItemAccessor) Convert into a JSON object the data in the given view of the currentRepeaterdataToJSON(ViewItemAccessor viewItemAccessor, DataContext context) Convert into a JSON object the data in the given view of the currentRepeaterdataToJSONForEdition(ViewItemAccessor viewItemAccessor, DataContext context) Convert into a JSON object the data in the given view in edition mode of the currentRepeaterdefault voiddataToSAX(ContentHandler contentHandler) Generates SAX events for the data in the model of the currentDataHolderdefault voiddataToSAX(ContentHandler contentHandler, String dataPath) Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given pathvoiddataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given pathvoiddataToSAX(ContentHandler contentHandler, DataContext context) Generates SAX events for the data in the model of the currentDataHolderdefault voiddataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor) Generates SAX events for the data in the given view in the currentRepeatervoiddataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) Generates SAX events for the data in the given view in the currentRepeatervoiddataToSAXForEdition(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) Generates SAX events for the data in the given view in edition mode in the currentRepeaterdefault Collection<ModelItem> getDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) Get the collection of model items where there are differences between the given values and the repeater's entriesgetDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) Get the collection of model items where there are differences between the given values and the repeater's entriesList<? extends RepeaterEntry> Retrieves the repeater entries, sorted by positiongetEntry(int position) Retrieves the repeater entry at the given position.getModel()Retrieves the repeater's modelRetrieves the parent of the currentRepeaterRetrieves the repository data used by thisRepeaterRetrieves the rootDataHolderof the current repeaterintgetSize()Retrieves the size of the repeaterdefault booleanhasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) Check if there are differences between the given values and the repeater's entriesbooleanhasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) Check if there are differences between the given values and the repeater's entriesbooleanhasEntry(int position) Determines if the repeater has an entry at the given position.booleanhasToMoveEntries(Map<Integer, Integer> positionsMapping, int targetSize) Check if has to be moved according to the given position mapping.
-
Method Details
-
getEntries
List<? extends RepeaterEntry> getEntries()Retrieves the repeater entries, sorted by position- Returns:
- the repeater entries
-
getEntry
Retrieves the repeater entry at the given position. The position starts at index 1. The position can be an integer between 1 and the repeater size to get an entry from the beginning Or the position can an integer between 0 and - the repeater size to get an entry from the end (0 means at the end, -1 means before the last one and so on)- Parameters:
position- the position of the entry to retrieve- Returns:
- the repeater entry,
nullif there is no entry at this position
-
getSize
int getSize()Retrieves the size of the repeater- Returns:
- the size of the repeater
-
hasEntry
Determines if the repeater has an entry at the given position. The position starts at index 1. The position can be an integer between 1 and the repeater size to get an entry from the beginning Or the position can an integer between 0 and - the repeater size to get an entry from the end (0 means at the end, -1 means before the last one and so on)- Parameters:
position- the position- Returns:
trueif the repeater has an entry at the given position,falseotherwise
-
copyTo
default void copyTo(ModifiableRepeater repeater) throws UndefinedItemPathException, BadItemTypeException Copies the currentRepeaterto the givenModifiableRepeater.- Parameters:
repeater- The destination repeater. Can not be null.- Throws:
UndefinedItemPathException- if one of the copied data is not defined by the model of the destinationModifiableRepeaterBadItemTypeException- if the type defined by the model of the destinationModifiableRepeaterdoesn't match the copied value
-
copyTo
void copyTo(ModifiableRepeater repeater, DataContext context) throws UndefinedItemPathException, BadItemTypeException Copies the currentRepeaterto the givenModifiableRepeater.- Parameters:
repeater- The destination repeater. Can not be null.context- The context of the data to copy- Throws:
UndefinedItemPathException- if one of the copied data is not defined by the model of the destinationModifiableRepeaterBadItemTypeException- if the type defined by the model of the destinationModifiableRepeaterdoesn't match the copied value
-
dataToSAX
Generates SAX events for the data in the model of the currentDataHolder- Parameters:
contentHandler- theContentHandlerthat will receive the SAX events- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the model of the currentDataHolder- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventscontext- The context of the data to SAX- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler, String dataPath) throws SAXException, BadItemTypeException, UndefinedItemPathException Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given path- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsdataPath- the path of the data to SAX- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored dataUndefinedItemPathException- if the given data path is not defined by the model of the repeater
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, String dataPath, DataContext context) throws SAXException, BadItemTypeException, UndefinedItemPathException Generates SAX events for the data at the given data path in the currentDataHolderDo not generate any event if there is no values at the given path- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsdataPath- the path of the data to SAXcontext- The context of the data to SAX- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored dataUndefinedItemPathException- if the given data path is not defined by the model of the repeater
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in the currentRepeater- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsviewItemAccessor- theViewItemAccessorreferencing the items for which generate SAX events- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in the currentRepeater- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsviewItemAccessor- theViewItemAccessorreferencing the items for which generate SAX eventscontext- The context of the data to SAX- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToSAXForEdition
void dataToSAXForEdition(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in edition mode in the currentRepeater- Parameters:
contentHandler- theContentHandlerthat will receive the SAX eventsviewItemAccessor- theViewItemAccessorreferencing the items for which generate SAX eventscontext- The context of the data to SAX- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored data
-
dataToJSON
Convert into a JSON object the data in the model of the currentRepeater- Returns:
- The data of the current
DataHolderas JSON - Throws:
BadItemTypeException- if the value's type does not matches the stored data
-
dataToJSON
Convert into a JSON object the data in the model of the currentRepeater- Parameters:
context- The context of the data to convert- Returns:
- The data of the current
DataHolderas JSON - Throws:
BadItemTypeException- if the value's type does not matches the stored data
-
dataToJSON
default Map<String,Object> dataToJSON(String dataPath) throws BadItemTypeException, UndefinedItemPathException Convert the data at the given path into a JSON object- Parameters:
dataPath- the path of the data to convert- Returns:
- The value as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored dataUndefinedItemPathException- if the given data path is not defined by the model of the repeater
-
dataToJSON
Map<String,Object> dataToJSON(String dataPath, DataContext context) throws BadItemTypeException, UndefinedItemPathException Convert the data at the given path into a JSON object- Parameters:
dataPath- the path of the data to convertcontext- The context of the data to convert- Returns:
- The value as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored dataUndefinedItemPathException- if the given data path is not defined by the model of the repeater
-
dataToJSON
default Map<String,Object> dataToJSON(ViewItemAccessor viewItemAccessor) throws BadItemTypeException Convert into a JSON object the data in the given view of the currentRepeater- Parameters:
viewItemAccessor- theViewItemAccessorreferencing the items to convert- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored data
-
dataToJSON
Map<String,Object> dataToJSON(ViewItemAccessor viewItemAccessor, DataContext context) throws BadItemTypeException Convert into a JSON object the data in the given view of the currentRepeater- Parameters:
viewItemAccessor- theViewItemAccessorreferencing the items to convertcontext- The context of the data to convert- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored data
-
dataToJSONForEdition
Map<String,Object> dataToJSONForEdition(ViewItemAccessor viewItemAccessor, DataContext context) throws BadItemTypeException Convert into a JSON object the data in the given view in edition mode of the currentRepeater- Parameters:
viewItemAccessor- theViewItemAccessorreferencing the items to convertcontext- The context of the data to convert- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored data
-
hasToMoveEntries
Check if has to be moved according to the given position mapping. The given position mapping's key is the previous position and the value is the new one The existent entries with no corresponding entry in the position mapping should be removed the given size is taken into account to create new empty entries if needed- Parameters:
positionsMapping- the position mappingtargetSize- the target size of the repeater- Returns:
trueif some entries have moved,falseotherwise
-
hasDifferences
default boolean hasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) throws BadItemTypeException Check if there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to checkrepeaterValues- the values of the repeater to check- Returns:
trueif there are differences,falseotherwise- Throws:
BadItemTypeException- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
hasDifferences
boolean hasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) throws BadItemTypeException Check if there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to checkrepeaterValues- the values of the repeater to checkcontext- the context of the synchronization- Returns:
trueif there are differences,falseotherwise- Throws:
BadItemTypeException- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
getDifferences
default Collection<ModelItem> getDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) throws BadItemTypeException Get the collection of model items where there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to checkrepeaterValues- the values of the repeater to check- Returns:
- a collection of model items with differences
- Throws:
BadItemTypeException- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
getDifferences
Collection<ModelItem> getDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) throws BadItemTypeException Get the collection of model items where there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to checkrepeaterValues- the values of the repeater to checkcontext- the context of the synchronization- Returns:
- a collection of model items with differences
- Throws:
BadItemTypeException- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
getRepositoryData
Retrieves the repository data used by thisRepeater- Returns:
- the repository data used by this
Repeater
-
getParentDataHolder
Retrieves the parent of the currentRepeater- Returns:
- the parent of the current
Repeater
-
getRootDataHolder
Retrieves the rootDataHolderof the current repeater- Returns:
- the root
DataHolder
-
getModel
Retrieves the repeater's model- Returns:
- the repeater's model
-