开发者

What is the list of valid GWT DOM / consumed events for Cells?

I've run into this multiple times, and can't find anything comprehensive. I want to know the complete list of all valid consumable DOM events for GWT.

The GWT docs for NativeEvent says:

public final java.lang.String getType()
Gets the enumerated type of this event.
Returns:
the event's enumerated type

Where is this 开发者_如何转开发enumeration? Does it actually exist? The actual code used (that I've found) that explicitly says these events always uses strings: "click", "contextmenu", "mouseup", "dblclick", etc. (etc covers so many vaguaries ...)

I'm trying to implement both Double Click and Right Click for cells in a CellTable ala this post. I'm passing super("click", "contextmenu", "mouseup", "dblclick"); in the constructor of my extension of AbstractCell. Then I overrode onBrowserEvent:

@Override

    public void onBrowserEvent(Context context, Element parent, ImageProperties<T> value,
            NativeEvent event, ValueUpdater<ImageProperties<T>> valueUpdater) {
        if (event.getButton() == NativeEvent.BUTTON_RIGHT) {
            event.stopPropagation();
            event.preventDefault();
            eventBus.fireEvent(new RightClickEvent<Context>(context, event));
        } else {
            super.onBrowserEvent(context, parent, value, event, valueUpdater);
        }
    }

However, I run into two issues. One, the default contextMenu still gets shown (over my custom one) - not to mention it doesn't even use the DOM event type. A different problem, how do I check if its a double click event? I find it hard to believe that it's literally an arbitrary set of strings ...

Thanks in advance! John


Native JavaScript DOM event types really are arbitrary strings and support for a given event type (and the name thereof) can be browser dependent.


the enumeration you are looking for does exist in the BrowserEvents class. you should use those constants instead of “magic” string literals.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜