|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractAction | +--com.borland.primetime.actions.UpdateAction
An UpdateAction functions as a regular Swing Action object - it stores the shortText, longText, icon, and enabled state for a single action. The primary difference is that an UpdateAction implements the UpdateableAction interface which also enables updating of an Action's state before the item is displayed in UI.
Subclasses of UpdateAction can optionally override the public method:
public void update(Object source)
to initialize the
UpdateAction object immediately before it is represented as UI somewhere in
the environment.
Several convenience methods surface the common properties of the Action object, like name, shortText, longText, and mnemonic.
Action
, Serialized FormField Summary | |
static java.lang.String |
ACCELERATOR
The storage attribute key for the ACCELERATOR (KeyStroke) property. |
static java.lang.String |
ALT_SHORT_DESCRIPTION
The storage attribute key for the ALT_SHORT_DESCRIPTION (text) property. |
protected java.lang.String |
disabledReason
If an UpdateAction (e.g. |
static UpdateAction[] |
EMPTY_ARRAY
Used as a quick return for an empty array of UpdateAction objects. |
static int |
ENTERPRISE
UpdateAction is enabled by default for Enterprise version. |
static int |
FOUNDATION
UpdateAction is enabled by default for Foundation version. |
static java.lang.String |
HELP_TOPIC
The storage attribute key for the HELP_TOPIC (HelpTopic) property. |
static java.lang.String |
LARGE_ICON
The storage attribute key for the LARGE_ICON (Icon) property. |
static java.lang.String |
MNEMONIC
The storage attribute key for the MNEMONIC (Character) property. |
static int |
PROFESSIONAL
UpdateAction is enabled by default for Professional version. |
Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
UpdateAction()
Constructs an UpdateAction with all default properties. |
|
UpdateAction(java.lang.String shortText)
Constructs an UpdateAction with the specified short text. |
|
UpdateAction(java.lang.String shortText,
char mnemonic)
Constructs an UpdateAction with the specified short text and mnemonic. |
|
UpdateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText)
Constructs an UpdateAction with the specified short text, mnemonic, and long text. |
|
UpdateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon)
Constructs an UpdateAction with the specified short text, mnemonic, long text, and small icon. |
|
UpdateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon,
javax.swing.Icon largeIcon)
Constructs an UpdateAction with the specified short text, mnemonic, long text, small icon, and large icon. |
|
UpdateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon,
java.lang.String altShortText)
Constructs an UpdateAction with the specified short text, mnemonic, long text, and small icon. |
Method Summary | |
java.lang.String |
getAltShortText()
Returns the altShortText property setting. |
java.lang.String |
getDisabledReason()
Returns the current "disabled reason". |
com.borland.primetime.help.HelpTopic |
getHelpTopic()
Returns the helpTopic property setting. |
javax.swing.Icon |
getLargeIcon()
Returns the largeIcon property setting. |
java.lang.String |
getLongText()
Returns the longText property setting. |
char |
getMnemonic()
Returns the mnemonic property setting. |
java.lang.String |
getShortText()
Returns the shortText property setting. |
javax.swing.Icon |
getSmallIcon()
Returns the smallIcon property setting. |
int |
getVersion()
Returns the default SKU. |
void |
setAltShortText(java.lang.String altText)
Sets the altShortText property. |
void |
setConfigured(boolean configured)
Updates "disabled reason" to indicate disabled due to a misconfiguration. |
void |
setDisabledReason(java.lang.String reason)
Updates the "disabled reason" and may modify the current "long text" value. |
void |
setHelpTopic(com.borland.primetime.help.HelpTopic helpTopic)
Sets the helpTopic property. |
void |
setLargeIcon(javax.swing.Icon largeIcon)
Sets the largeIcon property. |
void |
setLongText(java.lang.String longText)
Sets the longText property. |
void |
setMnemonic(char mnemonic)
Sets the mnemonic property. |
void |
setShortText(java.lang.String shortText)
Sets the shortText property. |
void |
setSmallIcon(javax.swing.Icon smallIcon)
Sets the smallIcon property. |
void |
update(java.lang.Object source)
The update method is called when the UpdateAction is about to be displayed in UI. |
Methods inherited from class javax.swing.AbstractAction |
actionPerformed, addPropertyChangeListener, clone, firePropertyChange, getKeys, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.Action |
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from interface java.awt.event.ActionListener |
actionPerformed |
Field Detail |
public static final int FOUNDATION
public static final int PROFESSIONAL
public static final int ENTERPRISE
public static final UpdateAction[] EMPTY_ARRAY
public static final java.lang.String MNEMONIC
public static final java.lang.String ACCELERATOR
public static final java.lang.String HELP_TOPIC
public static final java.lang.String LARGE_ICON
public static final java.lang.String ALT_SHORT_DESCRIPTION
protected java.lang.String disabledReason
Constructor Detail |
public UpdateAction()
public UpdateAction(java.lang.String shortText)
shortText
- The short text for the actionpublic UpdateAction(java.lang.String shortText, char mnemonic)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionpublic UpdateAction(java.lang.String shortText, char mnemonic, java.lang.String longText)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionpublic UpdateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionsmallIcon
- The small icon for the action (16x16)public UpdateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon, java.lang.String altShortText)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionsmallIcon
- The small icon for the action (16x16)altShortText
- The alternative short text for the actionpublic UpdateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon, javax.swing.Icon largeIcon)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionsmallIcon
- The small icon for the action (16x16)largeIcon
- The large icon for the action (32x32)Method Detail |
public void setShortText(java.lang.String shortText)
shortText
- The short text for the actionpublic java.lang.String getShortText()
public void setAltShortText(java.lang.String altText)
altText
- The alternative short text for the actionpublic java.lang.String getAltShortText()
public void setMnemonic(char mnemonic)
mnemonic
- The mnemonic character for the actionpublic char getMnemonic()
public void setLongText(java.lang.String longText)
longText
- The long text for the actionpublic java.lang.String getLongText()
public void setSmallIcon(javax.swing.Icon smallIcon)
smallIcon
- The small icon for the actionpublic javax.swing.Icon getSmallIcon()
public void setLargeIcon(javax.swing.Icon largeIcon)
largeIcon
- The large icon for the actionpublic javax.swing.Icon getLargeIcon()
public void setHelpTopic(com.borland.primetime.help.HelpTopic helpTopic)
helpTopic
- The helpTopic for the actionpublic com.borland.primetime.help.HelpTopic getHelpTopic()
public void update(java.lang.Object source)
The update method is called when the UpdateAction is about to be displayed in UI. At this point, the UpdateAction may optionally update it's enabled state, shortText, longText, icon, etc so that it may be represented in appropriate state for the passed source.
Subclasses can override this method to dynamically change their state
based on the current Node in the Browser, the current selected Node in the
ProjectView, or whatever they like. Typically, the static method:
public static Browser findBrowser(Object source)
is called
to acquire a Browser instance during the update process. If your action
*always* requires a browser, use the BrowserAction subclass in the ide
package.
NOTE: This method is called EVERY TIME a menu is about to display, or EVERY half-second for toolbar buttons displaying this action. The code in the update method should be VERY SLIM and VERY FAST.
ANOTHER NOTE: This method is called EVERY few milliseconds if it is ever bound to a keystroke in the KeymapManager. When called from the KeymapManager, the passed source will *always* be the active Browser.
update
in interface UpdateableAction
source
- The source of the action that is about to be displayed as UI.public int getVersion()
public java.lang.String getDisabledReason()
Returns
- the current disabled reason text or null if none.public void setDisabledReason(java.lang.String reason)
reason
- Text of disabled reason or null.public void setConfigured(boolean configured)
configured
- False if misconfigured.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |