tags:

views:

223

answers:

4

Hi,

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.

A: 

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.

Registered User
Diagram is a class in GWT-Connector, I did not create it (I just now added link to diagram class) and i am trying to add click listener to this class. But not sure if thats a possibility.
sprasad12
+1  A: 

You are overriding the fireEvent, whithout firing the event!

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

Drejc
A: 

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

sprasad12
A: 

I'm Trting to add onRightClick Listener to my tree but i'm not able add

Can some one help?????

Bhaskar
Hey, i have not tried right click listener, Here are two links that might help you, http://stackoverflow.com/questions/2709032/gwt-select-a-treeitem-with-right-click http://whatwouldnickdo.com/wordpress/370/gwt-right-click-context-menu/
sprasad12