|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
gate.swing.XJTable
public class XJTable
A "smarter" JTable. Features include:
JTable.setAutoResizeMode(int).
| Nested Class Summary | |
|---|---|
protected class |
XJTable.ColumnData
|
protected class |
XJTable.HeaderMouseListener
|
protected class |
XJTable.SortingModel
Handles translations between an indexed data source and a permutation of itself (like the translations between the rows in sorted table and the rows in the actual unsorted model). |
| Nested classes/interfaces inherited from class javax.swing.JTable |
|---|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected boolean |
ascending
is the current sort order ascending (or descending)? |
protected List<XJTable.ColumnData> |
columnData
A list of XJTable.ColumnData objects. |
private boolean |
componentSizedProperly
|
protected ObjectComparator |
defaultComparator
|
private boolean |
editCellAsSoonAsFocus
|
private boolean |
enableHidingColumns
|
protected XJTable.HeaderMouseListener |
headerMouseListener
|
protected List<TableColumn> |
hiddenColumns
Contains the hidden columns in no particular order. |
private Action |
oldShiftTabAction
|
private Action |
oldTabAction
|
private boolean |
sizingInProgress
|
protected boolean |
sortable
Should this table be sortable. |
protected int |
sortedColumn
The column currently being sorted. |
protected XJTable.SortingModel |
sortingModel
|
private boolean |
tabSkipUneditableCell
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
XJTable()
|
|
XJTable(TableModel model)
|
|
| Method Summary | |
|---|---|
protected void |
calculatePreferredSize()
|
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
|
void |
columnMarginChanged(ChangeEvent e)
Overridden to fix //http://bugs.sun.com/bugdatabase/view_bug.do? |
void |
columnMoved(TableColumnModelEvent e)
Overridden to fix //http://bugs.sun.com/bugdatabase/view_bug.do? |
void |
doLayout()
|
Dimension |
getPreferredScrollableViewportSize()
|
Dimension |
getPreferredSize()
|
boolean |
getScrollableTracksViewportHeight()
Track parent viewport's size if it's larger than the current preferred height of the table (causes empty tables to fill in the whole area of a JScrollPane). |
boolean |
getScrollableTracksViewportWidth()
Overridden to ignore requests for this table to track the width of its containing viewport in cases where the viewport is narrower than the minimum size of the table. |
int |
getSortedColumn()
|
int |
getTableRow(int modelRow)
Get the row in the table for a row in the model. |
private void |
handleRowUpdate(TableModelEvent e)
This borrows most of the logic from the superclass handling of update events, but changes the calculation of the height for the dirty region to provide proper handling for repainting custom height rows. |
void |
hideColumn(int columnIndex)
Hide a column. |
boolean |
isAscending()
|
boolean |
isColumnHidden(int columnIndex)
Gets the hidden state for a column |
boolean |
isEditCellAsSoonAsFocus()
Returns the state for editing a cell as soon as it gets the focus. |
boolean |
isEnableHidingColumns()
Returns the state for hiding a column. |
boolean |
isSortable()
|
boolean |
isTabSkipUneditableCell()
Returns the state for enabling tab key to skip uneditable cells. |
protected void |
newColumns()
Called when the columns have changed. |
int |
rowAtPoint(Point point)
|
int |
rowModelToView(int modelRow)
Converts a row number from the model co-ordinates system to the view's. |
int |
rowViewToModel(int viewRow)
Converts a row number from the view co-ordinates system to the model's. |
void |
setAscending(boolean ascending)
|
void |
setComparator(int column,
Comparator comparator)
Sets the custom comparator to be used for a particular column. |
void |
setEditCellAsSoonAsFocus(boolean editCellAsSoonAsFocus)
Set the possibility for a cell to be in editing mode as soon as it gets the focus. |
void |
setEnableHidingColumns(boolean enableHidingColumns)
Set the possibility for the user to hide/show a column by right-clicking on a column header. |
void |
setModel(TableModel dataModel)
|
void |
setSortable(boolean sortable)
|
void |
setSortedColumn(int sortColumn)
|
void |
setTableHeader(JTableHeader newTableHeader)
|
void |
setTabSkipUneditableCell(boolean tabSkipUneditableCell)
Set the possibility for the tab key to skip uneditable cells. |
void |
showColumn(int columnIndex,
int insertionIndex)
Show a column. |
void |
tableChanged(TableModelEvent e)
Overridden for efficiency reasons (provides a better calculation of the dirty region). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private volatile boolean componentSizedProperly
private volatile boolean sizingInProgress
protected XJTable.SortingModel sortingModel
protected ObjectComparator defaultComparator
protected int sortedColumn
protected boolean ascending
protected boolean sortable
protected List<XJTable.ColumnData> columnData
XJTable.ColumnData objects.
protected XJTable.HeaderMouseListener headerMouseListener
protected List<TableColumn> hiddenColumns
private boolean enableHidingColumns
private boolean tabSkipUneditableCell
private boolean editCellAsSoonAsFocus
private Action oldTabAction
private Action oldShiftTabAction
| Constructor Detail |
|---|
public XJTable()
public XJTable(TableModel model)
| Method Detail |
|---|
public void setModel(TableModel dataModel)
setModel in class JTableprotected void newColumns()
public void setTableHeader(JTableHeader newTableHeader)
setTableHeader in class JTablepublic Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface ScrollablegetPreferredScrollableViewportSize in class JTableprotected void calculatePreferredSize()
public void doLayout()
doLayout in class JTablepublic Dimension getPreferredSize()
getPreferredSize in class JComponentpublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface ScrollablegetScrollableTracksViewportWidth in class JTablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface ScrollablegetScrollableTracksViewportHeight in class JTablepublic int rowModelToView(int modelRow)
modelRow - the row number in the model
rowViewToModel(int)public boolean isAscending()
public boolean isColumnHidden(int columnIndex)
columnIndex - index of the column in the table model
public void hideColumn(int columnIndex)
columnIndex - index of the column in the table model
public void showColumn(int columnIndex,
int insertionIndex)
columnIndex - index of the column in the table modelinsertionIndex - index of the view where the colum will be insertedpublic void setAscending(boolean ascending)
ascending - The ascending to set. True by default.public int rowViewToModel(int viewRow)
viewRow - the row number in the view.
rowModelToView(int)public void setEnableHidingColumns(boolean enableHidingColumns)
enableHidingColumns - true if and only if the columns can be hidden.public boolean isEnableHidingColumns()
public boolean isEditCellAsSoonAsFocus()
public void setEditCellAsSoonAsFocus(boolean editCellAsSoonAsFocus)
editCellAsSoonAsFocus - true if and only if a cell get in editing
mode when it receives the focus.public boolean isTabSkipUneditableCell()
public void setTabSkipUneditableCell(boolean tabSkipUneditableCell)
tabSkipUneditableCell - true if and only if the tab key skip
uneditable cells.
public void setComparator(int column,
Comparator comparator)
column - the column index.comparator - the comparator to be used.public boolean isSortable()
public void setSortable(boolean sortable)
sortable - The sortable to set. True by default.public int getSortedColumn()
public void setSortedColumn(int sortColumn)
sortColumn - The sortColumn to set. None (-1) by default.public int getTableRow(int modelRow)
modelRow - row in the model
public void changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
changeSelection in class JTablepublic int rowAtPoint(Point point)
rowAtPoint in class JTablepublic void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenertableChanged in class JTableprivate void handleRowUpdate(TableModelEvent e)
public void columnMoved(TableColumnModelEvent e)
columnMoved in interface TableColumnModelListenercolumnMoved in class JTablepublic void columnMarginChanged(ChangeEvent e)
columnMarginChanged in interface TableColumnModelListenercolumnMarginChanged in class JTable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||