Class DialogErrorHandling
java.lang.Object
org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling
- All Implemented Interfaces:
IEditErrorHandler
Strategy class for conversion/validation failures. If the entered value is
not valid, a warning dialog with the corresponding error message will show
up. The warning dialog gives the opportunity to discard the invalid input or
change it, which will cause the editor to stay open. Only handles errors on
commit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag to configure if this dialog allows to commit invalid data.protected ICellEditor
TheICellEditor
for which thisDialogErrorHandling
is activated.Fields inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
underlyingErrorHandler
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newDialogErrorHandling
with no underlyingIEditErrorHandler
that does not support cross validation.DialogErrorHandling
(boolean allowCommit) Create a newDialogErrorHandling
with no underlyingIEditErrorHandler
that gives the opportunity to configure the error handling for cross validation.DialogErrorHandling
(IEditErrorHandler underlyingErrorHandler) Create a newDialogErrorHandling
using the givenIEditErrorHandler
as the underlying to allow chaining of error handling.DialogErrorHandling
(IEditErrorHandler underlyingErrorHandler, boolean allowCommit) Create a newDialogErrorHandling
using the givenIEditErrorHandler
as the underlying to allow chaining of error handling. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.protected boolean
Checks if the current active Shell is a conversion/validation failure warning dialog.void
setChangeButtonLabel
(String changeButtonLabel) void
setCommitButtonLabel
(String commitButtonLabel) void
setConversionFailureShellTitle
(String conversionFailureShellTitle) void
setDiscardButtonLabel
(String discardButtonLabel) void
setFailureShellTitle
(String failureShellTitle) void
setValidationFailureShellTitle
(String validationFailureShellTitle) protected void
showWarningDialog
(String dialogMessage, String dialogTitle) Shows a warning dialog if the conversion or the validation returned an error message.Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractEditErrorHandler
displayError, removeError
-
Field Details
-
editor
TheICellEditor
for which thisDialogErrorHandling
is activated. Needed so it is possible to operate on it dependent on the users choice. -
allowCommit
protected boolean allowCommitFlag to configure if this dialog allows to commit invalid data. This is necessary to implement cross validation in NatTable by using dialogs to tell the user what is wrong. By default this value is set tofalse
as cross validation is not the default validation use case.
-
-
Constructor Details
-
DialogErrorHandling
public DialogErrorHandling()Create a newDialogErrorHandling
with no underlyingIEditErrorHandler
that does not support cross validation. -
DialogErrorHandling
public DialogErrorHandling(boolean allowCommit) Create a newDialogErrorHandling
with no underlyingIEditErrorHandler
that gives the opportunity to configure the error handling for cross validation.- Parameters:
allowCommit
- Flag to configure if this dialog allows to commit invalid data. If this parameter is set totrue
, an additional button for committing the invalid data will be provided within the dialog.
-
DialogErrorHandling
Create a newDialogErrorHandling
using the givenIEditErrorHandler
as the underlying to allow chaining of error handling. Using this constructor there is no cross validation support.- Parameters:
underlyingErrorHandler
- The underlyingIEditErrorHandler
-
DialogErrorHandling
Create a newDialogErrorHandling
using the givenIEditErrorHandler
as the underlying to allow chaining of error handling.- Parameters:
underlyingErrorHandler
- The underlyingIEditErrorHandler
allowCommit
- Flag to configure if this dialog allows to commit invalid data. If this parameter is set totrue
, an additional button for committing the invalid data will be provided within the dialog.
-
-
Method Details
-
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 givenException
will be shown to the user.This implementation will call its underlying
IEditErrorHandler
. After the error is handled by its underlyingIEditErrorHandler
, a dialog will be opened showing the error message to the user, giving the opportunity to decide if the entered value should be discarded or if the editor should stay open so the value can be modified.- 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.e
- TheException
that contains information about the conversion/validation error. Used to show a more detailed description on the error to the user.
-
showWarningDialog
Shows a warning dialog if the conversion or the validation returned an error message. Otherwise nothing happens.- Parameters:
dialogMessage
- the dialog messagedialogTitle
- the dialog title
-
isWarningDialogActive
protected boolean isWarningDialogActive()Checks if the current active Shell is a conversion/validation failure warning dialog. As a Shell has not id it is checked if the Shell title is for conversion or validation failure in localized format.- Returns:
true
if a warning dialog is active
-
getFailureShellTitle
- Returns:
- The shell title that will be used if there is no conversion or validation shell title configured.
-
setFailureShellTitle
- Parameters:
failureShellTitle
- The shell title that should be used if there is no conversion or validation shell title configured.
-
getConversionFailureShellTitle
- Returns:
- The shell title that will be used in case this
DialogErrorHandling
is called to handle aConversionFailedException
.
-
setConversionFailureShellTitle
- Parameters:
conversionFailureShellTitle
- The shell title that should be used in case thisDialogErrorHandling
is called to handle aConversionFailedException
.
-
getValidationFailureShellTitle
- Returns:
- The shell title that will be used in case this
DialogErrorHandling
is called to handle aValidationFailedException
.
-
setValidationFailureShellTitle
- Parameters:
validationFailureShellTitle
- The shell title that should be used in case thisDialogErrorHandling
is called to handle aValidationFailedException
.
-
getChangeButtonLabel
- Returns:
- The text on the button for changing the entered value.
-
setChangeButtonLabel
- Parameters:
changeButtonLabel
- The text on the button for changing the entered value.
-
getDiscardButtonLabel
- Returns:
- The text on the button to discard the entered value.
-
setDiscardButtonLabel
- Parameters:
discardButtonLabel
- The text on the button to discard the entered value.
-
getCommitButtonLabel
- Returns:
- The text on the button to commit the entered value.
- Since:
- 1.4
-
setCommitButtonLabel
- Parameters:
commitButtonLabel
- The text on the button to commit the entered value.- Since:
- 1.4
-