public class RenderErrorHandling extends AbstractEditErrorHandler
IEditErrorHandler
implementation that will directly change the rendering
of the value inside the editor control.Modifier and Type | Field and 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.
|
underlyingErrorHandler
Constructor and Description |
---|
RenderErrorHandling()
Create a
RenderErrorHandling with no underlying error handler
and no decoration provider. |
RenderErrorHandling(ControlDecorationProvider decorationProvider)
Create a
RenderErrorHandling with no underlying error handler
and the specified decoration provider. |
RenderErrorHandling(IEditErrorHandler underlyingErrorHandler,
ControlDecorationProvider decorationProvider)
Create a
RenderErrorHandling with the underlying error handler
and the specified decoration provider. |
Modifier and Type | Method and Description |
---|---|
void |
displayError(ICellEditor cellEditor,
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) |
protected IStyle defaultErrorStyle
protected org.eclipse.swt.graphics.Color originalFgColor
protected org.eclipse.swt.graphics.Color originalBgColor
protected org.eclipse.swt.graphics.Font originalFont
protected IStyle errorStyle
protected final ControlDecorationProvider decorationProvider
public RenderErrorHandling()
RenderErrorHandling
with no underlying error handler
and no decoration provider.public RenderErrorHandling(ControlDecorationProvider decorationProvider)
RenderErrorHandling
with no underlying error handler
and the specified decoration provider.decorationProvider
- The decoration provider that should be used for decorating the
editor control on error.public RenderErrorHandling(IEditErrorHandler underlyingErrorHandler, ControlDecorationProvider decorationProvider)
RenderErrorHandling
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)underlyingErrorHandler
- The underlying error handler.decorationProvider
- The decoration provider that should be used for decorating the
editor control on error.public void removeError(ICellEditor cellEditor)
This implementation will call its underlying IEditErrorHandler
.
After the error remove is handled by its underlying IEditErrorHandler
,
the original style will be applied to the editor control.
removeError
in interface IEditErrorHandler
removeError
in class AbstractEditErrorHandler
cellEditor
- The ICellEditor
to remove the error styling from.public void displayError(ICellEditor cellEditor, Exception e)
Exception
will be shown to the user.
This implementation will call its underlying IEditErrorHandler
.
After the error is handled by its underlying IEditErrorHandler
,
the configured error style will be applied to the editor control.
displayError
in interface IEditErrorHandler
displayError
in class AbstractEditErrorHandler
cellEditor
- The ICellEditor
on which the conversion/validation error
occurred. Needed to add error styling or special handling.e
- The Exception
that contains information about the conversion/validation
error. Used to show a more detailed description on the error to the user.public void setErrorStyle(IStyle errorStyle)
errorStyle
- The style that should be used to render an error.
Supported style attributes are foreground color, background color and font.Copyright © 2013. All Rights Reserved.