suprasad
suprasad

Reputation: 1533

Click event to a Gwt-connector

I am trying to add click event to one of the widgets that use gwt-connector. Here is the code:

public class Diagrams extends Diagram implements HasClickHandlers{

    public Diagrams(AbsolutePanel boundaryPanel) {
        super(boundaryPanel);
    }

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

    @Override
    public void fireEvent(GwtEvent<?> event) {

    }    
}

Here Diagram is a gwt-connector class. Here is the link to the Diagram class and also link to GWT-Connector.

Question:

  1. Am i doing anything wrong in the code while adding the clickhandler?
  2. I am getting error saying that addDomHandler is undefined for the type Diagrams. are there limitations for adding click handlers?

Any input will be of great help. Thank you.

Upvotes: 1

Views: 582

Answers (3)

suprasad
suprasad

Reputation: 1533

I was supposed to add the HasClickHandler to Shape class rather than Diagrm. Its working fine now.

Upvotes: 0

Drejc
Drejc

Reputation: 14286

You are overriding the fireEvent, whithout firing the event!

You either need to fire the event or remove the method at all.

Upvotes: 1

Registered User
Registered User

Reputation: 1

I can not find the source code for this project. I am sure I am missing something. You would be better off putting the Diagram widget inside of say a FocusPanel or some other widget that supports the listeners you want. Also, Diagram is a custom widget. It may not be possible to add a listener to it. But It will be difficult for anyone to answer unless they can see the source code.

Upvotes: 0

Related Questions