org.eclipse.graphiti.func
Interface IDirectEditing

All Known Subinterfaces:
IDirectEditingFeature, IPattern
All Known Implementing Classes:
AbstractDirectEditingFeature, AbstractPattern, DirectEditingFeatureForPattern

public interface IDirectEditing

The Interface IDirectEditing.


Field Summary
static int TYPE_CUSTOM
          With this type the customers can provide their own cell editors for the direct editing mode.
static int TYPE_DROPDOWN
          combo box is wanted for editing.
static int TYPE_DROPDOWN_READ_ONLY
          read only combo box is wanted for editing.
static int TYPE_MULTILINETEXT
          multi line text box is wanted for editing.
static int TYPE_NONE
          no special UI is wanted for editing.
static int TYPE_TEXT
          text field is wanted for editing.
 
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 caretPosition, 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.
 IProposalSupport getProposalSupport()
          The direct editing mode contains controls for code completion and the selection from a combo box.
 java.lang.String[] getValueProposals(java.lang.String value, int caretPosition, 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 stretchFieldToFitText()
          Stretch input field to fit its contents.
 

Field Detail

TYPE_NONE

static final int TYPE_NONE
no special UI is wanted for editing.

See Also:
Constant Field Values

TYPE_TEXT

static final int TYPE_TEXT
text field is wanted for editing.

See Also:
Constant Field Values

TYPE_MULTILINETEXT

static final int TYPE_MULTILINETEXT
multi line text box is wanted for editing.

See Also:
Constant Field Values

TYPE_DROPDOWN

static final int TYPE_DROPDOWN
combo box is wanted for editing.

See Also:
Constant Field Values

TYPE_DROPDOWN_READ_ONLY

static final int TYPE_DROPDOWN_READ_ONLY
read only combo box is wanted for editing.

See Also:
Constant Field Values

TYPE_CUSTOM

static final int TYPE_CUSTOM
With this type the customers can provide their own cell editors for the direct editing mode. In this case the direct editing feature must implement the interface org.eclipse.graphiti.ui.platform.ICellEditorProvider

Since:
0.9
See Also:
Constant Field Values
Method Detail

getEditingType

int getEditingType()
Framework calls this method to decide which UI to show up.

Returns:
the editing type

canDirectEdit

boolean canDirectEdit(IDirectEditingContext context)
Checks if the feature can perform direct editing on the context handed over.

Parameters:
context - the context
Returns:
This method is equivalent to
See Also:
IFeature.canExecute(org.eclipse.graphiti.features.context.IContext)

getInitialValue

java.lang.String getInitialValue(IDirectEditingContext context)
Provides the initial value for the opened text editing UI component.

Parameters:
context - the context
Returns:
the initial value

getPossibleValues

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

Parameters:
context - the context
Returns:
the possible values for the combo box.

getValueProposals

java.lang.String[] getValueProposals(java.lang.String value,
                                     int caretPosition,
                                     IDirectEditingContext context)
This proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.

Parameters:
value - current value
caretPosition - current cursor position
context - the context
Returns:
the proposed values

completeValue

java.lang.String completeValue(java.lang.String value,
                               int caretPosition,
                               java.lang.String choosenValue,
                               IDirectEditingContext context)
Framework calls this method to let the feature calculate the new value.

Parameters:
value - current value
caretPosition - current cursor position
choosenValue - value choosen by user
context - the context
Returns:
the new value

isCompletionAvailable

boolean isCompletionAvailable()
Checks if completion is available. This functionality only applies to TYPE_TEXT.

Returns:
true if completion is / proposals are available at all

isAutoCompletionEnabled

boolean isAutoCompletionEnabled()
Checks if auto completion is enabled. This functionality only applies to TYPE_TEXT.

Returns:
true, if proposals should appear automatically

stretchFieldToFitText

boolean stretchFieldToFitText()
Stretch input field to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY.

Returns:
true if the field should exactly fit the contents

checkValueValid

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.

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

setValue

void setValue(java.lang.String value,
              IDirectEditingContext context)
Set the new value. The value comes from the text editing UI component.

Parameters:
value - the value
context - the context

getProposalSupport

IProposalSupport getProposalSupport()
The 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 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);

Returns:
the special implementation to support Objects in code completion and combo box
Since:
0.8


Copyright (c) SAP AG 2005, 2012.