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
public class RenderErrorHandling extends AbstractEditErrorHandler
IEditErrorHandler
implementation that will directly change the rendering of the value inside the editor control.
-
-
Field Summary
Fields Modifier and Type Field Description protected ControlDecorationProvider
decorationProvider
The decoration provider that should be used for decorating the editor control on error.protected IStyle
defaultErrorStyle
The default error styling used for rendering an error.protected IStyle
errorStyle
The style that should be used to render an error.protected org.eclipse.swt.graphics.Color
originalBgColor
The original background color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.Color
originalFgColor
The original foreground color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.Font
originalFont
The 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
Constructors Constructor Description RenderErrorHandling()
Create aRenderErrorHandling
with no underlying error handler and no decoration provider.RenderErrorHandling(ControlDecorationProvider decorationProvider)
Create aRenderErrorHandling
with no underlying error handler and the specified decoration provider.RenderErrorHandling(IEditErrorHandler underlyingErrorHandler, ControlDecorationProvider decorationProvider)
Create aRenderErrorHandling
with the underlying error handler and the specified decoration provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
displayError(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.void
removeError(ICellEditor cellEditor)
Will remove styling or other decorations that indicate that an error occurred.void
setErrorStyle(IStyle errorStyle)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
displayError
-
-
-
-
Field Detail
-
defaultErrorStyle
protected IStyle defaultErrorStyle
The default error styling used for rendering an error.
-
originalFgColor
protected org.eclipse.swt.graphics.Color originalFgColor
The original foreground color, needed to be able to restore the normal rendering if the error is removed.
-
originalBgColor
protected org.eclipse.swt.graphics.Color originalBgColor
The original background color, needed to be able to restore the normal rendering if the error is removed.
-
originalFont
protected org.eclipse.swt.graphics.Font originalFont
The original font, needed to be able to restore the normal rendering if the error is removed.
-
errorStyle
protected IStyle errorStyle
The style that should be used to render an error.
-
decorationProvider
protected final ControlDecorationProvider decorationProvider
The decoration provider that should be used for decorating the editor control on error.
-
-
Constructor Detail
-
RenderErrorHandling
public RenderErrorHandling()
Create aRenderErrorHandling
with no underlying error handler and no decoration provider.
-
RenderErrorHandling
public RenderErrorHandling(ControlDecorationProvider decorationProvider)
Create aRenderErrorHandling
with 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 aRenderErrorHandling
with 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 Detail
-
removeError
public void removeError(ICellEditor cellEditor)
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:
removeError
in interfaceIEditErrorHandler
- Overrides:
removeError
in classAbstractEditErrorHandler
- Parameters:
cellEditor
- TheICellEditor
to remove the error styling from.
-
displayError
public void displayError(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. Usually the message contained within the givenException
will 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:
displayError
in interfaceIEditErrorHandler
- Overrides:
displayError
in classAbstractEditErrorHandler
- Parameters:
cellEditor
- TheICellEditor
on which the conversion/validation error occurred. Needed to add error styling or special handling.configRegistry
- TheIConfigRegistry
to get additional context information.e
- TheException
that contains information about the conversion/validation error. Used to show a more detailed description on the error to the user.- Since:
- 2.0
-
setErrorStyle
public void setErrorStyle(IStyle errorStyle)
- Parameters:
errorStyle
- The style that should be used to render an error. Supported style attributes are foreground color, background color and font.
-
-