Class ControlDecorationProvider
java.lang.Object
org.eclipse.nebula.widgets.nattable.edit.editor.ControlDecorationProvider
This class adds support for adding a
ControlDecoration to the editor
controls of a ICellEditor. It is currently only used by the
TextCellEditor.
The default location for the ControlDecoration is the top right of
the editor. If the editor is located such that the ControlDecoration
would not be visible here (i.e. cell is at/extends beyond the right edge of
the NatTable) then the decoration is placed at the top left of the editor.
The location can be overridden, in which case the above behaviour does not get used.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a defaultControlDecorationProviderfor handling error decorations.ControlDecorationProvider(String fieldDecorationId) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateErrorDecorationIfRequired(org.eclipse.swt.widgets.Control controlToDecorate) If showing an error decoration is enabled, this method will create and add aControlDecorationfor the givenControlby using the configured information.voiddispose()Ensure to hide the decoration and dispose any resources related to theControlDecorationvoidWill hide the control decoration.voidsetDecorationPositionOverride(int decorationPositionOverride) Set the position configuration where the decoration should be rendered relative to the control that should be decorated.voidsetErrorDecorationEnabled(boolean enabled) Enables/disables the error decoration.voidsetErrorDecorationText(String errorText) voidsetFieldDecorationId(String fieldDecorationId) Configure the id that should be used to retrieve theFieldDecorationto be used by thisControlDecorationProvider.voidWill show the control decoration.voidshowErrorDecorationHover(String errorText) Will show the control decoration adding the given text as description text.
-
Constructor Details
-
ControlDecorationProvider
public ControlDecorationProvider()Create a defaultControlDecorationProviderfor handling error decorations. -
ControlDecorationProvider
- Parameters:
fieldDecorationId- The field decoration to use by this provider.- See Also:
-
FieldDecorationRegistry
-
-
Method Details
-
setErrorDecorationEnabled
public void setErrorDecorationEnabled(boolean enabled) Enables/disables the error decoration.- Parameters:
enabled-trueif a decoration should be added,falseif not.
-
setErrorDecorationText
- Parameters:
errorText- the text to be shown as a description for the decoration, ornullif none has been set.- See Also:
-
ControlDecoration.setDescriptionText(String)
-
showErrorDecorationHover
Will show the control decoration adding the given text as description text.- Parameters:
errorText- the text to be shown in the info hover, ornullif no text should be shown.- See Also:
-
ControlDecoration.show()ControlDecoration.showHoverText(String)
-
setFieldDecorationId
Configure the id that should be used to retrieve theFieldDecorationto be used by thisControlDecorationProvider.- Parameters:
fieldDecorationId- The String to determine theFieldDecorationto use by theControlDecorationthat is provided by thisControlDecorationProvider.
-
setDecorationPositionOverride
public void setDecorationPositionOverride(int decorationPositionOverride) Set the position configuration where the decoration should be rendered relative to the control that should be decorated.- Parameters:
decorationPositionOverride- bit-wise or of position constants (SWT.TOP,SWT.BOTTOM,SWT.LEFT,SWT.RIGHT, andSWT.CENTER).
-
showDecoration
public void showDecoration()Will show the control decoration.- See Also:
-
ControlDecoration.show()
-
hideDecoration
public void hideDecoration()Will hide the control decoration.- See Also:
-
ControlDecoration.hide()
-
dispose
public void dispose()Ensure to hide the decoration and dispose any resources related to theControlDecoration -
createErrorDecorationIfRequired
public void createErrorDecorationIfRequired(org.eclipse.swt.widgets.Control controlToDecorate) If showing an error decoration is enabled, this method will create and add aControlDecorationfor the givenControlby using the configured information.- Parameters:
controlToDecorate- TheControlto create the decoration for.
-