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 and Description
`AbstractConnectionPattern()` Creates a new `AbstractConnectionPattern`.

### Method Summary

All Methods Instance Methods Concrete Methods
`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` `canceledAttaching(ICreateConnectionContext context)` 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 given `ICreateConnectionContext`.
`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 given `ICreateConnectionContext`.
`Connection` `create(ICreateConnectionContext context)` Clients must override this method to implement the functionality to create a new connection domain object as defined in the given `ICreateConnectionContext`.
`void` `endConnecting()` Hook that is called by the Graphiti framework as soon as a new connection is ended.
`java.lang.String` `getCreateDescription()` Client should override to return a string description of the type of domain object that is created with this pattern.
`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.
`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.
`java.lang.String` `getCreateName()` Client should override to return the name of the domain object that is created with this pattern.
`void` `startConnecting()` Hook that is called by the Graphiti framework as soon as a new connection is started.

### Methods inherited from class org.eclipse.graphiti.pattern.AbstractBasePattern

`add, canAdd, getFeatureProvider, setFeatureProvider`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.graphiti.pattern.IConnectionPattern

`setFeatureProvider`

### Methods inherited from interface org.eclipse.graphiti.func.IAdd

`add, canAdd`

### Constructor Detail

#### AbstractConnectionPattern

    public AbstractConnectionPattern()

Creates a new `AbstractConnectionPattern`.

### Method Detail

#### 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 given `ICreateConnectionContext`. Corresponds to the method `ICreateConnection.canCreate(ICreateConnectionContext)` . The default implementation simply returns `false`.

Specified by:
  `canCreate` in interface `ICreateConnection`
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

    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 given `ICreateConnectionContext`. Corresponds to the method `ICreateConnection.canStartConnection(ICreateConnectionContext)` . The default implementation simply returns `false`.

Specified by:
  `canStartConnection` in interface `ICreateConnection`
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

    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 given `ICreateConnectionContext`. Corresponds to the method `ICreateConnection.create(ICreateConnectionContext)`. The default implementation simply does nothing and returns `null`.

Specified by:
  `create` in interface `ICreateConnection`
Parameters:
  `context` - The context holding information on the connection domain object to be created.
Returns:
  The newly create `Connection` pictogram element.

#### 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 returns `null` which indicates that no tooltip shall be displayed.

Specified by:
  `getCreateDescription` in interface `ICreateInfo`
Returns:
  A `String` holding 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 returns `null` which indicates that no icon shall be displayed.

Specified by:
  `getCreateImageId` in interface `ICreateInfo`
Returns:
  A `String` holding 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 returns `null` which indicates that no icon shall be displayed.

Specified by:
  `getCreateLargeImageId` in interface `ICreateInfo`
Returns:
  A `String` holding 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 returns `null` which results in an empty entry in the palette.

Specified by:
  `getCreateName` in interface `ICreateInfo`
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 method `AbstractCreateConnectionFeature.startConnecting()`. The default implementation simply does nothing.

Specified by:
  `startConnecting` in interface `ICreateConnection`
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 method `AbstractCreateConnectionFeature.endConnecting()`. The default implementation simply does nothing.

Specified by:
  `endConnecting` in interface `ICreateConnection`
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 method `AbstractCreateConnectionFeature.attachedToSource(ICreateConnectionContext)` . The default implementation simply does nothing.

Specified by:
  `attachedToSource` in interface `ICreateConnection`
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 method `AbstractCreateConnectionFeature.canceledAttaching(ICreateConnectionContext)` . The default implementation simply does nothing.

Specified by:
  `canceledAttaching` in interface `ICreateConnection`
Parameters:
  `context` - the context
Since:
  0.9