public abstract class AbstractAttributeEditorHandler<T> extends java.lang.Object implements Disposable
Observer
Selection changes of DrawingView
are observed by user interface
components:
Subject: DrawingView
; Observer: FigureSelectionListener
;
Concrete-Observer: AbstractAttributeEditorHandler
,
SelectionComponentDisplayer
, SelectionComponentRepainter
.
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractAttributeEditorHandler.EventHandler |
Modifier and Type | Field and Description |
---|---|
protected DrawingView |
activeView |
protected AttributeEditor<T> |
attributeEditor |
protected AttributeKey<T> |
attributeKey |
protected java.util.LinkedList<java.lang.Object> |
attributeRestoreData |
protected java.util.Map<AttributeKey,java.lang.Object> |
defaultAttributes |
protected DrawingEditor |
editor |
protected int |
updateDepth |
protected DrawingView |
view |
Constructor and Description |
---|
AbstractAttributeEditorHandler(AttributeKey<T> key,
AttributeEditor<T> attributeEditor,
DrawingEditor drawingEditor) |
AbstractAttributeEditorHandler(AttributeKey<T> key,
AttributeEditor<T> attributeEditor,
DrawingEditor drawingEditor,
boolean updateDrawingEditorDefaults) |
AbstractAttributeEditorHandler(AttributeKey<T> key,
java.util.Map<AttributeKey,java.lang.Object> defaultAttributes,
AttributeEditor<T> attributeEditor,
DrawingEditor drawingEditor,
boolean updateDrawingEditorDefaults) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of all resources held by this object so that they can be
garbage collected.
|
protected DrawingView |
getActiveView() |
AttributeEditor<T> |
getAttributeEditor()
Returns the AttributeEditor to which this FigureAttributeEditorHandler is
attached.
|
AttributeKey<T> |
getAttributeKey() |
protected abstract java.util.Set<Figure> |
getEditedFigures() |
DrawingEditor |
getEditor()
Returns the DrawingEditor to which this FigureAttributeEditorHandler is
attached.
|
DrawingView |
getView()
Returns the DrawingView to which this FigureAttributeEditorHandler is
attached.
|
boolean |
isUpdateDrawingEditorDefaults()
Returns true if the attribute editor updates the
default values of the drawing editor.
|
void |
setAttributeEditor(AttributeEditor<T> newValue)
Attaches the FigureAttributeEditorHandler to the specified AttributeEditor.
|
void |
setAttributeKey(AttributeKey<T> newValue) |
void |
setEditor(DrawingEditor newValue)
Attaches the FigureAttributeEditorHandler to the specified DrawingEditor.
|
void |
setUpdateDrawingEditorDefaults(boolean newValue)
Set this to true if you want the attribute editor to update the
default values of the drawing editor.
|
void |
setView(DrawingView newValue)
Attaches the FigureAttributeEditorHandler to the specified DrawingView.
|
protected void |
updateActiveView() |
protected void |
updateAttributeEditor() |
protected void |
updateFigures() |
protected DrawingEditor editor
protected DrawingView view
protected DrawingView activeView
protected AttributeEditor<T> attributeEditor
protected AttributeKey<T> attributeKey
protected int updateDepth
protected java.util.LinkedList<java.lang.Object> attributeRestoreData
protected java.util.Map<AttributeKey,java.lang.Object> defaultAttributes
public AbstractAttributeEditorHandler(AttributeKey<T> key, AttributeEditor<T> attributeEditor, DrawingEditor drawingEditor)
public AbstractAttributeEditorHandler(AttributeKey<T> key, AttributeEditor<T> attributeEditor, DrawingEditor drawingEditor, boolean updateDrawingEditorDefaults)
public AbstractAttributeEditorHandler(AttributeKey<T> key, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, AttributeEditor<T> attributeEditor, DrawingEditor drawingEditor, boolean updateDrawingEditorDefaults)
public void setEditor(DrawingEditor newValue)
The FigureAttributeEditorHandler listens to view changes and selection changes of the drawing editor and calls setEnabled(boolean) and updateField(Set<Figure>) on the field accordingly.
newValue
- a drawing editor.public DrawingEditor getEditor()
public void setView(DrawingView newValue)
If a non-null value is provided, the FigureAttributeEditorHandler listens only to selection changes of the specified view. If a null value is provided, the FigureAttributeEditorHandler listens to all views of the drawing editor.
newValue
- a drawing view.public DrawingView getView()
public void setUpdateDrawingEditorDefaults(boolean newValue)
newValue
- public boolean isUpdateDrawingEditorDefaults()
protected DrawingView getActiveView()
public void setAttributeEditor(AttributeEditor<T> newValue)
public AttributeEditor<T> getAttributeEditor()
public AttributeKey<T> getAttributeKey()
public void setAttributeKey(AttributeKey<T> newValue)
protected void updateActiveView()
protected abstract java.util.Set<Figure> getEditedFigures()
protected void updateAttributeEditor()
protected void updateFigures()
public void dispose()
Disposable
dispose
in interface Disposable