Rational Developer for Power Systems Software
V7.6

com.ibm.etools.systems.application.visual.editor.editpolicies
Class AggregateCanonicalConnectionEditPolicy

java.lang.Object
  extended by CanonicalConnectionEditPolicy
      extended by com.ibm.etools.systems.application.visual.editor.editpolicies.AggregateCanonicalConnectionEditPolicy
Direct Known Subclasses:
ApplicationModelCanonicalConnectionEditPolicy, SourceContainerCompartmentCanonicalEditPolicy

public class AggregateCanonicalConnectionEditPolicy
extends CanonicalConnectionEditPolicy

A specialized implementation of CanonicalConnectionEditPolicy. This implementation will manage the aggregate connections owned by the semantic host.


Field Summary
static String copyright
           
 
Constructor Summary
AggregateCanonicalConnectionEditPolicy()
           
 
Method Summary
protected  Collection<Relationship> computeLinksFromSemanticModel()
          Compute all links from semantic model which conforms to current model filter.
protected  void createAggregatedConnection(EObject aggregatedSourceElement, EObject aggregatedTargetElement)
          Create the aggregated relationships that either start or end with the host.
protected  Command createAggregatedConnectionCommand(EditPart sourceEditPart, EditPart targetEditPart)
          Create command for aggregated connection.
protected  void createConnections(Collection relations)
          Create the relationships that either start or end with the host.
protected  void createDirectConnection(Relationship relationship)
          Create the aggregated relationships that either start or end with the host.
 void deactivate()
           
protected  View findViewForSemanticElement(EObject element)
          Find view for semantic element under given view ancestor.
protected  EObject getAggregatedSemanticElement(EObject semanticElement)
          Get aggregated semantic element where the aggregated connection will connect.
protected  EObject getAncestor(EObject modelElement)
          Get ancestor of given semantic element.
protected  ApplicationModel getApplicationModel()
          Get ApplicationModel.
protected  View getCollapsedChecker(View ancestorView)
          Return the real view object used to check the collapse status, for example, a resizable compartment view.
protected  View getConnectionView(Relationship semanticRelation)
          Find the view object for the given relationship semantic element.
protected  Diagram getDiagram()
          Return the diagram object.
protected  EditPart getEditPartFor(EObject semanticElement)
          Find editpart from semantic model element.
protected  EditPart getEditPartFor(View view)
          Find editpart from semantic model element.
protected  EObject getExistDirectConnection(EObject relationship, Collection containedConnections)
          Get the exist direct connection for given relationship in contained connections.
protected  Edge getExistingAggregateConnection(Artifact sourceElement, Artifact targetElement)
          Check if the given relationship model element has been renderred.
protected  Edge getExistingDirectConnection(Relationship relationship)
          Check if the given relationship model element has been renderred.
protected  EObject getHighestCollapsedContainer(EObject targetSemanticElement)
          Check if the view of given semantic element is driectly or indirectly in a collapsed container.
protected  EObject getHostSemanticElement()
          Return the semantic element for the host of this editpolicy.
protected  ICollapsableEditPart getOwningCollapsableEditPart(EditPart ep)
          Gets the collapsable edipart ancestor for a given editpart.
protected  List getSemanticConnectionsList()
           
protected  ISemanticElementToViewRegistry getSemanticElementToViewRegistry()
          Helper to get SemanticElementToViewRegistry.
protected  EObject getSourceElement(EObject relationship)
           
protected  EObject getTargetElement(EObject relationship)
           
protected  boolean isCollapsedEditPart(EditPart ep)
          Return true if the given editpartt is collpased, false otherwise.
protected  boolean isConnectionReady(EObject sourceElement, EObject targetElement)
          Check if it is ready to create an Edge between two semantic elements.
protected  boolean isInternalRelation(Relationship nextRelationship)
          Check if a relationship is between two children ( direct or indirect ) inside the semantic element of the host.
protected  boolean isRelatedSemanticRelationship(Relationship relation)
          Check if the given Relationship semantic element is related with the host.
protected  boolean registerSemanticElementToViewMappings(View view)
          Register semantic element to view mappings for all semantic children elements from the element of given view.
protected  void setSemanticElementToViewRegistry(ISemanticElementToViewRegistry semanticElementToViewRegistry)
          Helper to set SemanticElementToViewRegistry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static String copyright
Constructor Detail

AggregateCanonicalConnectionEditPolicy

public AggregateCanonicalConnectionEditPolicy()
Method Detail

createConnections

protected void createConnections(Collection relations)
Create the relationships that either start or end with the host.

Parameters:
relations: - the collection for Relationships where the aggregated relationship to be computed.

getExistingDirectConnection

protected Edge getExistingDirectConnection(Relationship relationship)
Check if the given relationship model element has been renderred.

Returns:
Existing Edge object for the given relationship element if the edge exists, null otherwise.

getExistingAggregateConnection

protected Edge getExistingAggregateConnection(Artifact sourceElement,
                                              Artifact targetElement)
Check if the given relationship model element has been renderred.

Returns:
Existing Edge object for the given source element and target element the edge exists, null otherwise.

getHighestCollapsedContainer

protected EObject getHighestCollapsedContainer(EObject targetSemanticElement)
Check if the view of given semantic element is driectly or indirectly in a collapsed container.

Parameters:
targetSemanticElement - semantic element
Returns:
true if the view of given semantic element is driectly or indirectly in a collapsed container, false otherwise.

findViewForSemanticElement

protected View findViewForSemanticElement(EObject element)
Find view for semantic element under given view ancestor.

Parameters:
element - semantic element
viewAncestor - the view to be searched
Returns:
view object for given semantic element, if it exists. null otherwise.

getCollapsedChecker

protected View getCollapsedChecker(View ancestorView)
Return the real view object used to check the collapse status, for example, a resizable compartment view. The passed-in view may or may not contain compartment view. In some case, passed-in view itself is the compartment view.

Parameters:
ancestorView - the view asked for checking the collapse status
Returns:
the real view object supporting the collapse feature. If there is no compartment childview found, return the passed in view.

createAggregatedConnection

protected void createAggregatedConnection(EObject aggregatedSourceElement,
                                          EObject aggregatedTargetElement)
Create the aggregated relationships that either start or end with the host.

Parameters:
aggregatedSourceElement: - the source element that aggregated connection will start from.
aggregatedTargetElement: - the target element that aggregated connection will start from.

createDirectConnection

protected void createDirectConnection(Relationship relationship)
Create the aggregated relationships that either start or end with the host.

Parameters:
relations: - the collection for Relationships where the aggregated relationship to be computed.

getAggregatedSemanticElement

protected EObject getAggregatedSemanticElement(EObject semanticElement)
Get aggregated semantic element where the aggregated connection will connect. The aggregated element is the closest container whose View is collpased.

Parameters:
semanticElement - the semantic element
Returns:
the closest collpased container element if it exists, otherwise returns null which means the Views corresponding to the hierarchy branch from the given semantic element is fully expanded.

registerSemanticElementToViewMappings

protected boolean registerSemanticElementToViewMappings(View view)
Register semantic element to view mappings for all semantic children elements from the element of given view.

Parameters:
view - the view whose semantic elements to be mapped.
Returns:
true if the view is successfully registered. False otherwise.

isConnectionReady

protected boolean isConnectionReady(EObject sourceElement,
                                    EObject targetElement)
Check if it is ready to create an Edge between two semantic elements.

Parameters:
sourceElement - source element
targetElement - target element
Returns:
true if the views for both source and target elements are available, false otherwise.

isInternalRelation

protected boolean isInternalRelation(Relationship nextRelationship)
Check if a relationship is between two children ( direct or indirect ) inside the semantic element of the host. Because the GMF use depth first approach to create views, the views for all direct / indirect children will be available after refreshSemantic() is done. This means the internal relationships are ready to be created in the place without deferring.

Parameters:
nextRelationship - semantic relationship
Returns:
true if the given relationship is inside the semantic element of the host, false otherwise.

isCollapsedEditPart

protected boolean isCollapsedEditPart(EditPart ep)
Return true if the given editpartt is collpased, false otherwise.


getHostSemanticElement

protected EObject getHostSemanticElement()
Return the semantic element for the host of this editpolicy.

Returns:

getEditPartFor

protected EditPart getEditPartFor(View view)
Find editpart from semantic model element.


getEditPartFor

protected EditPart getEditPartFor(EObject semanticElement)
Find editpart from semantic model element.


getConnectionView

protected View getConnectionView(Relationship semanticRelation)
Find the view object for the given relationship semantic element.


getAncestor

protected EObject getAncestor(EObject modelElement)
Get ancestor of given semantic element. The ancestor is the top level child of ApplicationModel.

Parameters:
modelElement - semantic element.
Returns:
the top level child of ApplicationModel which is the ancestor of the given semantic element.

getDiagram

protected Diagram getDiagram()
Return the diagram object.


createAggregatedConnectionCommand

protected Command createAggregatedConnectionCommand(EditPart sourceEditPart,
                                                    EditPart targetEditPart)
Create command for aggregated connection.

Parameters:
sourceEditPart - editpart for source view
targetEditPart - editpart for target view

getSemanticElementToViewRegistry

protected ISemanticElementToViewRegistry getSemanticElementToViewRegistry()
Helper to get SemanticElementToViewRegistry.


setSemanticElementToViewRegistry

protected void setSemanticElementToViewRegistry(ISemanticElementToViewRegistry semanticElementToViewRegistry)
Helper to set SemanticElementToViewRegistry.


getApplicationModel

protected ApplicationModel getApplicationModel()
Get ApplicationModel.


getExistDirectConnection

protected EObject getExistDirectConnection(EObject relationship,
                                           Collection containedConnections)
Get the exist direct connection for given relationship in contained connections.

Parameters:
relationship - relationship to be checked
containedConnections - collection of existing contained connections
Returns:
the exist connection if found, null otherwise.

computeLinksFromSemanticModel

protected Collection<Relationship> computeLinksFromSemanticModel()
Compute all links from semantic model which conforms to current model filter.

Parameters:
myLinkDescriptors -

isRelatedSemanticRelationship

protected boolean isRelatedSemanticRelationship(Relationship relation)
Check if the given Relationship semantic element is related with the host.


getOwningCollapsableEditPart

protected ICollapsableEditPart getOwningCollapsableEditPart(EditPart ep)
Gets the collapsable edipart ancestor for a given editpart.

Parameters:
ep - edit part
Returns:
ShapeCompartmentEditPart

deactivate

public void deactivate()

getSemanticConnectionsList

protected List getSemanticConnectionsList()

getSourceElement

protected EObject getSourceElement(EObject relationship)

getTargetElement

protected EObject getTargetElement(EObject relationship)

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.