org.eclipse.graphiti.pattern.id
Class IdPattern

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

public abstract class IdPattern
extends TypedPattern
implements IPattern

Base class for ID patterns. The basic idea behind is to tag single parts of a pattern shape with IDs (using 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.

Since:
0.10

Field Summary
protected static String PROPERTY_KEY_ID
          The property key that is used to tag individual PictogramElements with a specific ID to identify them later during e.g.
protected static String PROPERTY_KEY_INDEX
          The property key that is used to tag individual PictogramElements with a specific index beyond the ID to identify them later during e.g.
protected static String PROPERTY_VALUE_PATTERN_TYPE_ID
          The property key that stores the information that a PictogramElement is the root object of a IdPattern subclass.
 
Fields inherited from class org.eclipse.graphiti.pattern.TypedPattern
PROPERTY_KEY_PATTERN_TYPE
 
Fields inherited from class org.eclipse.graphiti.pattern.AbstractPattern
EMPTY_STRING_ARRAY
 
Fields inherited from interface org.eclipse.graphiti.func.ICreate
EMPTY
 
Fields inherited from interface org.eclipse.graphiti.func.IDirectEditing
TYPE_CUSTOM, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT
 
Constructor Summary
IdPattern()
          Default constructor for a new IdPattern.
IdPattern(IPatternConfiguration patternConfiguration)
          Constructor taking some pattern configuration data for the created IdPattern.
 
Method Summary
 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).
protected  boolean canDirectEdit(IDirectEditingContext context, String id)
          Clients can override this method to indicate that the pattern allows direct editing for the shape described in the passed IDirectEditingContext holding the given ID.
 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.
 String checkValueValid(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.
protected  String checkValueValid(String value, IDirectEditingContext context, String id)
          This method will be called by the framework to check if the passed String is valid as new value for the shape.
protected abstract  PictogramElement doAdd(IAddContext context)
          Clients should primarily override this method and implement their add functionality here.
protected  PropertyContainer findById(PictogramElement pictogramElement, String idToFind)
          Searches for a PictogramElement that has the given ID starting from the given PictogramElement.
private  PropertyContainer findByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, String idToFind)
           
 int getEditingType()
          The Graphiti framework calls this method to decide which UI to show up for direct editing.
protected  String getId(PropertyContainer container)
          Returns any ID that has been set for the given PictogramElement; it can be any PropertyContainer, especially Shapes or GraphicsAlgorithms are allowed.
protected  int getIndex(PropertyContainer container)
          Returns any index that has been set for the given PictogramElement; it can be any PropertyContainer, especially Shapes or GraphicsAlgorithms are allowed.
 String getInitialValue(IDirectEditingContext context)
          Provides the initial value for display in the newly opened text editing UI component.
protected  String getInitialValue(IDirectEditingContext context, String id)
          Provides the initial value for display in the newly opened text editing UI component.
protected  boolean isPatternControlled(PictogramElement pictogramElement)
          Checks if the PictogramElement is controlled by the pattern.
protected  boolean isPatternRoot(PictogramElement pictogramElement)
          Checks if the given PictogramElement is the root object of this pattern.
protected abstract  boolean layout(IdLayoutContext context, String id)
          Clients should primarily override this method and implement their layout functionality here.
 boolean layout(ILayoutContext context)
          Layouts a PictogramElement representation given in the context.
protected  boolean layoutGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, IdLayoutContext context)
          This method implements the part of the layout that deals with the GraphicsAlgorithm children, see #layout(IdLayoutContext).
protected  void setId(PropertyContainer container, String id)
          Set the ID property (PROPERTY_KEY_ID) for the given PictogramElement; it can be any PropertyContainer ,especially Shapes or GraphicsAlgorithms are allowed.
protected  void setIndex(PropertyContainer container, int index)
          Set the index property (PROPERTY_KEY_ID) for the given PictogramElement; it can be any PropertyContainer ,especially Shapes or GraphicsAlgorithms are allowed.
 void setValue(String value, IDirectEditingContext context)
          Set the new value after direct editing is finished.
protected  void setValue(String value, IDirectEditingContext context, String id)
          Set the new value after direct editing is finished.
protected abstract  boolean update(IdUpdateContext context, String id)
          Clients should primarily override this method and implement their update functionality here.
 boolean update(IUpdateContext context)
          Updates a PictogramElement representation given in the context.
protected  boolean update(IUpdateContext context, boolean innerCall)
          Updates a PictogramElement representation given in the context recursively.
protected  boolean updateGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, IdUpdateContext context)
          This method implements the part of the update that deals with the GraphicsAlgorithm children, see update(IUpdateContext, boolean).
protected abstract  IReason updateNeeded(IdUpdateContext context, String id)
          Clients should primarily override this method and implement their update check functionality here.
 IReason updateNeeded(IUpdateContext context)
          Checks if an updates is needed for a PictogramElement representation given in the context.
protected  IReason updateNeededGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm, IdUpdateContext context)
          This method implements the part of the update needed check that deals with the GraphicsAlgorithm children, see updateNeeded(IUpdateContext).
 
Methods inherited from class org.eclipse.graphiti.pattern.TypedPattern
getPatternType, setPatternType
 
Methods inherited from class org.eclipse.graphiti.pattern.AbstractPattern
addGraphicalRepresentation, avoidNegativeCoordinates, canCreate, canDelete, canMoveShape, canRemove, canResizeShape, completeInfo, completeInfo, completeValue, create, createDeleteFeature, createRemoveFeature, delete, getCreateDescription, getCreateImageId, getCreateLargeImageId, getCreateName, getPatternConfiguration, getPossibleValues, getProposalSupport, getResizeConfiguration, getValueProposals, hasDoneChanges, internalMove, isAutoCompletionEnabled, isCompletionAvailable, isMainBusinessObjectApplicable, isPaletteApplicable, layoutPictogramElement, moveAllBendpoints, moveShape, postDelete, postMoveShape, postRemove, preDelete, preMoveShape, preRemove, remove, resizeShape, setPatternConfiguration, stretchFieldToFitText, updatePictogramElement
 
Methods inherited from class org.eclipse.graphiti.pattern.AbstractBasePattern
getBusinessObjectForPictogramElement, getDiagram, getDiagramBehavior, getDiagramEditor, 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.IPattern
completeInfo, completeInfo, getCreateDescription, getCreateName, getResizeConfiguration, hasDoneChanges, isMainBusinessObjectApplicable, isPaletteApplicable, setFeatureProvider
 
Methods inherited from interface org.eclipse.graphiti.func.ICreate
canCreate, create
 
Methods inherited from interface org.eclipse.graphiti.func.ICreateInfo
getCreateImageId, getCreateLargeImageId
 
Methods inherited from interface org.eclipse.graphiti.func.IDelete
canDelete, delete, postDelete, preDelete
 
Methods inherited from interface org.eclipse.graphiti.func.IRemove
canRemove, postRemove, preRemove, remove
 
Methods inherited from interface org.eclipse.graphiti.func.IResizeShape
canResizeShape, resizeShape
 
Methods inherited from interface org.eclipse.graphiti.func.IMoveShape
canMoveShape, moveShape
 
Methods inherited from interface org.eclipse.graphiti.func.IDirectEditing
completeValue, getPossibleValues, getProposalSupport, getValueProposals, isAutoCompletionEnabled, isCompletionAvailable, stretchFieldToFitText
 

Field Detail

PROPERTY_VALUE_PATTERN_TYPE_ID

protected static final String PROPERTY_VALUE_PATTERN_TYPE_ID
The property key that stores the information that a PictogramElement is the root object of a IdPattern subclass. The value is set by the add(IAddContext) method.

See Also:
Constant Field Values

PROPERTY_KEY_ID

protected static final String PROPERTY_KEY_ID
The property key that is used to tag individual PictogramElements with a specific ID to identify them later during e.g. update or layout.

See Also:
Constant Field Values

PROPERTY_KEY_INDEX

protected static final String PROPERTY_KEY_INDEX
The property key that is used to tag individual PictogramElements with a specific index beyond the ID to identify them later during e.g. update or layout. This can e.g. be used for lists of shapes like the attributes of a class.

See Also:
Constant Field Values
Constructor Detail

IdPattern

public IdPattern()
Default constructor for a new IdPattern. Clients should call either call this or the constructor using a IPatternConfiguration instance from their subclass constructor.


IdPattern

public IdPattern(IPatternConfiguration patternConfiguration)
Constructor taking some pattern configuration data for the created IdPattern. Clients should call either call this or the null parameter constructor from their subclass constructor.

Parameters:
patternConfiguration - The configuration data to use
Method Detail

isPatternControlled

protected boolean isPatternControlled(PictogramElement pictogramElement)
Checks if the PictogramElement is controlled by the pattern. The default implementation simply checks if the domain object linked to the given PictogramElement is the one that is controlled by this pattern, see AbstractPattern.isMainBusinessObjectApplicable(Object). Especially the default implementation does not traverse up the hierarchy to find a suitable parent.

Specified by:
isPatternControlled in class AbstractPattern
Parameters:
pictogramElement - The PictogramElement to check
Returns:
true in case the pattern controls the given PictogramElement, false otherwise.

isPatternRoot

protected boolean isPatternRoot(PictogramElement pictogramElement)
Checks if the given PictogramElement is the root object of this pattern. The default implementation checks if the domain object linked to the given PictogramElement is the one that is controlled by this pattern, see AbstractPattern.isMainBusinessObjectApplicable(Object). It also checks if the object is controlled by an ID pattern by checking the according property (TypedPattern.PROPERTY_KEY_PATTERN_TYPE).

Specified by:
isPatternRoot in class AbstractPattern
Parameters:
pictogramElement - The PictogramElement to check
Returns:
true in case the given PictogramElement is the root shape of this pattern, false otherwise.

setId

protected void setId(PropertyContainer container,
                     String id)
Set the ID property (PROPERTY_KEY_ID) for the given PictogramElement; it can be any PropertyContainer ,especially Shapes or GraphicsAlgorithms are allowed. The used ID string can later be used to identify the shape, e.g. in the update or layout methods.

Parameters:
container - The PictogramElement to set the ID property for
id - The String ID to set.

getId

protected String getId(PropertyContainer container)
Returns any ID that has been set for the given PictogramElement; it can be any PropertyContainer, especially Shapes or GraphicsAlgorithms are allowed.

Parameters:
container - The PictogramElement to get the ID property from
Returns:
A String representing the value of the property or null in case the property is not set, see setId(PropertyContainer, String).

findById

protected PropertyContainer findById(PictogramElement pictogramElement,
                                     String idToFind)
Searches for a PictogramElement that has the given ID starting from the given PictogramElement. First the given element is checked, then its GraphicsAlgorithm; after that the PictogramElement children are checked recursively and last the GraphicsAlgorithm children also recursively. The first PictogramElement that has the given ID is returned, in case none is found in the tree spanned by the given PictogramElement, null is returned.

Parameters:
pictogramElement - The PictogramElement at which the search shall start, any Shapes or GraphicsAlgorithms on top of this element are ignored.
idToFind - A String representing the ID to search for
Returns:
The PictogramElement that has the given ID property, in case none id found null.

findByIdInGraphicsAlgorithmChildren

private PropertyContainer findByIdInGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm,
                                                              String idToFind)

setIndex

protected void setIndex(PropertyContainer container,
                        int index)
Set the index property (PROPERTY_KEY_ID) for the given PictogramElement; it can be any PropertyContainer ,especially Shapes or GraphicsAlgorithms are allowed. The used index can later - together with the ID string - be used to identify the concrete shape in case of a list of shapes, e.g. in the update or layout methods.

Parameters:
container - The PictogramElement to set the index property for
id - The Integer index to set.

getIndex

protected int getIndex(PropertyContainer container)
Returns any index that has been set for the given PictogramElement; it can be any PropertyContainer, especially Shapes or GraphicsAlgorithms are allowed.

Parameters:
container - The PictogramElement to get the index property from
Returns:
An Integer representing the value of the property or -1 in case the property is not set, see setIndex(PropertyContainer, int).

canAdd

public boolean canAdd(IAddContext context)
Checks if adding is possible using this pattern in the given context. The default implementation simply checks if the new object passed in the context is the main domain object for the pattern, see AbstractPattern.isMainBusinessObjectApplicable(Object).

Specified by:
canAdd in interface IAdd
Specified by:
canAdd in interface IPattern
Overrides:
canAdd in class AbstractBasePattern
Parameters:
context - An IAddContext describing the add operation.
Returns:
true in case adding is possible, false otherwise.

add

public PictogramElement add(IAddContext context)
Adds a 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.

Specified by:
add in interface IAdd
Specified by:
add in interface IPattern
Overrides:
add in class AbstractBasePattern
Parameters:
context - An IAddContext describing the add operation.
Returns:
The root object of the created PictogramElement tree.

doAdd

protected abstract PictogramElement doAdd(IAddContext context)
Clients should primarily override this method and implement their add functionality here. This method is called from within add(IAddContext).

Parameters:
context - An IAddContext describing the add operation.
Returns:
The root object of the created PictogramElement tree.

canLayout

public boolean canLayout(ILayoutContext context)
Checks if layouting a shape is possible using this pattern in the given context. The default implementation simply checks if the object passed in the context is the main domain object for the pattern, see AbstractPattern.isMainBusinessObjectApplicable(Object) and if the PictogramElement given in the context is controlled by an ID pattern.

Specified by:
canLayout in interface ILayout
Overrides:
canLayout in class AbstractPattern
Parameters:
context - An ILayoutContext describing the layout operation.
Returns:
true in case layouting is possible, false otherwise.

layout

public boolean layout(ILayoutContext context)
Layouts a 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:

Specified by:
layout in interface ILayout
Overrides:
layout in class AbstractPattern
Parameters:
context - An ILayoutContext describing the layout operation.
Returns:
true in case the layout operation did changes to the diagram, false otherwise.

layoutGraphicsAlgorithmChildren

protected boolean layoutGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm,
                                                  IdLayoutContext context)
This method implements the part of the layout that deals with the GraphicsAlgorithm children, see #layout(IdLayoutContext). Clients should primarily override layout(IdLayoutContext, String) which is called for all found PictogramElements and GraphicsAlgorithms as described above that have an ID.

Parameters:
graphicsAlgorithm - The GraphicsAlgorithm to layout.
context - An ILayoutContext describing the layout operation.
Returns:
true in case the layout operation did changes to the diagram, false otherwise.

layout

protected abstract boolean layout(IdLayoutContext context,
                                  String id)
Clients should primarily override this method and implement their layout functionality here. This method is called from within layout(ILayoutContext) for each of the PictogramElements and GraphicsAlgorithms that have been tagged with an ID.

Parameters:
context - An IdLayoutContext describing the layout operation.
Returns:
true in case the layout operation did changes to the diagram, false otherwise.

canUpdate

public boolean canUpdate(IUpdateContext context)
Checks if updating a shape is possible using this pattern in the given context. The default implementation simply checks if the object passed in the context is the main domain object for the pattern, see AbstractPattern.isMainBusinessObjectApplicable(Object) and if the PictogramElement given in the context is controlled by an ID pattern.

Specified by:
canUpdate in interface IUpdate
Overrides:
canUpdate in class AbstractPattern
Parameters:
context - An IUpdateContext describing the update operation.
Returns:
true in case updating is possible, false otherwise.

updateNeeded

public IReason updateNeeded(IUpdateContext context)
Checks if an updates is needed for a 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:

Specified by:
updateNeeded in interface IUpdate
Overrides:
updateNeeded in class AbstractPattern
Parameters:
context - An IUpdateContext describing the update operation.
Returns:
An IReason indicating true and a String reason in case the update operation is needed, an IReason indicating false otherwise.

updateNeededGraphicsAlgorithmChildren

protected IReason updateNeededGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm,
                                                        IdUpdateContext context)
This method implements the part of the update needed check that deals with the GraphicsAlgorithm children, see updateNeeded(IUpdateContext). Clients should primarily override updateNeeded(IdUpdateContext, String) which is called for all found PictogramElements and GraphicsAlgorithms as described above that have an ID.

Parameters:
graphicsAlgorithm - The GraphicsAlgorithm to perform the update check for.
context - An IdUpdateContext describing the update operation.
Returns:
An IReason indicating true and a String reason in case the update operation is needed, an IReason indicating false otherwise.

updateNeeded

protected abstract IReason updateNeeded(IdUpdateContext context,
                                        String id)
Clients should primarily override this method and implement their update check functionality here. This method is called from within updateNeeded(IUpdateContext) for each of the PictogramElements and GraphicsAlgorithms that have been tagged with an ID.

Parameters:
context - An IdUpdateContext describing the update operation.
Returns:
An IReason indicating true and a String reason in case the update operation is needed, an IReason indicating false otherwise.

update

public boolean update(IUpdateContext context)
Updates a PictogramElement representation given in the context. The default implementation only delegates to update(IUpdateContext, boolean) setting the parameter innerCall to false.

Specified by:
update in interface IUpdate
Overrides:
update in class AbstractPattern
Parameters:
context - An IUpdateContext describing the update operation.
Returns:
true in case the update operation did changes to the diagram, false otherwise.

update

protected boolean update(IUpdateContext context,
                         boolean innerCall)
Updates a PictogramElement representation given in the context recursively. The default implementation delegates to update(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:

Parameters:
context - An IUpdateContext describing the update operation.
Returns:
true in case the update operation did changes to the diagram, false otherwise.

updateGraphicsAlgorithmChildren

protected boolean updateGraphicsAlgorithmChildren(GraphicsAlgorithm graphicsAlgorithm,
                                                  IdUpdateContext context)
This method implements the part of the update that deals with the GraphicsAlgorithm children, see update(IUpdateContext, boolean). Clients should primarily override update(IdUpdateContext, String) which is called for all found PictogramElements and GraphicsAlgorithms as described above that have an ID.

Parameters:
graphicsAlgorithm - The GraphicsAlgorithm to update.
context - An IdUpdateContext describing the update operation.
Returns:
true in case the update operation did changes to the diagram, false otherwise.

update

protected abstract boolean update(IdUpdateContext context,
                                  String id)
Clients should primarily override this method and implement their update functionality here. This method is called from within update(IUpdateContext, boolean) for each of the PictogramElements and GraphicsAlgorithms that have been tagged with an ID.

Parameters:
context - An IdUpdateContext describing the update operation.
Returns:
true in case the update operation did changes to the diagram, false otherwise.

getEditingType

public int getEditingType()
The Graphiti framework calls this method to decide which UI to show up for direct editing. Corresponds to the method IDirectEditing.getEditingType(). The default implementation return IDirectEditing.TYPE_NONE, other valid type are defined by the TYPE_* constants in IDirectEditing.

Specified by:
getEditingType in interface IDirectEditing
Overrides:
getEditingType in class AbstractPattern
Returns:
The desired editing type

canDirectEdit

public 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). 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).

Specified by:
canDirectEdit in interface IDirectEditing
Overrides:
canDirectEdit in class AbstractPattern
Parameters:
context - A context object describing the direct edit request.
Returns:
true in case direct editing shall be allowed, false otherwise.
See Also:
IFeature.canExecute(org.eclipse.graphiti.features.context.IContext)

canDirectEdit

protected boolean canDirectEdit(IDirectEditingContext context,
                                String id)
Clients can override this method to indicate that the pattern allows direct editing for the shape described in the passed IDirectEditingContext holding the given ID. Corresponds to the method AbstractDirectEditingFeature.canDirectEdit(IDirectEditingContext) . The default implementation simply returns false.

Parameters:
context - A context object describing the direct edit request.
id - The ID to check direct editing for
Returns:
true in case direct editing shall be allowed, false otherwise.

getInitialValue

public String getInitialValue(IDirectEditingContext context)
Provides the initial value for display in the newly opened text editing UI component. Corresponds to the method 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).

Specified by:
getInitialValue in interface IDirectEditing
Overrides:
getInitialValue in class AbstractPattern
Parameters:
context - A context object describing the direct edit request.
Returns:
The initial string value to be displayed for editing by the user.

getInitialValue

protected String getInitialValue(IDirectEditingContext context,
                                 String id)
Provides the initial value for display in the newly opened text editing UI component. Corresponds to the method IDirectEditing.getInitialValue(IDirectEditingContext) . The default implementation always returns an empty string.

Parameters:
context - A context object describing the direct edit request.
id - The ID of the shape to get the initial value for
Returns:
The initial string value to be displayed for editing by the user.

checkValueValid

public String checkValueValid(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. This method's response time should be small since the method is queried after each change of the value in the direct edit UI. In case of a not valid value, the returned string shall indicate the reason why the value is not valid. Corresponds to the method 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).

Specified by:
checkValueValid in interface IDirectEditing
Overrides:
checkValueValid in class AbstractPattern
Parameters:
value - The new value to check
context - A context object describing the direct edit request.
Returns:
null in case of a valid value, a string describing the reason for being not valid otherwise.

checkValueValid

protected String checkValueValid(String value,
                                 IDirectEditingContext context,
                                 String id)
This method will be called by the framework to check if the passed String is valid as new value for the shape. This method's response time should be small since the method is queried after each change of the value in the direct edit UI. The default implementation simply returns null to indicate that all values are valid. In case of a not valid value, the returned string shall indicate the reason why the value is not valid. Corresponds to the method AbstractDirectEditingFeature.checkValueValid(String, IDirectEditingContext) .

Parameters:
value - The new value to check
context - A context object describing the direct edit request.
id - The ID of the shape to check the value for
Returns:
null in case of a valid value, a string describing the reason for being not valid otherwise.

setValue

public void setValue(String value,
                     IDirectEditingContext context)
Set the new value after direct editing is finished. The value comes from the text editing UI component. Corresponds to the method 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).

Specified by:
setValue in interface IDirectEditing
Overrides:
setValue in class AbstractPattern
Parameters:
value - The new value to be set
context - A context object describing the direct edit request.

setValue

protected void setValue(String value,
                        IDirectEditingContext context,
                        String id)
Set the new value after direct editing is finished. The value comes from the text editing UI component. Corresponds to the method AbstractDirectEditingFeature.setValue(String, IDirectEditingContext) . The default implementation does nothing.

Parameters:
value - The new value to be set
context - A context object describing the direct edit request.
id - The ID of the shape to set the value for


Copyright (c) SAP AG 2005, 2012.