Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Help with validation error handlers
Help with validation error handlers [message #1771907] Thu, 31 August 2017 23:14 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
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);
            
          }
        });

Re: Help with validation error handlers [message #1771914 is a reply to message #1771907] Fri, 01 September 2017 03:52 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2622
Registered: July 2012
Senior Member
Maybe there is a conversion error before it comes to the validation. You need to debug to know for sure.
Previous Topic:How to make row header cells editable?
Next Topic:NatTable: Remove Gridline from cell
Goto Forum:
  


Current Time: Mon Nov 12 18:42:18 GMT 2018

Powered by FUDForum. Page generated in 0.02258 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top