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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Connection
addGraphicalRepresentation
(IConnectionContext context, Object newObject) Adds the graphical representation of the given newObject
with the information in the givenIConnectionContext
.void
attachedToSource
(ICreateConnectionContext context) Hook that is called by the Graphiti framework as soon as a new connection is attached to its source anchor.void
Hook that is called by the Graphiti framework as soon as a connection creation is cancelled.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
.boolean
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
.create
(ICreateConnectionContext context) Clients must override this method to implement the functionality to create a new connection domain object as defined in the givenICreateConnectionContext
.void
Hook that is called by the Graphiti framework as soon as a new connection is ended.protected static AddConnectionContext
Creates a newAddConnectionContext
suitable for adding a connection for this pattern.Client should override to return a string description of the type of domain object that is created with this pattern.Client should override to return a string id of the the image icon for the domain object that is created with this pattern.Client should override to return a string id of the the large image icon for the domain object that is created with this pattern.Client should override to return the name of the domain object that is created with this pattern.protected void
Helper method that triggers a layout of the givenPictogramElement
.void
Hook that is called by the Graphiti framework as soon as a new connection is started.protected void
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 Details
-
AbstractConnectionPattern
public AbstractConnectionPattern()Creates a newAbstractConnectionPattern
.
-
-
Method Details
-
getAddConnectionContext
Creates a newAddConnectionContext
suitable for adding a connection for this pattern. The default implementation simply takes the source and target anchors of the providedICreateConnectionContext
and adds them to a newly createdAddConnectionContext
object.- Parameters:
context
- The create connection context to be used as a basis for adding a connection.- Returns:
- The
AddConnectionContext
.
-
canCreate
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:
canCreate
in interfaceICreateConnection
- Parameters:
context
- The context holding information on the connection domain object to be created.- Returns:
true
in case this pattern can create such a connection domain object,false
otherwise.
-
canStartConnection
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:
canStartConnection
in interfaceICreateConnection
- Parameters:
context
- The context holding information on the connection domain object to be created.- Returns:
true
in case this pattern can create such a connection domain object,false
otherwise.
-
create
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:
create
in interfaceICreateConnection
- Parameters:
context
- The context holding information on the connection domain object to be created.- Returns:
- The newly create
Connection
pictogram element.
-
addGraphicalRepresentation
Adds the graphical representation of the given newObject
with the information in the givenIConnectionContext
.- Parameters:
context
- The connection context for the new objectnewObject
- The new object instance itself- Returns:
- The
Connection
prictogram element instance created for the connection domain object.
-
layoutPictogramElement
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 additionalAbstractLayoutFeature
that can handle the request and triggers the operation.- Parameters:
pe
- The pictogram element to layout
-
updatePictogramElement
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 additionalAbstractUpdateFeature
that can handle the request and triggers the operation.- Parameters:
pe
- The pictogram element to update
-
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 returnsnull
which indicates that no tooltip shall be displayed.- Specified by:
getCreateDescription
in interfaceICreateInfo
- Returns:
- A
String
holding the tooltip
-
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 returnsnull
which indicates that no icon shall be displayed.- Specified by:
getCreateImageId
in interfaceICreateInfo
- Returns:
- A
String
holding the id of the icon as defined in the AbstractImageProvider.
-
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 returnsnull
which indicates that no icon shall be displayed.- Specified by:
getCreateLargeImageId
in interfaceICreateInfo
- Returns:
- A
String
holding the id of the large icon as defined in the AbstractImageProvider.
-
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 returnsnull
which results in an empty entry in the palette.- Specified by:
getCreateName
in interfaceICreateInfo
- Returns:
- A
String
holding 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:
startConnecting
in 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:
endConnecting
in interfaceICreateConnection
- Since:
- 0.9
-
attachedToSource
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:
attachedToSource
in interfaceICreateConnection
- Parameters:
context
- the context- Since:
- 0.9
-
canceledAttaching
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:
canceledAttaching
in interfaceICreateConnection
- Parameters:
context
- the context- Since:
- 0.9
-