Class AbstractDirectEditingFeature
java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
- All Implemented Interfaces:
IDirectEditingFeature,IFeature,IFeatureProviderHolder,IDirectEditing,IDescription,IName
- Direct Known Subclasses:
DirectEditingFeatureForPattern
public abstract class AbstractDirectEditingFeature
extends AbstractFeature
implements IDirectEditingFeature
The Class AbstractDirectEditingFeature.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String[]The Constant EMPTY_STRING_ARRAY.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDirectEdit(IDirectEditingContext context) Checks if the feature can perform direct editing on the context handed over.booleancanExecute(IContext context) Decides if the current feature can execute with the given context.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.completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context) Framework calls this method to let the feature calculate the new value.voidExecutes the current feature with the given context.getName()Gets the name.String[]getPossibleValues(IDirectEditingContext context) This value will be used if the cell editor is a combo box.The direct editing mode contains controls for code completion and the selection from a combo box.String[]getValueProposals(String value, int caretPos, IDirectEditingContext context) This proposals will be used for the completion list of a simple text cell editor.booleanReturns true only if the direct editing feature really has changed anything.booleanChecks if auto completion is enabled.booleanChecks if completion is available.voidsetValue(String value, IDirectEditingContext context) Set the new value.final voidCalled by the framework (@see DirectEditingFeatureCommandWithContext) to indicate that this direct editing feature execution has really changed something.booleanStretch input field to fit its contents.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramBehavior, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString, updatePictogramElementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.graphiti.IDescription
getDescriptionMethods inherited from interface org.eclipse.graphiti.func.IDirectEditing
getEditingType, getInitialValueMethods inherited from interface org.eclipse.graphiti.features.IFeature
canUndo, isAvailableMethods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Field Details
-
EMPTY_STRING_ARRAY
The Constant EMPTY_STRING_ARRAY.
-
-
Constructor Details
-
AbstractDirectEditingFeature
Creates a newAbstractDirectEditingFeature.- Parameters:
fp- the fp
-
-
Method Details
-
canExecute
Description copied from interface:IFeatureDecides if the current feature can execute with the given context.- Specified by:
canExecutein interfaceIFeature- Parameters:
context- this is the general input for this method- Returns:
- true if the feature can be executed, false if not
- See Also:
-
canDirectEdit
Description copied from interface:IDirectEditingChecks if the feature can perform direct editing on the context handed over.- Specified by:
canDirectEditin interfaceIDirectEditing- Parameters:
context- the context- Returns:
- This method is equivalent to
- See Also:
-
execute
Description copied from interface:IFeatureExecutes the current feature with the given context. -
hasDoneChanges
public boolean hasDoneChanges()Returns true only if the direct editing feature really has changed anything. This is indicated by the execution of the feature in the DirectEditingFeatureCommandWithContext.execute method.- Specified by:
hasDoneChangesin interfaceIFeature- Overrides:
hasDoneChangesin classAbstractFeature- Returns:
trueif the feature should appear in the undo stack,falseotherwise
-
setValueChanged
public final void setValueChanged()Called by the framework (@see DirectEditingFeatureCommandWithContext) to indicate that this direct editing feature execution has really changed something. Only in this case there should be an entry in the undo stack and the editor should get dirty. -
getPossibleValues
Description copied from interface:IDirectEditingThis value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN.- Specified by:
getPossibleValuesin interfaceIDirectEditing- Parameters:
context- the context- Returns:
- the possible values for the combo box.
-
getValueProposals
Description copied from interface:IDirectEditingThis proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.- Specified by:
getValueProposalsin interfaceIDirectEditing- Parameters:
value- current valuecaretPos- current cursor positioncontext- the context- Returns:
- the proposed values
-
checkValueValid
Description copied from interface:IDirectEditingThis method will be called by clients many times to see if current value is valid and could be set.- Specified by:
checkValueValidin interfaceIDirectEditing- Parameters:
value- the valuecontext- the context- Returns:
- null if value is okay and could be set; any text means value is not valid; text is reason for invalidality
-
completeValue
public String completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context) Description copied from interface:IDirectEditingFramework calls this method to let the feature calculate the new value.- Specified by:
completeValuein interfaceIDirectEditing- Parameters:
value- current valuecaretPos- current cursor positionchoosenValue- value choosen by usercontext- the context- Returns:
- the new value
-
stretchFieldToFitText
public boolean stretchFieldToFitText()Description copied from interface:IDirectEditingStretch input field to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY.- Specified by:
stretchFieldToFitTextin interfaceIDirectEditing- Returns:
- true if the field should exactly fit the contents
-
isAutoCompletionEnabled
public boolean isAutoCompletionEnabled()Description copied from interface:IDirectEditingChecks if auto completion is enabled. This functionality only applies to TYPE_TEXT.- Specified by:
isAutoCompletionEnabledin interfaceIDirectEditing- Returns:
- true, if proposals should appear automatically
-
isCompletionAvailable
public boolean isCompletionAvailable()Description copied from interface:IDirectEditingChecks if completion is available. This functionality only applies to TYPE_TEXT.- Specified by:
isCompletionAvailablein interfaceIDirectEditing- Returns:
- true if completion is / proposals are available at all
-
getName
Description copied from interface:INameGets the name.- Specified by:
getNamein interfaceIName- Overrides:
getNamein classAbstractFeature- Returns:
- the name
-
getProposalSupport
Description copied from interface:IDirectEditingThe direct editing mode contains controls for code completion and the selection from a combo box. In both cases the standard implementation supports only strings.If the customer wants to work with Objects he must provide an implementation of
IProposalSupport. In this case the following methods ofIDirectEditingare 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);- Specified by:
getProposalSupportin interfaceIDirectEditing- Returns:
- the special implementation to support Objects in code completion and combo box
- Since:
- 0.8
-
setValue
Description copied from interface:IDirectEditingSet the new value. The value comes from the text editing UI component.- Specified by:
setValuein interfaceIDirectEditing- Parameters:
value- the valuecontext- the context- Since:
- 0.8
-