Interface CollectionController
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
CollectionField
public interface CollectionController extends Serializable
Marker interface for all components that can control a collection. Note: this is not generic in any way to allow reusing one controller among many components.- Since:
- 2021-08-14
- Author:
- miki
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidadd()Adds a new component at the end of current list.voidadd(int atIndex)Adds a new component at a specified position, moving subsequent elements by one.default booleanisEmpty()Checks if the collection is empty.default voidremove()Removes the last component.voidremove(int atIndex)Removes a component at given index.voidremoveAll()Clears the collection and removes all elements from it.intsize()Returns the current size of the collection.
-
-
-
Method Detail
-
size
int size()
Returns the current size of the collection.- Returns:
- A non-negative number.
-
isEmpty
default boolean isEmpty()
Checks if the collection is empty.- Returns:
trueifsize()returns0,falseotherwise.
-
removeAll
void removeAll()
Clears the collection and removes all elements from it.
-
add
void add(int atIndex)
Adds a new component at a specified position, moving subsequent elements by one.- Parameters:
atIndex- Index to add at.
-
add
default void add()
-
remove
void remove(int atIndex)
Removes a component at given index. All subsequent components are moved forward by one.- Parameters:
atIndex- Index to remove component at.
-
remove
default void remove()
Removes the last component. By default, it has the same effect as callingremove(int)withsize()- 1as parameter.
-
-