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
IEditErrorHandlerimplementation that will directly change the rendering of the value inside the editor control.
-
-
Field Summary
Fields Modifier and Type Field Description protected ControlDecorationProviderdecorationProviderThe decoration provider that should be used for decorating the editor control on error.protected IStyledefaultErrorStyleThe default error styling used for rendering an error.protected IStyleerrorStyleThe style that should be used to render an error.protected org.eclipse.swt.graphics.ColororiginalBgColorThe original background color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.ColororiginalFgColorThe original foreground color, needed to be able to restore the normal rendering if the error is removed.protected org.eclipse.swt.graphics.FontoriginalFontThe 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 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisplayError(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 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 aRenderErrorHandlingwith no underlying error handler and no decoration provider.
-
RenderErrorHandling
public RenderErrorHandling(ControlDecorationProvider decorationProvider)
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 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:
removeErrorin interfaceIEditErrorHandler- Overrides:
removeErrorin classAbstractEditErrorHandler- Parameters:
cellEditor- TheICellEditorto 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 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
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.
-
-