Class TableView.Selection

java.lang.Object
overit.geocall.basic.ui.container.TableView.Selection
All Implemented Interfaces:
Serializable
Enclosing class:
TableView

public class TableView.Selection extends Object implements Serializable
Implements the object that manages the selections on the table
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Selection(String columnName)
    Creates a Selection object based on the column name passed as parameter
    Selection(String columnName, Set set)
    Creates a Selection object based on the column name passed as firste parameter and the ordered set containing the reference of the selected rows passed as second parameter
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(int[] rows)
    Adds the rows to the selection
    boolean
    add(int fromRow, int toRow)
    Adds to the selection the rows included in a range
    boolean
    Add the selection passed as parameter to the current selection
    boolean
    contains(int row)
    Checks if the row is in the selection
    boolean
    It subtructs the DBView record identifiers from the selection
    boolean
    It adds the DBView record identifiers to the selection
    Return the content of the selection
    Get the master element between the selected ones.
    int
    Returns the position of the column used to select
    Return an ArrayList containing the row's indexes of the selected rows.
    Returns the set containing the reference of the selected rows
    boolean
    Checks if the selection is a set
    boolean
    remove(int[] rows)
    Removes the rows from the selection
    boolean
    remove(int fromRow, int toRow)
    Removes from the selection the rows included in a range
    void
    Called to setup the Selection, it sets the value of the position of the column used to select
    int
    Return the number of the currently selected rows of the table

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Selection

      public Selection(String columnName)
      Creates a Selection object based on the column name passed as parameter
      Parameters:
      columnName - The string that represents the column name
    • Selection

      public Selection(String columnName, Set set)
      Creates a Selection object based on the column name passed as firste parameter and the ordered set containing the reference of the selected rows passed as second parameter
      Parameters:
      columnName - The string that represents the column name
      set - Ordered set containing the reference of the selected rows. It can be null
  • Method Details

    • setupMetaData

      public void setupMetaData(DBView dbv)
      Called to setup the Selection, it sets the value of the position of the column used to select
      Parameters:
      dbv - The DBView containing the value of the position of the column used to select
    • isSet

      public boolean isSet()
      Checks if the selection is a set
      Returns:
      true is the selection is a set, false otherwise
    • getSet

      public Set getSet()
      Returns the set containing the reference of the selected rows
      Returns:
      The set of selected rows
    • getPosition

      public int getPosition()
      Returns the position of the column used to select
      Returns:
      The number that defines the position of the column
    • size

      public int size()
      Return the number of the currently selected rows of the table
      Returns:
      The number of the currently selected rows
    • empty

      public boolean empty()
      It subtructs the DBView record identifiers from the selection
      Returns:
      true if the selection changes, false otherwise
    • fill

      public boolean fill()
      It adds the DBView record identifiers to the selection
      Returns:
      true if the selection changes, false otherwise
    • add

      public boolean add(int[] rows)
      Adds the rows to the selection
      Parameters:
      rows - The array that contains the number of the rows to be added
      Returns:
      true if something is changed in the selection, false otherwise
    • add

      public boolean add(int fromRow, int toRow)
      Adds to the selection the rows included in a range
      Parameters:
      fromRow - The number of the first row of the range
      toRow - The number of the last row of the range
      Returns:
      true if something is changed in the selection, false otherwise
    • remove

      public boolean remove(int[] rows)
      Removes the rows from the selection
      Parameters:
      rows - The array that contains the number of the rows to be removed
      Returns:
      true if something is changed in the selection, false otherwise
    • remove

      public boolean remove(int fromRow, int toRow)
      Removes from the selection the rows included in a range
      Parameters:
      fromRow - The number of the first row of the range
      toRow - The number of the last row of the range
      Returns:
      true if something is changed in the selection, false otherwise
    • add

      public boolean add(TableView.Selection s)
      Add the selection passed as parameter to the current selection
      Parameters:
      s - The selection to be added
      Returns:
      true if something is changed in the selection, false otherwise
    • contains

      public boolean contains(int row)
      Checks if the row is in the selection
      Parameters:
      row - The number that identifies the row
      Returns:
      true if the row is currently selected, false otherwise
    • getContent

      public ArrayList<HashGetter> getContent()
      Return the content of the selection
      Returns:
      The ArrayList containing the HashGetters of the selected rows, or null
    • getMaster

      public HashGetter getMaster()
      Get the master element between the selected ones. In this implementation the master element is the last selected row.
      Note: this method can be used only if the selectset has been enabled, otherwise UnsupportedOperationException will be throws.
      Returns:
      The HashGetter containing the selected element's data, or null if the selection is empty.
    • getRows

      public ArrayList<Integer> getRows()
      Return an ArrayList containing the row's indexes of the selected rows. In case the DBView is istantiated but no rows was selected, return an empty ArrayList. In case the DBView was not instantiated, the method return null.
      Returns:
      The ArrayList containing the row's indexes of the selected rows, or null