public class HyperlinkAction extends AbstractHyperlinkAction<URI>
Desktop
actions BROWSE and MAIL, that is
URI-related.Modifier and Type | Class and Description |
---|---|
private class |
HyperlinkAction.BrowseVisitor |
private class |
HyperlinkAction.MailVisitor |
private class |
HyperlinkAction.URIVisitor
Thin wrapper around Desktop functionality to allow uniform handling of
different actions in HyperlinkAction.
|
Modifier and Type | Field and Description |
---|---|
private Desktop.Action |
desktopAction |
private static Logger |
LOG |
private HyperlinkAction.URIVisitor |
visitor |
target, VISITED_KEY
GROUP, IS_STATE, LARGE_ICON
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
HyperlinkAction()
Instantiates a HyperlinkAction with action type BROWSE.
|
HyperlinkAction(Desktop.Action desktopAction)
Instantiates a HyperlinkAction with the given action type.
|
HyperlinkAction(URI uri,
Desktop.Action desktopAction) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Implemented to perform the appropriate Desktop action if supported on the current
target.
|
static HyperlinkAction |
createHyperlinkAction(URI uri)
Factory method to create and return a HyperlinkAction for the given uri.
|
static HyperlinkAction |
createHyperlinkAction(URI uri,
Desktop.Action type)
Creates and returns a HyperlinkAction with the given target and action type.
|
private HyperlinkAction.URIVisitor |
createURIVisitor() |
Desktop.Action |
getDesktopAction() |
private HyperlinkAction.URIVisitor |
getURIVisitor() |
protected void |
installTarget()
hook for subclasses to update internal state after
a new target has been set.
|
private static boolean |
isMailURI(URI uri) |
private void |
updateEnabled() |
getTarget, isVisited, itemStateChanged, setStateAction, setTarget, setVisited, uninstallTarget
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setStateAction, toString
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
private Desktop.Action desktopAction
private HyperlinkAction.URIVisitor visitor
public HyperlinkAction()
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
DesktopIllegalArgumentException
- if unsupported action typepublic HyperlinkAction(Desktop.Action desktopAction)
desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAILHeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
DesktopIllegalArgumentException
- if unsupported action typepublic HyperlinkAction(URI uri, Desktop.Action desktopAction)
uri
- the target uri, maybe null.desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAILHeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
DesktopIllegalArgumentException
- if unsupported action typepublic static HyperlinkAction createHyperlinkAction(URI uri)
uri
- to uri to create a HyperlinkAction for, maybe null.HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktoppublic static HyperlinkAction createHyperlinkAction(URI uri, Desktop.Action type)
uri
- the target uri, maybe null.desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAILHeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
DesktopIllegalArgumentException
- if unsupported action typepublic void actionPerformed(ActionEvent e)
Implemented to perform the appropriate Desktop action if supported on the current target. Sets the visited property to true if the desktop action doesn't throw an exception or to false if it did. Does nothing if the action isn't supported.
public Desktop.Action getDesktopAction()
protected void installTarget()
AbstractHyperlinkAction
Subclasses are free to decide the details. Here:
installTarget
in class AbstractHyperlinkAction<URI>
private void updateEnabled()
private HyperlinkAction.URIVisitor getURIVisitor()
private HyperlinkAction.URIVisitor createURIVisitor()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses