Re: What am I misunderstanding about the event model?

2008-12-24 Thread David H. Cook
Reinier - Thank you, thank you, for the EXCELLENT explanation in your posts to this thread. I totally get it now. I like especially that you point out that, given GWT objectives and constraints, it is NOT necessarily the right tool for all webapps. I guess I made the correct decision, back whe

Re: What am I misunderstanding about the event model?

2008-12-23 Thread Ian Petersen
On Tue, Dec 23, 2008 at 7:53 PM, David Hoffer wrote: > So its not a notification problem its a data access problem. I have looked > at how the Tree control does this for single clicks but they made all the > data & methods private so I can't use them. > > If you know a way to do this please advi

Re: What am I misunderstanding about the event model?

2008-12-23 Thread Reinier Zwitserloot
As I said, "Event" is a low level class. You don't use it from java code, you use it from JSNI code. Another low level 'class' is the DOM class. It is a repository of loads of static utility methods (you don't ever do 'new DOM()', you just call DOM.someMethod()). Anything you can do with Event obj

Re: What am I misunderstanding about the event model?

2008-12-23 Thread David Hoffer
In my case I need to support right click in Tree widgets so the global option doesn't help. I'm willing to live with limited browser support if I can convert the Event returned via onBrowserEvent() to a TreeItem. -Dave On Tue, Dec 23, 2008 at 3:49 PM, lukehashj wrote: > > Those lego pieces are

Re: What am I misunderstanding about the event model?

2008-12-23 Thread David Hoffer
Jay, Yes, in my case at least, I want to use onBrowserEvent() like you say but...and its a show stopper...I am doing this in a Tree widget. Obviously what someone cares about in this context is the TreeItem the user right clicked on. The problem is there is no way (that I have found yet) to conv

Re: What am I misunderstanding about the event model?

2008-12-23 Thread jay
Perhaps I'm missing something, but why JSNI? Why not just override onBrowserEvent(), and use DOM.eventGetButton(Event) to check for Event.BUTTON_RIGHT? Can't you use the DOM.eventGetButton() to check for Event.ONDBLCLICK ? Please...if I'm wrong let me know... I've been fairly successful with my

Re: What am I misunderstanding about the event model?

2008-12-23 Thread lukehashj
Those lego pieces are the special get a box of em for 20 bucks pieces - To implement this functionality I would use a little bit of JSNI and the onContextMenu functionality. Open up your module's main .html file and locate your body element. Add onContextMenu='someJavaScriptFunction()' to it. N

Re: What am I misunderstanding about the event model?

2008-12-23 Thread David Hoffer
Sounds good, I'll try that for DoubleClickEventListener. What lego pieces would you use to implement RightClickEventListener? -Dave On Tue, Dec 23, 2008 at 2:59 PM, lukehashj wrote: > > If you want the double-click event, create a DoubleClickEventListener > that extends ClickListener. When the

Re: What am I misunderstanding about the event model?

2008-12-23 Thread lukehashj
If you want the double-click event, create a DoubleClickEventListener that extends ClickListener. When the click event is fired a timer is started - if they click again before the timer executes, the onDoubleClick event fires. Otherwise, it's just treated as a single click. Using this mechanism, y

Re: What am I misunderstanding about the event model?

2008-12-23 Thread jay
Sucks, but I've found in a few cases the only way to get what I want is to copy the GWT source (e.g., Horizontal/VerticalSplitPanel) and put it into my code base to make the enhancements I need. (I've not looked at the Tree, so I don't know how much pain would be involved in this route for that wi

Re: What am I misunderstanding about the event model?

2008-12-23 Thread David Hoffer
As you say...I did go looky...at the gwt source and I didn't like what I saw. They implemented converting events to treeitems with loads of private data/methods. I would basically have to reimplement huge portions of the gwt ui code and then somehow prevent my implementation for interfering with

Re: What am I misunderstanding about the event model?

2008-12-23 Thread Reinier Zwitserloot
You CAN use it. If you know what you're doing. It wasn't designed to be particularly easy to use; it was designed to be able to do anything HTML can theoretically do, even if not all browsers support it. Contrast this to e.g. ClickListener which is designed to be easy to use and work across all ta

Re: What am I misunderstanding about the event model?

2008-12-22 Thread David Hoffer
Hi Reinier, So are you saying I can't use EventListener to somehow implement double/right click support in Tree widgets and convert the Event to a TreeItem? Moreover are you saying that double/right click support cannot be implemented using GWT? Unless I want to start over and re-implement widge

Re: What am I misunderstanding about the event model?

2008-12-22 Thread Reinier Zwitserloot
1) You can use something called 'anonymous inner classes'. google it. They look something like this: someButton.addClickListener(new ClickListener() { public void onClick () { /* code that runs when someButton is clicked goes here. */ }}); This does produce 2 class files, but this is an utte

Re: What am I misunderstanding about the event model?

2008-12-22 Thread David Hoffer
In my case I do want to subclass and handle the EventListener interface because I care about single/double/right clicks in Tree objects. However how can I convert the Event returned via onBrowserEvent() into a TreeItem? The interface is quite useless unless it is possible to convert the thing ret

Re: What am I misunderstanding about the event model?

2008-12-22 Thread David H. Cook
Jason - You wrote: "The problem with the standard DOM EventListeners is that only one listener can be attached to an Element. The other problem is that a custom Widget may be required to listen for a sequence of low-level events in order to trigger a single high-level event (think MOUSEDOWN/UP/MO

Re: What am I misunderstanding about the event model?

2008-12-22 Thread Jason Morris
The GWT event model is a close relation of the standard Java event model. The problem with the standard DOM EventListeners is that only one listener can be attached to an Element. The other problem is that a custom Widget may be required to listen for a sequence of low-level events in order t