public abstract class IdPattern extends TypedPattern implements IPattern
Property objects). These IDs are used
to identify the parts of that shape and to call the update and layout methods
for the shapes with IDs. Clients do not need to search through the shape
hierarchy to find the shapes to update and layout.
Besides IDs this pattern base implementation also supports tagging
PictogramElements with an index property that allows to number a
sequence of children using the same ID, e.g. a list of attributes inside a
class.
TYPE_CUSTOM, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT| Constructor and Description |
|---|
IdPattern()
Default constructor for a new IdPattern.
|
IdPattern(IPatternConfiguration patternConfiguration)
Constructor taking some pattern configuration data for the created
IdPattern.
|
| Modifier and Type | Method and Description |
|---|---|
PictogramElement |
add(IAddContext context)
Adds a
PictogramElement representation for the given context to
the diagram. |
boolean |
canAdd(IAddContext context)
Checks if adding is possible using this pattern in the given context.
|
boolean |
canDirectEdit(IDirectEditingContext context)
Clients can override this method to indicate that the pattern allows
direct editing for the shape described in the passed
IDirectEditingContext, but the recommended method to override for
IdPattern is
canDirectEdit(IDirectEditingContext, String). |
boolean |
canLayout(ILayoutContext context)
Checks if layouting a shape is possible using this pattern in the given
context.
|
boolean |
canUpdate(IUpdateContext context)
Checks if updating a shape is possible using this pattern in the given
context.
|
java.lang.String |
checkValueValid(java.lang.String value,
IDirectEditingContext context)
This method will be called by the framework to check if the passed String
is valid as new value for the shape.
|
int |
getEditingType()
The Graphiti framework calls this method to decide which UI to show up
for direct editing.
|
java.lang.String |
getInitialValue(IDirectEditingContext context)
Provides the initial value for display in the newly opened text editing
UI component.
|
boolean |
layout(ILayoutContext context)
Layouts a
PictogramElement representation given in the context. |
void |
setValue(java.lang.String value,
IDirectEditingContext context)
Set the new value after direct editing is finished.
|
boolean |
update(IUpdateContext context)
Updates a
PictogramElement representation given in the context. |
IReason |
updateNeeded(IUpdateContext context)
Checks if an updates is needed for a
PictogramElement
representation given in the context. |
canCreate, canDelete, canMoveShape, canRemove, canResizeShape, completeInfo, completeInfo, completeValue, create, delete, getCreateDescription, getCreateImageId, getCreateLargeImageId, getCreateName, getPossibleValues, getProposalSupport, getResizeConfiguration, getValueProposals, hasDoneChanges, isAutoCompletionEnabled, isCompletionAvailable, isDeleteAbort, isMainBusinessObjectApplicable, isPaletteApplicable, isRemoveAbort, moveShape, postDelete, postRemove, preDelete, preRemove, remove, resizeShape, stretchFieldToFitTextgetFeatureProvider, setFeatureProviderequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompleteInfo, completeInfo, getCreateDescription, getCreateName, getResizeConfiguration, hasDoneChanges, isMainBusinessObjectApplicable, isPaletteApplicable, setFeatureProvidergetCreateImageId, getCreateLargeImageIdcanDelete, delete, isDeleteAbort, postDelete, preDeletecanRemove, isRemoveAbort, postRemove, preRemove, removecanResizeShape, resizeShapecanMoveShape, moveShapecompleteValue, getPossibleValues, getProposalSupport, getValueProposals, isAutoCompletionEnabled, isCompletionAvailable, stretchFieldToFitTextpublic IdPattern()
IPatternConfiguration instance
from their subclass constructor.public IdPattern(IPatternConfiguration patternConfiguration)
patternConfiguration - The configuration data to usepublic boolean canAdd(IAddContext context)
AbstractPattern.isMainBusinessObjectApplicable(Object).canAdd in interface IAddcanAdd in interface IPatterncanAdd in class AbstractBasePatterncontext - An IAddContext describing the add operation.true in case adding is possible, false
otherwise.public PictogramElement add(IAddContext context)
PictogramElement representation for the given context to
the diagram. The default implementation delegates to
doAdd(IAddContext) (which clients should primarily override) and
updates and layouts the returned PictogramElement afterwards.add in interface IAddadd in interface IPatternadd in class AbstractBasePatterncontext - An IAddContext describing the add operation.PictogramElement tree.public boolean canLayout(ILayoutContext context)
AbstractPattern.isMainBusinessObjectApplicable(Object) and if the
PictogramElement given in the context is controlled by an ID
pattern.canLayout in interface ILayoutcanLayout in class AbstractPatterncontext - An ILayoutContext describing the layout operation.true in case layouting is possible,
false otherwise.public boolean layout(ILayoutContext context)
PictogramElement representation given in the context.
The default implementation delegates to
layout(IdLayoutContext, String) (which clients should primarily
override) to actually update individual PictogramElements. This
delegation is done for any PictogramElement tagged with an ID in
the following order:
PictogramElement given in the context itselfGraphicsAlgorithm of the PictogramElement in the
contextPictogramElement children of the PictogramElement
in the contextGraphicsAlgorithm children of the
GraphicsAlgorithm of the PictogramElement in the context.
For this the method
layoutGraphicsAlgorithmChildren(GraphicsAlgorithm, IdLayoutContext)
is called which in term calles itself and this method recursively.layout in interface ILayoutlayout in class AbstractPatterncontext - An ILayoutContext describing the layout operation.true in case the layout operation did changes to the
diagram, false otherwise.public boolean canUpdate(IUpdateContext context)
AbstractPattern.isMainBusinessObjectApplicable(Object) and if the
PictogramElement given in the context is controlled by an ID
pattern.canUpdate in interface IUpdatecanUpdate in class AbstractPatterncontext - An IUpdateContext describing the update operation.true in case updating is possible,
false otherwise.public IReason updateNeeded(IUpdateContext context)
PictogramElement
representation given in the context. The default implementation delegates
to updateNeeded(IdUpdateContext, String) (which clients should
primarily override) to actually update individual
PictogramElements. This delegation is done for any
PictogramElement tagged with an ID in the following order:
PictogramElement given in the context itselfGraphicsAlgorithm of the PictogramElement in the
contextPictogramElement children of the PictogramElement
in the contextGraphicsAlgorithm children of the
GraphicsAlgorithm of the PictogramElement in the context.
For this the method
updateNeededGraphicsAlgorithmChildren(GraphicsAlgorithm, IdUpdateContext)
is called which in term calls itself and this method recursively.updateNeeded in interface IUpdateupdateNeeded in class AbstractPatterncontext - An IUpdateContext describing the update operation.IReason indicating true and a
String reason in case the update operation is needed, an
IReason indicating false otherwise.public boolean update(IUpdateContext context)
PictogramElement representation given in the context.
The default implementation only delegates to
update(IUpdateContext, boolean) setting the parameter innerCall
to false.update in interface IUpdateupdate in class AbstractPatterncontext - An IUpdateContext describing the update operation.true in case the update operation did changes to the
diagram, false otherwise.public int getEditingType()
IDirectEditing.getEditingType(). The default
implementation return IDirectEditing.TYPE_NONE, other valid type
are defined by the TYPE_* constants in IDirectEditing.getEditingType in interface IDirectEditinggetEditingType in class AbstractPatternpublic boolean canDirectEdit(IDirectEditingContext context)
IDirectEditingContext, but the recommended method to override for
IdPattern is
canDirectEdit(IDirectEditingContext, String). Corresponds to the
method
AbstractDirectEditingFeature.canDirectEdit(IDirectEditingContext)
. The default implementation checks if the pattern is responsible for the
shape and an ID is set; in that case it delegates to
canDirectEdit(IDirectEditingContext, String).canDirectEdit in interface IDirectEditingcanDirectEdit in class AbstractPatterncontext - A context object describing the direct edit request.true in case direct editing shall be allowed,
false otherwise.IFeature.canExecute(org.eclipse.graphiti.features.context.IContext)public java.lang.String getInitialValue(IDirectEditingContext context)
IDirectEditing.getInitialValue(IDirectEditingContext)
. The default implementation checks if the pattern is responsible for the
shape and an ID is set; in that case it delegates to
getInitialValue(IDirectEditingContext, String).getInitialValue in interface IDirectEditinggetInitialValue in class AbstractPatterncontext - A context object describing the direct edit request.public java.lang.String checkValueValid(java.lang.String value,
IDirectEditingContext context)
AbstractDirectEditingFeature.checkValueValid(String, IDirectEditingContext)
. The default implementation checks if the pattern is responsible for the
shape and an ID is set; in that case it delegates to
checkValueValid(String, IDirectEditingContext, String).checkValueValid in interface IDirectEditingcheckValueValid in class AbstractPatternvalue - The new value to checkcontext - A context object describing the direct edit request.null in case of a valid value, a string describing
the reason for being not valid otherwise.public void setValue(java.lang.String value,
IDirectEditingContext context)
AbstractDirectEditingFeature.setValue(String, IDirectEditingContext)
. The default implementation checks if the pattern is responsible for the
shape and an ID is set; in that case it delegates to
setValue(String, IDirectEditingContext, String).setValue in interface IDirectEditingsetValue in class AbstractPatternvalue - The new value to be setcontext - A context object describing the direct edit request.