pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Components made up of Java class and WTKX markup
Date Fri, 29 Jan 2010 17:45:27 GMT
Hi Cuong,

> Let's say I have the class AboutPane [extends BoxPane] and I have the markup file AboutPane.wtkx
which has the content
> 
> <mycorp:AboutPane ...>
>     <Label wtkx:id="version" text="Version 1.0" />
> </mycorp>
> 
> That is, AboutPane always has a Label to display a 'version' value.
> 
> To include in my app, I do a '<wtkx:include src="AboutPane.wtkx />' in my main
markup file, but within AboutPane.java, how do I reference the 'version' property from within,
say, AboutPane's constructor?

If AboutPane implements org.apache.pivot.wtkx.Bindable and declares a Label member as follows,
you can get access to the label in the initialize() method:

@WTKX private Label version;

(the annotation is also defined in org.apache.pivot.wtkx)

> Inversely, I can do a '<mycorp:AboutPane />' in my main markup file, but how do
tell Pivot to parse and render AboutPane.wtkx (as it automagically includes the version Label)?

Not entirely sure what you are looking for, but perhaps you want to use an include?

<wtkx:include src="AboutPane.wtkx"/>

Hope this helps,
Greg


Mime
View raw message