org.pdfsam.guiclient.commons.models
Class SimplePdfSelectionTableModel

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

public class SimplePdfSelectionTableModel
extends AbstractPdfSelectionTableModel

Model for the table in JPdfSlectionPanel

Author:
Andrea Vacondio
See Also:
AbstractTableModel, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.pdfsam.guiclient.commons.models.AbstractPdfSelectionTableModel
AbstractPdfSelectionTableModel.SortingState
 
Field Summary
protected  Configuration config
           
protected  java.util.Vector<PdfSelectionTableItem> data
           
 
Fields inherited from class org.pdfsam.guiclient.commons.models.AbstractPdfSelectionTableModel
ASCENDING, DEFAULT_SHOWED_COLUMNS_NUMBER, DESCENDING, FILENAME, MAX_COLUMNS_NUMBER, NOT_SORTED, PAGES, PAGESELECTION, PASSWORD, PATH, PDF_DOCUMENT_VERSION, ROW_NUM
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SimplePdfSelectionTableModel()
          default constructor with default number of showed columns
SimplePdfSelectionTableModel(int showedColumns, int maxRowsNumber)
           
 
Method Summary
 void addRow(PdfSelectionTableItem inputData)
          Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners
 void addRowAt(int index, PdfSelectionTableItem inputData)
          Add a row to the table data source if maxRowsNumber is not reached and fire to Listeners
 void clearData()
          Removes any data source for the model
 void deleteRow(int row)
          Remove a row from the table data source and fire to Listeners
 void deleteRows(int[] rows)
          Remove a set of rows from the table data source and fire to Listeners
 PdfSelectionTableItem getRow(int row)
          Return the value at row
 int getRowCount()
           
 PdfSelectionTableItem[] getRows()
           
 AbstractPdfSelectionTableModel.SortingState getSortingState()
           
 java.lang.Object getValueAt(int row, int col)
          Return the value at row, col
 void moveDownRow(int row)
          Moves down a row to the table data source and fire to Listeners
 void moveDownRows(int[] rows)
          Moves down a set of rows to the table data source and fire to Listeners
 void moveUpRow(int row)
          Moves up a row to the table data source and fire to Listeners
 void moveUpRows(int[] rows)
          Moves up a set of rows to the table data source and fire to Listeners
 void setData(PdfSelectionTableItem[] inputData)
          set data source for the model
 void setSortingState(AbstractPdfSelectionTableModel.SortingState sortingState)
          sets the sorting state
 void setValueAt(java.lang.Object value, int row, int column)
           
 void sort()
          Sort the data
 void updateRowAt(int index, PdfSelectionTableItem inputData)
          Replace a row to the table data source and fire to Listeners
 
Methods inherited from class org.pdfsam.guiclient.commons.models.AbstractPdfSelectionTableModel
getColumnClass, getColumnCount, getColumnName, getColumnNames, getMaxRowsNumber, getShowedColumns, getToolTips, isCellEditable, isSortable, setColumnNames, setMaxRowsNumber, setShowedColumns, setSortable, setToolTips
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected java.util.Vector<PdfSelectionTableItem> data

config

protected Configuration config
Constructor Detail

SimplePdfSelectionTableModel

public SimplePdfSelectionTableModel()
default constructor with default number of showed columns


SimplePdfSelectionTableModel

public SimplePdfSelectionTableModel(int showedColumns,
                                    int maxRowsNumber)
Parameters:
showedColumns -
maxRowsNumber -
Method Detail

getRowCount

public int getRowCount()
Returns:
Rows number

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Return the value at row, col


getRow

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

Specified by:
getRow in class AbstractPdfSelectionTableModel

setData

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

Specified by:
setData in class AbstractPdfSelectionTableModel
Parameters:
inputData - array PdfSelectionTableItem[] as data source

clearData

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

Specified by:
clearData in class AbstractPdfSelectionTableModel

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - value to assign to cell
row - row of cell
column - column of cell

addRow

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

Specified by:
addRow in class AbstractPdfSelectionTableModel
Parameters:
inputData - PdfSelectionTableItem to add to the data source

deleteRow

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

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

Specified by:
deleteRow in class AbstractPdfSelectionTableModel
Parameters:
row - row number to remove from the data source
Throws:
java.lang.Exception - if an exception occurs
java.lang.IndexOutOfBoundsException

deleteRows

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

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

Specified by:
deleteRows in class AbstractPdfSelectionTableModel
Parameters:
rows - rows number to remove from the data source
Throws:
java.lang.Exception - if an exception occurs
java.lang.IndexOutOfBoundsException

getRows

public PdfSelectionTableItem[] getRows()
Specified by:
getRows in class AbstractPdfSelectionTableModel
Returns:
rows of the model

addRowAt

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

Specified by:
addRowAt in class AbstractPdfSelectionTableModel
Parameters:
index - index to add to
inputData - PdfSelectionTableItem to add to the data source

updateRowAt

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

Specified by:
updateRowAt in class AbstractPdfSelectionTableModel
Parameters:
index - index to be replaced
inputData - new PdfSelectionTableItem to replace the data source

moveUpRow

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

Specified by:
moveUpRow in class AbstractPdfSelectionTableModel
Parameters:
row - Row number to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveUpRows

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

Specified by:
moveUpRows in class AbstractPdfSelectionTableModel
Parameters:
rows - Row numbers to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveDownRow

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

Specified by:
moveDownRow in class AbstractPdfSelectionTableModel
Parameters:
row - Row number to remove from the data source
Throws:
java.lang.IndexOutOfBoundsException

moveDownRows

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

Specified by:
moveDownRows in class AbstractPdfSelectionTableModel
Parameters:
rows - Row numbers to move from the data source
Throws:
java.lang.IndexOutOfBoundsException

sort

public void sort()
Description copied from class: AbstractPdfSelectionTableModel
Sort the data

Specified by:
sort in class AbstractPdfSelectionTableModel

getSortingState

public AbstractPdfSelectionTableModel.SortingState getSortingState()
Specified by:
getSortingState in class AbstractPdfSelectionTableModel
Returns:
the sortingState

setSortingState

public void setSortingState(AbstractPdfSelectionTableModel.SortingState sortingState)
Description copied from class: AbstractPdfSelectionTableModel
sets the sorting state

Specified by:
setSortingState in class AbstractPdfSelectionTableModel