|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel org.bibalex.daf.handlers.dbhandler.DataTable org.bibalex.daf.commongui.datamodels.UIDataTable
public class UIDataTable
This class extends the DataTable class to be able to display its contents in a proper way through a JTable, this class is used as a DataModel for the JTable. It also extracts the displayed data from a DataTable with the minimum duplication possible.
Field Summary | |
---|---|
protected int |
colID
The Column representing the ID in the DataTable. |
private int |
column
|
private java.lang.Class |
columnClass
|
protected boolean[] |
isColumnEditable
Boolean Array to indicate which columns are visible and wich are not. |
protected boolean[] |
isColumnVisible
Boolean Array to indicate which columns are visible and wich are not. |
protected java.lang.String[] |
uiColumnsNames
String Array to hold the displayed Column names on the JTable Header. |
protected int |
visibleColumnsCount
A member to indicate the count of the columns with visible state = true. |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
UIDataTable(DataTable dataTable)
Constructor. |
|
UIDataTable(DataTable dataTable,
int colID)
Constructor |
Method Summary | |
---|---|
protected int |
getActualColumnIndex(int column)
This method translate visual column index (relative to only visible columns) to the actual one in the DataTable. |
java.lang.Class |
getColumnClass(int col)
Retreives the specified Column Class. |
int |
getColumnCount()
Retreives the diplayed columns count. |
java.lang.String |
getColumnName(int column)
Retreives the column Name, if this column had a UI Column it is returned, elsewise the Original DataTable Column name is returned. |
int |
getIDAt(int index)
Retreives the ID from the DataTable representing the row at the given index. |
int |
getIndexOf(int value,
int colID)
Parses the DataTable to find the equivalent index for the given Object
in the metioned colID . |
int |
getIndexOfID(int id)
Parses the DataTable to find the equivalent index for the given id
in the default index column. |
int |
getRowCount()
Retreives the diplayed rows count. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Retreives the value (as Object) of a specific cell. |
boolean |
isCellEditable(int row,
int col)
Indicates whether the specified cell is editable or not, used by the JTable drawing methods. |
void |
setColumnClass(int col,
java.lang.Class columnClass)
|
void |
setColumnEditable(int col,
boolean columnIsEditable)
Sets the specified column to be either editable or not. |
void |
setColumnVisible(int col,
boolean columnIsVisible)
Sets the specified column to be either visible or not. |
void |
setUIColumnName(int col,
java.lang.String columnName)
Sets a different displayed name to the specified column, if not set the one from the DataTable is used. |
void |
setValueAt(java.lang.Object value,
int row,
int col)
Set the value of an object in the data table given the row and col. |
Methods inherited from class org.bibalex.daf.handlers.dbhandler.DataTable |
---|
addRow, addRow, addRowAt, addRowAt, deleteRow, elementAt, elementAt, ExportToExcel, getDynamicColumnIndices, getNameOfColumn, getNoOfColumns, getNoOfRows, getRow, setArchivingMatrix, setDynamicColumnIndices, setDynamicTable, setNameOfColumn, setNoOfColumn |
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 |
---|
private int column
private java.lang.Class columnClass
protected boolean[] isColumnVisible
protected boolean[] isColumnEditable
protected java.lang.String[] uiColumnsNames
protected int visibleColumnsCount
protected int colID
Constructor Detail |
---|
public UIDataTable(DataTable dataTable)
dataTable
- The DataTable to extract the displayed data from.public UIDataTable(DataTable dataTable, int colID)
dataTable
- The DataTable to extract the displayed data from.colID
- The Column representing the ID in the DataTable.Method Detail |
---|
public void setColumnEditable(int col, boolean columnIsEditable)
col
- The index of the column to be set.columnIsEditable
- true to set as Editable and false otherwise.public void setColumnVisible(int col, boolean columnIsVisible)
col
- The index of the column to be set.columnIsVisible
- true to set as Visible and false otherwise.public void setUIColumnName(int col, java.lang.String columnName)
col
- The index of the column to be set.columnName
- The new displayed column name.public boolean isCellEditable(int row, int col)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
row
- The row coordinate of the cell.col
- The column coordinate of the cell.
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
getRowCount
in class DataTable
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
getColumnCount
in class DataTable
public java.lang.Class getColumnClass(int col)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
col
- The index of the Column in question.
public void setColumnClass(int col, java.lang.Class columnClass)
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
getValueAt
in class DataTable
rowIndex
- The row coordinate of the cell.columnIndex
- The column coordinate of the cell.
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class DataTable
column
- The index of the column.
protected int getActualColumnIndex(int column)
column
- The index of the visual column index.
public void setValueAt(java.lang.Object value, int row, int col)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class DataTable
value
- The value to be setrow
- The row index (0 - based).col
- The column index.public int getIDAt(int index)
index
- The row index.
public int getIndexOf(int value, int colID)
index
for the given Object
in the metioned colID
.
value
- the value to search for.colID
- the Column identifier to search in.
row
if found, -1 otherwise.public int getIndexOfID(int id)
index
for the given id
in the default index column.
id
- the id
to search for.
id
if found, -1 otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |