|
||||||||||
| 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
org.knime.core.node.tableview.TableContentView
public class TableContentView
Table view on a DataTable. This
implementation uses a caching strategy as described in the
TableContentModel.
Standard renderers are used to display the different types of
DataCells. This will change in future.
This view typically resides in a
TableView (wrapping it in a
scroll pane and providing lots of delegating methods). If you want to use a
table view somewhere else than in this package, e.g. in a different node,
refer to the TableView
implementation.
| Nested Class Summary |
|---|
| 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 |
|---|
| 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 | |
|---|---|
TableContentView()
Creates empty content view. |
|
TableContentView(DataTable data)
Creates new TableContentView based on a
DataTable. |
|
TableContentView(TableContentModel model)
Creates new TableContentView based on a given
TableContentModel. |
|
| Method Summary | |
|---|---|
void |
addColumn(TableColumn aColumn)
Overridden to set proper header content and apply renderer. |
void |
cancelRowCountingInBackground()
Delegate method to cancel row counting. |
void |
changeRenderer(DataType type,
String ident)
Changes the renderer in all columns whose type is equal to type. |
void |
changeRenderer(int column,
String rendererID)
Changes the renderer in a given column. |
void |
countRowsInBackground()
Delegate method to start row counting. |
(package private) int |
fitCellSizeToRenderer()
Sets the preferred column width and returns the maximum of the preferred row heights according to each column's renderer. |
String[] |
getAvailableRenderers(int column)
Get the description of all available renderers in a column. |
TableContentModel |
getContentModel()
Returns a reference to the TableContentModel. |
protected ColumnHeaderRenderer |
getNewColumnHeaderRenderer()
Get the renderer for the column header (never null). |
protected JPopupMenu |
getPopUpMenu(int column)
Create a custom popup menu when the mouse was clicked in a column header. |
protected DataValueRendererFamily |
getRendererFamily(DataColumnSpec colSpec)
Method being invoked when the table is (re-)constructed to get the available renderer for a column. |
Map<DataType,String[]> |
getTypeRendererMap()
Creates a new map containing DataType<->available renderer identifiers. |
boolean |
hasData()
This table "hasData" when there is valid input, i.e. |
boolean |
hasHiLiteHandler()
Is there a HiLiteHandler connected? |
void |
hiliteSelected()
Requests to the HiLiteHandler that all rows that are
currently selected are added to the set of hilited patterns. |
boolean |
isRowCountFinal()
Is the row count returned by JTable.getRowCount() final? |
boolean |
isShowIconInColumnHeader()
Get the status if the icon in the column header is shown. |
protected void |
onMouseClickInHeader(MouseEvent e)
Invoked when a mouse event in the header occurs. |
protected void |
onSortRequest(int columnIndex)
Invoked by the mouse listener on the table header to trigger table sorting on a given column. |
Component |
prepareRenderer(TableCellRenderer renderer,
int row,
int column)
Overridden in order to set the correct selection color (depending on hilite status). |
void |
resetHilite()
Requests to the HiLiteHandler that the hilite status of
all rows is reset. |
void |
setColumnWidth(int width)
Sets the width of all columns to the argument width. |
void |
setDataTable(DataTable data)
Sets a new DataTable as content. |
void |
setHiLiteHandler(HiLiteHandler hiLiteHdl)
Sets a new HiLiteHandler that this view talks to. |
void |
setModel(TableModel tableModel)
Checks that the given argument is of type TableContentModel
and throws exception if it is not. |
void |
setSelectionBackground(Color back)
Overridden to avoid event storm. |
void |
setShowIconInColumnHeader(boolean show)
Sets the property whether or not the icon in the column header shall be shown. |
void |
setTableHeader(JTableHeader newTableHeader)
Overridden so that we can attach a mouse listener to it and set the proper renderer. |
void |
showHiLitedOnly(boolean showOnlyHilite)
Deprecated. Implementors should refer to getContentModel().setTableContentFilter(TableContentFilter) |
boolean |
showsHiLitedOnly()
Deprecated. Implementors should refer to getContentModel().getTableContentFilter() |
void |
tableChanged(TableModelEvent e)
|
void |
unHiliteSelected()
Requests to the HiLiteHandler that all rows that are
currently selected are removed from the set of hilited patterns. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TableContentView()
setDataTable(DataTable) to set a new data table to be
displayed.
public TableContentView(TableContentModel model)
TableContentView based on a given
TableContentModel. A standard renderer that prints the
toString() result of DataCell is used.
model - to be displayedpublic TableContentView(DataTable data)
TableContentView based on a
DataTable. The view's table model is a
TableContentModel.
data - DataTable to be displayed
NullPointerException - if data is null.TableContentModel.TableContentModel(DataTable)| Method Detail |
|---|
public void setModel(TableModel tableModel)
TableContentModel
and throws exception if it is not. Otherwise it sets the new model and
updates the table.
setModel in class JTabletableModel - the new model, necessarily of type
TableContentModel
ClassCastException - if dataModel not of type
TableContentModel
IllegalArgumentException - if dataModel is
null as done by
JTable.setModel(TableModel)JTable.setModel(javax.swing.table.TableModel)public TableContentModel getContentModel()
public Component prepareRenderer(TableCellRenderer renderer,
int row,
int column)
prepareRenderer in class JTablepublic boolean isRowCountFinal()
JTable.getRowCount() final?
true if row count won't change anymore (all rows
have been seen), false if more rows are expected to
comeTableContentModel.isRowCountFinal()public void setDataTable(DataTable data)
DataTable as content.
data - New data to be shown. May be null to have an
empty table.TableContentModel.setDataTable(DataTable)public void setHiLiteHandler(HiLiteHandler hiLiteHdl)
HiLiteHandler that this view talks to. The
argument may be null to disconnect the current
HiLiteHandler.
hiLiteHdl - the new HiLiteHandler.@Deprecated public final void showHiLitedOnly(boolean showOnlyHilite)
getContentModel().setTableContentFilter(TableContentFilter)
showOnlyHilite - true: filter and display only
rows whose hilite status is setTableContentModel.getTableContentFilter()@Deprecated public boolean showsHiLitedOnly()
getContentModel().getTableContentFilter()
true if only hilited rows are shown,
false if all rows are shown.TableContentModel.getTableContentFilter()public final boolean hasHiLiteHandler()
true if global hiliting is possibleTableContentModel.hasHiLiteHandler()public boolean hasData()
DataTable to be displayed is not null. The
status may be changed during runtime by calling the models
setDataTable method.
true if there is data to be displayedTableContentModel.hasData()public void cancelRowCountingInBackground()
TableContentModel.cancelRowCountingInBackground()public void countRowsInBackground()
TableContentModel.countRowsInBackground()public void hiliteSelected()
HiLiteHandler that all rows that are
currently selected are added to the set of hilited patterns. This
method does nothing if the view is not connected to any
HiLiteHandler.
public void unHiliteSelected()
HiLiteHandler that all rows that are
currently selected are removed from the set of hilited patterns. This
method does nothing if the view is not connected to any
HiLiteHandler.
public void resetHilite()
HiLiteHandler that the hilite status of
all rows is reset. This method does nothing if the view is not connected
to any HiLiteHandler.
public final void setShowIconInColumnHeader(boolean show)
show - Whether or not this icon should be shown.public boolean isShowIconInColumnHeader()
public void setTableHeader(JTableHeader newTableHeader)
setTableHeader in class JTablepublic void setSelectionBackground(Color back)
setSelectionBackground in class JTablepublic void addColumn(TableColumn aColumn)
DataTable's
DataColumnSpec and for the renderer the
type's getNewRenderer() is used
addColumn in class JTableaColumn - column to be addedJTable.addColumn(javax.swing.table.TableColumn),
DataType.getRenderer(DataColumnSpec),
DataColumnSpecprotected DataValueRendererFamily getRendererFamily(DataColumnSpec colSpec)
colSpec - The spec of the column, never null.
null.protected void onMouseClickInHeader(MouseEvent e)
e - the mouse event in the table headerprotected void onSortRequest(int columnIndex)
columnIndex - The column that was clicked.TableContentModel.isSortingAllowed()protected JPopupMenu getPopUpMenu(int column)
column - column for which to create the popup menu
onMouseClickInHeader(MouseEvent)
public void changeRenderer(int column,
String rendererID)
DataValueRendererFamily (which it is unless a subclass
overrides addColumn). In this renderer family the renderer
matching the description rendererID is set active.
null or unknown), this
method does nothing.
column - the column of interestrendererID - the name of the renderer
IndexOutOfBoundsException - if column violates its
rangeDataValueRendererFamily.getRendererDescriptions()public String[] getAvailableRenderers(int column)
DataValueRendererFamily (which should be the default
renderer in each column.)
column - the column of interest.
IndexOutOfBoundsException - if column violates its
range
public void changeRenderer(DataType type,
String ident)
type. This is a convenient way to change the
renderer of several columns at once. This method does nothing if
the type is unknown or the identifier is invalid.
type - the target typeident - The identifier for the renderer to usegetTypeRendererMap()public void setColumnWidth(int width)
width - The new width.TableColumn.setWidth(int)public Map<DataType,String[]> getTypeRendererMap()
column types, i.e. if the table
only contains, e.g. double values (represented by
DoubleCell), this map will have only one
entry. The values in this map correspond to the renderer descriptions
that are available for the
type at hand.
This map is used to switch the renderer for a set of columns.
int fitCellSizeToRenderer()
public void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenertableChanged in class JTableprotected ColumnHeaderRenderer getNewColumnHeaderRenderer()
null).
ColumnHeaderRendererColumnHeaderRenderer,
JTableHeader.setDefaultRenderer(javax.swing.table.TableCellRenderer)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||