com.vaadin.signals.

Record Class ListSignal.ListPosition

java.lang.Object
java.lang.Record
com.vaadin.signals.ListSignal.ListPosition

Record Components:

after - id of the node to insert immediately after, or null to not define a constraint

before - id of the node to insert immediately before, or null to not define a constraint

Enclosing class:

ListSignal<T>

public static record ListSignal.ListPosition(Id after, Id before) extends Record

A list insertion position before and/or after the referenced entries. If both entries are defined, then this position represents an exact match that is valid only if the two entries are adjacent. If only one is defined, then the position is relative to only that position. A position with neither reference is not valid for inserts but it is valid to test a parent-child relationship regardless of the child position. Id.ZERO represents the edge of the list, i.e. the first or the last position.

  • Constructor Details

    • ListPosition

      public ListPosition(Id after, Id before)

      Creates an instance of a ListPosition record class.

      Parameters:

      after - the value for the after record component

      before - the value for the before record component

  • Method Details

    • first

      public static ListSignal.ListPosition first()

      Gets the insertion position that corresponds to the beginning of the list.

      Returns:

      a list position for the beginning of the list, not null

    • last

      public static ListSignal.ListPosition last()

      Gets the insertion position that corresponds to the end of the list.

      Returns:

      a list position for the end of the list, not null

    • after

      public static ListSignal.ListPosition after(Signal<?> after)

      Gets the insertion position immediately after the given signal. Inserting after null is interpreted as inserting after the start of the list, i.e. as the first child.

      Parameters:

      after - the signal to insert after, or null to insert first

      Returns:

      a list position after the given signal, not null

    • before

      public static ListSignal.ListPosition before(Signal<?> before)

      Gets the insertion position immediately before the given signal. Inserting before null signal is interpreted as inserting before the end of the list, i.e. as the last child.

      Parameters:

      before - the signal to insert before, or null to insert last

      Returns:

      a list position after the given signal, not null

    • between

      public static ListSignal.ListPosition between(Signal<?> after, Signal<?> before)

      Gets the insertion position between the given signals, assuming those signals are currently adjacent. Inserting after null is interpreted as inserting after the start of the list, i.e. as the first child. Inserting before null signal is interpreted as inserting before the end of the list, i.e. as the last child.

      Parameters:

      after - the signal to insert after, or null to insert first

      before - the signal to insert before, or null to insert last

      Returns:

      a list position between the given signals, not null

    • 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. All components in this record class are compared with Objects::equals(Object,Object).

      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.

    • after

      public Id after()

      Returns the value of the after record component.

      Returns:

      the value of the after record component

    • before

      public Id before()

      Returns the value of the before record component.

      Returns:

      the value of the before record component