Class RowReorderEvent

All Implemented Interfaces:
ILayerEvent, IStructuralChangeEvent, IVisualChangeEvent

public class RowReorderEvent extends RowStructuralChangeEvent
Event indicating that one or multiple rows are moved to a new position.
  • Constructor Details

    • RowReorderEvent

      public RowReorderEvent(ILayer layer, int beforeFromRowPosition, int beforeFromRowIndex, int beforeToRowPosition, int beforeToRowIndex, boolean reorderToTopEdge)
      Parameters:
      layer - The layer to which the row positions match.
      beforeFromRowPosition - The row position that was reordered, before the reorder operation was performed.
      beforeFromRowIndex - The index of the reordered position.
      beforeToRowPosition - The position of the row to which the reorder operation was performed, before the reorder operation was performed
      beforeToRowIndex - The index of the row to which the reorder operation was performed.
      reorderToTopEdge - whether the reorder operation was performed to the top or the bottom edge.
      Since:
      1.6
    • RowReorderEvent

      public RowReorderEvent(ILayer layer, List<Integer> beforeFromRowPositions, List<Integer> beforeFromRowIndexes, int beforeToRowPosition, int beforeToRowIndex, boolean reorderToTopEdge)
      Parameters:
      layer - The layer to which the row positions match.
      beforeFromRowPositions - The row positions that were reordered, before the reorder operation was performed.
      beforeFromRowIndexes - The indexes of the reordered positions.
      beforeToRowPosition - The position of the row to which the reorder operation was performed, before the reorder operation was performed
      beforeToRowIndex - The index of the row to which the reorder operation was performed.
      reorderToTopEdge - whether the reorder operation was performed to the top or the bottom edge.
      Since:
      1.6
    • RowReorderEvent

      public RowReorderEvent(ILayer layer, int[] beforeFromRowPositions, int[] beforeFromRowIndexes, int beforeToRowPosition, int beforeToRowIndex, boolean reorderToTopEdge)
      Parameters:
      layer - The layer to which the row positions match.
      beforeFromRowPositions - The row positions that were reordered, before the reorder operation was performed.
      beforeFromRowIndexes - The indexes of the reordered positions.
      beforeToRowPosition - The position of the row to which the reorder operation was performed, before the reorder operation was performed
      beforeToRowIndex - The index of the row to which the reorder operation was performed.
      reorderToTopEdge - whether the reorder operation was performed to the top or the bottom edge.
      Since:
      2.0
    • RowReorderEvent

      public RowReorderEvent(RowReorderEvent event)
      Constructor for internal use to clone this event.
      Parameters:
      event - The event out of which the new one should be created
  • Method Details

    • getBeforeFromRowIndexes

      public Collection<Integer> getBeforeFromRowIndexes()
      Returns:
      The indexes of the reordered rows.
      Since:
      1.6
    • getBeforeFromRowIndexesArray

      public int[] getBeforeFromRowIndexesArray()
      Returns:
      The indexes of the reordered rows.
      Since:
      2.0
    • getBeforeFromRowPositionRanges

      public Collection<Range> getBeforeFromRowPositionRanges()
      Returns:
      The position ranges of the reordered rows.
    • getBeforeToRowPosition

      public int getBeforeToRowPosition()
      Returns:
      The position of the row to which the reorder operation was performed.
    • getBeforeToRowIndex

      public int getBeforeToRowIndex()
      Returns:
      The index of the row to which the reorder operation was performed.
      Since:
      1.6
    • setBeforeToRowIndex

      public void setBeforeToRowIndex(int beforeIndex)
      Setter for the beforeToRowIndex that needs to be called used in case a reorder operation was performed to a hidden row.
      Parameters:
      beforeIndex - The index of the row to which the reorder operation was performed.
      Since:
      1.6
    • isReorderToTopEdge

      public boolean isReorderToTopEdge()
      Returns:
      true if the rows were reordered to the top edge of the toRowPosition, false if the reorder operation was performed on the bottom edge (e.g. at the end of a table)
    • getRowDiffs

      public Collection<StructuralDiff> getRowDiffs()
    • setConvertedBeforePositions

      public void setConvertedBeforePositions(ILayer layer, Collection<Range> fromRowPositionRanges, int toRowPosition)
      This method is intended to be used for position conversion of the before positions. The locally stored before positions are the positions of the reordered row positions before the reorder is applied. Needed in case the conversion needs to be done before other states in the given layer are updated, and therefore the local before position cannot be determined anymore.
      Parameters:
      layer - The layer that performed the conversion of the before positions.
      fromRowPositionRanges - The converted row position ranges that were reordered before the reorder happened.
      toRowPosition - The converted row position to which a reorder happened before the reordering was performed.
      Since:
      1.6
    • convertToLocal

      public boolean convertToLocal(ILayer targetLayer)
      Description copied from interface: ILayerEvent
      Convert the column/row positions carried by the event to the layer about to handle the event.
      Specified by:
      convertToLocal in interface ILayerEvent
      Overrides:
      convertToLocal in class RowVisualChangeEvent
      Parameters:
      targetLayer - layer about to receive the event
      Returns:
      TRUE if successfully converted, FALSE otherwise
    • cloneEvent

      public RowReorderEvent cloneEvent()
      Returns:
      A cloned copy of the event. This cloned copy is provided to each listener.