org.jhotdraw.draw.action
Class AbstractSelectedAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.jhotdraw.draw.action.AbstractSelectedAction
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Disposable
- Direct Known Subclasses:
- AlignAction, ApplyAttributesAction, AttributeAction, BringToFrontAction, CombineAction, DefaultAttributeAction, FontChooserHandler, GroupAction, IncreaseHandleDetailLevelAction, MoveAction, MoveConstrainedAction, PickAttributesAction, SelectionColorChooserHandler, SelectSameAction, SendToBackAction
public abstract class AbstractSelectedAction extends javax.swing.AbstractAction implements Disposable
This abstract class can be extended to implement anActionthat acts on behalf of the selected figures of aDrawingView.By default the enabled state of this action reflects the enabled state of the active
DrawingView. If no drawing view is active, this action is disabled. When many actions listen to the enabled state of the active drawing views this can considerably slow down the editor. If updating the enabled state is not necessary, you can prevent the action from doing so usingsetUpdateEnabledState(boolean).AbstractDrawingEditorActionlistens using aWeakPropertyChangeListeneron theDrawingEditorand thus may become garbage collected if it is not referenced by any other object.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractSelectedAction(DrawingEditor editor)Creates an action which acts on the selected figures on the current view of the specified editor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddispose()Disposes of all resources held by this object so that they can be garbage collected.DrawingEditorgetEditor()booleanisUpdatEnabledState()Returns true, if this action automatically updates its enabled state to reflect the enabled state of the activeDrawingView.voidsetEditor(DrawingEditor editor)voidsetUpdateEnabledState(boolean newValue)By default, the enabled state of this action is updated to reflect the enabled state of the activeDrawingView.-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
AbstractSelectedAction
public AbstractSelectedAction(DrawingEditor editor)
Creates an action which acts on the selected figures on the current view of the specified editor.
-
-
Method Detail
-
dispose
public void dispose()
Description copied from interface:DisposableDisposes of all resources held by this object so that they can be garbage collected.- Specified by:
disposein interfaceDisposable
-
setEditor
public void setEditor(@Nullable DrawingEditor editor)
-
getEditor
@Nullable public DrawingEditor getEditor()
-
setUpdateEnabledState
public void setUpdateEnabledState(boolean newValue)
By default, the enabled state of this action is updated to reflect the enabled state of the activeDrawingView. Since this is not always necessary, and since many listening actions may considerably slow down the drawing editor, you can switch this behavior off here.- Parameters:
newValue- Specify false to prevent automatic updating of the enabled state.
-
isUpdatEnabledState
public boolean isUpdatEnabledState()
Returns true, if this action automatically updates its enabled state to reflect the enabled state of the activeDrawingView.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG