Runtime

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

    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

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

Direct Known Subclasses:
  ListCompartmentEditPart, ShapeCompartmentEditPart

public abstract class ResizableCompartmentEditPart
extends CompartmentEditPart
implements IResizableCompartmentEditPart

An editpart for controlling generic resizable compartment views The compartment can be collapsed, hidden, resized, or given a title

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`

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
`ResizableCompartmentEditPart(EObject model)` Constructs a new resizable editpart

Method Summary
`protected void` `addNotationalListeners()` This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy
`protected IFigure` `createFigure()`
`java.lang.Object` `getAdapter(java.lang.Class key)` This method helps in children navigation by scrolling the compartment until the child is visible in the viewport
`ResizableCompartmentFigure` `getCompartmentFigure()`
`java.lang.String` `getCompartmentName()`
`IFigure` `getContentPane()`

`protected void`

`handleNotificationEvent(Notification event)`
Handles the following properties:
`NotationPackage.eINSTANCE.getRatio_Value()` calls `ResizableCompartmentEditPart.refreshRatio()` `NotationPackage.eINSTANCE.getDrawerStyle_Collapsed()` calls `ResizableCompartmentEditPart.refreshCollapsed()` `NotationPackage.eINSTANCE.getTitleStyle_ShowTitle()` calls `ResizableCompartmentEditPart.refreshShowCompartmentTitle()`
All other properties are forwarded to the parent class for processing.

`boolean` `isSelectable()` By default, all compartment edit parts get selectable only if the compartment's top level container matches the top level container of the editpart that currently has the keyboard focus i.e: you need to select the shape first before selecting a compartment but once a compartment is selected, a peer compartment can also be selected
`protected void` `refreshCollapsed()` Refreshes the compartment's collapsed state
`protected void` `refreshRatio()` Refreshes the compartment ratio property
`protected void` `refreshShowCompartmentTitle()` Refreshes the compartment title visibility
`protected void` `refreshVisuals()` Refresh the editpart's figure visual properties.
`protected void` `removeNotationalListeners()` This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy
`protected void` `setCollapsed(boolean collapsed, boolean animate)` Sets the collapse state of the compartment figure, considering the passed animate flag while doing so
`protected void` `setFont(FontData fontData)` Sets the font to the label.
`protected void` `setFontColor(Color color)` sets the font color
`protected void` `setRatio(java.lang.Double ratio)` Sets the ratio of the resizable compartment
`protected void` `setShowCompartmentTitle(boolean showCompartmentTitle)` Sets the visibility of the compartment title

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
`createDefaultEditPolicies, getDragTracker`

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, refreshVisibility, registerModel, removeListenerFilter, removeNotify, removeSemanticListeners, resolveSemanticElement, setBackgroundColor, setForegroundColor, setModel, setStructuralFeatureValue, setVisibility, showSourceFeedback, showTargetFeedback, transactionAboutToCommit, unregisterModel`

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

`addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, 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, unregister, 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, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, 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

### ResizableCompartmentEditPart

    public ResizableCompartmentEditPart(EObject model)

  Constructs a new resizable editpart

Parameters:
  `model` - The resizable compartment view

Method Detail

### getAdapter

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

  This method helps in children navigation by scrolling the compartment until the child is visible in the viewport

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

### refreshVisuals

    protected void refreshVisuals()

  Description copied from class: `GraphicalEditPart`
  Refresh the editpart's figure visual properties.

  Overrides:
    `refreshVisuals` in class `GraphicalEditPart`
  See Also:
    `AbstractEditPart.refreshVisuals()`

### createFigure

    protected IFigure createFigure()

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

### getCompartmentFigure

    public ResizableCompartmentFigure getCompartmentFigure()

  Returns:
    The compartment's figure

### getContentPane

    public IFigure getContentPane()

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

### getCompartmentName

    public java.lang.String getCompartmentName()

  Specified by:
    `getCompartmentName` in interface `IResizableCompartmentEditPart`
  Returns:
    the `String` that is the title header typically displayed at the top of the compartment. It is used to identity a meaningful description of the contents of the compartment.

### handleNotificationEvent

    protected void handleNotificationEvent(Notification event)

  Handles the following properties:
  - `NotationPackage.eINSTANCE.getRatio_Value()` calls `ResizableCompartmentEditPart.refreshRatio()`
  - `NotationPackage.eINSTANCE.getDrawerStyle_Collapsed()` calls `ResizableCompartmentEditPart.refreshCollapsed()`
  - `NotationPackage.eINSTANCE.getTitleStyle_ShowTitle()` calls `ResizableCompartmentEditPart.refreshShowCompartmentTitle()`
    All other properties are forwarded to the parent class for processing.

  Overrides:
    `handleNotificationEvent` in class `GraphicalEditPart`
  Parameters:
    `event` - the `Notification` object that is the property changed event
  See Also:
    `org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#handlePropertyChangeEvent(java.beans.PropertyChangeEvent)`

### refreshRatio

    protected void refreshRatio()

  Refreshes the compartment ratio property

### refreshCollapsed

    protected void refreshCollapsed()

  Refreshes the compartment's collapsed state

### refreshShowCompartmentTitle

    protected void refreshShowCompartmentTitle()

  Refreshes the compartment title visibility

### setCollapsed

    protected void setCollapsed(boolean collapsed,
                                boolean animate)

  Sets the collapse state of the compartment figure, considering the passed animate flag while doing so

  Parameters:
    `collapsed` - the collapsed state
    `animate` - the animate flag

### setRatio

    protected void setRatio(java.lang.Double ratio)

  Sets the ratio of the resizable compartment

  Parameters:
    `ratio` -

### setShowCompartmentTitle

    protected void setShowCompartmentTitle(boolean showCompartmentTitle)

  Sets the visibility of the compartment title

  Parameters:
    `showCompartmentTitle` -

### setFont

    protected void setFont(FontData fontData)

  Description copied from class: `GraphicalEditPart`
  Sets the font to the label. This method could be overriden to change the font data of the font overrides typically look like this: super.setFont( new FontData( fontData.getName(), fontData.getHeight(), fontData.getStyle() <| &> SWT.????));

  Overrides:
    `setFont` in class `GraphicalEditPart`
  Parameters:
    `fontData` - the font data
  See Also:
    `GraphicalEditPart.setFont(org.eclipse.swt.graphics.FontData)`

### setFontColor

    protected void setFontColor(Color color)

  Description copied from class: `GraphicalEditPart`
  sets the font color

  Overrides:
    `setFontColor` in class `GraphicalEditPart`
  Parameters:
    `color` - the new value of the font color
  See Also:
    `GraphicalEditPart.setFontColor(org.eclipse.swt.graphics.Color)`

### addNotationalListeners

    protected void addNotationalListeners()

  Description copied from class: `GraphicalEditPart`
  This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy

  Overrides:
    `addNotationalListeners` in class `GraphicalEditPart`
  See Also:
    `GraphicalEditPart.addNotationalListeners()`

### removeNotationalListeners

    protected void removeNotationalListeners()

  Description copied from class: `GraphicalEditPart`
  This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy

  Overrides:
    `removeNotationalListeners` in class `GraphicalEditPart`
  See Also:
    `GraphicalEditPart.removeNotationalListeners()`

### isSelectable

    public boolean isSelectable()

  Description copied from class: `CompartmentEditPart`
  By default, all compartment edit parts get selectable only if the compartment's top level container matches the top level container of the editpart that currently has the keyboard focus i.e: you need to select the shape first before selecting a compartment but once a compartment is selected, a peer compartment can also be selected

  Specified by:
    `isSelectable` in interface `EditPart`
  Overrides:
    `isSelectable` in class `CompartmentEditPart`
  See Also:
    `EditPart.isSelectable()`

Runtime

Guidelines for using Eclipse APIs.

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