|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.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. |
protected ObjectComparator |
defaultComparator
|
protected XJTable.HeaderMouseListener |
headerMouseListener
|
protected List<TableColumn> |
hiddenColumns
Contains the hidden columns in no particular order. |
protected boolean |
sortable
Should this table be sortable. |
protected int |
sortedColumn
The column currently being sorted. |
protected XJTable.SortingModel |
sortingModel
|
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. |
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 |
---|
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
Constructor Detail |
---|
public XJTable()
public XJTable(TableModel model)
Method Detail |
---|
public void setModel(TableModel dataModel)
setModel
in class JTable
protected void newColumns()
public void setTableHeader(JTableHeader newTableHeader)
setTableHeader
in class JTable
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
getPreferredScrollableViewportSize
in class JTable
protected void calculatePreferredSize()
public void doLayout()
doLayout
in class JTable
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
getScrollableTracksViewportWidth
in class JTable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
getScrollableTracksViewportHeight
in class JTable
public 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 modelpublic 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 JTable
public int rowAtPoint(Point point)
rowAtPoint
in class JTable
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class JTable
public void columnMoved(TableColumnModelEvent e)
columnMoved
in interface TableColumnModelListener
columnMoved
in class JTable
public void columnMarginChanged(ChangeEvent e)
columnMarginChanged
in interface TableColumnModelListener
columnMarginChanged
in class JTable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |