Runtime

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

    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.ListCompartmentEditPart

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:
  SemanticListCompartmentEditPart

public abstract class ListCompartmentEditPart
extends ResizableCompartmentEditPart

An editpart implementation of the ResizableCompartment as a list compartment

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
`protected boolean` `listening` State of listening
`protected java.util.List` `modelChildrenListeners` list of model children that this edit part is listening

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
`ListCompartmentEditPart(EObject model)`

Method Summary
`protected void` `addSemanticChildrenListeners()` Add listeners to the children of this list compartment so changes to the children can be pickup and the sorting / filtering may be updated.
`protected void` `addSemanticListeners()` Add semanticChildrenListeners when we activiate, if needed.
`protected void` `createDefaultEditPolicies()` Should be overridden to install editpolicies programmatically.
`IFigure` `createFigure()` Adds a constrained flow layout algorithm to the content pane of compartment figure
`protected java.util.List` `getBaseModelChildren()` Returns a list of model children in their natural model state.
`protected java.util.List` `getChildrenFilteredBy(java.util.List filterKeys)` Returns a list of model children that are filtered according to Properties.ID_FILTERING_KEYS.
`protected java.util.List` `getChildrenSortedBy(java.util.Map sortingKeys)` Returns the model children sorted by the order specified by Properties.ID_SORTING_KEYS.
`protected java.util.Comparator` `getComparator(java.lang.String name, SortingDirection direction)` Returns a `Comparator` that is used to sort the list compartment children.
`java.lang.String` `getCompartmentName()`
`protected java.util.List` `getFilteredChildren()` Returns a `List` of `View` s corresponding to the unique id of the semantic elements which are filtered.
`protected View` `getModelChildByID(EObject eObject)` Returns the child view given the semantic ID.
`protected java.util.List` `getModelChildren()` Returns a list of sorted / filtered model children.
`protected java.util.List` `getSortedChildren()` Returns a `List` of model children corresponding appearance order of the list compartment items.

`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.

`protected abstract boolean` `hasModelChildrenChanged(Notification evt)` Determines if the given event affects the semantic model children
`protected boolean` `isAffectingSortingFiltering(java.lang.Object feature)` checks whether the feature affects the sorting / filtering.
`protected boolean` `modeAutomatic()` Returns `true` if sorting or filtering is in automatic mode and `false` otherwise.
`protected void` `removeSemanticChildrenListeners()` Remove the listeners on the children of this list compartment.
`protected void` `removeSemanticListeners()` Remove semanticChildrenListeners when we stop listening.

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

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

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

`activate, addChild, addListenerFilter, addListenerFilter, basicGetModel, createConnection, createEditPolicies, deactivate, disableEditMode, enableEditMode, eraseSourceFeedback, eraseTargetFeedback, executeCommand, findEditPart, getAccessibleEditPart, getChildBySemanticHint, getChildBySemanticHintOnPrimaryView, getChildViewBySemanticHint, getCommand, getContentPaneFor, getDiagramEditDomain, getDiagramPreferencesHint, getDiagramView, getEditDomain, getEditingDomain, getMapMode, getModel, 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, 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`

Field Detail

### modelChildrenListeners

    protected java.util.List modelChildrenListeners

  list of model children that this edit part is listening

### listening

    protected boolean listening

  State of listening

Constructor Detail

### ListCompartmentEditPart

    public ListCompartmentEditPart(EObject model)

Method Detail

### createDefaultEditPolicies

    protected void createDefaultEditPolicies()

  Description copied from class: `GraphicalEditPart`
  Should be overridden to install editpolicies programmatically.

  Overrides:
    `createDefaultEditPolicies` in class `CompartmentEditPart`

### createFigure

    public IFigure createFigure()

  Adds a constrained flow layout algorithm to the content pane of compartment figure

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

### getModelChildren

    protected java.util.List getModelChildren()

  Returns a list of sorted / filtered model children. To get the model children in their natural ordering and size use getBaseModelChildren();

  Overrides:
    `getModelChildren` in class `GraphicalEditPart`
  Returns:
    list of views.
  See Also:
    `AbstractEditPart.getModelChildren()`

### getBaseModelChildren

    protected java.util.List getBaseModelChildren()

  Returns a list of model children in their natural model state.

  Returns:
    list of model children of this edit part

### hasModelChildrenChanged

    protected abstract boolean hasModelChildrenChanged(Notification evt)

  Determines if the given event affects the semantic model children

  Parameters:
    `evt` - The event in question
  Returns:
    `true` if the events affects model children, `false` otherwise

### handleNotificationEvent

    protected void handleNotificationEvent(Notification event)

  Description copied from class: `ResizableCompartmentEditPart`
  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 `ResizableCompartmentEditPart`
  See Also:
    `org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#handlePropertyChangeEvent(java.beans.PropertyChangeEvent)`

### getSortedChildren

    protected java.util.List getSortedChildren()

  Returns a `List` of model children corresponding appearance order of the list compartment items.

  Returns:
    a `List` of Ids

### getChildrenSortedBy

    protected java.util.List getChildrenSortedBy(java.util.Map sortingKeys)

  Returns the model children sorted by the order specified by Properties.ID_SORTING_KEYS. This is used to support dynamic list compartment sorting.

  Parameters:
    `sortingKeys` -
  Returns:
    the model children sorted

### getComparator

    protected java.util.Comparator getComparator(java.lang.String name,
                                                 SortingDirection direction)

  Returns a `Comparator` that is used to sort the list compartment children. Override to provide a `Comparator` that provides for a particular child type.

  Parameters:
    `name` -
    `direction` -
  Returns:
    comparator

### getFilteredChildren

    protected java.util.List getFilteredChildren()

  Returns a `List` of `View` s corresponding to the unique id of the semantic elements which are filtered.

  Returns:
    list of filtered model children

### getChildrenFilteredBy

    protected java.util.List getChildrenFilteredBy(java.util.List filterKeys)

  Returns a list of model children that are filtered according to Properties.ID_FILTERING_KEYS. This is used to support dynamic sorting.

  Parameters:
    `filterKeys` -
  Returns:
    list of filtered children

### getCompartmentName

    public java.lang.String getCompartmentName()

  Specified by:
    `getCompartmentName` in interface `IResizableCompartmentEditPart`
  Overrides:
    `getCompartmentName` in class `ResizableCompartmentEditPart`

### getModelChildByID

    protected View getModelChildByID(EObject eObject)

  Returns the child view given the semantic ID.

  Parameters:
    `eObject` - the semantic element
  Returns:
    the view or null if not found

### modeAutomatic

    protected boolean modeAutomatic()

  Returns `true` if sorting or filtering is in automatic mode and `false` otherwise.

  Returns:
    `true` if yes, oherwise `false`

### isAffectingSortingFiltering

    protected boolean isAffectingSortingFiltering(java.lang.Object feature)

  checks whether the feature affects the sorting / filtering.

  Parameters:
    `feature` - the feature to check
  Returns:
    `true` if it affects it otherwise `false`

### addSemanticChildrenListeners

    protected void addSemanticChildrenListeners()

  Add listeners to the children of this list compartment so changes to the children can be pickup and the sorting / filtering may be updated.

### removeSemanticChildrenListeners

    protected void removeSemanticChildrenListeners()

  Remove the listeners on the children of this list compartment.

### addSemanticListeners

    protected void addSemanticListeners()

  Add semanticChildrenListeners when we activiate, if needed.

  Overrides:
    `addSemanticListeners` in class `GraphicalEditPart`

### removeSemanticListeners

    protected void removeSemanticListeners()

  Remove semanticChildrenListeners when we stop listening.

  Overrides:
    `removeSemanticListeners` in class `GraphicalEditPart`

Runtime

Guidelines for using Eclipse APIs.

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