Eclipse GEF
2.1

org.eclipse.gef.editparts
Class FreeformGraphicalRootEditPart

java.lang.Object
  |
  +--org.eclipse.gef.editparts.AbstractEditPart
        |
        +--org.eclipse.gef.editparts.AbstractGraphicalEditPart
              |
              +--org.eclipse.gef.editparts.FreeformGraphicalRootEditPart
All Implemented Interfaces:
EditPart, GraphicalEditPart, IAdaptable, LayerConstants, LayerManager, RequestConstants, RootEditPart
Direct Known Subclasses:
ScalableFreeformRootEditPart

public class FreeformGraphicalRootEditPart
extends AbstractGraphicalEditPart
implements RootEditPart, LayerConstants, LayerManager

A graphical root that uses FreeformFigures as the layers in the diagram. The contents editpart must provide a FreeformFigure as its figure. Freeform figures are special because they can expand in any direction. This allows the user to drag objects or bendpoints into the negative X and Y coordinates of a diagram. If this feature is not being used, clients should use the FreeformGraphicalRootEditPart as their viewer's root editpart.

IMPORTANT: The contents editpart that is added to a freeform root should have a FreeformFigure (such as FreeformLayer) as its Figure. The primary layer is not using a draw2d LayoutManager, and will not size the contents' figure properly unless it is a freeform figure.

IMPORTANT:The freeform root uses a FreeformViewport as its primary figure. This class must be used with the ScrollingGraphicalViewer. The viewport gets installed into that viewer's FigureCanvas, which provides native scrollbars for scrolling the viewport.

This root serves as the diagram's LayerManager, providing the following layer structure, in top-to-bottom order:
Root Freeform Layered Pane
 Feedback Layer
 Handle Layer
 Printable Layers
  ├ Connection Layer
  └ Primary Layer


Nested Class Summary
 
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
protected  EditPart contents
          Deprecated. call getContents()
protected  EditPartViewer viewer
          Deprecated. call getViewer()
 
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.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.LayerConstants
CONNECTION_LAYER, FEEDBACK_LAYER, HANDLE_LAYER, PRIMARY_LAYER, PRINTABLE_LAYERS, SCALABLE_LAYERS
 
Fields inherited from interface org.eclipse.gef.editparts.LayerManager
ID
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, 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
FreeformGraphicalRootEditPart()
           
 
Method Summary
protected  void createEditPolicies()
          Creates the initial EditPolicies and/or reserves slots for dynamic ones.
protected  IFigure createFigure()
          Creates the Figure to be used as this part's visuals.
protected  void createLayers(LayeredPane layeredPane)
          Creates the top-most set of layers on the given layered pane.
protected  LayeredPane createPrintableLayers()
          Creates a layered pane and the layers that should be printed.
 Object getAdapter(Class adapter)
          Extends AbstractEditPart.getAdapter(Class) to handle additional adapter types.
 Command getCommand(Request req)
          The RootEditPart should never be asked for a command.
 IFigure getContentPane()
          The contents' Figure will be added to the PRIMARY_LAYER.
 EditPart getContents()
          Returns the contents EditPart.
 DragTracker getDragTracker(Request req)
          Should not be called, but returns a MarqeeDragTracker for good measure.
 IFigure getLayer(Object key)
          Returns the layer indicated by the key.
 Object getModel()
          The root editpart does not have a real model.
protected  LayeredPane getPrintableLayers()
          Returns the LayeredPane that should be used during printing.
 RootEditPart getRoot()
          Returns this.
 EditPartViewer getViewer()
          Returns the viewer that was set.
protected  void refreshChildren()
          Overridden to do nothing, child is set using setContents(EditPart)
 void setContents(EditPart editpart)
          Sets the contents EditPart.
 void setViewer(EditPartViewer newViewer)
          Sets the EditPartViewer.
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
activate, addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, deactivate, 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, performRequest, refreshVisuals, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, 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
activate, addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getEditPolicy, getParent, getSelected, getTargetEditPart, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Field Detail

contents

protected EditPart contents
Deprecated. call getContents()


viewer

protected EditPartViewer viewer
Deprecated. call getViewer()

Constructor Detail

FreeformGraphicalRootEditPart

public FreeformGraphicalRootEditPart()
Method Detail

createEditPolicies

protected void createEditPolicies()
Description copied from class: AbstractEditPart
Creates the initial EditPolicies and/or reserves slots for dynamic ones. Should be implemented to install the inital EditPolicies based on the model's initial state. null can be used to reserve a "slot", should there be some desire to guarantee the ordering of EditPolcies.

Specified by:
createEditPolicies in class AbstractEditPart
See Also:
AbstractEditPart.createEditPolicies()

createFigure

protected IFigure createFigure()
Description copied from class: AbstractGraphicalEditPart
Creates the Figure to be used as this part's visuals. This is called from AbstractGraphicalEditPart.getFigure() if the figure has not been created.

Specified by:
createFigure in class AbstractGraphicalEditPart
Returns:
a Figure
See Also:
AbstractGraphicalEditPart.createFigure()

createLayers

protected void createLayers(LayeredPane layeredPane)
Creates the top-most set of layers on the given layered pane.

Parameters:
layeredPane - the parent for the created layers

createPrintableLayers

protected LayeredPane createPrintableLayers()
Creates a layered pane and the layers that should be printed.

Returns:
a new LayeredPane containing the printable layers
See Also:
PrintGraphicalViewerOperation

getAdapter

public Object getAdapter(Class adapter)
Description copied from class: AbstractGraphicalEditPart
Extends AbstractEditPart.getAdapter(Class) to handle additional adapter types. Currently, these types include AccessibleHandleProvider and AccessibleAnchorProvider. Subclasses should extend this method to support additional adapter types, or to replace the default provided adapaters.

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class AbstractGraphicalEditPart
See Also:
IAdaptable.getAdapter(java.lang.Class)

getCommand

public Command getCommand(Request req)
The RootEditPart should never be asked for a command. The implementation returns an unexecutable command.

Specified by:
getCommand in interface EditPart
Overrides:
getCommand in class AbstractEditPart
Parameters:
req - describes the Command being requested
Returns:
null or a Command
See Also:
EditPart.getCommand(org.eclipse.gef.Request)

getContentPane

public IFigure getContentPane()
The contents' Figure will be added to the PRIMARY_LAYER.

Specified by:
getContentPane in interface GraphicalEditPart
Overrides:
getContentPane in class AbstractGraphicalEditPart
See Also:
GraphicalEditPart.getContentPane()

getContents

public EditPart getContents()
Description copied from interface: RootEditPart
Returns the contents EditPart. A RootEditPart only has a single child, called its contents.

Specified by:
getContents in interface RootEditPart
Returns:
the contents.
See Also:
RootEditPart.getContents()

getDragTracker

public DragTracker getDragTracker(Request req)
Should not be called, but returns a MarqeeDragTracker for good measure.

Specified by:
getDragTracker in interface EditPart
Overrides:
getDragTracker in class AbstractGraphicalEditPart
Parameters:
req - a Request indicating the context of the drag
Returns:
null or a DragTracker
See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)

getLayer

public IFigure getLayer(Object key)
Returns the layer indicated by the key. Searches all layered panes.

Specified by:
getLayer in interface LayerManager
Overrides:
getLayer in class AbstractGraphicalEditPart
Parameters:
key - a key identifying the layer
Returns:
the specified layer
See Also:
LayerManager.getLayer(Object)

getModel

public Object getModel()
The root editpart does not have a real model. The LayerManager ID is returned so that this editpart gets registered using that key.

Specified by:
getModel in interface EditPart
Overrides:
getModel in class AbstractEditPart
Returns:
the primary model object
See Also:
EditPart.getModel()

getPrintableLayers

protected LayeredPane getPrintableLayers()
Returns the LayeredPane that should be used during printing. This layer will be identified using LayerConstants.PRINTABLE_LAYERS.

Returns:
the layered pane containing all printable content

getRoot

public RootEditPart getRoot()
Returns this.

Specified by:
getRoot in interface EditPart
Overrides:
getRoot in class AbstractEditPart
Returns:
the RootEditPart
See Also:
EditPart.getRoot()

getViewer

public EditPartViewer getViewer()
Returns the viewer that was set.

Specified by:
getViewer in interface RootEditPart
Overrides:
getViewer in class AbstractEditPart
Returns:
The EditPartViewer
See Also:
EditPart.getViewer()

refreshChildren

protected void refreshChildren()
Overridden to do nothing, child is set using setContents(EditPart)

Overrides:
refreshChildren in class AbstractEditPart
See Also:
AbstractEditPart.refreshChildren()

setContents

public void setContents(EditPart editpart)
Description copied from interface: RootEditPart
Sets the contents EditPart. A RootEditPart only has a single child, called its contents.

Specified by:
setContents in interface RootEditPart
Parameters:
editpart - the contents
See Also:
RootEditPart.setContents(org.eclipse.gef.EditPart)

setViewer

public void setViewer(EditPartViewer newViewer)
Sets the EditPartViewer.

Specified by:
setViewer in interface RootEditPart
Parameters:
newViewer - EditPartViewer.

Eclipse GEF
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.