public abstract class AbstractDrawingEditorAction
extends javax.swing.AbstractAction
Action
that acts
on behalf of a DrawingEditor
.
By default the enabled state of this action reflects the enabled state of the
DrawingEditor
. When many actions listen to the enabled state of the
drawing editor this can considerably slow down the editor. If updating the
enabled state is not necessary, you can prevent the action from doing so using
setUpdateEnabledState(boolean)
.
AbstractDrawingEditorAction
listens using a
WeakPropertyChangeListener
on the DrawingEditor
and thus may
become garbage collected if it is not referenced by any other object.
Modifier and Type | Field and Description |
---|---|
protected DrawingEditor |
editor |
Constructor and Description |
---|
AbstractDrawingEditorAction(DrawingEditor editor)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Updates the enabled state of this action to reflect the enabled state
of the active
DrawingView . |
protected Drawing |
getDrawing() |
DrawingEditor |
getEditor() |
protected DrawingView |
getView() |
boolean |
isUpdatEnabledState()
Returns true, if this action automatically updates its enabled
state to reflect the enabled state of the active
DrawingView . |
void |
setEditor(DrawingEditor newValue) |
void |
setUpdateEnabledState(boolean newValue)
By default, the enabled state of this action is updated to reflect
the enabled state of the active
DrawingView . |
protected void |
updateEnabledState() |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
protected DrawingEditor editor
public AbstractDrawingEditorAction(DrawingEditor editor)
public void setEditor(DrawingEditor newValue)
protected void updateEnabledState()
public DrawingEditor getEditor()
protected DrawingView getView()
protected Drawing getDrawing()
protected void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
DrawingView
. If no drawing view is active, this
action is disabled.public void setUpdateEnabledState(boolean newValue)
DrawingView
.
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.newValue
- Specify false to prevent automatic updating of the
enabled state.public boolean isUpdatEnabledState()
DrawingView
.