org.eclipse.graphiti.pattern
Class DirectEditingFeatureForPattern

java.lang.Object
  extended by org.eclipse.graphiti.features.impl.AbstractFeature
      extended by org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
          extended by org.eclipse.graphiti.pattern.DirectEditingFeatureForPattern
All Implemented Interfaces:
IDirectEditingFeature, IFeature, IFeatureProviderHolder, IDirectEditing, IDescription, IName

public class DirectEditingFeatureForPattern
extends AbstractDirectEditingFeature

The Class DirectEditingFeatureForPattern.


Field Summary
private  IDirectEditing delegate
           
 
Fields inherited from class org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
EMPTY_STRING_ARRAY
 
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
DirectEditingFeatureForPattern(IFeatureProvider featureProvider, IDirectEditing pattern)
          Creates a new DirectEditingFeatureForPattern.
 
Method Summary
 boolean canDirectEdit(IDirectEditingContext context)
          Checks if the feature can perform direct editing on the context handed over.
 java.lang.String checkValueValid(java.lang.String value, IDirectEditingContext context)
          This method will be called by clients many times to see if current value is valid and could be set.
 java.lang.String completeValue(java.lang.String value, int caretPos, java.lang.String choosenValue, IDirectEditingContext context)
          Framework calls this method to let the feature calculate the new value.
 int getEditingType()
          Framework calls this method to decide which UI to show up.
 java.lang.String getInitialValue(IDirectEditingContext context)
          Provides the initial value for the opened text editing UI component.
 java.lang.String[] getPossibleValues(IDirectEditingContext context)
          This value will be used if the cell editor is a combo box.
 java.lang.String[] getValueProposals(java.lang.String value, int caretPos, IDirectEditingContext context)
          This proposals will be used for the completion list of a simple text cell editor.
 boolean isAutoCompletionEnabled()
          Checks if auto completion is enabled.
 boolean isCompletionAvailable()
          Checks if completion is available.
 void setValue(java.lang.String value, IDirectEditingContext context)
          Set the new value.
 boolean stretchTextfieldToFitText()
          Stretch textfield to fit text.
 
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
canExecute, execute, getName, hasDoneChanges, setValueChanged
 
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramEditor, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, setProgressCallback, toString, updatePictogramElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.graphiti.features.IFeature
canUndo, isAvailable
 
Methods inherited from interface org.eclipse.graphiti.IDescription
getDescription
 
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
 

Field Detail

delegate

private IDirectEditing delegate
Constructor Detail

DirectEditingFeatureForPattern

public DirectEditingFeatureForPattern(IFeatureProvider featureProvider,
                                      IDirectEditing pattern)
Creates a new DirectEditingFeatureForPattern.

Parameters:
featureProvider - the feature provider
pattern - the pattern
Method Detail

canDirectEdit

public boolean canDirectEdit(IDirectEditingContext context)
Description copied from interface: IDirectEditing
Checks if the feature can perform direct editing on the context handed over.

Specified by:
canDirectEdit in interface IDirectEditing
Overrides:
canDirectEdit in class AbstractDirectEditingFeature
Parameters:
context - the context
Returns:
This method is equivalent to
See Also:
IDirecEditingFeature.canExecute()

checkValueValid

public java.lang.String checkValueValid(java.lang.String value,
                                        IDirectEditingContext context)
Description copied from interface: IDirectEditing
This method will be called by clients many times to see if current value is valid and could be set.

Specified by:
checkValueValid in interface IDirectEditing
Overrides:
checkValueValid in class AbstractDirectEditingFeature
Parameters:
value - the value
context - 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 java.lang.String completeValue(java.lang.String value,
                                      int caretPos,
                                      java.lang.String choosenValue,
                                      IDirectEditingContext context)
Description copied from interface: IDirectEditing
Framework calls this method to let the feature calculate the new value.

Specified by:
completeValue in interface IDirectEditing
Overrides:
completeValue in class AbstractDirectEditingFeature
Parameters:
value - current value
caretPos - current cursor position
choosenValue - value choosen by user
context - the context
Returns:
the new value

getPossibleValues

public java.lang.String[] getPossibleValues(IDirectEditingContext context)
Description copied from interface: IDirectEditing
This value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN.

Specified by:
getPossibleValues in interface IDirectEditing
Overrides:
getPossibleValues in class AbstractDirectEditingFeature
Parameters:
context - the context
Returns:
the possible values for the combo box.

getValueProposals

public java.lang.String[] getValueProposals(java.lang.String value,
                                            int caretPos,
                                            IDirectEditingContext context)
Description copied from interface: IDirectEditing
This proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.

Specified by:
getValueProposals in interface IDirectEditing
Overrides:
getValueProposals in class AbstractDirectEditingFeature
Parameters:
value - current value
caretPos - current cursor position
context - the context
Returns:
the proposed values

isAutoCompletionEnabled

public boolean isAutoCompletionEnabled()
Description copied from interface: IDirectEditing
Checks if auto completion is enabled. This functionality only applies to TYPE_TEXT.

Specified by:
isAutoCompletionEnabled in interface IDirectEditing
Overrides:
isAutoCompletionEnabled in class AbstractDirectEditingFeature
Returns:
true, if proposals should appear automatically

isCompletionAvailable

public boolean isCompletionAvailable()
Description copied from interface: IDirectEditing
Checks if completion is available. This functionality only applies to TYPE_TEXT.

Specified by:
isCompletionAvailable in interface IDirectEditing
Overrides:
isCompletionAvailable in class AbstractDirectEditingFeature
Returns:
true if completion is / proposals are available at all

stretchTextfieldToFitText

public boolean stretchTextfieldToFitText()
Description copied from interface: IDirectEditing
Stretch textfield to fit text. This functionality only applies to TYPE_TEXT.

Specified by:
stretchTextfieldToFitText in interface IDirectEditing
Overrides:
stretchTextfieldToFitText in class AbstractDirectEditingFeature
Returns:
true if the text field should exactly fit the inserted text

getEditingType

public int getEditingType()
Description copied from interface: IDirectEditing
Framework calls this method to decide which UI to show up.

Returns:
the editing type

getInitialValue

public java.lang.String getInitialValue(IDirectEditingContext context)
Description copied from interface: IDirectEditing
Provides the initial value for the opened text editing UI component.

Parameters:
context - the context
Returns:
the initial value

setValue

public void setValue(java.lang.String value,
                     IDirectEditingContext context)
Description copied from interface: IDirectEditing
Set the new value. The value comes from the text editing UI component.

Parameters:
value - the value
context - the context


Copyright (c) SAP AG 2005, 2010.