Class MultiRowReorderCommand

    • Field Detail

      • toRowPositionCoordinate

        protected RowPositionCoordinate toRowPositionCoordinate
        The coordinate of the row to which the dragged rows should be dropped.
        Since:
        1.6
    • Constructor Detail

      • MultiRowReorderCommand

        public MultiRowReorderCommand​(ILayer layer,
                                      List<Integer> fromRowPositions,
                                      int toRowPosition)
        Parameters:
        layer - The layer the positions are related to
        fromRowPositions - The positions of the rows that should be reordered
        toRowPosition - The position of the row to which the dragged row should be dropped
      • MultiRowReorderCommand

        public MultiRowReorderCommand​(ILayer layer,
                                      List<Integer> fromRowPositions,
                                      int toRowPosition,
                                      boolean reorderToTopEdge)
        Parameters:
        layer - The layer the positions are related to
        fromRowPositions - The positions of the rows that should be reordered
        toRowPosition - The position of the row to which the dragged row should be dropped
        reorderToTopEdge - Flag to indicate if the row is dragged to the top edge of the layer
      • MultiRowReorderCommand

        public MultiRowReorderCommand​(ILayer layer,
                                      int[] fromRowPositions,
                                      int toRowPosition)
        Parameters:
        layer - The layer the positions are related to
        fromRowPositions - The positions of the rows that should be reordered
        toRowPosition - The position of the row to which the dragged row should be dropped
        Since:
        2.0
      • MultiRowReorderCommand

        public MultiRowReorderCommand​(ILayer layer,
                                      int[] fromRowPositions,
                                      int toRowPosition,
                                      boolean reorderToTopEdge)
        Parameters:
        layer - The layer the positions are related to
        fromRowPositions - The positions of the rows that should be reordered
        toRowPosition - The position of the row to which the dragged row should be dropped
        reorderToTopEdge - Flag to indicate if the row is dragged to the top edge of the layer
        Since:
        2.0
      • MultiRowReorderCommand

        protected MultiRowReorderCommand​(MultiRowReorderCommand command)
        Constructor used for cloning purposes
        Parameters:
        command - The command which is base for the new one
    • Method Detail

      • getFromRowPositions

        public List<Integer> getFromRowPositions()
        Returns:
        The positions of the rows that should be reordered
      • getFromRowPositionsArray

        public int[] getFromRowPositionsArray()
        Returns:
        The positions of the rows that should be reordered
        Since:
        2.0
      • getToRowPosition

        public int getToRowPosition()
        Returns:
        The position of the row to which the dragged rows should be dropped
      • isReorderToTopEdge

        public boolean isReorderToTopEdge()
        Returns:
        Flag to indicate if the row is dragged to the top edge of the layer.
      • isReorderByIndex

        public boolean isReorderByIndex()
        Returns:
        true if the carried from rows are treated as indexes, false if they are treated as positions. Default is false.
        Since:
        1.6
      • setReorderByIndex

        public void setReorderByIndex​(boolean reorderByIndex)
        Configure how the carried rows should be treated. By default they are treated as positions and converted to the local layer. Setting this value to true will treat the rows as indexes which will avoid conversion. This can be useful to reorder hidden rows for example.
        Parameters:
        reorderByIndex - true if the carried from columns should be treated as indexes, false if they should be treated as positions.
        Since:
        1.6
      • toggleCoordinateByEdge

        public void toggleCoordinateByEdge()
        Toggles the coordinate from top edge to bottom edge and vice versa. Will not toggle if the coordinate is bottom edge of the last row or the top edge of the first row.
        Since:
        1.6
      • updateFromRowPositions

        public void updateFromRowPositions​(int... fromPositions)
        Parameters:
        fromPositions - The new fromRowPositions.
        Since:
        2.0
      • updateToRowPosition

        public void updateToRowPosition​(int toPosition)
        Parameters:
        toPosition - The new toRowPosition.
        Since:
        2.0
      • convertToTargetLayer

        public boolean convertToTargetLayer​(ILayer targetLayer)
        Description copied from interface: ILayerCommand
        Convert the row/column coordinates the command might be carrying from the source layer to the destination (target) layer. If it is not possible to convert the command to the target layer, then this method will return false and the state of this command object will remain unchanged. Note: Commands should not be processed if they fail conversion.
        Specified by:
        convertToTargetLayer in interface ILayerCommand
        Parameters:
        targetLayer - the target layer
        Returns:
        true if the command is valid after conversion, false if the command is no longer valid.