Record Class ItemDragging.ItemMove

java.lang.Object
java.lang.Record
org.inspirenxe.strata.api.control.attribute.item.ItemDragging.ItemMove
Record Components:
indexes - the rows' indexes in the items before the move, ascending and without repeats, never empty
before - the index, in the items before the move, of the row the moved rows go in front of, or the number of items to put them at the end
Enclosing interface:
ItemDragging<T, S extends ItemDragging<T,S>>

public static record ItemDragging.ItemMove(List<Integer> indexes, int before) extends Record
Rows moved inside a control: which rows, and where they go.
  • Constructor Details

    • ItemMove

      public ItemMove(List<Integer> indexes, int before)
      Checks and copies the indexes.
      Parameters:
      indexes - the rows' indexes, ascending and without repeats, never empty
      before - where they go
      Throws:
      IllegalArgumentException - if the indexes are empty, not ascending, repeat or are negative, or before is negative
  • Method Details

    • apply

      public <T> List<T> apply(List<T> items)
      Returns the items after this move.
      Type Parameters:
      T - the type of the items
      Parameters:
      items - the items before
      Returns:
      a new list with the moved items in front of before, in their order
      Throws:
      IndexOutOfBoundsException - if an index is not an item's, or before is past the end
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • indexes

      public List<Integer> indexes()
      Returns the value of the indexes record component.
      Returns:
      the value of the indexes record component
    • before

      public int before()
      Returns the value of the before record component.
      Returns:
      the value of the before record component