Class RenderErrorHandling
java.lang.Object
org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
org.eclipse.nebula.widgets.nattable.edit.config.RenderErrorHandling
- All Implemented Interfaces:
IEditErrorHandler
IEditErrorHandler implementation that will directly change the
rendering of the value inside the editor control.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ControlDecorationProviderThe decoration provider that should be used for decorating the editor control on error.protected IStyleThe default error styling used for rendering an error.protected IStyleThe style that should be used to render an error.protected org.eclipse.swt.graphics.ColorThe original background color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.ColorThe original foreground color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.FontThe original font, needed to be able to restore the normal rendering if the error is removed.Fields inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
underlyingErrorHandler -
Constructor Summary
ConstructorsConstructorDescriptionCreate aRenderErrorHandlingwith no underlying error handler and no decoration provider.RenderErrorHandling(ControlDecorationProvider decorationProvider) Create aRenderErrorHandlingwith no underlying error handler and the specified decoration provider.RenderErrorHandling(IEditErrorHandler underlyingErrorHandler, ControlDecorationProvider decorationProvider) Create aRenderErrorHandlingwith the underlying error handler and the specified decoration provider. -
Method Summary
Modifier and TypeMethodDescriptionvoiddisplayError(ICellEditor cellEditor, IConfigRegistry configRegistry, Exception e) If an error occurs on conversion/validation of data, this method will be called for showing that error to the user.voidremoveError(ICellEditor cellEditor) Will remove styling or other decorations that indicate that an error occurred.voidsetErrorStyle(IStyle errorStyle) Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
displayError
-
Field Details
-
defaultErrorStyle
The default error styling used for rendering an error. -
originalFgColor
protected org.eclipse.swt.graphics.Color originalFgColorThe original foreground color, needed to be able to restore the normal rendering if the error is removed. -
originalBgColor
protected org.eclipse.swt.graphics.Color originalBgColorThe original background color, needed to be able to restore the normal rendering if the error is removed. -
originalFont
protected org.eclipse.swt.graphics.Font originalFontThe original font, needed to be able to restore the normal rendering if the error is removed. -
errorStyle
The style that should be used to render an error. -
decorationProvider
The decoration provider that should be used for decorating the editor control on error.
-
-
Constructor Details
-
RenderErrorHandling
public RenderErrorHandling()Create aRenderErrorHandlingwith no underlying error handler and no decoration provider. -
RenderErrorHandling
Create aRenderErrorHandlingwith no underlying error handler and the specified decoration provider.- Parameters:
decorationProvider- The decoration provider that should be used for decorating the editor control on error.
-
RenderErrorHandling
public RenderErrorHandling(IEditErrorHandler underlyingErrorHandler, ControlDecorationProvider decorationProvider) Create aRenderErrorHandlingwith the underlying error handler and the specified decoration provider. By default the error style is set to render the value in the editor control with red foreground color. You can override that style by calling setErrorStyle(IStyle)- Parameters:
underlyingErrorHandler- The underlying error handler.decorationProvider- The decoration provider that should be used for decorating the editor control on error.
-
-
Method Details
-
removeError
Will remove styling or other decorations that indicate that an error occurred. Only necessary to implement if the error handler adds special styling or decorations on error.This implementation will call its underlying
IEditErrorHandler. After the error remove is handled by its underlyingIEditErrorHandler, the original style will be applied to the editor control.- Specified by:
removeErrorin interfaceIEditErrorHandler- Overrides:
removeErrorin classAbstractEditErrorHandler- Parameters:
cellEditor- TheICellEditorto remove the error styling from.
-
displayError
If an error occurs on conversion/validation of data, this method will be called for showing that error to the user. Usually the message contained within the givenExceptionwill be shown to the user.This implementation will call its underlying
IEditErrorHandler. After the error is handled by its underlyingIEditErrorHandler, the configured error style will be applied to the editor control.- Specified by:
displayErrorin interfaceIEditErrorHandler- Overrides:
displayErrorin classAbstractEditErrorHandler- Parameters:
cellEditor- TheICellEditoron which the conversion/validation error occurred. Needed to add error styling or special handling.configRegistry- TheIConfigRegistryto get additional context information.e- TheExceptionthat contains information about the conversion/validation error. Used to show a more detailed description on the error to the user.- Since:
- 2.0
-
setErrorStyle
- Parameters:
errorStyle- The style that should be used to render an error. Supported style attributes are foreground color, background color and font.
-