Question

I'm using the gwtupload library to change the standard upload Form. Basically I just want to create a widget with an image and change it on :hover and :active via css.

public class FileUploadFormImpl extends FileUploadForm implements HasClickHandler {

  private SingleUploader fileUpload;

  public FileUploadFormImplCostum(String actionUrl) {
    setAction(actionUrl);
    // Create Panel with costum Button
    DecoratorPanel widget = new DecoratorPanel();
    widget.setSize("100%", "100%");
    widget.setStyleName("costum-Button");

    // Create a FileUpload widget.
    fileUpload = new SingleUploader(FileInputType.CUSTOM.with(widget));
    fileUpload.setStyleName("costum-Button"); 
    fileUpload.setWidth("100%");

    fileUpload.getWidget().setSize("100%", "100%);");

    add(fileUpload);
  }
    @Override
    public HandlerRegistration addClickHandler(ClickHandler handler) {
        return addDomHandler(handler, ClickEvent.getType());
    }

The projects builds but doesn't run I'm getting the error message:

java.lang.AssertionError: Button should implement HasClickHandlers

But I'm having a click handler and it's basically the same as on the library example code page. I don't get it is my implementation wrong or do I miss something. Thx for any help.

Was it helpful?

Solution

You're passing to FileInputType.CUSTOM.with method the DecoratorPanel that don't implements HasClickHandlers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top