Re: Of "onClick" attribute and XulAction
Gerald Bauer <[email protected]> Thu, 2 Oct 2003 10:42:53 -0700 (PDT)
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Denis,
> Could you please give me a hint on how you link a
> "oncommand" xul attribute and its corresponding
> XulAction.
> I have look a few times at the code but I can't see
> where the glue code is...
I guess it's confusing because in the Java code
Luxor uses Java-speak instead of XUL-speak, that is,
action instead of command.
Here's the snippet from the XulAction class that
registers the action/command with the XulManager.
XulAction.class
=======================================
public XulAction( String id )
{
super();
_id = id;
XulManager.getXulManager().addAction( _id, this
);
}
And here's the snippet from the Button, for example,
that looks up the action/command and adds it to the
Swing button. Yes, that's all there is to it. Guess
that's why it's so easy to overlook it.
XButton.class
========================================
Action action = def.getAction( ctx );
if( action != null )
_button.setAction( action );
Hope this helps. By the way, in the future it's
better to use reflection and get rid of the XulAction
class alltogether.
- Gerald
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf