Runtime

org.eclipse.gmf.runtime.diagram.ui.editparts
Class DiagramRootEditPart

java.lang.Object
  extended byorg.eclipse.gef.editparts.AbstractEditPart
      extended byorg.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended byorg.eclipse.gef.editparts.SimpleRootEditPart
              extended byorg.eclipse.gef.editparts.FreeformGraphicalRootEditPart
                  extended byorg.eclipse.gef.editparts.ScalableFreeformRootEditPart
                      extended byorg.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart
All Implemented Interfaces:
EditPart, GraphicalEditPart, IAdaptable, IDiagramPreferenceSupport, LayerConstants, LayerManager, RequestConstants, RootEditPart, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
Direct Known Subclasses:
RenderedDiagramRootEditPart

public class DiagramRootEditPart
extends ScalableFreeformRootEditPart
implements org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart, IDiagramPreferenceSupport

RootEditPart which manages the Diagram's layers and creates the discrete zoom levels for the ZoomManager.


Nested Class Summary
protected static class DiagramRootEditPart.DiagramScalableFreeformLayeredPane
           
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
AbstractGraphicalEditPart.AccessibleGraphicalEditPart, AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator
 
Nested classes inherited from class org.eclipse.gef.editparts.LayerManager
LayerManager.Helper
 
Field Summary
static java.lang.String DECORATION_PRINTABLE_LAYER
          Identifies the layers containing printable decoration layer.
static java.lang.String DECORATION_UNPRINTABLE_LAYER
          Identifies the layers containing Unprintable decoration layer.
static java.lang.String PAGE_BREAKS_LAYER
          Identifies the layer containing the page breaks figure.
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
 
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
 
Fields inherited from interface org.eclipse.gef.LayerConstants
CONNECTION_LAYER, FEEDBACK_LAYER, GRID_LAYER, GUIDE_LAYER, HANDLE_LAYER, PRIMARY_LAYER, PRINTABLE_LAYERS, SCALABLE_LAYERS, SCALED_FEEDBACK_LAYER
 
Fields inherited from interface org.eclipse.gef.editparts.LayerManager
ID
 
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
 
Constructor Summary
DiagramRootEditPart()
          Default constructor
DiagramRootEditPart(MeasurementUnit mu)
           
 
Method Summary
 void activate()
          Adds a listener to the workspace preference store for changes related to the page breaks and diagram grid.
protected  GridLayer createGridLayer()
           
protected  GridLayer createGridLayer(int r, int g, int b)
           
protected  LayeredPane createPrintableLayers()
           
protected  ScalableFreeformLayeredPane createScalableFreeformLayeredPane()
          Creates the ScalableFreeformLayeredPane.
protected  ScalableFreeformLayeredPane createScaledLayers()
          Creates and returns the scalable layers of this EditPart
 void deactivate()
           
 double getGridSpacing()
          Get the Grid Spacing from the Plug-ins preference store
 org.eclipse.gmf.runtime.diagram.ui.internal.ruler.DiagramRuler getHorizontalRuler()
           
protected  ScalableFreeformLayeredPane getLayers()
          Accessor for scalable layers.
 org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode()
          Clients must define the measurement unit in the Diagram notation object for their editor to affect this mapping mode object value.
 org.eclipse.gmf.runtime.diagram.ui.internal.editparts.PageBreakEditPart getPageBreakEditPart()
          Returns the PageBreakEditPart controlled by this RootEditPart.
 PreferencesHint getPreferencesHint()
          Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.
 org.eclipse.gmf.runtime.diagram.ui.internal.ruler.DiagramRuler getVerticalRuler()
           
protected  IPreferenceStore getWorkspaceViewerPreferences()
          Convience method to access the workspace viewer preferences.
 ZoomManager getZoomManager()
          Override to set a non-default zoom levels
protected  void moveGridLayer(boolean inFront)
           
 void performRequest(Request request)
          This is a workspace property request.
protected  void refreshEnableAntiAlias()
          Refreshes anti-alias status on the diagram
protected  void refreshPageBreaks()
          Refreshes the page breaks.
protected  void refreshRulerUnits()
          Refreshes ruler units on the diagram
 void refreshVisuals()
          Refresh visuals in order to enable anti-aliasing
 void setGridColor(java.lang.Integer rgbValue)
          Sets the grid line color.
 void setGridSpacing(double gridSpacing)
          This method is called to set the grid spacing.
 void setGridStyle(int style)
          Sets the grid line style.
protected  void setLayers(ScalableFreeformLayeredPane layers)
           
 void setPreferencesHint(PreferencesHint preferenceHint)
          Sets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.
 void zoomIn()
          zoomIn Method will zoom in the EditPart to the next available level
 void zoomIn(Point center)
          zoomIn Method will zoom in the EditPart to the next available level centered around a given point
 void zoomOut()
          zoomOut Method will zoom out the EditPart to the next available level
 void zoomOut(Point center)
          zoomOut Method will zoom out the EditPart to the next available level centered around a given point
 void zoomTo(double zoom, Point center)
          zoomTo This method allows implementators to zoom to a certain level centered around a given point.
 void zoomTo(Rectangle rect)
          zoomTo This method allows implementors to zoom into or out to a rectangular area.
 
Methods inherited from class org.eclipse.gef.editparts.ScalableFreeformRootEditPart
createLayers, getLayer, getScaledLayers, register, unregister
 
Methods inherited from class org.eclipse.gef.editparts.FreeformGraphicalRootEditPart
createFigure, getAdapter, getContentPane, getDragTracker, getModel, getPrintableLayers, refreshGridLayer
 
Methods inherited from class org.eclipse.gef.editparts.SimpleRootEditPart
createEditPolicies, getCommand, getContents, getRoot, getViewer, refreshChildren, setContents, setViewer
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getFigure, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refresh, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeNotify, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModelChildren, getParent, getSelected, getTargetEditPart, hasFocus, installEditPolicy, isActive, isSelectable, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregisterAccessibility, unregisterModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, addNotify, eraseSourceFeedback, eraseTargetFeedback, getChildren, getEditPolicy, getParent, getSelected, getTargetEditPart, hasFocus, installEditPolicy, isActive, isSelectable, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Field Detail

PAGE_BREAKS_LAYER

public static final java.lang.String PAGE_BREAKS_LAYER
Identifies the layer containing the page breaks figure.

See Also:
Constant Field Values

DECORATION_PRINTABLE_LAYER

public static final java.lang.String DECORATION_PRINTABLE_LAYER
Identifies the layers containing printable decoration layer.

See Also:
Constant Field Values

DECORATION_UNPRINTABLE_LAYER

public static final java.lang.String DECORATION_UNPRINTABLE_LAYER
Identifies the layers containing Unprintable decoration layer.

See Also:
Constant Field Values
Constructor Detail

DiagramRootEditPart

public DiagramRootEditPart()
Default constructor


DiagramRootEditPart

public DiagramRootEditPart(MeasurementUnit mu)
Parameters:
mu - the MeasurementUnit that is used to display all contents within the root edit part.
Method Detail

createPrintableLayers

protected LayeredPane createPrintableLayers()

moveGridLayer

protected void moveGridLayer(boolean inFront)

createScaledLayers

protected ScalableFreeformLayeredPane createScaledLayers()
Creates and returns the scalable layers of this EditPart

Returns:
ScalableFreeformLayeredPane Pane that contains the scalable layers

createScalableFreeformLayeredPane

protected ScalableFreeformLayeredPane createScalableFreeformLayeredPane()
Creates the ScalableFreeformLayeredPane.

Returns:
the new ScalableFreeformLayeredPane

getZoomManager

public ZoomManager getZoomManager()
Override to set a non-default zoom levels

Returns:
the ZoomManager with the non-default zoom range

zoomTo

public void zoomTo(double zoom,
                   Point center)
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomTo This method allows implementators to zoom to a certain level centered around a given point.

Specified by:
zoomTo in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
Parameters:
zoom - double value where 1.0 represents 100%.
center - Point around which the zoom will be centered in absolute coordinates

zoomTo

public void zoomTo(Rectangle rect)
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomTo This method allows implementors to zoom into or out to a rectangular area.

Specified by:
zoomTo in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
Parameters:
rect - Rectangle that the edit part will zoom into our out to in absolute coordinates.

zoomIn

public void zoomIn()
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomIn Method will zoom in the EditPart to the next available level

Specified by:
zoomIn in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart

zoomIn

public void zoomIn(Point center)
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomIn Method will zoom in the EditPart to the next available level centered around a given point

Specified by:
zoomIn in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
Parameters:
center - Point around which the zoom will be centered in absolute coordinates

zoomOut

public void zoomOut()
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomOut Method will zoom out the EditPart to the next available level

Specified by:
zoomOut in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart

zoomOut

public void zoomOut(Point center)
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
zoomOut Method will zoom out the EditPart to the next available level centered around a given point

Specified by:
zoomOut in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ZoomableEditPart
Parameters:
center - Point around which the zoom will be centered in absolute coordinates

getWorkspaceViewerPreferences

protected IPreferenceStore getWorkspaceViewerPreferences()
Convience method to access the workspace viewer preferences.

Returns:
PreferenceStore the workspace viewer preference store

getGridSpacing

public double getGridSpacing()
Get the Grid Spacing from the Plug-ins preference store

Returns:
grid spacing value.

setGridStyle

public void setGridStyle(int style)
Sets the grid line style.

Parameters:
style -

setGridColor

public void setGridColor(java.lang.Integer rgbValue)
Sets the grid line color.


setGridSpacing

public void setGridSpacing(double gridSpacing)
This method is called to set the grid spacing. The units used for grid spacing are the same as the rulers current units.

Parameters:
gridSpacing -

getPageBreakEditPart

public org.eclipse.gmf.runtime.diagram.ui.internal.editparts.PageBreakEditPart getPageBreakEditPart()
Returns the PageBreakEditPart controlled by this RootEditPart.

Returns:
the PageBreakEditPart

refreshPageBreaks

protected void refreshPageBreaks()
Refreshes the page breaks.


refreshVisuals

public void refreshVisuals()
Refresh visuals in order to enable anti-aliasing


refreshEnableAntiAlias

protected void refreshEnableAntiAlias()
Refreshes anti-alias status on the diagram


refreshRulerUnits

protected void refreshRulerUnits()
Refreshes ruler units on the diagram


performRequest

public void performRequest(Request request)
This is a workspace property request. It does not use a Command to execute since it does not change the model.

Specified by:
performRequest in interface EditPart
Parameters:
request -

activate

public void activate()
Adds a listener to the workspace preference store for changes related to the page breaks and diagram grid.

Specified by:
activate in interface EditPart

deactivate

public void deactivate()
Specified by:
deactivate in interface EditPart

getLayers

protected ScalableFreeformLayeredPane getLayers()
Accessor for scalable layers. Subclasses can access them in order to update the layer when a relevant preference has been modified

Returns:

setLayers

protected void setLayers(ScalableFreeformLayeredPane layers)

setPreferencesHint

public void setPreferencesHint(PreferencesHint preferenceHint)
Description copied from interface: IDiagramPreferenceSupport
Sets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

Specified by:
setPreferencesHint in interface IDiagramPreferenceSupport

getPreferencesHint

public PreferencesHint getPreferencesHint()
Description copied from interface: IDiagramPreferenceSupport
Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

Specified by:
getPreferencesHint in interface IDiagramPreferenceSupport
Returns:
the preferences hint

getMapMode

public final org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode()
Clients must define the measurement unit in the Diagram notation object for their editor to affect this mapping mode object value.

Returns:
IMapMode that is the coordinate mapping for the Editor from device to logical coordinates.

getHorizontalRuler

public org.eclipse.gmf.runtime.diagram.ui.internal.ruler.DiagramRuler getHorizontalRuler()

getVerticalRuler

public org.eclipse.gmf.runtime.diagram.ui.internal.ruler.DiagramRuler getVerticalRuler()

createGridLayer

protected GridLayer createGridLayer()

createGridLayer

protected GridLayer createGridLayer(int r,
                                    int g,
                                    int b)

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.