binding wtkx xml objects to java listeners

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

binding wtkx xml objects to java listeners

Robert Piotrowski-2
I was looking at the Pivot primer page again and was wondering if you can bind the Pivot objects in wtkx to java listeners with something like this :

<PushButton xmlns="org.apache.pivot.wtk"

    xmlns:wtkx="http://pivot.apache.org/wtkx"

    buttonData="Click Me!"

    ButtonPressListener.buttonPressed=="mypackage.main.mybuttonlistener"/>


or does all the implementation have to be done with embedded script in the xml?


The thing is, I'd prefer to write my listeners in Java, but I dont want to do the binding in Java with all the tedious serializer/getlisteners/addlistener stuff.



Thanks,
Bob

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: binding wtkx xml objects to java listeners

Greg Brown
Administrator
Take a look at the org.apache.pivot.wtkx.Bindable interface. It won't allow you to do what you describe below, but it does make integrating Java and WTKX much easier. I'm planning to write up a tutorial example on how to use it for 1.4.1, but you can take a look at the test code here to get an idea of how it works:

http://svn.apache.org/repos/asf/pivot/trunk/tests/src/org/apache/pivot/tests/bindable_test.wtkx

Basically the idea is that, when initialize() is called, you are guaranteed to have access to all of your bound variables.

G

On Feb 23, 2010, at 2:41 PM, Robert Piotrowski wrote:

I was looking at the Pivot primer page again and was wondering if you can bind the Pivot objects in wtkx to java listeners with something like this :

<PushButton xmlns="org.apache.pivot.wtk"

    xmlns:wtkx="http://pivot.apache.org/wtkx"

    buttonData="Click Me!"

    ButtonPressListener.buttonPressed=="mypackage.main.mybuttonlistener"/>


or does all the implementation have to be done with embedded script in the xml?


The thing is, I'd prefer to write my listeners in Java, but I dont want to do the binding in Java with all the tedious serializer/getlisteners/addlistener stuff.



Thanks,
Bob


Loading...