JHotDraw 7.1

org.jhotdraw.draw
Interface DrawingEditor

All Known Implementing Classes:
DefaultDrawingEditor, DrawingEditorProxy

public interface DrawingEditor

DrawingEditor defines the interface for coordinating the different objects that participate in a drawing editor.

For applications with a single document interface (SDI) there is typically one DrawingEditor instance per document window. So that each window can have its own toolbars and drawing palettes.

For applications with a Windows-style multiple document interface (MDI) there is typically one DrawingEditor instance per parent window. All document windows within a parent window share the toolbars and drawing palettes provided be the parent window.

For applications with a Mac OS X-style application document interface (OSX) there is typically a single DrawingEditor instance for the application. All document windows within the application share a single set of toolbars and drawing palettes.

Version:
2.4 2007-12-25 Renamed PROP_CURRENT_VIEW to ACTIVE_VIEW_PROPERTY.
2.3 2007-05-26 Streamlined methods setActiveView, setFocusedView, getActiveView into setActiveView, getActiveView.
2.2 2007-04-16 Added method getDefaultAttributes
2.1 2006-03-15 Support for enabled state added.
2.0 2006-02-13 Revised to support multiple drawing views.
1.0 2003-12-01 Derived from JHotDraw 5.4b1.
Author:
Werner Randelshofer

Field Summary
static java.lang.String ACTIVE_VIEW_PROPERTY
          The property name for the active view Property.
 
Method Summary
 void add(DrawingView view)
          Adds a drawing view to the editor.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void applyDefaultAttributesTo(Figure f)
          Applies the default attributes to the specified figure.
 DrawingView findView(java.awt.Container c)
          Finds a drawing view.
 DrawingView getActiveView()
          Gets the editor's active drawing view.
 java.lang.Object getDefaultAttribute(AttributeKey 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.
 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 removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 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 value)
          Sets a default attribute of the editor.
 void setEnabled(boolean newValue)
          Sets the enabled state of the drawing editor.
 void setTool(Tool t)
          Calls deactivate on the previously active tool of this drawing editor.
 

Field Detail

ACTIVE_VIEW_PROPERTY

static final java.lang.String ACTIVE_VIEW_PROPERTY
The property name for the active view Property.

See Also:
Constant Field Values
Method Detail

add

void add(DrawingView view)
Adds a drawing view to the editor. The editor invokes addNotify on the view, and it registers its tool as an event listener on the view.


remove

void remove(DrawingView view)
Removes a drawing view from the editor. The editor invokes removeNotify on the view, and it unregisters its tool on the view.


getDrawingViews

java.util.Collection<DrawingView> getDrawingViews()
Gets all drawing views associated with this editor.


getActiveView

DrawingView getActiveView()
Gets the editor's active drawing view. This can be null, if the editor has no views.


setActiveView

void setActiveView(DrawingView newValue)
Sets the editor's active drawing view. This can be set to null, if the editor has no views.


setTool

void setTool(Tool t)
Calls deactivate on the previously active tool of this drawing editor. Calls activate on the provided tool. Forwards all mouse, mouse moation and keyboard events that occur on the DrawingView to the provided tool.


getTool

Tool getTool()
Gets the current tool.


setCursor

void setCursor(java.awt.Cursor c)
Sets the cursor on the view(s) of the drawing editor.


findView

DrawingView findView(java.awt.Container c)
Finds a drawing view. This is used by Tool to identify the view of which it has received an event.


setDefaultAttribute

void setDefaultAttribute(AttributeKey key,
                         java.lang.Object value)
Sets a default attribute of the editor. The default attribute will be used by creation tools, to create a new figure.


getDefaultAttribute

java.lang.Object getDefaultAttribute(AttributeKey key)
Gets a default attribute from the editor. The default attribute will be used by creation tools, to create a new figure.


applyDefaultAttributesTo

void applyDefaultAttributesTo(Figure f)
Applies the default attributes to the specified figure.


getDefaultAttributes

java.util.Map<AttributeKey,java.lang.Object> getDefaultAttributes()
Returns an immutable Map with the default attributes of this editor.


setEnabled

void setEnabled(boolean newValue)
Sets the enabled state of the drawing editor. This is a bound property.


isEnabled

boolean isEnabled()
Gets the enabled state of the drawing editor.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.