|
JIDE 2.8.0 | ||||||||
| 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
com.jidesoft.grid.JideTable
com.jidesoft.grid.ContextSensitiveTable
com.jidesoft.grid.NavigableTable
com.jidesoft.grid.CellStyleTable
com.jidesoft.grid.CellSpanTable
public class CellSpanTable
CellSpanTable introduces cell spans to table. As long as the table model implements SpanModel
and its SpanModel.isCellSpanOn() returns true, CellSpanTable will use the CellSpan
that is returned from SpanModel.getCellSpanAt(int,int) to span the cell. The span could be across several
rows or several columns. If you know the table data and cell span beforehand, you can use
DefaultSpanTableModel. If the table data is dynamic so is the cell span, you should use
AbstractSpanTableModel.
| Nested Class Summary | |
|---|---|
protected static class |
CellSpanTable.DelegateAction
|
| Nested classes/interfaces inherited from class com.jidesoft.grid.JideTable |
|---|
JideTable.NonContiguousTransferHandler |
| 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 | |
|---|---|
static int |
AUTO_CELL_MERGE_COLUMNS
|
static int |
AUTO_CELL_MERGE_COLUMNS_LIMITED
|
static int |
AUTO_CELL_MERGE_OFF
|
static int |
AUTO_CELL_MERGE_ROWS
|
static int |
AUTO_CELL_MERGE_ROWS_LIMITED
|
static String |
PROPERTY_AUTO_CONVERT_CELL_SPAN
|
| Fields inherited from class com.jidesoft.grid.CellStyleTable |
|---|
_cellStyleList |
| 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 | |
|---|---|
CellSpanTable()
|
|
CellSpanTable(int numRows,
int numColumns)
|
|
CellSpanTable(Object[][] rowData,
Object[] columnNames)
|
|
CellSpanTable(TableModel dm)
|
|
CellSpanTable(TableModel dm,
TableColumnModel cm)
|
|
CellSpanTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
|
|
CellSpanTable(Vector<?> rowData,
Vector<?> columnNames)
|
|
| Method Summary | |
|---|---|
protected int |
calculateRowHeight(int row)
The method calculates the height for the row based on the content in the row. |
void |
calculateRowHeight(int row,
boolean doWholeSpan)
Calculate the height of a rows based on the preferred size of contents in each of its cells. |
void |
calculateRowHeights()
Calculate the height of all rows based on the preferred size of contents in each of a row's cells. |
int |
columnAtPoint(Point point)
|
void |
columnSelectionChanged(ListSelectionEvent e)
|
CellSpan |
convertModelCellSpanToView(CellSpan span)
Converts the cell span from table model to the cell span from the view. |
CellSpan |
convertViewCellSpanToModel(CellSpan span)
Converts the cell span from view to the cell span from the table model. |
protected Action |
createDelegateAction(Action action,
KeyStroke keyStroke)
|
boolean |
editCellAt(int row,
int column,
EventObject o)
|
int |
getAutoCellMerge()
Gets the autoCellMerge mode. |
protected List<CellSpan> |
getCache()
|
protected Set<com.jidesoft.grid.CellSpanTable.Cell> |
getCacheEmpty()
|
TableCellEditor |
getCellEditor(int row,
int column)
Returns an appropriate cell editor for the cell specified by this row and column. |
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
|
TableCellRenderer |
getCellRenderer(int row,
int column)
Returns an appropriate renderer for the cell specified by this row and column. |
CellSpan |
getCellSpanAt(int row,
int column)
Gets the cell span at the specified cell. |
CellSpan |
getCellSpanAt(SpanModel spanModel,
int row,
int column)
Gets the cell span at the specified cells. |
protected CellSpan |
getCellSpanFromAutoCellMerge(int row,
int column)
|
protected CellSpan |
getCellSpanFromSpanModel(int row,
int column)
|
TableModel |
getSpanModel()
Gets span model. |
String |
getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component. |
void |
invalidateCellSpanCache()
Invalidates the cell span cache. |
boolean |
isAutoConvertCellSpan()
Check the autoConvertCellSpan flag. |
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 |
isCellSpanCacheEnabled()
Get the flag indicating if the cache for cell span is enabled. |
boolean |
isCellSpanOn()
|
boolean |
isKeepColumnAtPoint()
Checks if columnAtPoint(java.awt.Point) method will return the actual column index without considering
the cell spans. |
boolean |
isKeepRowAtPoint()
Checks if rowAtPoint(java.awt.Point) method will return the actual row index without considering the
cell spans. |
protected void |
muteDefaultKeyStroke()
|
int |
originalColumnAtPoint(Point point)
The columnAtPoint method without considering the cell spans. |
Rectangle |
originalGetCellRect(int row,
int column,
boolean includeSpacing)
Gets the original cell rect of the cell at row and column without considering the cell spans. |
int |
originalRowAtPoint(Point point)
The rowAtPoint method without considering the cell spans. |
Component |
prepareEditor(TableCellEditor editor,
int row,
int column)
Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareEditor(). |
Component |
prepareRenderer(TableCellRenderer renderer,
int row,
int column)
Override this method to get the style from CellStyle defined by StyleModel and set it to component return from super.prepareRenderer(). |
protected void |
replaceAction(KeyStroke keyStroke)
Registers an action for the KeyStroke. |
protected void |
replaceAction(KeyStroke keyStroke,
int condition)
Registers an action for the KeyStroke. |
protected void |
restoreAction(KeyStroke keyStroke)
Restores the action registered using replaceAction(javax.swing.KeyStroke). |
protected void |
restoreAction(KeyStroke keyStroke,
int condition)
Restores the action registered using replaceAction(javax.swing.KeyStroke, int). |
int |
rowAtPoint(Point point)
Returns the index of the row that point lies in, or -1 if the result is not in the range [0,
getRowCount()-1]. |
void |
setAutoCellMerge(int autoCellMerge)
Sets the autoCellMerge mode. |
void |
setAutoConvertCellSpan(boolean autoConvertCellSpan)
By default, we will automatically convert CellSpan from model to view and vice verse in order to consider the case of hidden columns. |
void |
setCellSpanCacheEnabled(boolean cellSpanCacheEnabled)
Set the flag indicating if the cache for cell span is enabled. |
void |
setKeepColumnAtPoint(boolean keepColumnAtPoint)
CellSpanTable overrides columnAtPoint(java.awt.Point) method to consider the cell span. |
void |
setKeepRowAtPoint(boolean keepRowAtPoint)
CellSpanTable overrides rowAtPoint(java.awt.Point) method to consider the cell span. |
void |
tableChanged(TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. |
void |
updateUI()
Resets the UI property to a value from the current look and feel. |
void |
valueChanged(ListSelectionEvent e)
|
static boolean |
verifyCellSpan(CellSpanTable table)
This is a method for debugging purpose. |
static boolean |
verifyCellSpan(SpanModel spanModel)
This is a method for debugging purpose. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.jidesoft.grid.TableAdapter |
|---|
getCellSelectionEnabled, getColumnClass, getColumnCount, getColumnName, getColumnSelectionAllowed, getRowCount, getRowSelectionAllowed, getValueAt, isCellEditable, setCellSelectionEnabled, setValueAt |
| Field Detail |
|---|
public static final int AUTO_CELL_MERGE_OFF
public static final int AUTO_CELL_MERGE_ROWS
public static final int AUTO_CELL_MERGE_COLUMNS
public static final int AUTO_CELL_MERGE_ROWS_LIMITED
public static final int AUTO_CELL_MERGE_COLUMNS_LIMITED
public static final String PROPERTY_AUTO_CONVERT_CELL_SPAN
| Constructor Detail |
|---|
public CellSpanTable()
public CellSpanTable(int numRows,
int numColumns)
public CellSpanTable(TableModel dm)
public CellSpanTable(Object[][] rowData,
Object[] columnNames)
public CellSpanTable(Vector<?> rowData,
Vector<?> columnNames)
public CellSpanTable(TableModel dm,
TableColumnModel cm)
public CellSpanTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
| Method Detail |
|---|
public void updateUI()
updateUI in class NavigableTableJComponent.updateUI()public String getUIClassID()
getUIClassID in class NavigableTableJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public TableModel getSpanModel()
TableModelWrapperUtils.getActualTableModel(javax.swing.table.TableModel,Class) to find an
instance of SpanModel. If it can finds one, it will return that one. Otherwise, getModel() is returned as fall
back.
public CellSpan getCellSpanAt(SpanModel spanModel,
int row,
int column)
convertModelCellSpanToView(CellSpan) to do auto conversion from model to view if isAutoConvertCellSpan() is true. If isAutoConvertCellSpan() is false, this method is the same as
tableModel.getCellSpanAt(row, column).
Please note, you should use getCellSpanAt(int, int) method instead of using this method directly in most
cases because this method will not look at isCellSpanOn() value when returning the cell span. In the
other word, even if isCellSpanOn() returns false, this method could still return a valid cell span. In
comparison, getCellSpanAt(int, int) will always return null if isCellSpanOn() returns false.
spanModel - the SpanModelrow - the row indexcolumn - the column index
public CellSpan convertModelCellSpanToView(CellSpan span)
span - the CellSpan
public CellSpan convertViewCellSpanToModel(CellSpan span)
span - the CellSpan
public boolean isAutoConvertCellSpan()
setAutoConvertCellSpan(boolean)public void setAutoConvertCellSpan(boolean autoConvertCellSpan)
autoConvertCellSpan - true or false.public boolean isKeepColumnAtPoint()
columnAtPoint(java.awt.Point) method will return the actual column index without considering
the cell spans.
columnAtPoint(java.awt.Point) method will return the actual column index without
considering the cell spans. Otherwise, false.public void setKeepColumnAtPoint(boolean keepColumnAtPoint)
columnAtPoint(java.awt.Point) method to consider the cell span. When the point
passed to columnAtPoint() is in a cell span, it will return the anchor column index of that cell span instead of
the column index the actual obscured cell. However sometimes it is still useful to know the actual column index.
If you call this method and set it to true, columnAtPoint(java.awt.Point) will return the actual column
index without considering the cell spans.
keepColumnAtPoint - true or false.public boolean isKeepRowAtPoint()
rowAtPoint(java.awt.Point) method will return the actual row index without considering the
cell spans.
rowAtPoint(java.awt.Point) method will return the actual row index without considering
the cell spans. Otherwise, false.public void setKeepRowAtPoint(boolean keepRowAtPoint)
rowAtPoint(java.awt.Point) method to consider the cell span. When the point
passed to rowAtPoint() is in a cell span, it will return the anchor row index of that cell span instead of the
row index the actual obscured cell. However sometimes it is still useful to know the actual row index. IF you
call this method and set it to true, rowAtPoint(java.awt.Point) will return the actual row index without
considering the cell spans.
keepRowAtPoint - true or false.
public Rectangle originalGetCellRect(int row,
int column,
boolean includeSpacing)
row - the row index.column - the column index.includeSpacing - if false, return the true cell bounds - computed by subtracting the inter cell spacing from
the height and widths of the column and row models
public Rectangle getCellRect(int row,
int column,
boolean includeSpacing)
getCellRect in class JideTablepublic int originalRowAtPoint(Point point)
point - the location of the interest.
point lies in, or -1 if the result is not in the range [0,
getRowCount()-1]public int originalColumnAtPoint(Point point)
point - the location of the interest.
point lies in, or -1 if the result is not in the range [0,
getColumnCount()-1]public int rowAtPoint(Point point)
JideTablepoint lies in, or -1 if the result is not in the range [0,
getRowCount()-1].
rowAtPoint in class JideTablepoint - the location of interest
point lies in, or -1 if the result is not in the range [0,
getRowCount()-1]JTable.columnAtPoint(java.awt.Point)public int columnAtPoint(Point point)
columnAtPoint in class JTable
public boolean editCellAt(int row,
int column,
EventObject o)
editCellAt in class JideTable
public boolean isCellSelected(int row,
int column)
TableAdapter
isCellSelected in interface TableAdapterisCellSelected in class JideTablerow - 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 0
public TableCellEditor getCellEditor(int row,
int column)
ContextSensitiveTableContextSensitiveTable.isCellEditorManagerEnabled() is true. If true, it will look for the cell editor that assigned to the specific
column. Only if the editor is still null, it will use the EditorContext information from
ContextSensitiveTableModel and get the correct CellEditorfrom the CellRendererManager. In any case, if we can't
determine a cell editor, we will call super.getCellEditor(row, column) just like regular JTable.
getCellEditor in class ContextSensitiveTablerow - the row of the cell to edit, where 0 is the first rowcolumn - the column of the cell to edit, where 0 is the first column
TableCellEditor that does the editingJTable.cellEditor
public TableCellRenderer getCellRenderer(int row,
int column)
ContextSensitiveTableContextSensitiveTable.getDefaultCellRenderer() method. If null, it will check is ContextSensitiveTable.isCellRendererManagerEnabled() is true. If true, it will look for the cell renderer that assigned to the
specific column. Only if the renderer is still null, it will use the EditorContext information from
ContextSensitiveTableModel and get the correct CellRedenerer from the CellRendererManager. In any case, if we
can't determine a cell renderer, we will call super.getCellRenderer(row, column) just like regular JTable.
getCellRenderer in class ContextSensitiveTablerow - the row of the cell to render, where 0 is the first rowcolumn - the column of the cell to render, where 0 is the first column
public Component prepareEditor(TableCellEditor editor,
int row,
int column)
CellStyleTable
prepareEditor in class CellStyleTableeditor - the cell editor.row - the row index.column - the column index.
public Component prepareRenderer(TableCellRenderer renderer,
int row,
int column)
CellStyleTable
prepareRenderer in class CellStyleTablerenderer - the renderer at the specified cell.row - the row index.column - the column index.
public void columnSelectionChanged(ListSelectionEvent e)
columnSelectionChanged in interface TableColumnModelListenercolumnSelectionChanged in class JTablepublic boolean isCellSpanOn()
public CellSpan getCellSpanAt(int row,
int column)
convertModelCellSpanToView(CellSpan) to do auto conversion from model to view if isAutoConvertCellSpan() is true. If isAutoConvertCellSpan() is false, this method is the same as
tableModel.getCellSpanAt(row, column). If isCellSpanOn() returns false, this method will always return
null.
row - the row indexcolumn - the column index
protected CellSpan getCellSpanFromAutoCellMerge(int row,
int column)
protected CellSpan getCellSpanFromSpanModel(int row,
int column)
public void valueChanged(ListSelectionEvent e)
valueChanged in interface ListSelectionListenervalueChanged in class JideTablepublic void tableChanged(TableModelEvent e)
JideTableTableModel generates a TableModelEvent. The
TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping
to the view coordinate system is performed by this JTable when it receives the event.
Application code will not use these methods explicitly, they are used internally by JTable.
tableChanged in interface TableModelListenertableChanged in class JideTablepublic void invalidateCellSpanCache()
protected void muteDefaultKeyStroke()
protected Action createDelegateAction(Action action,
KeyStroke keyStroke)
public boolean isCellSpanCacheEnabled()
public void setCellSpanCacheEnabled(boolean cellSpanCacheEnabled)
cellSpanCacheEnabled - the flagisCellSpanCacheEnabled()protected void replaceAction(KeyStroke keyStroke)
keyStroke - the KeyStroke.
protected void replaceAction(KeyStroke keyStroke,
int condition)
keyStroke - the KeyStroke.condition - the condition. Valid values are JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
JComponent.WHEN_FOCUSED and JComponent.WHEN_IN_FOCUSED_WINDOW.protected void restoreAction(KeyStroke keyStroke)
replaceAction(javax.swing.KeyStroke).
keyStroke - the KeyStroke.
protected void restoreAction(KeyStroke keyStroke,
int condition)
replaceAction(javax.swing.KeyStroke, int).
keyStroke - the KeyStroke.condition - the condition. Valid values are JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
JComponent.WHEN_FOCUSED and JComponent.WHEN_IN_FOCUSED_WINDOW.public void calculateRowHeights()
public void calculateRowHeight(int row,
boolean doWholeSpan)
row - intdoWholeSpan - boolean indicates whether to check all the rows in a span, if any, that the given row might
belong to. If false, height of none of the rows that might belong to the same spans as the
given row would be recalculated.protected int calculateRowHeight(int row)
JideTable
calculateRowHeight in class JideTablerow - the row to be calculated
public static boolean verifyCellSpan(SpanModel spanModel)
spanModel - the SpanModel.
public static boolean verifyCellSpan(CellSpanTable table)
table - the CellSpanTable.
protected List<CellSpan> getCache()
protected Set<com.jidesoft.grid.CellSpanTable.Cell> getCacheEmpty()
public int getAutoCellMerge()
AUTO_CELL_MERGE_OFF, AUTO_CELL_MERGE_ROWS or AUTO_CELL_MERGE_COLUMNS, AUTO_CELL_MERGE_ROWS_LIMITED and AUTO_CELL_MERGE_COLUMNS_LIMITED. If
on, the cell spans will be created automatically for the adjacent cells that have the same value on the same row
or on the same column.
public void setAutoCellMerge(int autoCellMerge)
autoCellMerge - the new value for the autoCellMerge mode. Valid values are AUTO_CELL_MERGE_OFF,
AUTO_CELL_MERGE_ROWS, AUTO_CELL_MERGE_COLUMNS, AUTO_CELL_MERGE_ROWS_LIMITED and AUTO_CELL_MERGE_COLUMNS_LIMITED
|
JIDE 2.8.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||