@Test public void testValidateNonEmptyFile() { final ValidatorWithReasonCallback validatorWithReasonCallback = mock(ValidatorWithReasonCallback.class); when(uploadWidget.getFilenameSelectedToUpload()).thenReturn("table.xls"); handler.validate("filename", validatorWithReasonCallback); verify(uploadWidget, never()).addStyleName(ValidationState.ERROR.getCssName()); }
@Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { if(uploadWidget.getFilenameSelectedToUpload() == null || uploadWidget.getFilenameSelectedToUpload().isEmpty()) { uploadWidget.addStyleName(ValidationState.ERROR.getCssName()); } else { super.validate(baseFileName, callback); } }
NewDecisionTableXLSHandler extends DefaultNewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { if(uploadWidget.getFilenameSelectedToUpload() == null || uploadWidget.getFilenameSelectedToUpload().isEmpty()) { uploadWidget.addStyleName(ValidationState.ERROR.getCssName()); } else { super.validate(baseFileName, callback); } } }
NewDecisionTableXLSHandler extends DefaultNewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { if(uploadWidget.getFilenameSelectedToUpload() == null || uploadWidget.getFilenameSelectedToUpload().isEmpty()) { uploadWidget.addStyleName(ValidationState.ERROR.getCssName()); } else { super.validate(baseFileName, callback); } } NewDecisionTableXLSHandler(); @Inject  NewDecisionTableXLSHandler( final PlaceManager placeManager,
                                       final DecisionTableXLSResourceType decisionTableXLSResourceType,
                                       final DecisionTableXLSXResourceType decisionTableXLSXResourceType,
                                       final BusyIndicatorView busyIndicatorView,
                                       final ClientMessageBus clientMessageBus ); }
NewDecisionTableXLSHandler extends DefaultNewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { if(uploadWidget.getFilenameSelectedToUpload() == null || uploadWidget.getFilenameSelectedToUpload().isEmpty()) { uploadWidget.addStyleName(ValidationState.ERROR.getCssName()); } else { super.validate(baseFileName, callback); } } NewDecisionTableXLSHandler(); @Inject  NewDecisionTableXLSHandler( final PlaceManager placeManager,
                                       final DecisionTableXLSResourceType decisionTableXLSResourceType,
                                       final DecisionTableXLSXResourceType decisionTableXLSXResourceType,
                                       final BusyIndicatorView busyIndicatorView,
                                       final ClientMessageBus clientMessageBus ); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override void validate(final String baseFileName, final ValidatorWithReasonCallback callback); @Override void create( final Package pkg,
                        final String baseFileName,
                        final NewResourcePresenter presenter ); }
NewDecisionTableXLSHandler extends DefaultNewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { if(uploadWidget.getFilenameSelectedToUpload() == null || uploadWidget.getFilenameSelectedToUpload().isEmpty()) { uploadWidget.addStyleName(ValidationState.ERROR.getCssName()); } else { super.validate(baseFileName, callback); } } NewDecisionTableXLSHandler(); @Inject  NewDecisionTableXLSHandler( final PlaceManager placeManager,
                                       final DecisionTableXLSResourceType decisionTableXLSResourceType,
                                       final DecisionTableXLSXResourceType decisionTableXLSXResourceType,
                                       final BusyIndicatorView busyIndicatorView,
                                       final ClientMessageBus clientMessageBus ); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override void validate(final String baseFileName, final ValidatorWithReasonCallback callback); @Override void create( final Package pkg,
                        final String baseFileName,
                        final NewResourcePresenter presenter );  }