org.eclipse.graphiti.pattern
Class AbstractPattern

java.lang.Object
  extended by org.eclipse.graphiti.pattern.AbstractBasePattern
      extended by org.eclipse.graphiti.pattern.AbstractPattern
All Implemented Interfaces:
IFeatureProviderHolder, IAdd, ICreate, ICreateInfo, ILayout, IMoveShape, IResizeShape, IUpdate, IPattern

public abstract class AbstractPattern
extends AbstractBasePattern
implements IPattern

The Class AbstractPattern.


Field Summary
private  IPatternConfiguration patternConfiguration
           
 
Fields inherited from interface org.eclipse.graphiti.func.ICreate
EMPTY
 
Constructor Summary
AbstractPattern(IPatternConfiguration patternConfiguration)
          Creates a new AbstractPattern.
 
Method Summary
protected  void addGraphicalRepresentation(IAreaContext context, java.lang.Object newObject)
          Adds the graphical representation.
protected  boolean avoidNegativeCoordinates()
           
 boolean canCreate(ICreateContext context)
          Checks if business object can be created for the given context.
 boolean canLayout(ILayoutContext context)
          Checks whether the current pictogram element of the given context can be layouted.
 boolean canMoveShape(IMoveShapeContext context)
          Can move shape.
 boolean canResizeShape(IResizeShapeContext context)
          Can resize shape.
 boolean canUpdate(IUpdateContext context)
          Checks whether the values of the current pictogram element of the given context can be updated.
 void completeInfo(IDirectEditingInfo info, java.lang.Object bo)
          Complete the directEditing info.
 void completeInfo(IDirectEditingInfo info, java.lang.Object bo, java.lang.String keyProperty)
          Complete the directEditing info.
 java.lang.Object[] create(ICreateContext context)
          Creates the business object for the given context.
private  java.util.List<Anchor> getAnchors(ContainerShape containerShape)
           
 java.lang.String getCreateDescription()
          Gets the create description.
 java.lang.String getCreateImageId()
          Gets the create image id.
 java.lang.String getCreateLargeImageId()
          Gets the create large image id.
 java.lang.String getCreateName()
          Gets the create name.
protected  java.lang.String getImage(IStructureMapping structureMapping, PictogramLink link)
          Gets the image.
protected  IPatternConfiguration getPatternConfiguration()
          Gets the pattern configuration.
 IResizeConfiguration getResizeConfiguration()
          Provides configuration object, which describes the resize behavior.
protected  java.lang.String getText(IStructureMapping structureMapping, PictogramLink link)
          Gets the text.
protected  void internalMove(IMoveShapeContext context)
          Internal move.
abstract  boolean isMainBusinessObjectApplicable(java.lang.Object mainBusinessObject)
          This method must be implemented by the pattern user.
protected abstract  boolean isPatternControlled(PictogramElement pictogramElement)
          This method must be implemented by the pattern developer / provider.
protected abstract  boolean isPatternRoot(PictogramElement pictogramElement)
          This method must be implemented by the pattern developer / provider.
 boolean layout(ILayoutContext context)
          Layoutes the pictogram element.
protected  void layoutPictogramElement(PictogramElement pe)
          Layout pictogram element.
protected  void moveAllBendpoints(IMoveShapeContext context)
          Move all bendpoints within a container shape.
 void moveShape(IMoveShapeContext context)
          Move shape.
protected  void postMoveShape(IMoveShapeContext context)
          Post move shape.
protected  void preMoveShape(IMoveShapeContext context)
          Pre move shape.
 void resizeShape(IResizeShapeContext context)
          Resize shape.
protected  void setPatternConfiguration(IPatternConfiguration patternConfiguration)
          Sets the pattern configuration.
 boolean update(IUpdateContext context)
          Updates the pictogram element.
 IReason updateNeeded(IUpdateContext context)
          Check whether the values in the pictogram element are up to date, that means whether the graphics algorithm of this pictogram element contain the latest values from the business objects.
protected  void updatePictogramElement(PictogramElement pe)
          Update pictogram element.
 
Methods inherited from class org.eclipse.graphiti.pattern.AbstractBasePattern
add, canAdd, getBusinessObjectForPictogramElement, getDiagram, getDiagramEditor, getFeatureProvider, getMappingProvider, link, link, manageColor, manageColor, 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.IPattern
add, canAdd, setFeatureProvider
 

Field Detail

patternConfiguration

private IPatternConfiguration patternConfiguration
Constructor Detail

AbstractPattern

public AbstractPattern(IPatternConfiguration patternConfiguration)
Creates a new AbstractPattern.

Parameters:
patternConfiguration - the pattern configuration
Method Detail

canCreate

public boolean canCreate(ICreateContext context)
Description copied from interface: ICreate
Checks if business object can be created for the given context.

Specified by:
canCreate in interface ICreate
Parameters:
context - the context
Returns:
true if create is possible.

canLayout

public boolean canLayout(ILayoutContext context)
Description copied from interface: ILayout
Checks whether the current pictogram element of the given context can be layouted.

Specified by:
canLayout in interface ILayout
Parameters:
context - the context
Returns:
true if update is possible

canMoveShape

public boolean canMoveShape(IMoveShapeContext context)
Description copied from interface: IMoveShape
Can move shape.

Specified by:
canMoveShape in interface IMoveShape
Parameters:
context - the context
Returns:
true, if successful

canResizeShape

public boolean canResizeShape(IResizeShapeContext context)
Description copied from interface: IResizeShape
Can resize shape.

Specified by:
canResizeShape in interface IResizeShape
Parameters:
context - the context
Returns:
true, if successful

canUpdate

public boolean canUpdate(IUpdateContext context)
Description copied from interface: IUpdate
Checks whether the values of the current pictogram element of the given context can be updated.

Specified by:
canUpdate in interface IUpdate
Parameters:
context - the context
Returns:
true if update is possible

create

public java.lang.Object[] create(ICreateContext context)
Description copied from interface: ICreate
Creates the business object for the given context.

Specified by:
create in interface ICreate
Parameters:
context - the context
Returns:
the newly created objects

getCreateDescription

public java.lang.String getCreateDescription()
Description copied from interface: IPattern
Gets the create description.

Specified by:
getCreateDescription in interface ICreateInfo
Specified by:
getCreateDescription in interface IPattern
Returns:
description for UI representation

getCreateImageId

public java.lang.String getCreateImageId()
Description copied from interface: ICreateInfo
Gets the create image id.

Specified by:
getCreateImageId in interface ICreateInfo
Returns:
image for UI representation

getCreateLargeImageId

public java.lang.String getCreateLargeImageId()
Description copied from interface: ICreateInfo
Gets the create large image id.

Specified by:
getCreateLargeImageId in interface ICreateInfo
Returns:
large image for UI representation

getCreateName

public java.lang.String getCreateName()
Description copied from interface: IPattern
Gets the create name.

Specified by:
getCreateName in interface ICreateInfo
Specified by:
getCreateName in interface IPattern
Returns:
name for UI representation

isMainBusinessObjectApplicable

public abstract boolean isMainBusinessObjectApplicable(java.lang.Object mainBusinessObject)
Description copied from interface: IPattern
This method must be implemented by the pattern user. The main pictogram element of the pattern is linked with the main business object.

Specified by:
isMainBusinessObjectApplicable in interface IPattern
Parameters:
mainBusinessObject - the main business object
Returns:
True, if this pattern is responsible for the main business object

layout

public boolean layout(ILayoutContext context)
Description copied from interface: ILayout
Layoutes the pictogram element.

Specified by:
layout in interface ILayout
Parameters:
context - the context
Returns:
true, if update process was successfull

moveShape

public final void moveShape(IMoveShapeContext context)
Description copied from interface: IMoveShape
Move shape.

Specified by:
moveShape in interface IMoveShape
Parameters:
context - the context

postMoveShape

protected void postMoveShape(IMoveShapeContext context)
Post move shape.

Parameters:
context - the move shape context

preMoveShape

protected void preMoveShape(IMoveShapeContext context)
Pre move shape.

Parameters:
context - the move shape context

internalMove

protected void internalMove(IMoveShapeContext context)
Internal move.

Parameters:
context - the move shape context

moveAllBendpoints

protected void moveAllBendpoints(IMoveShapeContext context)
Move all bendpoints within a container shape.

Parameters:
context - the move shape context

getAnchors

private java.util.List<Anchor> getAnchors(ContainerShape containerShape)

resizeShape

public void resizeShape(IResizeShapeContext context)
Description copied from interface: IResizeShape
Resize shape.

Specified by:
resizeShape in interface IResizeShape
Parameters:
context - the context

update

public boolean update(IUpdateContext context)
Description copied from interface: IUpdate
Updates the pictogram element. It copies the latest values from the business model to the graphics algorithm of this pictogram elements.

Specified by:
update in interface IUpdate
Parameters:
context - the context
Returns:
true, if update process was successfull

updateNeeded

public IReason updateNeeded(IUpdateContext context)
Description copied from interface: IUpdate
Check whether the values in the pictogram element are up to date, that means whether the graphics algorithm of this pictogram element contain the latest values from the business objects.

Specified by:
updateNeeded in interface IUpdate
Parameters:
context - the context
Returns:
true if parts of the pictogram model needs to be updated with the latest values from the business model

addGraphicalRepresentation

protected void addGraphicalRepresentation(IAreaContext context,
                                          java.lang.Object newObject)
Adds the graphical representation.

Parameters:
context - the area context
newObject - the new object

avoidNegativeCoordinates

protected boolean avoidNegativeCoordinates()
Returns:
true if moving to negative coordinates should not be possible

getImage

protected java.lang.String getImage(IStructureMapping structureMapping,
                                    PictogramLink link)
Gets the image.

Parameters:
structureMapping - the structure mapping
link - the pictogram link
Returns:
the image

getText

protected java.lang.String getText(IStructureMapping structureMapping,
                                   PictogramLink link)
Gets the text.

Parameters:
structureMapping - the structure mapping
link - the pictogram link
Returns:
the text

isPatternControlled

protected abstract boolean isPatternControlled(PictogramElement pictogramElement)
This method must be implemented by the pattern developer / provider.

Parameters:
pictogramElement - the pictogram element
Returns:
true, if is pattern controlled

isPatternRoot

protected abstract boolean isPatternRoot(PictogramElement pictogramElement)
This method must be implemented by the pattern developer / provider.

Parameters:
pictogramElement - the pictogram element
Returns:
true, if is pattern root

layoutPictogramElement

protected void layoutPictogramElement(PictogramElement pe)
Layout pictogram element.

Parameters:
pe - the pictogram element

updatePictogramElement

protected void updatePictogramElement(PictogramElement pe)
Update pictogram element.

Parameters:
pe - the pictogram element

setPatternConfiguration

protected void setPatternConfiguration(IPatternConfiguration patternConfiguration)
Sets the pattern configuration.

Parameters:
patternConfiguration - the new patternConfiguration

getPatternConfiguration

protected IPatternConfiguration getPatternConfiguration()
Gets the pattern configuration.

Returns:
the patternConfiguration

completeInfo

public void completeInfo(IDirectEditingInfo info,
                         java.lang.Object bo)
Description copied from interface: IPattern
Complete the directEditing info. This information is needed to switch automatically into the direct editing mode. (e.g. after creation of a new object)

Specified by:
completeInfo in interface IPattern
Parameters:
info - the directEditing info
bo - the business object

completeInfo

public void completeInfo(IDirectEditingInfo info,
                         java.lang.Object bo,
                         java.lang.String keyProperty)
Description copied from interface: IPattern
Complete the directEditing info. This information is needed to switch automatically into the direct editing mode. (e.g. after creation of a new object)

Specified by:
completeInfo in interface IPattern
Parameters:
info - the directEditing info
bo - the business object
keyProperty - the key property

getResizeConfiguration

public IResizeConfiguration getResizeConfiguration()
Description copied from interface: IPattern
Provides configuration object, which describes the resize behavior.

Specified by:
getResizeConfiguration in interface IPattern
Returns:
the resize configuration object


Copyright (c) SAP AG 2005, 2010.