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

    Modifier and Type
    Method
    Description
    default void
    add()
    Adds a new component at the end of current list.
    void
    add(int atIndex)
    Adds a new component at a specified position, moving subsequent elements by one.
    default boolean
    Checks if the collection is empty.
    default void
    Removes the last component.
    void
    remove(int atIndex)
    Removes a component at given index.
    void
    Clears the collection and removes all elements from it.
    int
    Returns the current size of the collection.
  • Method Details

    • 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:
      true if size() returns 0, false otherwise.
    • 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()
      Adds a new component at the end of current list. By default, it has the same effect as calling add(int) with size() as parameter.
    • 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 calling remove(int) with size()- 1 as parameter.