public class ButtonDef
extends java.lang.Object
TableButtonPanel
.
Set the comboItems
property if you like a ComboButton
being displayed
instead of a simple JButton
. The ComboButton
provides an array
down icon button to display a popup with click options for the button. This functionality
has been implemented by the Thunderbird e-mail client for example.
Modifier and Type | Field and Description |
---|---|
java.lang.String |
autoenable
The strategy for automatic enabling,
null means no automatic enabling (default). |
EnableChecker |
checker
The instance responsible for enabling,
null if not used (default). |
ComboButtonItem[] |
comboitems
The button options if the button allows for more than one action (arrow down, optional).
|
java.lang.String |
defaultaction
The default action command for combo buttons (
comboitems ) needs to be set. |
javax.swing.ImageIcon |
icon
The button icon.
|
java.lang.String |
key
Unique button key.
|
java.lang.String |
popuptext
The text for the popup menu.
|
java.lang.String |
tooltip
The button tooltip.
|
Constructor and Description |
---|
ButtonDef()
Constructor method for i18n purposes only.
|
ButtonDef(java.lang.String key)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
ComboButtonItem[] items,
java.lang.String defaultaction)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
javax.swing.ImageIcon icon)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
javax.swing.ImageIcon icon,
EnableChecker checker,
java.lang.String popuptext)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
javax.swing.ImageIcon icon,
EnableChecker checker,
java.lang.String popuptext,
ComboButtonItem[] items,
java.lang.String defaultaction)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
javax.swing.ImageIcon icon,
java.lang.String popuptext,
ComboButtonItem[] items,
java.lang.String defaultaction,
java.lang.String autoenable)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
javax.swing.ImageIcon icon,
java.lang.String autoenable,
java.lang.String popuptext)
Another constructor with real initializing functionality.
|
ButtonDef(java.lang.String key,
java.lang.String tooltip,
java.lang.String popuptext)
Another constructor with real initializing functionality.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
acceptAutoEnablePattern(java.lang.String pattern,
int count)
Checks, if the selection count matches the given pattern (button should be enabled).
|
static boolean |
checkAutoEnablePattern(java.lang.String pattern)
Checks the given auto-enable pattern for correctness.
|
boolean |
equals(ButtonDef tocheck)
Checks if a given
ButtonDef instance is equal to this instance. |
ButtonDef |
setAutoEnabled(java.lang.String autoenable)
Updates the auto-enable feature (1, +, ?
|
ButtonDef |
setEnableChecker(EnableChecker checker)
Sets a new checker instance for auto-enabling.
|
java.lang.String |
toString()
Debug method for testing the internal managed strings.
|
public java.lang.String key
public java.lang.String tooltip
public java.lang.String popuptext
public javax.swing.ImageIcon icon
public java.lang.String autoenable
null
means no automatic enabling (default).public EnableChecker checker
null
if not used (default).public ComboButtonItem[] comboitems
public java.lang.String defaultaction
comboitems
) needs to be set.public ButtonDef() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic ButtonDef(java.lang.String key)
key
- Unique button key (required)java.lang.NullPointerException
- If parameters are null
public ButtonDef(java.lang.String key, java.lang.String tooltip)
key
- Unique button key (required)tooltip
- The button tooltip (optional)java.lang.NullPointerException
- If parameters are null
public ButtonDef(java.lang.String key, java.lang.String tooltip, javax.swing.ImageIcon icon)
key
- Unique button key (required)tooltip
- The button tooltip (optional)icon
- The button icon (optional)java.lang.NullPointerException
- If parameters are null
public ButtonDef(java.lang.String key, java.lang.String tooltip, java.lang.String popuptext)
key
- Unique button key (required)tooltip
- The button tooltip (optional)popuptext
- The text for the popup menu (optional)java.lang.NullPointerException
- If parameters are null
public ButtonDef(java.lang.String key, java.lang.String tooltip, javax.swing.ImageIcon icon, java.lang.String autoenable, java.lang.String popuptext)
? one selected item or none at all
* zero or more selected items (button is always enabled)
+ one or more selected items
n exactly n selected items
n, at least n selected items
n,m at least n but not more than m selected items
never button is always disabled
always same as "*" (button is always enabled)
key
- Unique button key (required)tooltip
- The button tooltip (optional)icon
- The button icon (optional)autoenable
- The strategy for enabling/disabling, not used if null
popuptext
- The text for the popup menu (optional)java.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef(java.lang.String key, java.lang.String tooltip, javax.swing.ImageIcon icon, EnableChecker checker, java.lang.String popuptext)
key
- Unique button key (required)tooltip
- The button tooltip (optional)icon
- The button icon (optional)checker
- The checker for enabling/disabling, not used if null
popuptext
- The text for the popup menu (optional)java.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef(java.lang.String key, java.lang.String tooltip, javax.swing.ImageIcon icon, EnableChecker checker, java.lang.String popuptext, ComboButtonItem[] items, java.lang.String defaultaction)
key
- Unique button key (required)tooltip
- The button tooltip (optional)icon
- The button icon (optional)checker
- The checker for enabling/disabling, not used if null
popuptext
- The text for the popup menu (optional)items
- The button options if the button allows for more than one action (arrow down, optional)defaultaction
- The default action command for combo buttons (comboitems
) needs to be setjava.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef(java.lang.String key, java.lang.String tooltip, javax.swing.ImageIcon icon, java.lang.String popuptext, ComboButtonItem[] items, java.lang.String defaultaction, java.lang.String autoenable)
key
- Unique button key (required)tooltip
- The button tooltip (optional)icon
- The button icon (optional)popuptext
- The text for the popup menu (optional)items
- The button options if the button allows for more than one action (arrow down, optional)defaultaction
- The default action command for combo buttons (comboitems
) needs to be setautoenable
- The strategy for enabling/disabling, not used if null
java.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef(java.lang.String key, ComboButtonItem[] items, java.lang.String defaultaction)
key
- Unique button key (required)items
- The button options if the button allows for more than one action (arrow down, optional)defaultaction
- The default action command for combo buttons (comboitems
) needs to be setjava.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(ButtonDef tocheck)
ButtonDef
instance is equal to this instance.
tocheck
- Instance to be checkedButtonDef
instance to check for equalitypublic static boolean checkAutoEnablePattern(java.lang.String pattern)
pattern
- The pattern to be checkedjava.lang.NullPointerException
- If parameters are null
public static boolean acceptAutoEnablePattern(java.lang.String pattern, int count)
pattern
- The pattern to be checkedcount
- The selected item countjava.lang.NullPointerException
- If parameters are null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef setAutoEnabled(java.lang.String autoenable)
autoenable
- The strategy for enabling/disabling, not used if null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic ButtonDef setEnableChecker(EnableChecker checker)
checker
- The checker, may be null
Copyright © 2005-2023 Leisenfels GmbH. All rights reserved.