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 Details

    • 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 Details

    • RenderErrorHandling

      public RenderErrorHandling()
      Create a RenderErrorHandling with no underlying error handler and no decoration provider.
    • RenderErrorHandling

      public RenderErrorHandling(ControlDecorationProvider decorationProvider)
      Create a RenderErrorHandling 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 a 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)
      Parameters:
      underlyingErrorHandler - The underlying error handler.
      decorationProvider - The decoration provider that should be used for decorating the editor control on error.
  • Method Details

    • 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 underlying IEditErrorHandler, the original style will be applied to the editor control.

      Specified by:
      removeError in interface IEditErrorHandler
      Overrides:
      removeError in class AbstractEditErrorHandler
      Parameters:
      cellEditor - The ICellEditor 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 given 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.

      Specified by:
      displayError in interface IEditErrorHandler
      Overrides:
      displayError in class AbstractEditErrorHandler
      Parameters:
      cellEditor - The ICellEditor on which the conversion/validation error occurred. Needed to add error styling or special handling.
      configRegistry - The IConfigRegistry to get additional context information.
      e - The Exception 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.