public class TableButtonPanel
extends javax.swing.JPanel
implements javax.swing.event.ListSelectionListener
TablePanel
but not restricted to it. The components are not installed
all at once but only if added to the underlying toolbar. Listeners can be installed with one
step, the button can be identified by their unique key which is also used a action command.
The button names contain the popup text as additional payload.
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUTTON_ADD
Unique button identifier.
|
static java.lang.String |
BUTTON_CONNECT
Unique button identifier.
|
static java.lang.String |
BUTTON_COPY
Unique button identifier.
|
static java.lang.String |
BUTTON_CUT
Unique button identifier.
|
static java.lang.String |
BUTTON_DELETE
Unique button identifier.
|
static java.lang.String |
BUTTON_DISCONNECT
Unique button identifier.
|
static java.lang.String |
BUTTON_EDIT
Unique button identifier.
|
static java.lang.String |
BUTTON_FIND
Unique button identifier.
|
static java.lang.String |
BUTTON_HELP
Unique button identifier.
|
static java.lang.String |
BUTTON_LOAD_FILE
Unique button identifier.
|
static java.lang.String |
BUTTON_OPEN
Unique button identifier.
|
static java.lang.String |
BUTTON_PASTE
Unique button identifier.
|
static java.lang.String |
BUTTON_PRINT
Unique button identifier.
|
static java.lang.String |
BUTTON_REFRESH
Unique button identifier.
|
static java.lang.String |
BUTTON_RENAME
Unique button identifier.
|
static java.lang.String |
BUTTON_SAVE_FILE
Unique button identifier.
|
static java.lang.String |
BUTTON_SETTINGS
Unique button identifier.
|
static java.lang.String |
BUTTON_TRASH
Unique button identifier.
|
static java.lang.String |
BUTTON_VIEW
Unique button identifier.
|
static java.net.URL |
ICON_ADD
A button icon.
|
static java.net.URL |
ICON_CONNECT
A button icon.
|
static java.net.URL |
ICON_COPY
A button icon.
|
static java.net.URL |
ICON_CUT
A button icon.
|
static java.net.URL |
ICON_DELETE
A button icon.
|
static java.net.URL |
ICON_DISCONNECT
A button icon.
|
static java.net.URL |
ICON_EDIT
A button icon.
|
static java.net.URL |
ICON_FIND
A button icon.
|
static java.net.URL |
ICON_HELP
A button icon.
|
static java.net.URL |
ICON_LOAD_FILE
A button icon.
|
static java.net.URL |
ICON_OPEN
A button icon.
|
static java.net.URL |
ICON_PASTE
A button icon.
|
static java.net.URL |
ICON_PRINT
A button icon.
|
static java.net.URL |
ICON_REFRESH
A button icon.
|
static java.net.URL |
ICON_RENAME
A button icon.
|
static java.net.URL |
ICON_SAVE_FILE
A button icon.
|
static java.net.URL |
ICON_SETTINGS
A button icon.
|
static java.net.URL |
ICON_TRASH
A button icon.
|
static java.net.URL |
ICON_VIEW
A button icon.
|
static java.lang.String |
SEPARATOR
Unique button identifier (placeholder for separator).
|
protected javax.swing.JToolBar |
toolBar |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
TableButtonPanel()
Constructor of this form.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Adds a listener to be informed about clicks to all buttons currently installed.
|
java.awt.Component |
addButton(ButtonDef def)
Adds another toolbar button.
|
protected void |
finalize()
Clean-up method to help the gc.
|
java.awt.Component[] |
getAllButtons()
Provides the list of the currently shown buttons from left to right.
|
java.awt.Component |
getButton(java.lang.String key)
Determines the button for a button key.
|
javax.swing.JToolBar |
getToolBar()
Provides the tool bar component.
|
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener to be informed about clicks from all buttons currently installed.
|
void |
setButtons(ButtonDef[] defs)
Creates the toolbar buttons in the order the buttons are passed here.
|
void |
setTableComponent(java.awt.Component tablecomp)
Sets the component to be monitored for automatic button enabling/disabling.
|
protected void |
updateButtons()
Implements the auto-enable strategies for the installed buttons.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent event)
Reacts on table selection changes.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String SEPARATOR
public static final java.lang.String BUTTON_ADD
public static final java.lang.String BUTTON_DELETE
public static final java.lang.String BUTTON_EDIT
public static final java.lang.String BUTTON_VIEW
public static final java.lang.String BUTTON_RENAME
public static final java.lang.String BUTTON_HELP
public static final java.lang.String BUTTON_REFRESH
public static final java.lang.String BUTTON_PRINT
public static final java.lang.String BUTTON_OPEN
public static final java.lang.String BUTTON_CUT
public static final java.lang.String BUTTON_COPY
public static final java.lang.String BUTTON_PASTE
public static final java.lang.String BUTTON_FIND
public static final java.lang.String BUTTON_SETTINGS
public static final java.lang.String BUTTON_CONNECT
public static final java.lang.String BUTTON_DISCONNECT
public static final java.lang.String BUTTON_TRASH
public static final java.lang.String BUTTON_LOAD_FILE
public static final java.lang.String BUTTON_SAVE_FILE
public static final java.net.URL ICON_ADD
public static final java.net.URL ICON_DELETE
public static final java.net.URL ICON_EDIT
public static final java.net.URL ICON_VIEW
public static final java.net.URL ICON_RENAME
public static final java.net.URL ICON_HELP
public static final java.net.URL ICON_REFRESH
public static final java.net.URL ICON_PRINT
public static final java.net.URL ICON_OPEN
public static final java.net.URL ICON_CUT
public static final java.net.URL ICON_COPY
public static final java.net.URL ICON_PASTE
public static final java.net.URL ICON_FIND
public static final java.net.URL ICON_SETTINGS
public static final java.net.URL ICON_CONNECT
public static final java.net.URL ICON_DISCONNECT
public static final java.net.URL ICON_TRASH
public static final java.net.URL ICON_LOAD_FILE
public static final java.net.URL ICON_SAVE_FILE
protected javax.swing.JToolBar toolBar
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setButtons(ButtonDef[] defs)
defs
- The button definitionsjava.lang.NullPointerException
- If the parameters are null
public java.awt.Component addButton(ButtonDef def)
def
- The button definitionJButton
or ComboButton
, may be null
java.lang.IllegalArgumentException
- If the parameters are invalidjava.lang.NullPointerException
- If the parameters are null
public java.awt.Component getButton(java.lang.String key)
key
- The internally used button keyJButton
or ComboButton
, may be null
java.lang.NullPointerException
- If the parameters are null
public java.awt.Component[] getAllButtons()
JButton
or ComboButton
, may be null
public void addActionListener(java.awt.event.ActionListener listener)
listener
- The listener instancejava.lang.NullPointerException
- If parameter is null
java.lang.IllegalArgumentException
- If threshold is not between 10% and 100%public void removeActionListener(java.awt.event.ActionListener listener)
listener
- The listener instancejava.lang.NullPointerException
- If parameter is null
public void setTableComponent(java.awt.Component tablecomp)
TablePanel
instances.
tablecomp
- The component to be monitored, may be null
java.lang.NullPointerException
- If a parameter is null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic javax.swing.JToolBar getToolBar()
protected void updateButtons()
public void valueChanged(javax.swing.event.ListSelectionEvent event)
valueChanged
in interface javax.swing.event.ListSelectionListener
event
- The eventCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.