|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.graphiti.pattern.AbstractBasePattern
org.eclipse.graphiti.pattern.AbstractPattern
public abstract class AbstractPattern
The Class AbstractPattern.
Field Summary | |
---|---|
protected static String[] |
EMPTY_STRING_ARRAY
An empty string array used in direct editing. |
private IPatternConfiguration |
patternConfiguration
|
private IDeleteFeature |
wrappedDeleteFeature
To avoid code duplication, this base class uses a wrapped default implementation of an IDeleteFeature to provide the default
deletion behaviour. |
private IRemoveFeature |
wrappedRemoveFeature
To avoid code duplication, this base class uses a wrapped default implementation of an IRemoveFeature to provide the default
removal behavior. |
Fields inherited from interface org.eclipse.graphiti.func.ICreate |
---|
EMPTY |
Fields inherited from interface org.eclipse.graphiti.func.IDirectEditing |
---|
TYPE_CHECK, TYPE_COLOR, TYPE_DIALOG, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT |
Constructor Summary | |
---|---|
AbstractPattern(IPatternConfiguration patternConfiguration)
Creates a new AbstractPattern . |
Method Summary | |
---|---|
protected void |
addGraphicalRepresentation(IAreaContext context,
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 |
canDelete(IDeleteContext context)
Can delete. |
boolean |
canDirectEdit(IDirectEditingContext context)
Checks if the feature can perform direct editing on the context handed over. |
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 |
canRemove(IRemoveContext context)
Checks if given object could be removed. |
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. |
String |
checkValueValid(String value,
IDirectEditingContext context)
This method will be called by clients many times to see if current value is valid and could be set. |
void |
completeInfo(IDirectEditingInfo info,
Object bo)
Complete the directEditing info. |
void |
completeInfo(IDirectEditingInfo info,
Object bo,
String keyProperty)
Complete the directEditing info. |
String |
completeValue(String value,
int caretPos,
String choosenValue,
IDirectEditingContext context)
Framework calls this method to let the feature calculate the new value. |
Object[] |
create(ICreateContext context)
Creates the business object for the given context. |
protected IDeleteFeature |
createDeleteFeature(IDeleteContext context)
Creates the IDeleteFeature instance that handles the deletion of
business objects and diagram elements. |
protected IRemoveFeature |
createRemoveFeature(IRemoveContext context)
Creates the IRemoveFeature instance that handles the removal of
diagram elements. |
void |
delete(IDeleteContext context)
Delete. |
private List<Anchor> |
getAnchors(ContainerShape containerShape)
|
String |
getCreateDescription()
Gets the create description. |
String |
getCreateImageId()
Gets the create image id. |
String |
getCreateLargeImageId()
Gets the create large image id. |
String |
getCreateName()
Gets the create name. |
int |
getEditingType()
Framework calls this method to decide which UI to show up. |
protected String |
getImage(IStructureMapping structureMapping,
PictogramLink link)
Gets the image. |
String |
getInitialValue(IDirectEditingContext context)
Provides the initial value for the opened text editing UI component. |
protected IPatternConfiguration |
getPatternConfiguration()
Gets the pattern configuration. |
String[] |
getPossibleValues(IDirectEditingContext context)
This value will be used if the cell editor is a combo box. |
IProposalSupport |
getProposalSupport()
The direct editing mode contains controls for code completion and the selection from a combo box. |
IResizeConfiguration |
getResizeConfiguration(IResizeShapeContext context)
Provides configuration object, which describes the resize behavior. |
protected String |
getText(IStructureMapping structureMapping,
PictogramLink link)
Gets the text. |
String[] |
getValueProposals(String value,
int caretPos,
IDirectEditingContext context)
This proposals will be used for the completion list of a simple text cell editor. |
protected void |
internalMove(IMoveShapeContext context)
Internal move. |
boolean |
isAutoCompletionEnabled()
Checks if auto completion is enabled. |
boolean |
isCompletionAvailable()
Checks if completion is available. |
abstract boolean |
isMainBusinessObjectApplicable(Object mainBusinessObject)
This method must be implemented by the pattern user. |
boolean |
isPaletteApplicable()
Determines whether the pattern supports the creation of new business objects from the palette. |
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. |
void |
postDelete(IDeleteContext context)
Post delete. |
protected void |
postMoveShape(IMoveShapeContext context)
Post move shape. |
void |
postRemove(IRemoveContext context)
called after remove call. |
void |
preDelete(IDeleteContext context)
Pre delete. |
protected void |
preMoveShape(IMoveShapeContext context)
Pre move shape. |
void |
preRemove(IRemoveContext context)
called prior to remove call. |
void |
remove(IRemoveContext context)
Remove the given object. |
void |
resizeShape(IResizeShapeContext context)
Resize shape. |
protected void |
setPatternConfiguration(IPatternConfiguration patternConfiguration)
Sets the pattern configuration. |
void |
setValue(String value,
IDirectEditingContext context)
Set the new value. |
boolean |
stretchFieldToFitText()
Stretch input field to fit its contents. |
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 |
---|
protected static final String[] EMPTY_STRING_ARRAY
private IPatternConfiguration patternConfiguration
private IDeleteFeature wrappedDeleteFeature
IDeleteFeature
to provide the default
deletion behaviour. Subclasses may decide to either override
createDeleteFeature(IDeleteContext)
to provide another
IDeleteFeature
implementation or override and extend the
individual IDelete
methods or return a IDeleteFeature
by
overriding the method
DefaultFeatureProviderWithPatterns.getDeleteFeature(IDeleteContext)
.
private IRemoveFeature wrappedRemoveFeature
IRemoveFeature
to provide the default
removal behavior. Subclasses may decide to either override
createRemoveFeature(IRemoveContext)
to provide another
IRemoveFeature
implementation or override and extend the
individual IRemove
methods or return a IRemoveFeature
by
overriding the method
DefaultFeatureProviderWithPatterns.getRemoveFeature(IRemoveContext)
.
Constructor Detail |
---|
public AbstractPattern(IPatternConfiguration patternConfiguration)
AbstractPattern
.
patternConfiguration
- the pattern configurationMethod Detail |
---|
public boolean isPaletteApplicable()
IPattern
false
will
suppress the creation of a palette item for this pattern.
isPaletteApplicable
in interface IPattern
true
if the pattern supports the ICreate
methods and a palette item should be generatedpublic boolean canCreate(ICreateContext context)
ICreate
canCreate
in interface ICreate
context
- the context
public boolean canLayout(ILayoutContext context)
ILayout
canLayout
in interface ILayout
context
- the context
public boolean canMoveShape(IMoveShapeContext context)
IMoveShape
canMoveShape
in interface IMoveShape
context
- the context
public boolean canResizeShape(IResizeShapeContext context)
IResizeShape
canResizeShape
in interface IResizeShape
context
- the context
public boolean canUpdate(IUpdateContext context)
IUpdate
canUpdate
in interface IUpdate
context
- the context
public Object[] create(ICreateContext context)
ICreate
create
in interface ICreate
context
- the context
public String getCreateDescription()
IPattern
getCreateDescription
in interface ICreateInfo
getCreateDescription
in interface IPattern
public String getCreateImageId()
ICreateInfo
getCreateImageId
in interface ICreateInfo
public String getCreateLargeImageId()
ICreateInfo
getCreateLargeImageId
in interface ICreateInfo
public String getCreateName()
IPattern
getCreateName
in interface ICreateInfo
getCreateName
in interface IPattern
public abstract boolean isMainBusinessObjectApplicable(Object mainBusinessObject)
IPattern
isMainBusinessObjectApplicable
in interface IPattern
mainBusinessObject
- the main business object
public boolean layout(ILayoutContext context)
ILayout
layout
in interface ILayout
context
- the context
public final void moveShape(IMoveShapeContext context)
IMoveShape
moveShape
in interface IMoveShape
context
- the contextprotected void postMoveShape(IMoveShapeContext context)
context
- the move shape contextprotected void preMoveShape(IMoveShapeContext context)
context
- the move shape contextprotected void internalMove(IMoveShapeContext context)
context
- the move shape contextprotected void moveAllBendpoints(IMoveShapeContext context)
context
- the move shape contextprivate List<Anchor> getAnchors(ContainerShape containerShape)
public void resizeShape(IResizeShapeContext context)
IResizeShape
resizeShape
in interface IResizeShape
context
- the contextpublic boolean update(IUpdateContext context)
IUpdate
update
in interface IUpdate
context
- the context
public IReason updateNeeded(IUpdateContext context)
IUpdate
updateNeeded
in interface IUpdate
context
- the context
protected void addGraphicalRepresentation(IAreaContext context, Object newObject)
context
- the area contextnewObject
- the new objectprotected boolean avoidNegativeCoordinates()
protected String getImage(IStructureMapping structureMapping, PictogramLink link)
structureMapping
- the structure mappinglink
- the pictogram link
protected String getText(IStructureMapping structureMapping, PictogramLink link)
structureMapping
- the structure mappinglink
- the pictogram link
protected abstract boolean isPatternControlled(PictogramElement pictogramElement)
pictogramElement
- the pictogram element
protected abstract boolean isPatternRoot(PictogramElement pictogramElement)
pictogramElement
- the pictogram element
protected void layoutPictogramElement(PictogramElement pe)
pe
- the pictogram elementprotected void updatePictogramElement(PictogramElement pe)
pe
- the pictogram elementprotected void setPatternConfiguration(IPatternConfiguration patternConfiguration)
patternConfiguration
- the new patternConfigurationprotected IPatternConfiguration getPatternConfiguration()
public void completeInfo(IDirectEditingInfo info, Object bo)
IPattern
completeInfo
in interface IPattern
info
- the directEditing infobo
- the business objectpublic void completeInfo(IDirectEditingInfo info, Object bo, String keyProperty)
IPattern
completeInfo
in interface IPattern
info
- the directEditing infobo
- the business objectkeyProperty
- the key propertypublic IResizeConfiguration getResizeConfiguration(IResizeShapeContext context)
IPattern
getResizeConfiguration
in interface IPattern
context
- the resizing context
protected IDeleteFeature createDeleteFeature(IDeleteContext context)
IDeleteFeature
instance that handles the deletion of
business objects and diagram elements. The default implementation just
creates a DefaultDeleteFeature
. Concrete pattern implementations
may either override this method to provide their own subclass of
DefaultDeleteFeature
or override and extend the individual
methods provided by IDelete
.
context
- the deletion context
IDeleteFeature
instance to use for this patterncanDelete(IDeleteContext)
,
preDelete(IDeleteContext)
,
delete(IDeleteContext)
,
postDelete(IDeleteContext)
public boolean canDelete(IDeleteContext context)
IDelete
canDelete
in interface IDelete
context
- the context
public void preDelete(IDeleteContext context)
IDelete
preDelete
in interface IDelete
context
- the contextpublic void delete(IDeleteContext context)
IDelete
delete
in interface IDelete
context
- the contextpublic void postDelete(IDeleteContext context)
IDelete
postDelete
in interface IDelete
context
- the contextprotected IRemoveFeature createRemoveFeature(IRemoveContext context)
IRemoveFeature
instance that handles the removal of
diagram elements. The default implementation just creates a
DefaultRemoveFeature
. Concrete pattern implementations may either
override this method to provide their own subclass of
DefaultRemoveFeature
or override and extend the individual
methods provided by IRemove
.
context
- the removal context
IRemoveFeature
instance to use for this patterncanRemove(IRemoveContext)
,
preRemove(IRemoveContext)
,
remove(IRemoveContext)
,
postRemove(IRemoveContext)
public boolean canRemove(IRemoveContext context)
IRemove
canRemove
in interface IRemove
context
- contains object to remove
public void preRemove(IRemoveContext context)
IRemove
preRemove
in interface IRemove
context
- the contextpublic void remove(IRemoveContext context)
IRemove
remove
in interface IRemove
context
- contains object to removepublic void postRemove(IRemoveContext context)
IRemove
postRemove
in interface IRemove
context
- the contextpublic boolean canDirectEdit(IDirectEditingContext context)
IDirectEditing
canDirectEdit
in interface IDirectEditing
context
- the context
IFeature.canExecute(org.eclipse.graphiti.features.context.IContext)
public String checkValueValid(String value, IDirectEditingContext context)
IDirectEditing
checkValueValid
in interface IDirectEditing
value
- the valuecontext
- the context
public String completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context)
IDirectEditing
completeValue
in interface IDirectEditing
value
- current valuecaretPos
- current cursor positionchoosenValue
- value choosen by usercontext
- the context
public String[] getPossibleValues(IDirectEditingContext context)
IDirectEditing
getPossibleValues
in interface IDirectEditing
context
- the context
public String[] getValueProposals(String value, int caretPos, IDirectEditingContext context)
IDirectEditing
getValueProposals
in interface IDirectEditing
value
- current valuecaretPos
- current cursor positioncontext
- the context
public boolean isAutoCompletionEnabled()
IDirectEditing
isAutoCompletionEnabled
in interface IDirectEditing
public boolean isCompletionAvailable()
IDirectEditing
isCompletionAvailable
in interface IDirectEditing
public boolean stretchFieldToFitText()
IDirectEditing
stretchFieldToFitText
in interface IDirectEditing
public int getEditingType()
IDirectEditing
getEditingType
in interface IDirectEditing
public String getInitialValue(IDirectEditingContext context)
IDirectEditing
getInitialValue
in interface IDirectEditing
context
- the context
public void setValue(String value, IDirectEditingContext context)
IDirectEditing
setValue
in interface IDirectEditing
value
- the valuecontext
- the contextpublic IProposalSupport getProposalSupport()
IDirectEditing
If the customer wants to work with Objects he must provide an
implementation of IProposalSupport
. In this case the following
methods of IDirectEditing
are ignored:
* String checkValueValid(String value, IDirectEditingContext context);
* String completeValue(String value, int caretPosition, String choosenValue, IDirectEditingContext context);
* String[] getPossibleValues(IDirectEditingContext context);
* String[] getValueProposals(String value, int caretPosition, IDirectEditingContext context);
* void setValue(String value, IDirectEditingContext context);
getProposalSupport
in interface IDirectEditing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |