VLab Common 1.2

pl.psnc.vlab.util.gui.helper
Class TableHelper

java.lang.Object
  extended by pl.psnc.vlab.util.gui.helper.TableHelper

public abstract class TableHelper
extends java.lang.Object

TableHelper class - set of utility classes for JTable.

Author:
Dominik Stoklosa (~osa~)
Email address
osa@man.poznan.pl

Constructor Summary
TableHelper()
           
 
Method Summary
static int getModelRowIndex(javax.swing.JTable table, int rowIndex)
          Maps the index of the row in terms of the view to the underlying TableModel.
static int getModelSelectedRow(javax.swing.JTable table)
          Maps the index of the row in terms of the view to the underlying TableModel.
static int[] getModelSelectedRows(javax.swing.JTable table)
          Maps the indexes of rows in terms of the view to the underlying TableModel.
static int getViewRowIndex(javax.swing.JTable table, int rowIndex)
          Maps the index of the row in terms of the TableModel to the view.
static int[] getViewSelectedRows(javax.swing.JTable table)
          Maps the indexes of rows in terms of the model to view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableHelper

public TableHelper()
Method Detail

getModelSelectedRow

public static int getModelSelectedRow(javax.swing.JTable table)
Maps the index of the row in terms of the view to the underlying TableModel. If the contents of the model are not sorted the model and view indices are the same.

Parameters:
table - instance of JTable
Returns:
selected row index from the model point of view.

getModelSelectedRows

public static int[] getModelSelectedRows(javax.swing.JTable table)
Maps the indexes of rows in terms of the view to the underlying TableModel. If the contents of the model are not sorted the model and view indices are the same.

Parameters:
table - instance of JTable
Returns:
selected row indexes from the model point of view or null if no rows are selected.

getViewSelectedRows

public static int[] getViewSelectedRows(javax.swing.JTable table)
Maps the indexes of rows in terms of the model to view. If the contents of the model are not sorted the model and view indices are the same.

Parameters:
table - instance of JTable
Returns:
selected row indexes from the view point or null if no rows are selected.

getModelRowIndex

public static int getModelRowIndex(javax.swing.JTable table,
                                   int rowIndex)
Maps the index of the row in terms of the view to the underlying TableModel. If the contents of the model are not sorted the model and view indices are the same.

Parameters:
table - instance of JTable
rowIndex - the index of the row in terms of the view
Returns:
selected row index from the model point of view.

getViewRowIndex

public static int getViewRowIndex(javax.swing.JTable table,
                                  int rowIndex)
Maps the index of the row in terms of the TableModel to the view. If the contents of the model are not sorted the model and view indices are the same.

Parameters:
table - instance of JTable
rowIndex - the index of the row in terms of the model
Returns:
selected row index from the model point of view , or -1 if the row isn't visible

VLab Common 1.2

Copyright 2004 by VLAB Dominik Stoklosa.