org.jhotdraw.draw.event
Class AbstractAttributeEditorHandler<T>
- java.lang.Object
-
- org.jhotdraw.draw.event.AbstractAttributeEditorHandler<T>
-
- All Implemented Interfaces:
- Disposable
- Direct Known Subclasses:
- DrawingAttributeEditorHandler, FigureAttributeEditorHandler
public abstract class AbstractAttributeEditorHandler<T> extends java.lang.Object implements Disposable
AbstractAttributeEditorHandler mediates between an AttributeEditor and the currently selected Figure's in a DrawingEditor.
Design PatternsObserver
Selection changes ofDrawingVieware observed by user interface components:
Subject:DrawingView; Observer:FigureSelectionListener; Concrete-Observer:AbstractAttributeEditorHandler,SelectionComponentDisplayer,SelectionComponentRepainter.
-
-
Constructor Summary
Constructors 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)
-
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.AttributeEditor<T>getAttributeEditor()Returns the AttributeEditor to which this FigureAttributeEditorHandler is attached.AttributeKey<T>getAttributeKey()DrawingEditorgetEditor()Returns the DrawingEditor to which this FigureAttributeEditorHandler is attached.DrawingViewgetView()Returns the DrawingView to which this FigureAttributeEditorHandler is attached.booleanisUpdateDrawingEditorDefaults()Returns true if the attribute editor updates the default values of the drawing editor.voidsetAttributeEditor(AttributeEditor<T> newValue)Attaches the FigureAttributeEditorHandler to the specified AttributeEditor.voidsetAttributeKey(AttributeKey<T> newValue)voidsetEditor(DrawingEditor newValue)Attaches the FigureAttributeEditorHandler to the specified DrawingEditor.voidsetUpdateDrawingEditorDefaults(boolean newValue)Set this to true if you want the attribute editor to update the default values of the drawing editor.voidsetView(DrawingView newValue)Attaches the FigureAttributeEditorHandler to the specified DrawingView.
-
-
-
Constructor Detail
-
AbstractAttributeEditorHandler
public AbstractAttributeEditorHandler(AttributeKey<T> key, AttributeEditor<T> attributeEditor, @Nullable DrawingEditor drawingEditor)
-
AbstractAttributeEditorHandler
public AbstractAttributeEditorHandler(AttributeKey<T> key, AttributeEditor<T> attributeEditor, @Nullable DrawingEditor drawingEditor, boolean updateDrawingEditorDefaults)
-
AbstractAttributeEditorHandler
public AbstractAttributeEditorHandler(AttributeKey<T> key, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, AttributeEditor<T> attributeEditor, @Nullable DrawingEditor drawingEditor, boolean updateDrawingEditorDefaults)
-
-
Method Detail
-
setEditor
public void setEditor(@Nullable DrawingEditor newValue)
Attaches the FigureAttributeEditorHandler to the specified DrawingEditor.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.
- Parameters:
newValue- a drawing editor.
-
getEditor
@Nullable public DrawingEditor getEditor()
Returns the DrawingEditor to which this FigureAttributeEditorHandler is attached.
-
setView
public void setView(@Nullable DrawingView newValue)
Attaches the FigureAttributeEditorHandler to the specified DrawingView.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.
- Parameters:
newValue- a drawing view.
-
getView
@Nullable public DrawingView getView()
Returns the DrawingView to which this FigureAttributeEditorHandler is attached. Returns null, if the FigureAttributeEditorHandler is attached to all views of the DrawingEditor.
-
setUpdateDrawingEditorDefaults
public void setUpdateDrawingEditorDefaults(boolean newValue)
Set this to true if you want the attribute editor to update the default values of the drawing editor.- Parameters:
newValue-
-
isUpdateDrawingEditorDefaults
public boolean isUpdateDrawingEditorDefaults()
Returns true if the attribute editor updates the default values of the drawing editor.
-
setAttributeEditor
public void setAttributeEditor(AttributeEditor<T> newValue)
Attaches the FigureAttributeEditorHandler to the specified AttributeEditor.
-
getAttributeEditor
public AttributeEditor<T> getAttributeEditor()
Returns the AttributeEditor to which this FigureAttributeEditorHandler is attached.
-
getAttributeKey
public AttributeKey<T> getAttributeKey()
-
setAttributeKey
public void setAttributeKey(AttributeKey<T> newValue)
-
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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG