public class ConnectorAction extends AbstractAction
Connector
object.
This action can be put into a button whose text will read "Log In"
and "Log Out" as appropriate. It has a property with the
key CONNECTION_PROPERTY
which contains the active
Connection
object, so that PropertyChangeListeners may be
configured to watch when a connection is established or broken.
A log in attempt will pop up a modal dialogue asking for the
various authorization information required to attempt the connection.Modifier and Type | Field and Description |
---|---|
static String |
CONNECTION_PROPERTY
Key for the property which stores a
Connection object. |
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 |
---|
ConnectorAction(Connector connector)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt) |
protected JDialog |
createDialog(Component parent)
Constructs the dialogue which is used to ask the user for
authorization information.
|
Connection |
getConnection()
Returns the currently active connection.
|
Connector |
getConnector()
Returns the connector used by this action.
|
void |
setEnabled(boolean enabled) |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener
public static final String CONNECTION_PROPERTY
Connection
object.public ConnectorAction(Connector connector)
connector
- connector describing the service this action
can connect topublic void actionPerformed(ActionEvent evt)
protected JDialog createDialog(Component parent)
parent
- parent componentpublic void setEnabled(boolean enabled)
setEnabled
in interface Action
setEnabled
in class AbstractAction
public Connector getConnector()
public Connection getConnection()
null
.
Thus it's very likely that the connection returned from this
method will be active, but it can't be guaranteed that it won't
have expired between this method returning it and the caller
receiving it.Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.