org.pdfsam.guiclient.commons.models
Class AbstractPdfSelectionTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.pdfsam.guiclient.commons.models.AbstractPdfSelectionTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
SimplePdfSelectionTableModel

public abstract class AbstractPdfSelectionTableModel
extends javax.swing.table.AbstractTableModel

Abstract model for the selection table

Author:
Andrea Vacondio
See Also:
Serialized Form

Nested Class Summary
 class AbstractPdfSelectionTableModel.SortingState
          Model of a sorting state (column and sort type)
 
Field Summary
static int ASCENDING
           
static int DEFAULT_SHOWED_COLUMNS_NUMBER
           
static int DESCENDING
           
static int FILENAME
           
static int MAX_COLUMNS_NUMBER
           
static int NOT_SORTED
           
static int PAGES
           
static int PAGESELECTION
           
static int PASSWORD
           
static int PATH
           
static int PDF_DOCUMENT_VERSION
           
static int ROW_NUM
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AbstractPdfSelectionTableModel()
           
 
Method Summary
abstract  void addRow(PdfSelectionTableItem inputData)
          Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners
abstract  void addRowAt(int index, PdfSelectionTableItem inputData)
          Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners
abstract  void clearData()
          Removes any data source for the model
abstract  void deleteRow(int row)
          Remove a row from the table data source and fire to Listeners
abstract  void deleteRows(int[] rows)
          Remove a set of rows from the table data source and fire to Listeners
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int col)
           Return column name
 java.lang.String[] getColumnNames()
           
 int getMaxRowsNumber()
           
abstract  PdfSelectionTableItem getRow(int row)
          Return the value at row
abstract  PdfSelectionTableItem[] getRows()
           
 int getShowedColumns()
           
abstract  AbstractPdfSelectionTableModel.SortingState getSortingState()
           
 java.lang.String[] getToolTips()
           
 boolean isCellEditable(int row, int column)
          Return true if the cell is editable
 boolean isSortable()
           
abstract  void moveDownRow(int row)
          Moves down a row to the table data source and fire to Listeners
abstract  void moveDownRows(int[] rows)
          Moves down a set of rows to the table data source and fire to Listeners
abstract  void moveUpRow(int row)
          Moves up a row to the table data source and fire to Listeners
abstract  void moveUpRows(int[] rows)
          Moves up a set of rows to the table data source and fire to Listeners
 void setColumnNames(java.lang.String[] columnNames)
           
abstract  void setData(PdfSelectionTableItem[] inputData)
          set data source for the model
 void setMaxRowsNumber(int maxRowsNumber)
           
 void setShowedColumns(int showedColumns)
           
protected  void setSortable(boolean sortable)
           
abstract  void setSortingState(AbstractPdfSelectionTableModel.SortingState sortingState)
          sets the sorting state
 void setToolTips(java.lang.String[] toolTips)
           
abstract  void sort()
          Sort the data
abstract  void updateRowAt(int index, PdfSelectionTableItem inputData)
          Replace a row to the table data source and fire to Listeners
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
getRowCount, getValueAt
 

Field Detail

ROW_NUM

public static final int ROW_NUM
See Also:
Constant Field Values

FILENAME

public static final int FILENAME
See Also:
Constant Field Values

PATH

public static final int PATH
See Also:
Constant Field Values

PAGES

public static final int PAGES
See Also:
Constant Field Values

PASSWORD

public static final int PASSWORD
See Also:
Constant Field Values

PDF_DOCUMENT_VERSION

public static final int PDF_DOCUMENT_VERSION
See Also:
Constant Field Values

PAGESELECTION

public static final int PAGESELECTION
See Also:
Constant Field Values

MAX_COLUMNS_NUMBER

public static final int MAX_COLUMNS_NUMBER
See Also:
Constant Field Values

DEFAULT_SHOWED_COLUMNS_NUMBER

public static final int DEFAULT_SHOWED_COLUMNS_NUMBER
See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

NOT_SORTED

public static final int NOT_SORTED
See Also:
Constant Field Values

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values
Constructor Detail

AbstractPdfSelectionTableModel

public AbstractPdfSelectionTableModel()
Method Detail

getColumnNames

public java.lang.String[] getColumnNames()
Returns:
the columnNames

setToolTips

public void setToolTips(java.lang.String[] toolTips)
Parameters:
toolTips - the toolTips to set

getColumnCount

public int getColumnCount()
Returns:
Number of showed columns

getShowedColumns

public int getShowedColumns()
Returns:
the showedColumns

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

setShowedColumns

public void setShowedColumns(int showedColumns)
Parameters:
showedColumns - the showedColumns to set (must be positive)

getMaxRowsNumber

public int getMaxRowsNumber()
Returns:
the maxRowsNumber

setMaxRowsNumber

public void setMaxRowsNumber(int maxRowsNumber)
Parameters:
maxRowsNumber - the maxRowsNumber to set (must be positive)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Return true if the cell is editable

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

getColumnName

public java.lang.String getColumnName(int col)

Return column name

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - Column number
Returns:
Column name

getToolTips

public java.lang.String[] getToolTips()
Returns:
Returns the toolTips.

setColumnNames

public void setColumnNames(java.lang.String[] columnNames)
Parameters:
columnNames - The columnNames to set.

setSortable

protected void setSortable(boolean sortable)
Parameters:
sortable - the sortable to set

isSortable

public boolean isSortable()
Returns:
the sortable

getRows

public abstract PdfSelectionTableItem[] getRows()
Returns:
rows of the model

deleteRows

public abstract void deleteRows(int[] rows)
                         throws java.lang.IndexOutOfBoundsException

Remove a set of rows from the table data source and fire to Listeners

Parameters:
rows - rows number to remove from the data source
Throws:
java.lang.Exception - if an exception occurs
java.lang.IndexOutOfBoundsException

deleteRow

public abstract void deleteRow(int row)
                        throws java.lang.IndexOutOfBoundsException

Remove a row from the table data source and fire to Listeners

Parameters:
row - row number to remove from the data source
Throws:
java.lang.Exception - if an exception occurs
java.lang.IndexOutOfBoundsException

moveDownRows

public abstract void moveDownRows(int[] rows)
                           throws java.lang.IndexOutOfBoundsException
Moves down a set of rows to the table data source and fire to Listeners

Parameters:
rows - Row numbers to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveDownRow

public abstract void moveDownRow(int row)
                          throws java.lang.IndexOutOfBoundsException
Moves down a row to the table data source and fire to Listeners

Parameters:
row - Row number to remove from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveUpRows

public abstract void moveUpRows(int[] rows)
                         throws java.lang.IndexOutOfBoundsException
Moves up a set of rows to the table data source and fire to Listeners

Parameters:
rows - Row numbers to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveUpRow

public abstract void moveUpRow(int row)
                        throws java.lang.IndexOutOfBoundsException
Moves up a row to the table data source and fire to Listeners

Parameters:
row - Row number to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

addRowAt

public abstract void addRowAt(int index,
                              PdfSelectionTableItem inputData)
Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners

Parameters:
inputData - PdfSelectionTableItem to add to the data source

updateRowAt

public abstract void updateRowAt(int index,
                                 PdfSelectionTableItem inputData)
Replace a row to the table data source and fire to Listeners

Parameters:
index - index to be replaced
inputData - new PdfSelectionTableItem to replace the data source

addRow

public abstract void addRow(PdfSelectionTableItem inputData)
Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners

Parameters:
inputData - PdfSelectionTableItem to add to the data source

clearData

public abstract void clearData()
Removes any data source for the model


setData

public abstract void setData(PdfSelectionTableItem[] inputData)
set data source for the model

Parameters:
inputData - array PdfSelectionTableItem[] as data source

getRow

public abstract PdfSelectionTableItem getRow(int row)
Return the value at row


sort

public abstract void sort()
Sort the data


getSortingState

public abstract AbstractPdfSelectionTableModel.SortingState getSortingState()
Returns:
the sortingState

setSortingState

public abstract void setSortingState(AbstractPdfSelectionTableModel.SortingState sortingState)
sets the sorting state

Parameters:
sortingState -