public class DrawingEditorProxy extends AbstractBean implements DrawingEditor
Proxy
To remove the need for null-handling, AbstractTool
makes use of
a proxy for DrawingEditor
.
Subject: DrawingEditor
; Proxy: DrawingEditorProxy
;
Client: AbstractTool
.
propertySupport
ACTION_MAP_PROPERTY, ACTIVE_VIEW_PROPERTY, DEFAULT_ATTRIBUTE_PROPERTY_PREFIX, INPUT_MAP_PROPERTY, TOOL_PROPERTY
Constructor and Description |
---|
DrawingEditorProxy()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DrawingView view)
Adds a drawing view to the editor.
|
void |
applyDefaultAttributesTo(Figure f)
Applies the default attributes to the specified figure.
|
DrawingView |
findView(java.awt.Container c)
Finds a drawing view.
|
javax.swing.ActionMap |
getActionMap()
Gets the action map used by the tool of this drawing editor as a fall back
for performing actions.
|
DrawingView |
getActiveView()
Gets the editor's active drawing view.
|
<T> T |
getDefaultAttribute(AttributeKey<T> key)
Gets a default attribute from the editor.
|
java.util.Map<AttributeKey,java.lang.Object> |
getDefaultAttributes()
Returns an immutable Map with the default attributes of this editor.
|
java.util.Collection<DrawingView> |
getDrawingViews()
Gets all drawing views associated with this editor.
|
DrawingView |
getFocusedView() |
<T> T |
getHandleAttribute(AttributeKey<T> key)
Gets a handle attribute from the editor.
|
javax.swing.InputMap |
getInputMap()
Sets the input map used by the tool of this drawing editor as a fall back
for handling keyboard events.
|
DrawingEditor |
getTarget()
Gets the target of the proxy.
|
Tool |
getTool()
Gets the current tool.
|
boolean |
isEnabled()
Gets the enabled state of the drawing editor.
|
void |
remove(DrawingView view)
Removes a drawing view from the editor.
|
void |
setActionMap(javax.swing.ActionMap newValue)
Sets the action map used by the tool of this drawing editor as a fall back
for performing actions.
|
void |
setActiveView(DrawingView newValue)
Sets the editor's active drawing view.
|
void |
setCursor(java.awt.Cursor c)
Sets the cursor on the view(s) of the drawing editor.
|
<T> void |
setDefaultAttribute(AttributeKey<T> key,
T value)
Sets a default attribute of the editor.
|
void |
setEnabled(boolean newValue)
Sets the enabled state of the drawing editor.
|
<T> void |
setHandleAttribute(AttributeKey<T> key,
T value)
Sets a handle attribute of the editor.
|
void |
setInputMap(javax.swing.InputMap newValue)
Sets the input map used by the tool of this drawing editor as a fall back
for handling keyboard events.
|
void |
setTarget(DrawingEditor newValue)
Sets the target of the proxy.
|
void |
setTool(Tool t)
Calls deactivate on the previously active tool of this drawing editor.
|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
public void setTarget(DrawingEditor newValue)
public DrawingEditor getTarget()
public void add(DrawingView view)
DrawingEditor
add
in interface DrawingEditor
public void remove(DrawingView view)
DrawingEditor
remove
in interface DrawingEditor
public java.util.Collection<DrawingView> getDrawingViews()
DrawingEditor
getDrawingViews
in interface DrawingEditor
public DrawingView getActiveView()
DrawingEditor
getActiveView
in interface DrawingEditor
public void setActiveView(DrawingView newValue)
DrawingEditor
setActiveView
in interface DrawingEditor
public DrawingView getFocusedView()
public void setTool(Tool t)
DrawingEditor
This is a bound property.
setTool
in interface DrawingEditor
public Tool getTool()
DrawingEditor
This is a bound property.
getTool
in interface DrawingEditor
public void setCursor(java.awt.Cursor c)
DrawingEditor
setCursor
in interface DrawingEditor
public DrawingView findView(java.awt.Container c)
DrawingEditor
findView
in interface DrawingEditor
public <T> void setDefaultAttribute(AttributeKey<T> key, T value)
DrawingEditor
Fires a property change event with the name of the attribute key,
and the prefix "defaultAttribute."
.
setDefaultAttribute
in interface DrawingEditor
public <T> T getDefaultAttribute(AttributeKey<T> key)
DrawingEditor
getDefaultAttribute
in interface DrawingEditor
public void applyDefaultAttributesTo(Figure f)
DrawingEditor
applyDefaultAttributesTo
in interface DrawingEditor
public java.util.Map<AttributeKey,java.lang.Object> getDefaultAttributes()
DrawingEditor
getDefaultAttributes
in interface DrawingEditor
public void setEnabled(boolean newValue)
DrawingEditor
setEnabled
in interface DrawingEditor
public boolean isEnabled()
DrawingEditor
isEnabled
in interface DrawingEditor
public <T> void setHandleAttribute(AttributeKey<T> key, T value)
DrawingEditor
setHandleAttribute
in interface DrawingEditor
key
- AttributeKey.value
- Attribute value.public <T> T getHandleAttribute(AttributeKey<T> key)
DrawingEditor
getHandleAttribute
in interface DrawingEditor
key
- AttributeKey.public void setInputMap(javax.swing.InputMap newValue)
DrawingEditor
This is a bound property.
setInputMap
in interface DrawingEditor
public javax.swing.InputMap getInputMap()
DrawingEditor
Tool
s use the input map of the drawing editor to determine what
to do when a key was pressed that the tool can not handle.
This is a bound property.
getInputMap
in interface DrawingEditor
public void setActionMap(javax.swing.ActionMap newValue)
DrawingEditor
This is a bound property.
setActionMap
in interface DrawingEditor
public javax.swing.ActionMap getActionMap()
DrawingEditor
Tool
s use the action map of the drawing editor to determine what
to do when an action needs to be invoked from the InputMap of the
drawing editor.
This is a bound property.
getActionMap
in interface DrawingEditor