|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
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 oracle.javatools.ui.table.GenericTable
public class GenericTable
GenericTable is a subclass of JTable with a number of nice and enhanced features and a cleaner UI.
Features provided by this GenericTable:
JTable.getPreferredScrollableViewportSize()
method, which is used to calculate the preferred size of an enclosing
viewport.
GenericTable table = new GenericTable(); RowHeader rowHead = table.createDefaultRowHeader(); table.setRowHeader(rowHead);
convertValueToText(java.lang.Object, boolean, boolean, int, int)
. If values in the data model do not have a
human-readable toString() representation which is suitable for the
clipboard, they may be handled there.
GenericTable's clipboard support can also be switched off by calling
setUseTransferHandler(boolean)
with false
before the UI is
initialized through the L&F.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JTable |
---|
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader |
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 | |
---|---|
GenericTable()
Constructs a default GenericTable that is initialized with a
default data model, a default column model, and a default selection
model. |
|
GenericTable(java.lang.Object[][] rowData,
java.lang.Object[] columnNames)
Constructs a JTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model. |
|
GenericTable(javax.swing.table.TableModel model)
Constructs a GenericTable that is initialized with
dm as the data model, a default column model,
and a default selection model. |
|
GenericTable(java.util.Vector rowData,
java.util.Vector columnNames)
Constructs a GenericTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model. |
Method Summary | |
---|---|
protected void |
configureEnclosingScrollPane()
Override to configure the scrollpane for this table. |
java.lang.String |
convertValueToText(java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Called by the renderers to convert the specified value to text. |
protected void |
createDefaultRenderers()
Override to creates default GenericTableCellRenderer for objects, numbers, doubles, dates, booleans, and icons. |
RowHeader |
createDefaultRowHeader()
Creates a default RowHeader for this table. |
javax.swing.Action[] |
getColumnSelectorActions()
Returns the additional column selector actions if it has been set before. |
javax.swing.table.TableCellRenderer |
getDefaultRenderer(java.lang.Class<?> columnClass)
Override to fix JDK bug if columnClass is null. |
int[] |
getHiddenColumns()
Get columns that are hidden. |
java.lang.String |
getNoEntryInstructionText()
Returns the instruction text of the table when there is no entry in the table. |
java.awt.Dimension |
getPreferredSize()
Override to return a height of 2 rows for the table when there are no elements in the table. |
int |
getPreferredVisibleRowCount()
Returns the value of the visibleRowCount property. |
RowHeader |
getRowHeader()
Returns the row header of this generic table. |
javax.swing.Action |
getSelectColumnsAction()
Returns the additional select columns action if it has been set before. |
java.awt.Color |
getSortColumnBackgroundColor()
Get the background color of the sorted column. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
Override to provide a tooltip for cells that are obscured because they are too small to display their renderer properly. |
boolean |
getUseTransferHandler()
Get whether the default TransferHandler from the look
and feel is associated with this component when the UI is initialized. |
boolean |
isColumnHeaderSelectionEnabled()
Returns whether column header selection is supported for the table. |
boolean |
isColumnSelectorAvailable()
Get whether the dropdown button is displayed at the end of the column header for hiding and showing columns is available on this instance of table. |
boolean |
isResizeColumnOnDoubleClick()
Get whether the user can resize columns in this table by double clicking the resize divider between two columns. |
boolean |
isRolloverHighlightingEnabled()
Returns whether rollover highlighting is enabled/disabled on the table. |
boolean |
isSelectAllEnabled()
Returns whether selectAll feature is enabled for the table. |
boolean |
isShowToolTips()
Get whether tooltips are being shown for truncated cells. |
void |
paintComponent(java.awt.Graphics g)
Override the paint component to paint the background of the sorted column in a slightly different color from other columns. |
void |
selectAll()
Stop cell editing when the user select all cells. |
void |
setColumnHeaderSelectionEnabled(boolean select)
Add column header selection support for the table. |
void |
setColumnSelectorActions(javax.swing.Action... actions)
This method adds the specified actions to the end of ColumnSelector dropdow menu. |
void |
setColumnSelectorAvailable(boolean isAvailable)
Set whether this table will display a dropdown button at the end of the column header to hide/show columns. |
protected void |
setColumnVisible(javax.swing.table.TableColumn column,
int modelColumn,
boolean isVisible)
Makes the column visible it it can be hidden. |
void |
setHiddenColumns(int[] hiddenColumns)
Set columns that are hidden. |
void |
setNoEntryInstructionText(java.lang.String text)
Sets the instruction text on the firt row of the table when there is no entry in the table. |
void |
setPreferredVisibleRowCount(int visibleRowCount)
Sets the visibleRowCount property. |
void |
setResizeColumnOnDoubleClick(boolean isOn)
Set whether the user can resize columns in this table by double clicking the resize divider between two columns. |
void |
setRolloverHighlightingEnabled(boolean highlight)
Set rollover highlighting enabled/disabled on the table. |
void |
setRowHeader(RowHeader rowHeader)
Sets the row header for this table. |
void |
setSelectAllEnabled(boolean enable)
Enables whether the user can click on upper left corner to select all cells in the table by clicking on it. |
void |
setSelectColumnsAction(javax.swing.Action selectColumn)
This method adds the specified SelectColumns action to the end of ColumnSelector dropdow menu. |
void |
setShowToolTips(boolean showToolTips)
Controls whether this GenericTable will show tooltips for cells that are truncated due to reduced column width. |
void |
setSortColumnBackgroundColor(java.awt.Color c)
Set the background color used to highlight the sorted column. |
void |
setUI(javax.swing.plaf.TableUI ui)
Override to use the transferhandler that uses convertValueToText to copying the text. |
void |
setUseTransferHandler(boolean useTransferHandler)
Set whether the default TransferHandler from the look
and feel is associated with this component when the UI is initialized. |
void |
setVisibleRows(int rows)
Sets the number of visible rows on the table. |
void |
sizeTableToContents()
|
void |
sizeTableToContents(java.lang.Object[] prototypeValues)
Utility method that will set the preferred size of all columns in this table so that they are just big enough to display their contents. |
protected void |
unconfigureEnclosingScrollPane()
Override to unconfigure the scrollpane for this table. |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, updateUI, valueChanged |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GenericTable()
GenericTable
that is initialized with a
default data model, a default column model, and a default selection
model.
public GenericTable(javax.swing.table.TableModel model)
GenericTable
that is initialized with
dm
as the data model, a default column model,
and a default selection model.
public GenericTable(java.util.Vector rowData, java.util.Vector columnNames)
GenericTable
that is initialized with
dm
as the data model, cm
as the column model, and a default selection model.
public GenericTable(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
JTable
that is initialized with
dm
as the data model, cm
as the
column model, and sm
as the selection model.
Method Detail |
---|
public void setColumnSelectorAvailable(boolean isAvailable)
isAvailable
- if true, a dropdown button will be provided at the
end of the column header of this table with checkbox
menu items for each column. The user can use these
to hide and show columns.public boolean isColumnSelectorAvailable()
public void setSelectColumnsAction(javax.swing.Action selectColumn)
public javax.swing.Action getSelectColumnsAction()
public void setColumnSelectorActions(javax.swing.Action... actions)
public javax.swing.Action[] getColumnSelectorActions()
public void setHiddenColumns(int[] hiddenColumns)
hiddenColumns
- columns which are currently hiddenpublic int[] getHiddenColumns()
public void setNoEntryInstructionText(java.lang.String text)
public java.lang.String getNoEntryInstructionText()
public void setShowToolTips(boolean showToolTips)
showToolTips
- if true, a tooltip will be displayed for any cell
which is truncated because the column is not wide enough to display
its full value.public boolean isShowToolTips()
public void setResizeColumnOnDoubleClick(boolean isOn)
table.setAutoResizeMode( GenericTable.AUTO_RESIZE_OFF );
isOn
- if true, the user can resize columnspublic boolean isResizeColumnOnDoubleClick()
public void sizeTableToContents()
sizeTableToContents( Object[])
public void sizeTableToContents(java.lang.Object[] prototypeValues)
JTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
public void setVisibleRows(int rows)
public void setPreferredVisibleRowCount(int visibleRowCount)
visibleRowCount
property. This sets the preferred number
of rows to display without requiring scrolling. Setting this property
affects the return value of the JTable.getPreferredScrollableViewportSize()
method, which is used to calculate the preferred size of an enclosing
viewport. See that method's documentation for more details.
The default value of this property is -1
, indicating null
PreferredScrollableViewportSize.
Calling this method with a negative value will set the PreferredScrollableViewportSize to null.
visibleRowCount
- an integer specifying the preferred number of
rows to display without requiring scrollinggetPreferredVisibleRowCount()
,
JTable.getPreferredScrollableViewportSize()
,
JViewport
public int getPreferredVisibleRowCount()
visibleRowCount
property. See the
documentation for setPreferredVisibleRowCount(int)
for details on how
to interpret this value.
visibleRowCount
property.setPreferredVisibleRowCount(int)
public void setRowHeader(RowHeader rowHeader)
public RowHeader getRowHeader()
public RowHeader createDefaultRowHeader()
public void setColumnHeaderSelectionEnabled(boolean select)
public boolean isColumnHeaderSelectionEnabled()
public void setSelectAllEnabled(boolean enable)
public boolean isSelectAllEnabled()
public void setRolloverHighlightingEnabled(boolean highlight)
public boolean isRolloverHighlightingEnabled()
public void setUseTransferHandler(boolean useTransferHandler)
TransferHandler
from the look
and feel is associated with this component when the UI is initialized.
The default for this property is false.
useTransferHandler
- true if the transfer handler from the
L&F will be used.public boolean getUseTransferHandler()
TransferHandler
from the look
and feel is associated with this component when the UI is initialized.
The default for this property is false.
public void setSortColumnBackgroundColor(java.awt.Color c)
c
- the color to paint the background of the sorted columnpublic java.awt.Color getSortColumnBackgroundColor()
public java.lang.String convertValueToText(java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
convertValueToText
in interface DisplayableTable
value
- the Object
to convert to textisSelected
- true if cell is selectedhasFocus
- true if cell has focusrow
- the row of the cell to rendercolumn
- the column of the cell to render
String
representation of the node's valueprotected void configureEnclosingScrollPane()
configureEnclosingScrollPane
in class javax.swing.JTable
protected void unconfigureEnclosingScrollPane()
unconfigureEnclosingScrollPane
in class javax.swing.JTable
public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
getToolTipText
in class javax.swing.JTable
event
- mouse event to get tooltip for
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void setUI(javax.swing.plaf.TableUI ui)
setUI
in class javax.swing.JTable
public javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class<?> columnClass)
getDefaultRenderer
in class javax.swing.JTable
public void selectAll()
selectAll
in class javax.swing.JTable
protected void setColumnVisible(javax.swing.table.TableColumn column, int modelColumn, boolean isVisible)
protected void createDefaultRenderers()
createDefaultRenderers
in class javax.swing.JTable
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |