public class TLcyInterruptTaskAction extends ALcdAction implements ILcdStatusListener, ILcyCustomizableRepresentationAction
Action to interrupt the current task using Thread#interrupt
.
It is up to the user of this class to attach this ILcdStatusListener
to a source
of status events, so it can monitor the current tasks.
This action sets its ILcdAction.VISIBLE
property to false
when it is
not applicable. This means no task is ongoing, or the task is blocking. Blocking tasks block
user input (e.g. by using TLcyUserInteractionBlocker
), and
therefore the user cannot click the button anyway.
changeSupport
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Constructor and Description |
---|
TLcyInterruptTaskAction(ILcyLucyEnv aLucyEnv) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent event) |
Component |
customizeRepresentation(Component aDefaultComponent,
ILcdAction aWrapperAction,
ILcyActionBar aActionBar)
Allows to customize or replace the default component that is used to represent this
ILcdAction (typically a JButton ). |
void |
statusChanged(TLcdStatusEvent event)
This method will be called when the status of an
Object to
which this ILcdStatusListener has been registered has changed. |
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, isTraceOn, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription, setTraceOn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValue, isEnabled, putValue, setEnabled
addPropertyChangeListener, removePropertyChangeListener
public TLcyInterruptTaskAction(ILcyLucyEnv aLucyEnv)
public void actionPerformed(ActionEvent event)
actionPerformed
in interface ActionListener
public void statusChanged(TLcdStatusEvent event)
ILcdStatusListener
Object
to
which this ILcdStatusListener has been registered has changed.statusChanged
in interface ILcdStatusListener
event
- a TLcdStatusEvent detailing the status changes.public Component customizeRepresentation(Component aDefaultComponent, ILcdAction aWrapperAction, ILcyActionBar aActionBar)
ILcyCustomizableRepresentationAction
Allows to customize or replace the default component that is used to represent this
ILcdAction
(typically a JButton
).
customizeRepresentation
in interface ILcyCustomizableRepresentationAction
aDefaultComponent
- The component that normally represents this action.aWrapperAction
- In case this action is wrapped (for example when using (TLcyActionBarUtil
), this parameter is the wrapper
action, if not, it is this action. This is useful to retrieve
properties such as the name or the icon of the action which can be
different for different wrapper instances. E.g., a tool bar might use
a different icon as a menu bar. And if the action is customized for
the tool bar, it might be required to retrieve the tool bar icon.aActionBar
- The action bar in which this action is going to be inserted, provided
as contextual information.return aDefaultComponent;
.TLcyAlwaysFitJToolBar.createToolBarPanel(java.awt.Component)