T - the type handled by this tablepublic class FormTable<T> extends JTable implements FormChangeableComponent
The FormTable provides the following extensions to the standard JTable:
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintModeJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
CELLTRAVERSAL_AUTOEDIT
if cell is editable, start editing.
|
static int |
CELLTRAVERSAL_COLUMN
cell traversal next/previous column.
|
static int |
CELLTRAVERSAL_NOLINEWRAP
don't wrap at start or end of row/column (implies NOTABLEWRAP).
|
static int |
CELLTRAVERSAL_NONE
cell traversal default mode, no traversal at all.
|
static int |
CELLTRAVERSAL_NOTABLEWRAP
no wrap at start/end of table.
|
static int |
CELLTRAVERSAL_ROW
cell traversal next/previous row.
|
static int |
CELLTRAVERSAL_SKIPNOEDIT
move to next/previous editable cell only.
|
static int |
CELLTRAVERSAL_TRANSFERFOCUS
transfer focus to the previous/next component when stepping out at begin/end of table (implies NOTABLEWRAP).
|
static int |
CELLTRAVERSAL_WRAPINLINE
stay in current row/column (implies NOTABLEWRAP).
|
static String |
CLICK_ACTION
action string for mouse click
|
protected LinkedHashMap<Class<?>,TableCellEditor> |
defaultEditorsByColumnInterface
Default mapping of interfaces to editors.
Notice: unlike with JTable.defaultEditorsByColumnClass the order of interfaces is important. |
protected LinkedHashMap<Class<?>,TableCellRenderer> |
defaultRenderersByColumnInterface
Default mapping of interfaces to renderers.
Notice: unlike with JTable.defaultRenderersByColumnClass the order of interfaces is important. |
static String |
ENTER_ACTION
action string for enter keypress
|
static String |
HELP_ACTION
help action
|
static String |
NEXTCELL_ACTION
next cell action
|
static String |
PREF_COLUMN_INDEX
preferences key for column view index
|
static String |
PREF_COLUMN_VISIBILITY
preferences key for column visibility
|
static String |
PREF_COLUMN_WIDTH
preferences key for column width
|
static String |
PREF_TABLE_HEIGHT
preferences key for table height
|
static String |
PREF_TABLE_WIDTH
preferences key for table width
|
protected Dimension |
preferencesSize
size from preferences (even if sizeInPreferencesIgnored = true!)
|
static String |
PREVIOUSCELL_ACTION
previous cell action
|
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, tableHeaderlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
FormTable()
Creates an empty form table.
|
FormTable(TableModel model)
Creates a formtable for a given data model.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener listener)
Adds an action listener (usually a double click on a selection).
|
void |
addFormTableTraversalListener(FormTableTraversalListener listener)
Adds a traversal listener.
|
void |
addListSelectionListener(ListSelectionListener listener)
Adds a selection changed listener.
|
void |
applyTemplate(FormTableEntry<T> template)
Sets the formatting flags from a
FormTableEntry. |
void |
autoResizeColumnWidths()
Resize the column widths according to the displayed data.
|
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend) |
void |
clearInhibitCellTraversal()
Clears the inhibit of the cell traversal if for some reason set erroneously.
|
void |
configureEditors()
Updates the editors.
Useful, for example, if the some configuration changed and the editors are fixed (see FormTableEntry.isCellEditorFixed()). |
void |
configureRenderers()
Updates the renderers.
Useful, for example, if the some configuration changed and the renderers are fixed (see FormTableEntry.isCellRendererFixed()). |
protected String |
createColumnIdentifier(TableColumn column)
Creates an identification String for the specified TableColumn.
Used for storing/retrieving table preferences. |
protected TableColumnModel |
createDefaultColumnModel() |
void |
createDefaultColumnsFromDefaultModel()
Creates the columns from the default column model
|
void |
createDefaultColumnsFromModel() |
boolean |
createDefaultColumnsFromPreferences(String prefName,
boolean systemOnly)
Creates the columns from the Preferences and sets the preferred table
size according to the column sizes.
|
void |
discardCellEvents()
Discards all cell events in the event queue.
|
boolean |
editCellAt(int row,
int column,
EventObject e) |
void |
editCellLater(int row,
int column)
Starts editing at a given row/column.
If the cell is already being edited (i.e. |
void |
editingCanceled(ChangeEvent e) |
void |
editingStopped(ChangeEvent e) |
void |
editNextCellLater()
Edits the next cell according to cellTraversal.
|
void |
editNextCellLater(int row,
int column)
Same as editCellLater but advance to next editable cell if
given cell is not editable.
|
void |
editPreviousCellLater()
Edits the previous cell according to cellTraversal.
|
void |
editPreviousCellLater(int row,
int column)
Same as editCellLater but advance to previous editable cell if
given cell is not editable
|
static BindableTableModel<?> |
findBindableTableModel(TableModel model)
Finds the last
BindableTableModel in the model chain. |
void |
fireActionPerformed(ActionEvent evt)
Notifies all action listeners.
|
void |
fireTraversalRequested(FormTableTraversalEvent evt)
Notifies all traversal listeners that a cell traversal is triggered.
|
void |
fireValueChanged(ListSelectionEvent evt)
Notifies all Listeners that the selection has changed.
|
char |
getAdjust(int column)
Gets the adjust flag.
|
TableCellEditor |
getCellEditor(int row,
int column) |
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing) |
TableCellRenderer |
getCellRenderer(int row,
int column) |
int |
getCellTraversal()
Sets the cell traversal mode.
|
int |
getClickCount()
Gets the number of mouse clicks that caused the current selection.
|
int |
getClickCountToAction()
Gets the number of mouse clicks to trigger an action event.
|
int |
getClickCountToStart()
Gets the number of clicks to start the full editing mode of a cell.
|
TableColumn |
getColumnByModelIndex(int modelIndex)
Gets the table-column according to the data-model index.
|
char |
getConvert(int column)
Gets the convert flag.
|
DateFormat |
getDateFormat(int column)
Gets the date format.
If not set the default format is used from StringHelper. |
DateFormat |
getDateFormat(int column,
boolean asTimestamp)
Gets the date format.
If not set the default format is used from StringHelper. |
Rectangle |
getDefaultCellRect(int row,
int column,
boolean includeSpacing)
Refers to the default implementation of getCellRect()
because overridden.
|
TableCellEditor |
getDefaultEditor(Class<?> columnClass) |
TableCellRenderer |
getDefaultRenderer(Class<?> columnClass) |
FormTableEntry<T> |
getEntryAt(int row)
Gets the FormTableEntry at a given (visible) row.
|
Color |
getFocusedBackground()
Gets the color for the focus background.
|
Color |
getFocusedForeground()
Gets the color for the focus foreground.
|
String[] |
getFormat()
Gets the format strings of all columns.
|
String |
getFormat(int column)
Gets the format of a column.
|
String |
getHelpURL()
Gets the help url.
|
int |
getHorizontalAlignment(int column)
Gets the horizontal alignment.
|
Integer |
getMaxColumn(int column)
Gets the maxcolumns.
|
int |
getMaxRowHeight()
Gets the maximum row-height.
|
int |
getMinRowHeight()
Gets the minimum row-height.
|
NumberFormat |
getNumberFormat(int column)
Gets the number format.
|
T |
getObjectAt(int row)
Gets the data object that is associated to a given (visible) row.
|
long |
getPaintCount()
Gets the current (re-)paint count.
|
String |
getPreferencesName()
Gets the Preferences-name for this table.
By default, the name is evaluated from the template of the model which is assumed to be an AbstractFormTableModel. |
String |
getPreferencesName(FormTableEntry<?> entry)
Gets the Preferences-name for this table.
The name is built from the classname of the FormTableEntry associated with the table-model plus the name of the table. |
Dimension |
getPreferencesSize()
Gets the preferred size as defined by the preferences.
|
Integer |
getScale(int column)
Gets the scale.
|
Color |
getSelectedBackground()
Gets the color for the selected background.
|
Color |
getSelectedForeground()
Gets the color for the selected foreground.
|
Color |
getSelectedMandatoryBackground()
Gets the mandatory background for selected cells.
|
T |
getSelectedObject()
Gets the data object at the current row.
|
Color |
getUnselectedBackground()
Gets the color for the unselected background.
|
Color |
getUnselectedForeground()
Gets the color for the unselected foreground.
|
Color |
getUnselectedMandatoryBackground()
Gets the mandatory background for unselected cells.
|
FormTableUtilityPopup |
getUtilityPopup()
Gets the utility popup.
|
int |
getVerticalAlignment(int column)
Gets the vertical alignment.
|
void |
inhibitCellTraversal()
Inhibits cell traversal once.
Useful if we should stay in selected field even after Enter-key has been pressed. |
protected void |
installUtilityPopup()
Performs initialization of the utility popup.
The method is invoked from within setUtilityPopup(org.tentackle.swing.FormTableUtilityPopup). |
boolean |
isAutoSelect(int column)
Gets the autoselect flag.
|
boolean |
isBlankZero(int column)
Gets the blankzero flag.
|
boolean |
isCellDragEnabled()
Returns whether cell drag is enabled.
|
boolean |
isCellEditable(int row,
int column) |
boolean |
isCellEditorFixed()
Returns whether all cell editors are fixed or may change dynamically.
|
boolean |
isCellMandatory(int row,
int column)
Determines from model binding whether cell is mandatory.
|
boolean |
isCellRectFixed()
Returns whether the cell rectangles are fixed or change dynamically.
|
boolean |
isCellRendererFixed()
Returns whether all cell renderers are fixed or may change dynamically.
|
boolean |
isChangeable()
Returns if this component is changeable.
|
boolean |
isColumnVisible(int columnIndex)
Returns whether column is visible or not.
|
boolean |
isCreateDefaultColumnsFromPreferences()
Returns whether the columns are created according to the preferences.
|
boolean |
isDataChanged()
Determines whether some data cell has been changed.
|
boolean |
isEditing(int row,
int column)
Returns whether the given cell is currently being edited.
|
boolean |
isEnterActionEnabled()
Returns whether ENTER triggers actionPerformed.
|
boolean |
isFormTraversable()
Returns whether the table may receive keyboard focus
due to a form traversal.
|
boolean |
isHonourChangeable()
Returns whether this component should honour the changeable-attribute or not.
|
boolean |
isSizeInPreferencesIgnored()
Returns whether sizes in the preferences are ignored.
|
protected void |
paintComponent(Graphics g) |
Component |
prepareEditor(TableCellEditor editor,
int row,
int column) |
protected void |
processEvent(AWTEvent e) |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed) |
protected void |
queueEvent(AWTEvent e)
Queues an Event at the end of the event-queue.
|
void |
removeActionListener(ActionListener listener)
Removes an action Listener
|
void |
removeFormTableTraversalListener(FormTableTraversalListener listener)
Removes a traversal listener
|
void |
removeListSelectionListener(ListSelectionListener listener)
Removes a selection changed Listener.
|
void |
savePreferences(String prefName,
boolean system)
Saves the preferences of this table.
|
void |
scrollToCell(int row,
int column)
Scrolls to the row, column so that it's visible.
|
void |
setAdjust(char adjust)
Sets the adjust flag for all columns.
|
void |
setAdjust(int column,
char adjust)
Sets the adjust flag.
|
void |
setAutoSelect(boolean autoSelect)
Sets autoSelect for all columns.
|
void |
setAutoSelect(int column,
boolean autoSelect)
Sets the autoselect flag.
|
void |
setBlankZero(boolean blankZero)
Sets the blankzero flag for all columns.
|
void |
setBlankZero(int column,
boolean blankZero)
Sets the blankzero flag.
|
void |
setCellDragEnabled(boolean cellDragEnabled)
Enables or disables cell dragging.
The default TransferHandler in MetalLookAndFeel drags cells only if column-selection is allowed. |
void |
setCellEditorFixed(boolean cellEditorFixed)
Sets whether all cell editors are fixed or may change dynamically.
|
void |
setCellRectFixed(boolean cellRectFixed)
Sets whether the cell rectangles are fixed or change dynamically.
|
void |
setCellRendererFixed(boolean cellRendererFixed)
Sets whether all cell renderers are fixed or may change dynamically.
|
void |
setCellTraversal(int mode)
Sets the cell traversal mode.
|
void |
setChangeable(boolean changeable)
Set the component to be changeable.
This is a unified abstraction and will be translated to setEditable or setEnabled, whatever is appropriate to this component. |
void |
setClickCountToAction(int clicks)
Sets the number of mouse clicks to trigger an action event.
|
void |
setClickCountToStart(int clicks)
Sets the number of clicks to start the full editing mode of a cell.
|
void |
setColumnVisible(int columnIndex,
boolean visible)
Hides or displays a column.
|
void |
setConvert(char convert)
Sets the convert flag for all columns.
|
void |
setConvert(int column,
char convert)
Sets the convert flag.
|
void |
setCreateDefaultColumnsFromPreferences(boolean createDefaultColumnsFromPreferences)
Sets whether the columns are created according to the preferences.
|
void |
setDefaultEditor(Class<?> columnClass,
TableCellEditor editor) |
void |
setDefaultRenderer(Class<?> columnClass,
TableCellRenderer renderer) |
void |
setEnterActionEnabled(boolean enableEnterAction)
Enables/disables ENTER to trigger actionPerformed if row is selected.
|
void |
setFocusedBackground(Color c)
Sets the color for the focus background.
|
void |
setFocusedForeground(Color c)
Sets the color for the focus foreground.
|
void |
setFormat(int column,
String fmt)
Sets the format for a given column.
|
void |
setFormat(String[] fmt)
Sets the format for all columns.
|
void |
setFormTraversable(boolean formTraversable)
Sets whether the table may receive keyboard focus
due to a form traversal.
|
void |
setHelpURL(String helpURL)
Sets the help url.
|
void |
setHonourChangeable(boolean flag)
Sets whether this component should honour the changeable-attribute or not.
The default is true. |
void |
setHorizontalAlignment(int align)
Sets the horizontal alignment for all columns.
|
void |
setHorizontalAlignment(int column,
int align)
Sets the horizontal alignment (not to be mixed up with ADJUST_...)
|
void |
setMaxColumn(int column,
Integer maxColumn)
Sets the maxcolumns.
|
void |
setMaxRowHeight(int maxRowHeight)
Sets the maximum row-height.
|
void |
setMinRowHeight(int minRowHeight)
Sets the minimum row-height.
|
void |
setModel(TableModel dataModel) |
void |
setRowHeight(int rowHeight) |
void |
setRowHeight(int row,
int rowHeight) |
void |
setScale(int column,
Integer maxColumn)
Sets the scale.
|
void |
setSelectedBackground(Color c)
Sets the color for the selected background.
|
void |
setSelectedColumn(int col)
Sets the selected column.
|
void |
setSelectedColumns(int[] cols)
Sets the col-selection for an array of columns.
|
void |
setSelectedForeground(Color c)
Sets the color for the selected foreground.
|
void |
setSelectedMandatoryBackground(Color selectedMandatoryBackground)
Sets the mandatory background for selected cells.
|
void |
setSelectedRow(int row)
Sets the row-selection (single row)
(getSelectedRow is implemented in JTable but not setSelectedRow, for whatever reason)
|
void |
setSelectedRows(int[] rows)
Sets the row-selection for an array of rows.
|
void |
setSizeInPreferencesIgnored(boolean sizeInPreferencesIgnored)
Returns whether sizes in the preferences are ignored.
In apps with fixed window sizes (i.e. |
void |
setUnselectedBackground(Color c)
Sets the color for the unselected background.
|
void |
setUnselectedForeground(Color c)
Sets the color for the unselected foreground.
|
void |
setUnselectedMandatoryBackground(Color unselectedMandatoryBackground)
Sets the mandatory background for unselected cells.
|
void |
setUtilityPopup(FormTableUtilityPopup utilityPopup)
Sets the utility popup.
|
void |
setVerticalAlignment(int align)
Sets the vertical alignment for all columns.
Works only if a tentackle-plaf is used. |
void |
setVerticalAlignment(int column,
int align)
Sets the vertical alignment.
Works only if a tentackle-plaf is used. |
protected void |
uninstallUtilityPopup()
Performs de-initialization of the utility popup.
The method is invoked from within setUtilityPopup(org.tentackle.swing.FormTableUtilityPopup). |
void |
updateAllChangeable(boolean allChangeable)
Updates the container's changeable flag.
|
void |
valueChanged(ListSelectionEvent evt)
Invoked when the row selection changes.
|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, 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, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareRenderer, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, unconfigureEnclosingScrollPane, updateUIaddAncestorListener, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateadd, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCyclepublic static final String PREF_TABLE_WIDTH
public static final String PREF_TABLE_HEIGHT
public static final String PREF_COLUMN_WIDTH
public static final String PREF_COLUMN_INDEX
public static final String PREF_COLUMN_VISIBILITY
public static final String CLICK_ACTION
public static final String ENTER_ACTION
public static final String NEXTCELL_ACTION
public static final String PREVIOUSCELL_ACTION
public static final String HELP_ACTION
public static final int CELLTRAVERSAL_NONE
public static final int CELLTRAVERSAL_COLUMN
public static final int CELLTRAVERSAL_ROW
public static final int CELLTRAVERSAL_NOTABLEWRAP
public static final int CELLTRAVERSAL_SKIPNOEDIT
public static final int CELLTRAVERSAL_AUTOEDIT
public static final int CELLTRAVERSAL_TRANSFERFOCUS
public static final int CELLTRAVERSAL_NOLINEWRAP
public static final int CELLTRAVERSAL_WRAPINLINE
protected final transient LinkedHashMap<Class<?>,TableCellRenderer> defaultRenderersByColumnInterface
JTable.defaultRenderersByColumnClass the order of interfaces is important.
That's why we're using a LinkedHashMap here.protected final transient LinkedHashMap<Class<?>,TableCellEditor> defaultEditorsByColumnInterface
JTable.defaultEditorsByColumnClass the order of interfaces is important.
That's why we're using a LinkedHashMap here.protected Dimension preferencesSize
public FormTable(TableModel model)
model - the data modelpublic FormTable()
setModel(javax.swing.table.TableModel).public String getHelpURL()
public void setHelpURL(String helpURL)
helpURL - the help url, null if nonepublic boolean isFormTraversable()
public void setFormTraversable(boolean formTraversable)
formTraversable - true if can receive focus, default is false (focus only by mouse-click)public void setUtilityPopup(FormTableUtilityPopup utilityPopup)
utilityPopup - the popup, null to clearprotected void installUtilityPopup()
setUtilityPopup(org.tentackle.swing.FormTableUtilityPopup).protected void uninstallUtilityPopup()
setUtilityPopup(org.tentackle.swing.FormTableUtilityPopup).public FormTableUtilityPopup getUtilityPopup()
public void autoResizeColumnWidths()
public boolean isDataChanged()
public String getPreferencesName(FormTableEntry<?> entry)
entry - the formtable entrypublic String getPreferencesName()
AbstractFormTableModel.public boolean createDefaultColumnsFromPreferences(String prefName, boolean systemOnly)
prefName - is the name of the Preferences-nodesystemOnly - is true if take from SystemPreferences only. Otherwise
system is only consulted if there is no user setting.public Dimension getPreferencesSize()
public boolean isCreateDefaultColumnsFromPreferences()
public void setCreateDefaultColumnsFromPreferences(boolean createDefaultColumnsFromPreferences)
createDefaultColumnsFromPreferences - true if createDefaultColumnsFromModel() should invoke createDefaultColumnsFromPreferences()public void createDefaultColumnsFromModel()
Overridden to create the columns according to the Preferences if the tableModel is an AbstractFormTableModel (and Preferences exist for that table).
createDefaultColumnsFromModel in class JTablepublic void createDefaultColumnsFromDefaultModel()
public void savePreferences(String prefName, boolean system) throws BackingStoreException
prefName - the name of the Preferences-nodesystem - true if store to system-preferences, else store in userprefsBackingStoreException - if save failedprotected String createColumnIdentifier(TableColumn column)
column - the tableColumnpublic void setSelectedRow(int row)
row - the row numberpublic void setSelectedRows(int[] rows)
rows - the rowspublic void setSelectedColumn(int col)
col - the column numberpublic void setSelectedColumns(int[] cols)
cols - the columnspublic FormTableEntry<T> getEntryAt(int row)
row - the row numberpublic T getObjectAt(int row)
row - the row numberpublic T getSelectedObject()
protected void queueEvent(AWTEvent e)
e - the eventprotected void processEvent(AWTEvent e)
Overridden to handle cell-traversal events
processEvent in class Containerprotected TableColumnModel createDefaultColumnModel()
Overridden to use FormTableColumnModel instead of DefaultTableColumnModel. This is necessary to allow setVisible() of a column.
createDefaultColumnModel in class JTablepublic void setColumnVisible(int columnIndex,
boolean visible)
columnIndex - the column index according to the data-model.visible - true if column is made visible, false if invisiblepublic boolean isColumnVisible(int columnIndex)
columnIndex - the column index according to the data-model.protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
Overridden to implement enhanced keyboard handling.
processKeyBinding in class JTablepublic void setSelectedForeground(Color c)
c - the foreground colorpublic Color getSelectedForeground()
public void setSelectedBackground(Color c)
c - the background colorpublic Color getSelectedBackground()
public void setUnselectedForeground(Color c)
c - the unselected foreground colorpublic Color getUnselectedForeground()
public void setUnselectedBackground(Color c)
c - the background colorpublic Color getUnselectedBackground()
public void setFocusedForeground(Color c)
c - the focus foreground colorpublic Color getFocusedForeground()
public void setFocusedBackground(Color c)
c - the focus background colorpublic Color getFocusedBackground()
public Color getSelectedMandatoryBackground()
public void setSelectedMandatoryBackground(Color selectedMandatoryBackground)
selectedMandatoryBackground - mandatory background if not default from LAFpublic Color getUnselectedMandatoryBackground()
public void setUnselectedMandatoryBackground(Color unselectedMandatoryBackground)
unselectedMandatoryBackground - mandatory background if not default from LAFpublic boolean isEditing(int row,
int column)
row - the row indexcolumn - the column indexpublic void editCellLater(int row,
int column)
Notice that the edit-request is queued!
row - the row indexcolumn - the column indexpublic void editNextCellLater(int row,
int column)
Notice that the edit-request is queued!
row - the row indexcolumn - the column indexeditCellLater(int, int)public void editPreviousCellLater(int row,
int column)
Notice that the edit-request is queued!
row - the row indexcolumn - the column indexeditCellLater(int, int)public void editNextCellLater()
Notice that the edit-request is queued!
public void editPreviousCellLater()
Notice that the edit-request is queued!
public boolean editCellAt(int row,
int column,
EventObject e)
Overridden to fix certain flaws in JTable.
editCellAt in class JTablepublic void editingStopped(ChangeEvent e)
Overridden to catch the last key for generating CellTraversalEvents
editingStopped in interface CellEditorListenereditingStopped in class JTablepublic void editingCanceled(ChangeEvent e)
editingCanceled in interface CellEditorListenereditingCanceled in class JTablepublic void inhibitCellTraversal()
public void clearInhibitCellTraversal()
public void discardCellEvents()
public void setModel(TableModel dataModel)
Overridden to setup the formatting, renderers and editors.
public static BindableTableModel<?> findBindableTableModel(TableModel model)
BindableTableModel in the model chain.model - the table modelpublic void applyTemplate(FormTableEntry<T> template)
FormTableEntry.template - the table entry, null to set defaultspublic void configureRenderers()
FormTableEntry.isCellRendererFixed()).
Does nothing if the current model is not an AbstractFormTableModel.public void configureEditors()
FormTableEntry.isCellEditorFixed()).
Does nothing if the current model is not an AbstractFormTableModel.public TableColumn getColumnByModelIndex(int modelIndex)
modelIndex - the column index according to the data modelpublic Rectangle getDefaultCellRect(int row, int column, boolean includeSpacing)
row - the row indexcolumn - the column indexincludeSpacing - false to return the true cell boundsJTable.getCellRect(int, int, boolean)public Rectangle getCellRect(int row, int column, boolean includeSpacing)
Overridden to implement cell merging.
getCellRect in class JTablepublic void changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
Overridden to implement cell merging.
changeSelection in class JTablepublic void setCellTraversal(int mode)
mode - the cell traversal mode, one or more of CELLTRAVERSAL_...public int getCellTraversal()
public void addListSelectionListener(ListSelectionListener listener)
listener - the listener to addpublic void removeListSelectionListener(ListSelectionListener listener)
listener - the listener to removepublic void fireValueChanged(ListSelectionEvent evt)
evt - the selection eventpublic void valueChanged(ListSelectionEvent evt)
Overridden to fire the formtable listeners.
valueChanged in interface ListSelectionListenervalueChanged in class JTableevt - the selection eventpublic void addFormTableTraversalListener(FormTableTraversalListener listener)
listener - the listener to addpublic void removeFormTableTraversalListener(FormTableTraversalListener listener)
listener - the listener to removepublic void fireTraversalRequested(FormTableTraversalEvent evt) throws FormTableTraversalVetoException
evt - the traversal eventFormTableTraversalVetoException - if traversal vetoedpublic void addActionListener(ActionListener listener)
listener - the listener to addpublic void removeActionListener(ActionListener listener)
listener - the listener to removepublic void fireActionPerformed(ActionEvent evt)
evt - the action eventpublic int getClickCount()
public void setClickCountToAction(int clicks)
clicks - the number of clicks, default is 2.public int getClickCountToAction()
public void setEnterActionEnabled(boolean enableEnterAction)
Notice that enabling ENTER action is only meaningful if the table is not editable and celltraversal is turned off.
enableEnterAction - true to enable, default is falsepublic boolean isEnterActionEnabled()
public void setClickCountToStart(int clicks)
clicks - the number of clicks, default is 2public int getClickCountToStart()
public void setChangeable(boolean changeable)
FormChangeablesetChangeable in interface FormChangeablechangeable - true the user can edit the data, false if show onlypublic boolean isChangeable()
FormChangeableisChangeable in interface FormChangeablepublic void setHonourChangeable(boolean flag)
FormChangeablesetHonourChangeable in interface FormChangeableflag - true if honour the changeable attribute, false if notpublic boolean isHonourChangeable()
FormChangeableisHonourChangeable in interface FormChangeablepublic void updateAllChangeable(boolean allChangeable)
FormChangeableComponent
Whenever FormChangeable.setChangeable(boolean) is invoked
all of the container's components get this method invoked.
updateAllChangeable in interface FormChangeableComponentallChangeable - true if changeablepublic boolean isCellEditable(int row,
int column)
Overridden to implement the changeable attribute.
isCellEditable in class JTablepublic boolean isCellMandatory(int row,
int column)
row - the view rowcolumn - the view columnpublic void setFormat(int column,
String fmt)
column - the column indexfmt - the format stringpublic void setFormat(String[] fmt)
fmt - the format array (size must match the number of columns)public String getFormat(int column)
column - the column indexpublic String[] getFormat()
public void setAutoSelect(int column,
boolean autoSelect)
column - the column indexautoSelect - true to enable autoselect, default is falsepublic void setAutoSelect(boolean autoSelect)
autoSelect - true to enable autoselect, default is falsepublic boolean isAutoSelect(int column)
column - the column indexpublic void setBlankZero(int column,
boolean blankZero)
column - the column indexblankZero - true to enable zero suppression, default is falsepublic void setBlankZero(boolean blankZero)
blankZero - true to enable zero suppression, default is falsepublic boolean isBlankZero(int column)
column - the column indexpublic void setConvert(int column,
char convert)
column - the column indexconvert - the character conversion mode, default is FormFieldComponent.CONVERT_NONEpublic void setConvert(char convert)
convert - the character conversion mode, default is FormFieldComponent.CONVERT_NONEpublic char getConvert(int column)
column - the column indexpublic void setAdjust(int column,
char adjust)
column - the column indexadjust - the adjustment mode, default is FormFieldComponent.ADJUST_TRIMpublic void setAdjust(char adjust)
adjust - the adjustment mode, default is FormFieldComponent.ADJUST_TRIMpublic char getAdjust(int column)
column - the column indexpublic void setMaxColumn(int column,
Integer maxColumn)
column - the column indexmaxColumn - the maximum number of columns, null to clearAbstractFormField.setMaxColumns(int)public Integer getMaxColumn(int column)
column - the column indexAbstractFormField.getMaxColumns()public void setScale(int column,
Integer maxColumn)
column - the column indexmaxColumn - the maximum number of columns, null to clearAbstractFractionNumberFormField.setScale(int)public Integer getScale(int column)
column - the column indexAbstractFractionNumberFormField.getScale()public void setHorizontalAlignment(int column,
int align)
column - the column indexalign - the alignmentJLabel.setHorizontalAlignment(int)public void setHorizontalAlignment(int align)
align - the alignmentJLabel.setHorizontalAlignment(int)public int getHorizontalAlignment(int column)
column - the column indexJLabel.setHorizontalAlignment(int)public void setVerticalAlignment(int column,
int align)
column - the column indexalign - the alignmentJLabel.setVerticalAlignment(int)public void setVerticalAlignment(int align)
align - the alignmentJLabel.setVerticalAlignment(int)public int getVerticalAlignment(int column)
column - the column indexJLabel.setHorizontalAlignment(int)public DateFormat getDateFormat(int column, boolean asTimestamp)
column - the column indexasTimestamp - true if default format to use is for timestampspublic DateFormat getDateFormat(int column)
column - the column indexpublic NumberFormat getNumberFormat(int column)
column - the column indexpublic void setMinRowHeight(int minRowHeight)
minRowHeight - the minimum row height in pixels, 0 = no limitpublic int getMinRowHeight()
public void setMaxRowHeight(int maxRowHeight)
maxRowHeight - the minimum row height in pixels, 0 = no limitpublic int getMaxRowHeight()
public void setRowHeight(int row,
int rowHeight)
Overridden to check against min/max-rowheights
setRowHeight in class JTablepublic void setRowHeight(int rowHeight)
Overridden to check against min/max-rowheights
setRowHeight in class JTablepublic void scrollToCell(int row,
int column)
row - the row indexcolumn - the column indexJComponent.scrollRectToVisible(java.awt.Rectangle)public boolean isSizeInPreferencesIgnored()
public void setSizeInPreferencesIgnored(boolean sizeInPreferencesIgnored)
sizeInPreferencesIgnored - true if don't setPreferredSize, default is false.public boolean isCellEditorFixed()
public void setCellEditorFixed(boolean cellEditorFixed)
cellEditorFixed - true if cell editors don't change dynamically (default)public boolean isCellRendererFixed()
public void setCellRendererFixed(boolean cellRendererFixed)
cellRendererFixed - true if cell renderers don't change dynamically (default)public boolean isCellRectFixed()
public void setCellRectFixed(boolean cellRectFixed)
cellRectFixed - true if cells don't change sizes dynamically (default)public TableCellRenderer getCellRenderer(int row, int column)
Overridden to invoke getCellRenderer in FormTableEntry if the renderer is not fixed.
getCellRenderer in class JTablepublic TableCellEditor getCellEditor(int row, int column)
Overridden to invoke getCellEditor in FormTableEntry if the editor is not fixed.
getCellEditor in class JTablepublic void setDefaultEditor(Class<?> columnClass, TableCellEditor editor)
Overridden to manage a map of interfaces and because of setClickCountToStart(int).
setDefaultEditor in class JTablepublic TableCellEditor getDefaultEditor(Class<?> columnClass)
Overridden to keep a map of interfaces and to return the FormFieldEditor for a String in case the column-class isn't known yet. In this case a column-class of 'Object' is passed which we will translate to a String right here because it will be done by JTable's implementation anyway (see GenericEditor). The GenericEditor should be avoided because it isn't aware of all the FormTable-extensions. A couple of things won't work such as celltraversal, formatting, etc... If this is not what you want, please override getColumnClass in the FormTableEntry and provide the correct class for columns that may be initially null.
getDefaultEditor in class JTablepublic void setDefaultRenderer(Class<?> columnClass, TableCellRenderer renderer)
Overridden to keep a map of interfaces.
Notice: the order in which interfaces are added is important
setDefaultRenderer in class JTablepublic TableCellRenderer getDefaultRenderer(Class<?> columnClass)
Overridden to allow interfaces as well.
If JTable.defaultRenderersByColumnClass contains interfaces, they will be checked first.
getDefaultRenderer in class JTablepublic boolean isCellDragEnabled()
public void setCellDragEnabled(boolean cellDragEnabled)
cellDragEnabled - true to enable cell drag (default), false for row dragpublic Component prepareEditor(TableCellEditor editor, int row, int column)
overridden to fix the bug in JTable that editable ComboBoxes don't return the focus to the table. Furthermore transferFocusBackward is implemented here to allow walk back in editing cells with Shift-ENTER.
prepareEditor in class JTableprotected void paintComponent(Graphics g)
Overridden to optimize excessive cell setViewValue
paintComponent in class JComponentpublic long getPaintCount()
Tentackle - a domain driven enterprise framework