Help with validation error handlers [message #1771907] |
Thu, 31 August 2017 19:14  |
Eclipse User |
|
|
|
Hello, I am trying to make it so that if the user tries to enter a null string into the row header cells a dialog box pops up displaying an error message and giving the user the option to change or discard the entry. So far with the following code, it doesn't allow the user to commit a null string, but the dialog box does not pop up. Any ideas what's going wrong?
natTable.addConfiguration(new AbstractRegistryConfiguration() {
private IDataValidator nullEntryValidator() {
return new DataValidator() {
@Override
public boolean validate (int columnIndex, int rowIndex, Object newValue) {
if (!((String) newValue).equals("")) {
return true;
}
else throw new ValidationFailedException("This entry should not be empty.");
}
};
}
public void configureRegistry(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE,
DisplayMode.NORMAL, NatTableUtility.DESCRIPTION);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE,
DisplayMode.NORMAL, GridRegion.ROW_HEADER);
configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, nullEntryValidator(),
DisplayMode.EDIT, GridRegion.ROW_HEADER);
configRegistry.registerConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_HANDLER,
new DialogErrorHandling(), DisplayMode.EDIT, GridRegion.ROW_HEADER);
}
});
|
|
|
|
Powered by
FUDForum. Page generated in 0.22003 seconds