com.sas.swing.visuals.tableview
Interface TableRowModel

All Known Implementing Classes:
DefaultTableRowModel

public interface TableRowModel

Defines the requirements for a table row model object suitable for use with TableView.

See Also:
DefaultTableRowModel

Method Summary
 void addRowModelListener(TableRowModelListener x)
          Adds a listener for table row model events.
 void clearRowMoves()
          This will reset the row indexes back to their original values, before any calls to moveRow were made.
 int convertRowIndexToModel(int viewRowIndex)
          Maps the index of the row in the view at viewRowIndex to the index of the row in the table model.
 int convertRowIndexToView(int modelRowIndex)
          Maps the index of the row in the table model at modelRowIndex to the index of the row in the view.
 int getRowCount()
          Returns the number of rows in the model.
 int getRowMargin()
          Returns the width between the cells in each row.
 boolean getRowSelectionAllowed()
          Returns true if rows may be selected.
 int getSelectedRowCount()
          Returns the number of selected rows.
 int[] getSelectedRows()
          Returns an array of indicies of all selected rows.
 javax.swing.ListSelectionModel getSelectionModel()
          Returns the current selection model.
 void moveRow(int rowIndex, int newIndex)
          Moves the row and its header at rowIndex to newIndex.
 void removeRowModelListener(TableRowModelListener x)
          Removes a listener for table row model events.
 void setRowMargin(int newMargin)
          Sets the row margin to newMargin.
 void setRowSelectionAllowed(boolean flag)
          Sets whether the rows in this model may be selected.
 void setSelectionModel(javax.swing.ListSelectionModel newModel)
          Sets the selection model.
 

Method Detail

moveRow

void moveRow(int rowIndex,
             int newIndex)
Moves the row and its header at rowIndex to newIndex. The old row at rowIndex will now be found at newIndex. The row that used to be at newIndex is shifted up or down to make room. This will not move any rows if rowIndex equals newIndex. This method posts a rowMoved event to its listeners.

Parameters:
rowIndex - the index of row to be moved
newIndex - index of the row's new location
Throws:
java.lang.IllegalArgumentException - if rowIndex or newIndex are not in the valid range

clearRowMoves

void clearRowMoves()
This will reset the row indexes back to their original values, before any calls to moveRow were made. This allows users to clear the row moves whenever they want as there may have been a change in the model that requires such.


setRowMargin

void setRowMargin(int newMargin)
Sets the row margin to newMargin. This method posts a rowMarginChanged event to its listeners.

Parameters:
newMargin - the width, in pixels, of the new row margins
See Also:
getRowMargin()

getRowMargin

int getRowMargin()
Returns the width between the cells in each row.

Returns:
the margin, in pixels, between the cells
See Also:
setRowMargin(int)

getRowCount

int getRowCount()
Returns the number of rows in the model.

Returns:
the number of rows in the model

convertRowIndexToModel

int convertRowIndexToModel(int viewRowIndex)
Maps the index of the row in the view at viewRowIndex to the index of the row in the table model. Returns the index of the corresponding row in the model. If viewRowIndex is less than zero, returns viewRowIndex.

Parameters:
viewRowIndex - the index of the row in the view
Returns:
the index of the corresponding row in the model
See Also:
convertRowIndexToView(int)

convertRowIndexToView

int convertRowIndexToView(int modelRowIndex)
Maps the index of the row in the table model at modelRowIndex to the index of the row in the view. Returns the index of the corresponding row in the view; returns -1 if this row is not being displayed. If modelRowIndex is less than zero, returns modelRowIndex.

Parameters:
modelRowIndex - the index of the row in the model
Returns:
the index of the corresponding row in the view
See Also:
convertRowIndexToModel(int)

setRowSelectionAllowed

void setRowSelectionAllowed(boolean flag)
Sets whether the rows in this model may be selected.

Parameters:
flag - true if rows may be selected; otherwise false
See Also:
getRowSelectionAllowed()

getRowSelectionAllowed

boolean getRowSelectionAllowed()
Returns true if rows may be selected.

Returns:
true if rows may be selected
See Also:
setRowSelectionAllowed(boolean)

getSelectedRows

int[] getSelectedRows()
Returns an array of indicies of all selected rows.

Returns:
an array of integers containing the indicies of all selected rows; or an empty array if nothing is selected

getSelectedRowCount

int getSelectedRowCount()
Returns the number of selected rows.

Returns:
the number of selected rows; or 0 if no rows are selected

setSelectionModel

void setSelectionModel(javax.swing.ListSelectionModel newModel)
Sets the selection model.

Parameters:
newModel - a ListSelectionModel object
See Also:
getSelectionModel()

getSelectionModel

javax.swing.ListSelectionModel getSelectionModel()
Returns the current selection model.

Returns:
a ListSelectionModel object
See Also:
setSelectionModel(javax.swing.ListSelectionModel)

addRowModelListener

void addRowModelListener(TableRowModelListener x)
Adds a listener for table row model events.

Parameters:
x - a TableRowModelListener object

removeRowModelListener

void removeRowModelListener(TableRowModelListener x)
Removes a listener for table row model events.

Parameters:
x - a TableRowModelListener object



Copyright © 2009 SAS Institute Inc. All Rights Reserved.