Class AbstractMoveableTableModel

    • Constructor Detail

      • AbstractMoveableTableModel

        public AbstractMoveableTableModel()
    • Method Detail

      • swap

        protected abstract void swap​(int firstIndex,
                                     int secondIndex)
        Swaps the two rows.
        Parameters:
        firstIndex - the index of the first row
        secondIndex - the index of the second row
      • moveItems

        protected int[] moveItems​(int[] indices,
                                  int moveby,
                                  boolean up)
        moves the selected items by a certain amount of items in a given direction.
        Parameters:
        indices - the indices to move
        moveby - the number of items to move by
        up - if true then items are moved up, otherwise down
        Returns:
        the updated selected indices
      • moveUp

        public int[] moveUp​(int[] indices)
        moves the selected items up by 1.
        Specified by:
        moveUp in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        the updated indices of the selected rows
      • moveDown

        public int[] moveDown​(int[] indices)
        moves the selected items down by 1.
        Specified by:
        moveDown in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        the updated indices of the selected rows
      • moveTop

        public int[] moveTop​(int[] indices)
        moves the selected items to the top.
        Specified by:
        moveTop in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        the updated indices of the selected rows
      • moveBottom

        public int[] moveBottom​(int[] indices)
        moves the selected items to the end.
        Specified by:
        moveBottom in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        the updated indices of the selected rows
      • canMoveUp

        public boolean canMoveUp​(int[] indices)
        checks whether the selected items can be moved up.
        Specified by:
        canMoveUp in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        true if the selected items can be moved
      • canMoveDown

        public boolean canMoveDown​(int[] indices)
        checks whether the selected items can be moved down.
        Specified by:
        canMoveDown in interface MoveableTableModel
        Parameters:
        indices - the indices of the rows to move
        Returns:
        true if the selected items can be moved