Interface ModifiableRepeater
- All Superinterfaces:
Repeater
- All Known Subinterfaces:
ModifiableIndexableRepeater
- All Known Implementing Classes:
DefaultModifiableIndexableRepeater,DefaultModifiableRepeater
Interface for modifiable repeaters
-
Method Summary
Modifier and TypeMethodDescriptionaddEntry()Creates a Repeater entry at the last position.addEntry(int position) Creates a Repeater entry at the given position.List<? extends ModifiableRepeaterEntry> Retrieves the repeater entries, sorted by positiongetEntry(int position) Retrieves the repeater entry at the given position.Retrieves the parent of the currentRepeaterRetrieves the repository data used by thisRepeaterRetrieves the rootDataHolderof the current repeaterbooleanmoveEntries(Map<Integer, Integer> positionsMapping, int targetSize) Moves the entries according to the given position mapping.voidremoveEntries(Set<Integer> positions) Removes the repeater entries at the given positions.voidremoveEntry(int position) Removes the repeater entry at the given position.default <T extends SynchronizationResult>
TsynchronizeValues(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) Synchronizes the given values with each repeater's entry<T extends SynchronizationResult>
TsynchronizeValues(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) Synchronizes the given values with each repeater's entryMethods inherited from interface org.ametys.plugins.repository.data.holder.group.Repeater
copyTo, copyTo, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getDifferences, getDifferences, getModel, getSize, hasDifferences, hasDifferences, hasEntry, hasToMoveEntries
-
Method Details
-
getEntries
List<? extends ModifiableRepeaterEntry> getEntries()Description copied from interface:RepeaterRetrieves the repeater entries, sorted by position- Specified by:
getEntriesin interfaceRepeater- Returns:
- the repeater entries
-
getEntry
Description copied from interface:RepeaterRetrieves 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) -
addEntry
Creates a Repeater entry at the last position.- Returns:
- the created entry
-
addEntry
Creates a Repeater entry at the given position. The position starts at index 1. The position can be an integer between 1 and the repeater size + 1 to insert an entry from the beginning Or the position can an integer between 0 and - the repeater size to insert 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 new entry- Returns:
- the created entry
- Throws:
IllegalArgumentException- if the position is not between the negative and positive repeater size
-
moveEntries
Moves the entries 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 will 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
-
removeEntries
Removes the repeater entries at the given positions. The position starts at index 1. The positions can be integers between 1 and the repeater size to remove an entry from the beginning Or the positions can integers between 0 and - the repeater size to remove an entry from the end (0 means the last entry, -1 means before the last one and so on)- Parameters:
positions- The positions of the entries to remove- Throws:
UnknownDataException- if there is no entry for one of the given positions
-
removeEntry
Removes 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 remove an entry from the beginning Or the position can an integer between 0 and - the repeater size to remove an entry from the end (0 means the last entry, -1 means before the last one and so on)- Parameters:
position- The position of the entry to remove- Throws:
UnknownDataException- if there is no entry at the given position
-
synchronizeValues
default <T extends SynchronizationResult> T synchronizeValues(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) throws BadItemTypeException, UndefinedItemPathException Synchronizes the given values with each repeater's entry- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to synchronizerepeaterValues- the values of the repeater to synchronize- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one entry's key doesn't match the corresponding valueUndefinedItemPathException- if an entry's key refers to a data that is not defined by the model
-
synchronizeValues
<T extends SynchronizationResult> T synchronizeValues(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) throws BadItemTypeException, UndefinedItemPathException Synchronizes the given values with each repeater's entry- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
viewItemAccessor- TheViewItemAccessorfor all items to synchronizerepeaterValues- the values of the repeater to synchronizecontext- the context of the synchronization- Returns:
- the
SynchronizationResult - Throws:
BadItemTypeException- if the type defined by the model of one entry's key doesn't match the corresponding valueUndefinedItemPathException- if an entry's key refers to a data that is not defined by the model
-
getRepositoryData
Description copied from interface:RepeaterRetrieves the repository data used by thisRepeater- Specified by:
getRepositoryDatain interfaceRepeater- Returns:
- the repository data used by this
Repeater
-
getParentDataHolder
Description copied from interface:RepeaterRetrieves the parent of the currentRepeater- Specified by:
getParentDataHolderin interfaceRepeater- Returns:
- the parent of the current
Repeater
-
getRootDataHolder
Description copied from interface:RepeaterRetrieves the rootDataHolderof the current repeater- Specified by:
getRootDataHolderin interfaceRepeater- Returns:
- the root
DataHolder
-