Runtime

## org.eclipse.gmf.runtime.diagram.ui.editparts
Class ShapeCompartmentEditPart

    java.lang.Object
      org.eclipse.gef.editparts.AbstractEditPart
          org.eclipse.gef.editparts.AbstractGraphicalEditPart
              org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
                  org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
                      org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart
                          org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart

All Implemented Interfaces:
  EditPart, java.util.EventListener, GraphicalEditPart, IAdaptable, IAdaptableSelection, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IContainedEditPart, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart, IGraphicalEditPart, IResizableCompartmentEditPart, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart, NotificationListener, java.beans.PropertyChangeListener, RequestConstants

public abstract class ShapeCompartmentEditPart
extends ResizableCompartmentEditPart
implements org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart, java.beans.PropertyChangeListener

A generic (sub) shape container that holds instances of `ShapeNodeEditPart`s and manages the display of `ConnectionNodeEditPart`s anchored to these shape editpart instances.

Nested Class Summary
`static class` `ShapeCompartmentEditPart.ConnectionRefreshMgr` Class used to refresh the connections associated to the shape compartment's children.

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`

Field Summary

Fields inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
`accessibleEP, elementGuid`

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.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
`ShapeCompartmentEditPart(View view)` Constructor for ShapeCompartmentEditPart.

Method Summary
`void` `addNotify()`
`protected ShapeCompartmentEditPart.ConnectionRefreshMgr` `createConnectionRefreshMgr()` Factory method to create a refresh connection.

`protected void`

`createDefaultEditPolicies()`
Adds the following editpolicies:
`EditPolicyRoles.CREATION_ROLE` :: `CreationEditPolicy` `EditPolicy.LAYOUT_ROLE` :: `XYLayoutEditPolicy` `EditPolicy.CONTAINER_ROLE` :: `ContainerEditPolicy` `EditPolicyRoles.DRAG_DROP_ROLE` :: `DiagramLinkDragDropEditPolicy` `EditPolicy.GRAPHICAL_NODE_ROLE` :: `ContainerNodeEditPolicy` `EditPolicyRoles.SNAP_FEEDBACK_ROLE` :: `SnapFeedbackPolicy` `EditPolicyRoles.DRAG_DROP_ROLE` :: `ShapeCompartmentDropEditPolicy` `EditPolicyRoles.POPUPBAR_ROLE` :: `PopupBarEditPolicy`

`protected IFigure` `createFigure()` Creates a scrollpane (with auto scrollbars) in which the children are drawn.
`protected void` `forceRefreshConnections()` Refresh the connections associated the the children of this shape compartment.
`java.lang.Object` `getAdapter(java.lang.Class adapter)` Adds the ability to adapt to `SnapToHelper`.
`protected ShapeCompartmentEditPart.ConnectionRefreshMgr` `getConnectionRefreshMgr()` Returns the connection refresh manager.
`IFigure` `getContentPane()` Return the container in which shape editparts are added.
`DragTracker` `getDragTracker(Request req)`
`protected LayoutManager` `getLayoutManager()` Returns the layout manager to be used by this shape compartment.
`java.util.List` `getPrimaryEditParts()` Gets the primary editparts on this surface, that is, the top-level shapes and connectors.
`ShapeCompartmentFigure` `getShapeCompartmentFigure()` Convenience method to retrieve the shape compartment figure.
`protected void` `handleNotificationEvent(Notification event)` Refreshes the connections inside the shape compartment if the supplied event is for an element inserted or removed from the editpart.
`protected void` `handlePropertyChangeEvent(java.beans.PropertyChangeEvent event)` Handles property change callbacks.
`boolean` `isSupportingViewActions()` Returns true if the surface edit part is to support the view actions.
`void` `propertyChange(java.beans.PropertyChangeEvent event)` Handles the passed property changed event only if the editpart's view is not deleted.
`protected void` `refreshConnections()` Refresh the connections associated the the children of this shape compartment.
`protected void` `refreshVisibility()` Also calls `ShapeCompartmentEditPart.refreshConnections()`.
`protected void` `registerVisuals()` Registers this instance as a PropertyChangeListener on its figure.
`void` `removeNotify()`
`void` `setIsSupportingViewActions(boolean supportsViewActions)` Setter for isSupportingViewActions
`protected boolean` `supportsDragSelection()` Determines if the shape compartment supports drag selection of it's children.
`protected void` `unregister()` Unregisters this instance as a PropertyChangeListener on its figure.

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart
`addNotationalListeners, getCompartmentFigure, getCompartmentName, isSelectable, refreshCollapsed, refreshRatio, refreshShowCompartmentTitle, refreshVisuals, removeNotationalListeners, setCollapsed, setFont, setFontColor, setRatio, setShowCompartmentTitle`

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart

`activate, addChild, addListenerFilter, addListenerFilter, addSemanticListeners, basicGetModel, createConnection, createEditPolicies, deactivate, disableEditMode, enableEditMode, eraseSourceFeedback, eraseTargetFeedback, executeCommand, findEditPart, getAccessibleEditPart, getChildBySemanticHint, getChildBySemanticHintOnPrimaryView, getChildViewBySemanticHint, getCommand, getContentPaneFor, getDiagramEditDomain, getDiagramPreferencesHint, getDiagramView, getEditDomain, getEditingDomain, getMapMode, getModel, getModelChildren, getNotationView, getPreferredValue, getPrimaryChildEditPart, getPrimaryView, getResourceManager, getRoot, getStructuralFeatureValue, getTopGraphicEditPart, handleMajorSemanticChange, hasNotationView, isCanonical, isEditModeEnabled, notifyChanged, performDirectEditRequest, performRequest, reactivateSemanticModel, refresh, refreshBackgroundColor, refreshChild, refreshFont, refreshFontColor, refreshForegroundColor, refreshSourceConnection, refreshTargetConnection, registerModel, removeListenerFilter, removeSemanticListeners, resolveSemanticElement, setBackgroundColor, setForegroundColor, setModel, setStructuralFeatureValue, setVisibility, showSourceFeedback, showTargetFeedback, transactionAboutToCommit, unregisterModel`

Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart

`addChildVisual, addNodeListener, addSourceConnection, addTargetConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, removeChildVisual, removeNodeListener, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals`

Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart

`activateEditPolicies, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getChildren, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getParent, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setParent, setSelected, toString, understandsRequest, unregisterAccessibility`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart
`findEditPart, getChildBySemanticHint, getDiagramEditDomain, getDiagramPreferencesHint, getEditingDomain, getNotationView, getPreferredValue, getPrimaryChildEditPart, getPrimaryView, getStructuralFeatureValue, getTopGraphicEditPart, resolveSemanticElement, setStructuralFeatureValue`

Methods inherited from interface org.eclipse.gef.GraphicalEditPart
`addNodeListener, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint`

Methods inherited from interface org.eclipse.gef.EditPart

`activate, addEditPartListener, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refresh, removeEditPartListener, removeEditPolicy, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest`

Methods inherited from interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart
`disableEditMode, enableEditMode, isEditModeEnabled`

Constructor Detail

### ShapeCompartmentEditPart

    public ShapeCompartmentEditPart(View view)

  Constructor for ShapeCompartmentEditPart.

Parameters:
  `view` - the view `controlled` by this editpart.

Method Detail

### getConnectionRefreshMgr

    protected final ShapeCompartmentEditPart.ConnectionRefreshMgr getConnectionRefreshMgr()

  Returns the connection refresh manager.

  Returns:
    `ConnectionRefreshMgr`

### createConnectionRefreshMgr

    protected ShapeCompartmentEditPart.ConnectionRefreshMgr createConnectionRefreshMgr()

  Factory method to create a refresh connection. This implementation returns a `ShapeCompartmentEditPart.ConnectionRefreshMgr` instance.

  Returns:
    `ConnectionRefreshMgr`

### getLayoutManager

    protected LayoutManager getLayoutManager()

  Returns the layout manager to be used by this shape compartment. This implemantion returns a `FreeformLayout` instance.

  Returns:
    a layout manager.

### createFigure

    protected IFigure createFigure()

  Creates a scrollpane (with auto scrollbars) in which the children are drawn. The factory hint property is used to set this compartments label.

  Overrides:
    `createFigure` in class `ResizableCompartmentEditPart`
  See Also:
    `AbstractGraphicalEditPart.createFigure()`

### getShapeCompartmentFigure

    public ShapeCompartmentFigure getShapeCompartmentFigure()

  Convenience method to retrieve the shape compartment figure. Same as calling `(ShapeCompartmentFigure)getCompartmentFigure()`.

  Returns:
    `ShapeCompartmentFigure`

### getContentPane

    public IFigure getContentPane()

  Return the container in which shape editparts are added.

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

### createDefaultEditPolicies

    protected void createDefaultEditPolicies()

  Adds the following editpolicies:
  - `EditPolicyRoles.CREATION_ROLE` :: `CreationEditPolicy`
  - `EditPolicy.LAYOUT_ROLE` :: `XYLayoutEditPolicy`
  - `EditPolicy.CONTAINER_ROLE` :: `ContainerEditPolicy`
  - `EditPolicyRoles.DRAG_DROP_ROLE` :: `DiagramLinkDragDropEditPolicy`
  - `EditPolicy.GRAPHICAL_NODE_ROLE` :: `ContainerNodeEditPolicy`
  - `EditPolicyRoles.SNAP_FEEDBACK_ROLE` :: `SnapFeedbackPolicy`
  - `EditPolicyRoles.DRAG_DROP_ROLE` :: `ShapeCompartmentDropEditPolicy`
  - `EditPolicyRoles.POPUPBAR_ROLE` :: `PopupBarEditPolicy`

  Overrides:
    `createDefaultEditPolicies` in class `CompartmentEditPart`

### handlePropertyChangeEvent

    protected void handlePropertyChangeEvent(java.beans.PropertyChangeEvent event)

  Handles property change callbacks. All unrecognized events are forwarded to the parent class.

  Parameters:
    `event` - a property change event.

### handleNotificationEvent

    protected void handleNotificationEvent(Notification event)

  Refreshes the connections inside the shape compartment if the supplied event is for an element inserted or removed from the editpart.

  Overrides:
    `handleNotificationEvent` in class `ResizableCompartmentEditPart`
  Parameters:
    `event` - a model server event.
  See Also:
    `ShapeCompartmentEditPart.refreshConnections()`

### refreshConnections

    protected void refreshConnections()

  Refresh the connections associated the the children of this shape compartment.

### forceRefreshConnections

    protected void forceRefreshConnections()

  Refresh the connections associated the the children of this shape compartment.

### unregister

    protected void unregister()

  Unregisters this instance as a PropertyChangeListener on its figure.

### registerVisuals

    protected void registerVisuals()

  Registers this instance as a PropertyChangeListener on its figure.

### supportsDragSelection

    protected boolean supportsDragSelection()

  Determines if the shape compartment supports drag selection of it's children. Otherwise, it will default to the core behavior of selecting the compartment itself on click on the compartment background surface.

  Returns:
    `boolean` `true` if shape compartment supports drag selection of it's children, `false` otherwise.

### getDragTracker

    public DragTracker getDragTracker(Request req)

  Specified by:
    `getDragTracker` in interface `EditPart`
  Overrides:
    `getDragTracker` in class `CompartmentEditPart`
  See Also:
    `EditPart.getDragTracker(org.eclipse.gef.Request)`

### getAdapter

    public java.lang.Object getAdapter(java.lang.Class adapter)

  Adds the ability to adapt to `SnapToHelper`.

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

### refreshVisibility

    protected void refreshVisibility()

  Also calls `ShapeCompartmentEditPart.refreshConnections()`.

  Overrides:
    `refreshVisibility` in class `GraphicalEditPart`

### isSupportingViewActions

    public boolean isSupportingViewActions()

  Description copied from interface: `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`
  Returns true if the surface edit part is to support the view actions. False otherwise.

  Specified by:
    `isSupportingViewActions` in interface `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`
  Returns:
    boolean isSupportingViewActions

### setIsSupportingViewActions

    public void setIsSupportingViewActions(boolean supportsViewActions)

  Description copied from interface: `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`
  Setter for isSupportingViewActions

  Specified by:
    `setIsSupportingViewActions` in interface `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`

### propertyChange

    public final void propertyChange(java.beans.PropertyChangeEvent event)

  Handles the passed property changed event only if the editpart's view is not deleted.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`

### getPrimaryEditParts

    public java.util.List getPrimaryEditParts()

  Description copied from interface: `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`
  Gets the primary editparts on this surface, that is, the top-level shapes and connectors.

  Specified by:
    `getPrimaryEditParts` in interface `org.eclipse.gmf.runtime.diagram.ui.internal.editparts.ISurfaceEditPart`
  Returns:
    List of primary edit parts. If there are none then it returns a Collections.EMPTY_LIST, which is immutable

### addNotify

    public void addNotify()

  Specified by:
    `addNotify` in interface `EditPart`

### removeNotify

    public void removeNotify()

  Specified by:
    `removeNotify` in interface `EditPart`
  Overrides:
    `removeNotify` in class `GraphicalEditPart`

Runtime

Guidelines for using Eclipse APIs.

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