Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.javatools.ui.table
Class TableToolbar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by oracle.javatools.ui.table.TableToolbar
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public final class TableToolbar
extends javax.swing.JPanel

This toolbar component can be used at the top of the table with various tools like Add, Edit, Delete, Clear, Copy, Paste and Duplicate which supports actions like adding row, adding column, deleting row, deleting column, clearing cell data, copying or pasting data and duplicating a row in the table. In addition clients can also have a header label which will be shown at the left side of this title bar.

These buttons can be made visible either by setting setToolMask or calling setXXXVisible method. Then you can set the default action for these buttons using setDefaultXXXAction. If the action button supports more than one action, you can assign the additional actions using setXXXMenuActions. These actions will appear in the dropdown menu of the tool button.

By default we have implemented various actions that can be assigned to the above mentioned standard tools. You can get these default actions using various ToolAction. Clients should either use DefaultTableModel or EditableTableModel to get automatic support for these actions.

Clients can also add custom components or actions using addActionControl method.

See Also:
Serialized Form

Nested Class Summary
static class TableToolbar.ToolAction
          Action Keys to get some of the default action for the table
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
static int TOOL_CLEAR
          Constant indicating Clear button in Toolbar
static int TOOL_COPY
          Constant indicating Copy button in Toolbar
static int TOOL_DELETE
          Constant indicating Delete button in Toolbar
static int TOOL_DUPLICATE
          Constant indicating Duplicate button in Toolbar
static int TOOL_EDIT
          Constant indicating Edit button in Toolbar
static int TOOL_NEW
          Constant indicating New/Add button in Toolbar
static int TOOL_NONE
          Constant indicating no buttons in Toolbar
static int TOOL_PASTE
          Constant indicating Paste button in Toolbar
 
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
TableToolbar(javax.swing.JTable table)
          Create a TitleToolbar component for the specified table.
TableToolbar(javax.swing.JTable table, java.lang.String label)
          Create a TitleToolbar component for the specified table which shows the header label.
TableToolbar(javax.swing.JTable table, java.lang.String label, int toolMask)
          Create a TitleToolbar component for the specified table which shows the header label and the tool buttons specified in the toolMask.
 
Method Summary
 void addActionControl(javax.swing.Action action)
          Add a custom tool component to the table toolbar
 void addActionControl(java.awt.Component tool)
          Add a custom tool component to the table toolbar
 javax.swing.Action[] getAddMenuActions()
          Returns the menu actions of Add button.
 javax.swing.Action[] getClearMenuActions()
          Returns the menu actions of clear button.
 javax.swing.Action[] getCopyMenuActions()
          Returns the menu actions of copy button.
 javax.swing.Action getDefaultAction(TableToolbar.ToolAction action)
          Gets one of those default actions mentioned in ToolAction.* for this table.
 javax.swing.Action getDefaultAddAction()
          Default action for Add button
 javax.swing.Action getDefaultClearAction()
          Default action for Clear button
 javax.swing.Action getDefaultCopyAction()
          Default action for Copy button
 javax.swing.Action getDefaultDeleteAction()
          Default action for Delete button
 javax.swing.Action getDefaultDuplicateAction()
          Default action for duplicate button
 javax.swing.Action getDefaultEditAction()
          Default action for Edit button
 javax.swing.Action getDefaultPasteAction()
          Default action for Paste button
 javax.swing.Action[] getDeleteMenuActions()
          Returns the menu actions of delete button.
 javax.swing.Action[] getDuplicateMenuActions()
          Returns the menu actions of duplicate button.
 javax.swing.Action[] getEditMenuActions()
          Returns the menu actions of edit button.
 java.lang.String getLabel()
          Returns the title header label.
 javax.swing.Action[] getPasteMenuActions()
          Returns the menu actions of paste button.
 int getToolMask()
          The buttonMask, a bitwise or of the Tool_* constants.
 boolean isAddEnabled()
          Returns whether the add button is enabled or not.
 boolean isAddVisible()
          Returns whether the add button is added and visible in the toolbar.
 boolean isClearEnabled()
          Returns whether the clear button is enabled or not.
 boolean isClearVisible()
          Returns whether the clear button is added and visible in the toolbar.
 boolean isCopyEnabled()
          Returns whether the copy button is enabled or not.
 boolean isCopyVisible()
          Returns whether the copy button is added and visible in the toolbar.
 boolean isDeleteEnabled()
          Returns whether the delete button is enabled or not.
 boolean isDeleteVisible()
          Returns whether the delete button is added and visible in the toolbar.
 boolean isDuplicateEnabled()
          Returns whether the duplicate button is enabled or not.
 boolean isDuplicateVisible()
          Returns whether the duplicate button is added and visible in the toolbar.
 boolean isEditEnabled()
          Returns whether the edit button is enabled or not.
 boolean isEditVisible()
          Returns whether the edit button is added and visible in the toolbar.
 boolean isPasteEnabled()
          Returns whether the paste button is enabled or not.
 boolean isPasteVisible()
          Returns whether the paste button is added and visible in the toolbar.
 void removeActionControl(java.awt.Component tool)
          Remove the custom tool component you added to this toolbar.
 void setAddEnabled(boolean enable)
          Enable/Disable the new/add button.
 void setAddMenuActions(javax.swing.Action... addAction)
          Sets the menu actions for Add button.
 void setAddVisible(boolean visible)
          Add the Add/New button to the toolbar.
 void setClearEnabled(boolean enable)
          Enable/Disable the clear button.
 void setClearMenuActions(javax.swing.Action... copyAction)
          Sets the menu actions for clear button.
 void setClearVisible(boolean visible)
          Add the Clear button to the toolbar.
 void setCopyEnabled(boolean enable)
          Enable/Disable the copy button.
 void setCopyMenuActions(javax.swing.Action... copyAction)
          Sets the menu actions for copy button.
 void setCopyVisible(boolean visible)
          Add the Copy button to the toolbar.
 void setDefaultAddAction(javax.swing.Action action)
          Default action for Add button
 void setDefaultClearAction(javax.swing.Action action)
          Default action for Clear button
 void setDefaultCopyAction(javax.swing.Action action)
          Default action for Copy button
 void setDefaultDeleteAction(javax.swing.Action action)
          Default action for Delete button
 void setDefaultDuplicateAction(javax.swing.Action action)
          Default action for duplicate button
 void setDefaultEditAction(javax.swing.Action action)
          Default action for Edit button
 void setDefaultPasteAction(javax.swing.Action action)
          Default action for Paste button
 void setDeleteEnabled(boolean enable)
          Enable/Disable the delete button.
 void setDeleteMenuActions(javax.swing.Action... copyAction)
          Sets the menu actions for delete button.
 void setDeleteVisible(boolean visible)
          Add the Delete button to the toolbar.
 void setDuplicateEnabled(boolean enable)
          Enable/Disable the duplicate button.
 void setDuplicateMenuActions(javax.swing.Action... copyAction)
          Sets the menu actions for duplicate button.
 void setDuplicateVisible(boolean visible)
          Add the Duplicate button to the toolbar.
 void setEditEnabled(boolean enable)
          Enable/Disable the edit button.
 void setEditMenuActions(javax.swing.Action... editAction)
          Sets the menu action for Edit button.
 void setEditVisible(boolean visible)
          Add the Edit button to the toolbar.
 void setLabel(java.lang.String text)
          Set the title header label.
 void setPasteEnabled(boolean enable)
          Enable/Disable the paste button.
 void setPasteMenuActions(javax.swing.Action... copyAction)
          Sets the menu actions for paste button.
 void setPasteVisible(boolean visible)
          Add the Paste button to the toolbar.
 void setToolMask(int mask)
          Choose which tool buttons to add to this toolbar.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, doLayout, 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
 

Field Detail

TOOL_NONE

public static final int TOOL_NONE
Constant indicating no buttons in Toolbar

See Also:
Constant Field Values

TOOL_NEW

public static final int TOOL_NEW
Constant indicating New/Add button in Toolbar

See Also:
Constant Field Values

TOOL_EDIT

public static final int TOOL_EDIT
Constant indicating Edit button in Toolbar

See Also:
Constant Field Values

TOOL_DELETE

public static final int TOOL_DELETE
Constant indicating Delete button in Toolbar

See Also:
Constant Field Values

TOOL_CLEAR

public static final int TOOL_CLEAR
Constant indicating Clear button in Toolbar

See Also:
Constant Field Values

TOOL_COPY

public static final int TOOL_COPY
Constant indicating Copy button in Toolbar

See Also:
Constant Field Values

TOOL_PASTE

public static final int TOOL_PASTE
Constant indicating Paste button in Toolbar

See Also:
Constant Field Values

TOOL_DUPLICATE

public static final int TOOL_DUPLICATE
Constant indicating Duplicate button in Toolbar

See Also:
Constant Field Values
Constructor Detail

TableToolbar

public TableToolbar(javax.swing.JTable table)
Create a TitleToolbar component for the specified table. Table cannot be null.


TableToolbar

public TableToolbar(javax.swing.JTable table,
                    java.lang.String label)
Create a TitleToolbar component for the specified table which shows the header label. Table cannot be null.


TableToolbar

public TableToolbar(javax.swing.JTable table,
                    java.lang.String label,
                    int toolMask)
Create a TitleToolbar component for the specified table which shows the header label and the tool buttons specified in the toolMask. Table cannot be null.

Method Detail

setLabel

public void setLabel(java.lang.String text)
Set the title header label.


getLabel

public java.lang.String getLabel()
Returns the title header label.


setToolMask

public void setToolMask(int mask)
Choose which tool buttons to add to this toolbar. Bitwise or of any of Tool_* constants.


getToolMask

public int getToolMask()
The buttonMask, a bitwise or of the Tool_* constants.


setAddVisible

public void setAddVisible(boolean visible)
Add the Add/New button to the toolbar. Clients have to call setDefaultAddAction to associate any action to this button.


isAddVisible

public boolean isAddVisible()
Returns whether the add button is added and visible in the toolbar.


setAddEnabled

public void setAddEnabled(boolean enable)
Enable/Disable the new/add button.


isAddEnabled

public boolean isAddEnabled()
Returns whether the add button is enabled or not.


setAddMenuActions

public void setAddMenuActions(javax.swing.Action... addAction)
Sets the menu actions for Add button.


getAddMenuActions

public javax.swing.Action[] getAddMenuActions()
Returns the menu actions of Add button.


setDefaultAddAction

public void setDefaultAddAction(javax.swing.Action action)
Default action for Add button


getDefaultAddAction

public javax.swing.Action getDefaultAddAction()
Default action for Add button


setEditVisible

public void setEditVisible(boolean visible)
Add the Edit button to the toolbar. Clients have to call setDefaultEditAction to associate any action to this button.


isEditVisible

public boolean isEditVisible()
Returns whether the edit button is added and visible in the toolbar.


setEditEnabled

public void setEditEnabled(boolean enable)
Enable/Disable the edit button.


isEditEnabled

public boolean isEditEnabled()
Returns whether the edit button is enabled or not.


setEditMenuActions

public void setEditMenuActions(javax.swing.Action... editAction)
Sets the menu action for Edit button.


getEditMenuActions

public javax.swing.Action[] getEditMenuActions()
Returns the menu actions of edit button.


setDefaultEditAction

public void setDefaultEditAction(javax.swing.Action action)
Default action for Edit button


getDefaultEditAction

public javax.swing.Action getDefaultEditAction()
Default action for Edit button


setDeleteVisible

public void setDeleteVisible(boolean visible)
Add the Delete button to the toolbar. Clients have to call setDefaultDeleteAction to associate any action to this button.


isDeleteVisible

public boolean isDeleteVisible()
Returns whether the delete button is added and visible in the toolbar.


setDeleteEnabled

public void setDeleteEnabled(boolean enable)
Enable/Disable the delete button.


isDeleteEnabled

public boolean isDeleteEnabled()
Returns whether the delete button is enabled or not.


setDeleteMenuActions

public void setDeleteMenuActions(javax.swing.Action... copyAction)
Sets the menu actions for delete button.


getDeleteMenuActions

public javax.swing.Action[] getDeleteMenuActions()
Returns the menu actions of delete button.


setDefaultDeleteAction

public void setDefaultDeleteAction(javax.swing.Action action)
Default action for Delete button


getDefaultDeleteAction

public javax.swing.Action getDefaultDeleteAction()
Default action for Delete button


setClearVisible

public void setClearVisible(boolean visible)
Add the Clear button to the toolbar. Clients have to call setDefaultClearAction to associate any action to this button.


isClearVisible

public boolean isClearVisible()
Returns whether the clear button is added and visible in the toolbar.


setClearEnabled

public void setClearEnabled(boolean enable)
Enable/Disable the clear button.


isClearEnabled

public boolean isClearEnabled()
Returns whether the clear button is enabled or not.


setClearMenuActions

public void setClearMenuActions(javax.swing.Action... copyAction)
Sets the menu actions for clear button.


getClearMenuActions

public javax.swing.Action[] getClearMenuActions()
Returns the menu actions of clear button.


setDefaultClearAction

public void setDefaultClearAction(javax.swing.Action action)
Default action for Clear button


getDefaultClearAction

public javax.swing.Action getDefaultClearAction()
Default action for Clear button


setCopyVisible

public void setCopyVisible(boolean visible)
Add the Copy button to the toolbar. Clients have to call setDefaultCopyAction to associate any action to this button.


isCopyVisible

public boolean isCopyVisible()
Returns whether the copy button is added and visible in the toolbar.


setCopyEnabled

public void setCopyEnabled(boolean enable)
Enable/Disable the copy button.


isCopyEnabled

public boolean isCopyEnabled()
Returns whether the copy button is enabled or not.


setCopyMenuActions

public void setCopyMenuActions(javax.swing.Action... copyAction)
Sets the menu actions for copy button.


getCopyMenuActions

public javax.swing.Action[] getCopyMenuActions()
Returns the menu actions of copy button.


setDefaultCopyAction

public void setDefaultCopyAction(javax.swing.Action action)
Default action for Copy button


getDefaultCopyAction

public javax.swing.Action getDefaultCopyAction()
Default action for Copy button


setPasteVisible

public void setPasteVisible(boolean visible)
Add the Paste button to the toolbar. Clients have to call setDefaultPasteAction to associate any action to this button.


isPasteVisible

public boolean isPasteVisible()
Returns whether the paste button is added and visible in the toolbar.


setPasteEnabled

public void setPasteEnabled(boolean enable)
Enable/Disable the paste button.


isPasteEnabled

public boolean isPasteEnabled()
Returns whether the paste button is enabled or not.


setPasteMenuActions

public void setPasteMenuActions(javax.swing.Action... copyAction)
Sets the menu actions for paste button.


getPasteMenuActions

public javax.swing.Action[] getPasteMenuActions()
Returns the menu actions of paste button.


setDefaultPasteAction

public void setDefaultPasteAction(javax.swing.Action action)
Default action for Paste button


getDefaultPasteAction

public javax.swing.Action getDefaultPasteAction()
Default action for Paste button


setDuplicateVisible

public void setDuplicateVisible(boolean visible)
Add the Duplicate button to the toolbar. Clients have to call setDefaultDuplicateAction to associate any action to this button.


isDuplicateVisible

public boolean isDuplicateVisible()
Returns whether the duplicate button is added and visible in the toolbar.


setDuplicateEnabled

public void setDuplicateEnabled(boolean enable)
Enable/Disable the duplicate button.


isDuplicateEnabled

public boolean isDuplicateEnabled()
Returns whether the duplicate button is enabled or not.


setDuplicateMenuActions

public void setDuplicateMenuActions(javax.swing.Action... copyAction)
Sets the menu actions for duplicate button.


getDuplicateMenuActions

public javax.swing.Action[] getDuplicateMenuActions()
Returns the menu actions of duplicate button.


setDefaultDuplicateAction

public void setDefaultDuplicateAction(javax.swing.Action action)
Default action for duplicate button


getDefaultDuplicateAction

public javax.swing.Action getDefaultDuplicateAction()
Default action for duplicate button


addActionControl

public void addActionControl(javax.swing.Action action)
Add a custom tool component to the table toolbar


addActionControl

public void addActionControl(java.awt.Component tool)
Add a custom tool component to the table toolbar


removeActionControl

public void removeActionControl(java.awt.Component tool)
Remove the custom tool component you added to this toolbar.


getDefaultAction

public javax.swing.Action getDefaultAction(TableToolbar.ToolAction action)
Gets one of those default actions mentioned in ToolAction.* for this table.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.