public class DefaultDrawingEditor extends AbstractBean implements DrawingEditor
DrawingEditor.
XXX - DefaultDrawingEditor should not publicly implement ToolListener.propertySupportACTION_MAP_PROPERTY, ACTIVE_VIEW_PROPERTY, DEFAULT_ATTRIBUTE_PROPERTY_PREFIX, INPUT_MAP_PROPERTY, TOOL_PROPERTY| Constructor and Description |
|---|
DefaultDrawingEditor()
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.
|
protected javax.swing.ActionMap |
createActionMap()
Override this method to create a tool-specific action map, which
overrides the action map of the drawing edtior.
|
protected javax.swing.InputMap |
createInputMap()
Override this method to create a tool-specific input map, which
overrides the input map of the drawing edtior.
|
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.
|
<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.
|
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.
|
void |
setDefaultAttribute(AttributeKey key,
java.lang.Object newValue)
Sets a default attribute of the editor.
|
void |
setEnabled(boolean newValue)
Sets the enabled state of the drawing editor.
|
void |
setHandleAttribute(AttributeKey key,
java.lang.Object 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 |
setTool(Tool newValue)
Calls deactivate on the previously active tool of this drawing editor.
|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, removePropertyChangeListenerpublic void setTool(Tool newValue)
DrawingEditorThis is a bound property.
setTool in interface DrawingEditorpublic void setActiveView(DrawingView newValue)
DrawingEditorsetActiveView in interface DrawingEditorpublic Tool getTool()
DrawingEditorThis is a bound property.
getTool in interface DrawingEditorpublic DrawingView getActiveView()
DrawingEditorgetActiveView in interface DrawingEditorpublic void applyDefaultAttributesTo(Figure f)
DrawingEditorapplyDefaultAttributesTo in interface DrawingEditorpublic <T> T getDefaultAttribute(AttributeKey<T> key)
DrawingEditorgetDefaultAttribute in interface DrawingEditorpublic void setDefaultAttribute(AttributeKey key, java.lang.Object newValue)
DrawingEditor
Fires a property change event with the name of the attribute key,
and the prefix "defaultAttribute.".
setDefaultAttribute in interface DrawingEditorpublic void remove(DrawingView view)
DrawingEditorremove in interface DrawingEditorpublic void add(DrawingView view)
DrawingEditoradd in interface DrawingEditorpublic void setCursor(java.awt.Cursor c)
DrawingEditorsetCursor in interface DrawingEditorpublic java.util.Collection<DrawingView> getDrawingViews()
DrawingEditorgetDrawingViews in interface DrawingEditorpublic DrawingView findView(java.awt.Container c)
DrawingEditorfindView in interface DrawingEditorpublic void setEnabled(boolean newValue)
DrawingEditorsetEnabled in interface DrawingEditorpublic boolean isEnabled()
DrawingEditorisEnabled in interface DrawingEditorpublic java.util.Map<AttributeKey,java.lang.Object> getDefaultAttributes()
DrawingEditorgetDefaultAttributes in interface DrawingEditorpublic void setHandleAttribute(AttributeKey key, java.lang.Object value)
DrawingEditorsetHandleAttribute in interface DrawingEditorkey - AttributeKey.value - Attribute value.public <T> T getHandleAttribute(AttributeKey<T> key)
DrawingEditorgetHandleAttribute in interface DrawingEditorkey - AttributeKey.public void setInputMap(javax.swing.InputMap newValue)
DrawingEditorThis is a bound property.
setInputMap in interface DrawingEditorpublic javax.swing.InputMap getInputMap()
DrawingEditor
Tools 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 DrawingEditorpublic void setActionMap(javax.swing.ActionMap newValue)
DrawingEditorThis is a bound property.
setActionMap in interface DrawingEditorpublic javax.swing.ActionMap getActionMap()
DrawingEditor
Tools 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 DrawingEditorprotected javax.swing.InputMap createInputMap()
The implementation of this class creates an input map for the following action ID's:
protected javax.swing.ActionMap createActionMap()
The implementation of this class creates an action map which maps the following action ID's to the classes which define them: