|
JIDE 3.5.15 | ||||||||
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.JPanel com.jidesoft.grid.PagedTablePane
public class PagedTablePane
PagedTablePane is a panel that displays several tables side by side so that more rows are visible at the same time. A perfect use case is to display a table with not many columns but many rows in a very wide area. If we only display one table in the area, you may only see 20 rows at a time but if you use PagedTablePane, you can see 40 or 60 rows at a time.
PagedTablePane must work together with PagedTablePaneNavigationBar. You may choose not to display the PagedTablePaneNavigationBar but you must create one using new PagedTablePaneNavigationBar(a PagedTablePane) to enable the page navigation in the tables.
Nested Class Summary | |
---|---|
static class |
PagedTablePane.TablePosition
A class that define a table, a row index and a column index. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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 |
_columnSelectionAllowed
True if column selection is allowed in this table. |
protected boolean |
_nonContiguousCellSelectionAllowed
True if non-contiguous selection is allowed in this table. |
protected boolean |
_rowSelectionAllowed
True if row selection is allowed in this table scroll pane. |
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 | |
---|---|
PagedTablePane(TableModel tableModel)
Creates a PagedTablePane with two tables side by side. |
|
PagedTablePane(TableModel tableModel,
int column)
|
Method Summary | |
---|---|
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
Updates the selection models of the table, depending on the state of the two flags: toggle and
extend . |
void |
clearSelection()
Deselects all selected columns and rows. |
int |
convertColumnIndexToModel(int viewIndex)
Convert the view column index in the entire TableScrollPane to model index. |
int |
convertColumnIndexToView(int modelIndex)
Convert the view column index in the entire TableScrollPane to model index. |
protected JTable |
createTable(TableModel model)
Overrides to create your own table. |
boolean |
getCellSelectionEnabled()
Returns true if both row and column selection models are enabled. |
Class<?> |
getColumnClass(int column)
Returns the type of the column appearing in the view at column position column . |
int |
getColumnCount()
Gets the total column count of TableScrollPane. |
String |
getColumnName(int column)
Returns the name of the column appearing in the view at column position column . |
boolean |
getColumnSelectionAllowed()
Returns true if columns can be selected. |
TableModel |
getModel()
|
int |
getRowCount()
Gets the total row count of TableScrollPane. |
boolean |
getRowSelectionAllowed()
Returns true if rows can be selected. |
int |
getSelectedColumn()
Returns the index of the first selected column, -1 if no column is selected. |
int |
getSelectedColumnCount()
Returns the number of selected columns. |
int[] |
getSelectedColumns()
Returns the indices of all selected columns. |
int |
getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected. |
int |
getSelectedRowCount()
Returns the number of selected rows. |
int[] |
getSelectedRows()
Returns the indices of all selected rows. |
PagedTablePane.TablePosition |
getTableAtCell(int row,
int column)
Gets the table as the specified row and column index. |
PagedTablePane.TablePosition |
getTableAtRow(int row)
Gets the table as the specified row index. |
JTable[] |
getTables()
|
Object |
getValueAt(int row,
int column)
Returns the cell value at row and column . |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and column is editable. |
boolean |
isCellSelected(int row,
int column)
Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected. |
boolean |
isColumnSelected(int column)
Returns true if the specified index is in the valid range of columns, and the column at that index is selected. |
boolean |
isNonContiguousCellSelectionAllowed()
Returns true if non-contiguous cell selection can be selected. |
boolean |
isRowSelected(int row)
Returns true if the specified index is in the valid range of rows, and the row at that index is selected. |
protected void |
resynchronizeTablesSelection()
|
void |
setCellSelectionEnabled(boolean cellSelectionEnabled)
Sets whether this table allows both a column selection and a row selection to exist simultaneously. |
void |
setColumnSelectionAllowed(boolean columnSelectionAllowed)
Sets whether the columns in this model can be selected. |
void |
setModel(TableModel tableModel)
|
void |
setNonContiguousCellSelectionAllowed(boolean nonContiguousCellSelectionAllowed)
Sets whether non-contiguous cell selection in this model can be selected. |
void |
setRowSelectionAllowed(boolean rowSelectionAllowed)
Sets whether the rows in this model can be selected. |
void |
setValueAt(Object aValue,
int row,
int column)
Sets the value for the cell in the table model at row and column . |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean _rowSelectionAllowed
protected boolean _columnSelectionAllowed
protected boolean _nonContiguousCellSelectionAllowed
Constructor Detail |
---|
public PagedTablePane(TableModel tableModel)
tableModel
- the table model.public PagedTablePane(TableModel tableModel, int column)
Method Detail |
---|
public void setModel(TableModel tableModel)
public TableModel getModel()
protected JTable createTable(TableModel model)
model
- the model
public JTable[] getTables()
public void setRowSelectionAllowed(boolean rowSelectionAllowed)
setRowSelectionAllowed
in interface TableAdapter
rowSelectionAllowed
- true if this model will allow row selectiongetRowSelectionAllowed()
public boolean getRowSelectionAllowed()
getRowSelectionAllowed
in interface TableAdapter
setRowSelectionAllowed(boolean)
public void setColumnSelectionAllowed(boolean columnSelectionAllowed)
setColumnSelectionAllowed
in interface TableAdapter
columnSelectionAllowed
- true if this model will allow column selectiongetColumnSelectionAllowed()
public boolean getColumnSelectionAllowed()
getColumnSelectionAllowed
in interface TableAdapter
setColumnSelectionAllowed(boolean)
public void setCellSelectionEnabled(boolean cellSelectionEnabled)
isCellSelected
to change this default behavior. This method is equivalent to setting both the
rowSelectionAllowed
property and columnSelectionAllowed
property of the
columnModel
to the supplied value.
setCellSelectionEnabled
in interface TableAdapter
cellSelectionEnabled
- true if simultaneous row and column selection is allowedgetCellSelectionEnabled()
public boolean getCellSelectionEnabled()
getRowSelectionAllowed() &&
getColumnSelectionAllowed()
.
getCellSelectionEnabled
in interface TableAdapter
setCellSelectionEnabled(boolean)
public void setNonContiguousCellSelectionAllowed(boolean nonContiguousCellSelectionAllowed)
nonContiguousCellSelectionAllowed
- true if this model will allow non-contiguous cell selectionisNonContiguousCellSelectionAllowed()
public boolean isNonContiguousCellSelectionAllowed()
setNonContiguousCellSelectionAllowed(boolean)
protected void resynchronizeTablesSelection()
public int getRowCount()
getRowCount
in interface TableAdapter
public int getColumnCount()
getColumnCount
in interface TableAdapter
public PagedTablePane.TablePosition getTableAtRow(int row)
row
- the row index related to TableScrollPane.
public PagedTablePane.TablePosition getTableAtCell(int row, int column)
row
- the row index related to TableScrollPane.column
- the column index related to TableScrollPane.
public String getColumnName(int column)
column
.
getColumnName
in interface TableAdapter
column
- the column in the view being queried
column
in the view where the first column is column 0public Class<?> getColumnClass(int column)
column
.
getColumnClass
in interface TableAdapter
column
- the column in the view being queried
column
in the view where the first column is column 0public Object getValueAt(int row, int column)
row
and column
.
Note: The column is specified in the table view's display order, and not in the TableModel
's
column order. This is an important distinction because as the user rearranges the columns in the table, the
column at a given index in the view will change. Meanwhile the user's actions never affect the model's column
ordering.
getValueAt
in interface TableAdapter
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
public void setValueAt(Object aValue, int row, int column)
row
and column
.
Note: The column is specified in the table view's display order, and not in the TableModel
's
column order. This is an important distinction because as the user rearranges the columns in the table, the
column at a given index in the view will change. Meanwhile the user's actions never affect the model's column
ordering.
aValue
is the new value.
setValueAt
in interface TableAdapter
aValue
- the new valuerow
- the row of the cell to be changedcolumn
- the column of the cell to be changedgetValueAt(int, int)
public boolean isCellEditable(int row, int column)
row
and column
is editable. Otherwise, invoking
setValueAt
on the cell will have no effect.
Note: The column is specified in the table view's display order, and not in the TableModel
's
column order. This is an important distinction because as the user rearranges the columns in the table, the
column at a given index in the view will change. Meanwhile the user's actions never affect the model's column
ordering.
isCellEditable
in interface TableAdapter
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
setValueAt(java.lang.Object, int, int)
public int getSelectedRow()
getSelectedRow
in interface TableAdapter
public int getSelectedColumn()
getSelectedColumn
in interface TableAdapter
public int[] getSelectedRows()
getSelectedRows
in interface TableAdapter
getSelectedRow()
public int convertColumnIndexToView(int modelIndex)
modelIndex
- the model column index
public int convertColumnIndexToModel(int viewIndex)
viewIndex
- the view column index counting from 0 including row header table, main table and row footer table
public int[] getSelectedColumns()
getSelectedColumns
in interface TableAdapter
getSelectedColumn()
public int getSelectedRowCount()
getSelectedRowCount
in interface TableAdapter
public int getSelectedColumnCount()
getSelectedColumnCount
in interface TableAdapter
public boolean isRowSelected(int row)
isRowSelected
in interface TableAdapter
row
- the row index
row
is a valid index and the row at that index is selected (where 0 is the first
row)public boolean isColumnSelected(int column)
isColumnSelected
in interface TableAdapter
column
- the column in the column model
column
is a valid index and the column at that index is selected (where 0 is the
first column)public boolean isCellSelected(int row, int column)
isCellSelected
in interface TableAdapter
row
- the row being queriedcolumn
- the column being queried
row
and column
are valid indices and the cell at index (row,
column)
is selected, where the first row and first column are at index 0public void clearSelection()
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
TableAdapter
toggle
and
extend
. Most changes to the selection that are the result of keyboard or mouse events received by
the UI are channeled through this method so that the behavior may be overridden by a subclass. Some UIs may need
more functionality than this method provides, such as when manipulating the lead for discontiguous selection, and
may not call into this method for some selection changes.
This implementation uses the following conventions: toggle
: false,
extend
: false. Clear the previous selection and ensure the new cell is selected. toggle
: false, extend
: true. Extend the previous selection from the
anchor to the specified cell, clearing all other selections. toggle
: true,
extend
: false. If the specified cell is selected, deselect it. If it is not selected,
select it. toggle
: true, extend
: true. Apply the selection state
of the anchor to all cells between it and the specified cell.
changeSelection
in interface TableAdapter
rowIndex
- affects the selection at row
columnIndex
- affects the selection at column
toggle
- see description aboveextend
- if true, extend the current selection
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |