Package org.eclipse.graphiti.pattern
Class AbstractConnectionPattern
- java.lang.Object
-
- org.eclipse.graphiti.pattern.AbstractBasePattern
-
- org.eclipse.graphiti.pattern.AbstractConnectionPattern
-
- All Implemented Interfaces:
IFeatureProviderHolder,IAdd,ICreateConnection,ICreateInfo,IConnectionPattern
public abstract class AbstractConnectionPattern extends AbstractBasePattern implements IConnectionPattern
This is the base class AbstractConnectionPattern that clients writing a pattern for a connection domain object should subclass.
-
-
Constructor Summary
Constructors Constructor Description AbstractConnectionPattern()Creates a newAbstractConnectionPattern.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConnectionaddGraphicalRepresentation(IConnectionContext context, java.lang.Object newObject)Adds the graphical representation of the given newObjectwith the information in the givenIConnectionContext.voidattachedToSource(ICreateConnectionContext context)Hook that is called by the Graphiti framework as soon as a new connection is attached to its source anchor.voidcanceledAttaching(ICreateConnectionContext context)Hook that is called by the Graphiti framework as soon as a connection creation is cancelled.booleancanCreate(ICreateConnectionContext context)Clients must override this method to indicate that the pattern can be used to create domain objects as defined in the givenICreateConnectionContext.booleancanStartConnection(ICreateConnectionContext context)Clients must override this method to indicate that the pattern can be used to create domain objects starting from what is defined in the givenICreateConnectionContext.Connectioncreate(ICreateConnectionContext context)Clients must override this method to implement the functionality to create a new connection domain object as defined in the givenICreateConnectionContext.voidendConnecting()Hook that is called by the Graphiti framework as soon as a new connection is ended.protected static AddConnectionContextgetAddConnectionContext(ICreateConnectionContext context)Creates a newAddConnectionContextsuitable for adding a connection for this pattern.java.lang.StringgetCreateDescription()Client should override to return a string description of the type of domain object that is created with this pattern.java.lang.StringgetCreateImageId()Client should override to return a string id of the the image icon for the domain object that is created with this pattern.java.lang.StringgetCreateLargeImageId()Client should override to return a string id of the the large image icon for the domain object that is created with this pattern.java.lang.StringgetCreateName()Client should override to return the name of the domain object that is created with this pattern.protected voidlayoutPictogramElement(PictogramElement pe)Helper method that triggers a layout of the givenPictogramElement.voidstartConnecting()Hook that is called by the Graphiti framework as soon as a new connection is started.protected voidupdatePictogramElement(PictogramElement pe)Helper method that triggers an update of the givenPictogramElement.-
Methods inherited from class org.eclipse.graphiti.pattern.AbstractBasePattern
add, canAdd, getBusinessObjectForPictogramElement, getDiagram, getDiagramBehavior, getFeatureProvider, getMappingProvider, link, link, manageColor, manageColor, manageFont, manageFont, setFeatureProvider
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.graphiti.pattern.IConnectionPattern
setFeatureProvider
-
-
-
-
Constructor Detail
-
AbstractConnectionPattern
public AbstractConnectionPattern()
Creates a newAbstractConnectionPattern.
-
-
Method Detail
-
getAddConnectionContext
protected static AddConnectionContext getAddConnectionContext(ICreateConnectionContext context)
Creates a newAddConnectionContextsuitable for adding a connection for this pattern. The default implementation simply takes the source and target anchors of the providedICreateConnectionContextand adds them to a newly createdAddConnectionContextobject.- Parameters:
context- The create connection context to be used as a basis for adding a connection.- Returns:
- The
AddConnectionContext.
-
canCreate
public boolean canCreate(ICreateConnectionContext context)
Clients must override this method to indicate that the pattern can be used to create domain objects as defined in the givenICreateConnectionContext. Corresponds to the methodICreateConnection.canCreate(ICreateConnectionContext). The default implementation simply returnsfalse.- Specified by:
canCreatein interfaceICreateConnection- Parameters:
context- The context holding information on the connection domain object to be created.- Returns:
truein case this pattern can create such a connection domain object,falseotherwise.
-
canStartConnection
public boolean canStartConnection(ICreateConnectionContext context)
Clients must override this method to indicate that the pattern can be used to create domain objects starting from what is defined in the givenICreateConnectionContext. Corresponds to the methodICreateConnection.canStartConnection(ICreateConnectionContext). The default implementation simply returnsfalse.- Specified by:
canStartConnectionin interfaceICreateConnection- Parameters:
context- The context holding information on the connection domain object to be created.- Returns:
truein case this pattern can create such a connection domain object,falseotherwise.
-
create
public Connection create(ICreateConnectionContext context)
Clients must override this method to implement the functionality to create a new connection domain object as defined in the givenICreateConnectionContext. Corresponds to the methodICreateConnection.create(ICreateConnectionContext). The default implementation simply does nothing and returnsnull.- Specified by:
createin interfaceICreateConnection- Parameters:
context- The context holding information on the connection domain object to be created.- Returns:
- The newly create
Connectionpictogram element.
-
addGraphicalRepresentation
protected Connection addGraphicalRepresentation(IConnectionContext context, java.lang.Object newObject)
Adds the graphical representation of the given newObjectwith the information in the givenIConnectionContext.- Parameters:
context- The connection context for the new objectnewObject- The new object instance itself- Returns:
- The
Connectionprictogram element instance created for the connection domain object.
-
layoutPictogramElement
protected void layoutPictogramElement(PictogramElement pe)
Helper method that triggers a layout of the givenPictogramElement. The default implementation queries the feature provider and tries to find a functionality either in the pattern of an additionalAbstractLayoutFeaturethat can handle the request and triggers the operation.- Parameters:
pe- The pictogram element to layout
-
updatePictogramElement
protected void updatePictogramElement(PictogramElement pe)
Helper method that triggers an update of the givenPictogramElement. The default implementation queries the feature provider and tries to find a functionality either in the pattern of an additionalAbstractUpdateFeaturethat can handle the request and triggers the operation.- Parameters:
pe- The pictogram element to update
-
getCreateDescription
public java.lang.String getCreateDescription()
Client should override to return a string description of the type of domain object that is created with this pattern. The Graphiti framework uses this information to fill a tooltip for the creation tool entry in the palette. The default implementation simply returnsnullwhich indicates that no tooltip shall be displayed.- Specified by:
getCreateDescriptionin interfaceICreateInfo- Returns:
- A
Stringholding the tooltip
-
getCreateImageId
public java.lang.String getCreateImageId()
Client should override to return a string id of the the image icon for the domain object that is created with this pattern. The Graphiti framework uses this information to add an icon to the creation tool entry in the palette. The default implementation simply returnsnullwhich indicates that no icon shall be displayed.- Specified by:
getCreateImageIdin interfaceICreateInfo- Returns:
- A
Stringholding the id of the icon as defined in the AbstractImageProvider.
-
getCreateLargeImageId
public java.lang.String getCreateLargeImageId()
Client should override to return a string id of the the large image icon for the domain object that is created with this pattern. The Graphiti framework uses this information to add a large icon to the creation tool entry in the palette. The default implementation simply returnsnullwhich indicates that no icon shall be displayed.- Specified by:
getCreateLargeImageIdin interfaceICreateInfo- Returns:
- A
Stringholding the id of the large icon as defined in the AbstractImageProvider.
-
getCreateName
public java.lang.String getCreateName()
Client should override to return the name of the domain object that is created with this pattern. The Graphiti framework uses this information to fill the text for the creation tool entry in the palette. The default implementation simply returnsnullwhich results in an empty entry in the palette.- Specified by:
getCreateNamein interfaceICreateInfo- Returns:
- A
Stringholding the name of the domain object.
-
startConnecting
public void startConnecting()
Hook that is called by the Graphiti framework as soon as a new connection is started. Corresponds to the methodAbstractCreateConnectionFeature.startConnecting(). The default implementation simply does nothing.- Specified by:
startConnectingin interfaceICreateConnection- Since:
- 0.9
-
endConnecting
public void endConnecting()
Hook that is called by the Graphiti framework as soon as a new connection is ended. Corresponds to the methodAbstractCreateConnectionFeature.endConnecting(). The default implementation simply does nothing.- Specified by:
endConnectingin interfaceICreateConnection- Since:
- 0.9
-
attachedToSource
public void attachedToSource(ICreateConnectionContext context)
Hook that is called by the Graphiti framework as soon as a new connection is attached to its source anchor. Corresponds to the methodAbstractCreateConnectionFeature.attachedToSource(ICreateConnectionContext). The default implementation simply does nothing.- Specified by:
attachedToSourcein interfaceICreateConnection- Parameters:
context- the context- Since:
- 0.9
-
canceledAttaching
public void canceledAttaching(ICreateConnectionContext context)
Hook that is called by the Graphiti framework as soon as a connection creation is cancelled. Corresponds to the methodAbstractCreateConnectionFeature.canceledAttaching(ICreateConnectionContext). The default implementation simply does nothing.- Specified by:
canceledAttachingin interfaceICreateConnection- Parameters:
context- the context- Since:
- 0.9
-
-