Yup - it's a 1:1 relationship.  The WTKXSerializer actually translates the
WTKX into Java API calls by applying the direct translation.

For instance, to set a push button to be a toolbar button, you set the
"toolbar" style on the button, like so: <PushButton
xmlns="org.apache.pivot.wtk" buttonData="Click Me" styles="{toolbar:true}"/>

What is happening here is you're creating an instance of
"org.apache.pivot.wtk.PushButton", calling setButtonData("Click Me") and
setStyles("{toolbar:true}").  The latter call is shorthand for setting a
number of styles en mass that would otherwise be set via a series of calls
to getStyles().put(key,value).  Finally, the styles dictionary in general is
a virtual passthrough to bean properties on the component's skin, so in this
case, you can find the supported styles for PushButton by looking at
org.apache.pivot.wtk.skin.terra.PushButtonSkin (the default push button
skin).  In this example, what ends up getting called is
http://pivot.apache.org/1.4/docs/api/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.html#setToolbar%28boolean%29

One area where we could do better is explaining what the default skin is for
any given component.  In general, you should look to the
org.apache.pivot.wtk.skin.terra package, but some skins don't need theming,
so their skin lies in org.apache.pivot.wtk.skin...  In your case, looking at
the bean properties of org.apache.piviot.wtk.skin.terra.TerraPushButtonSkin
will tell you what styles are supported for push buttons.

Hope that helps,
-T

On Wed, Feb 24, 2010 at 12:57 PM, Mathias Versichele <
[email protected]> wrote:

> But is this really a 1 one 1 relation ? For example, I'm looking up how to
> make a pushbutton a toolbar-styled pushbutton. I dont think I can find this
> in the javadoc ?
>
> 2010/2/24 Greg Brown <[email protected]>
>
> I think we need to make this question #1 on the FAQ.  ;-)
>>
>> WTKX is just a "shortcut" to writing Java code. The relationship between
>> WTKX and Java is described here:
>>
>> http://pivot.apache.org/tutorials/wtkx-primer.html
>>
>>
>> On Feb 24, 2010, at 12:51 PM, Mathias Versichele wrote:
>>
>> > I might have missed it, but is there some kind of reference document for
>> the wtkx markup language which lists all options, attributes, ... of all
>> components ?
>> >
>> > --
>> > Mathias Versichele
>> > Bio-ir milieutechnologie / Msc. geografie
>> > Oudburgstraat 16
>> > 9240 Zele
>> > 0485/16.07.08
>>
>>
>
>
> --
> Mathias Versichele
> Bio-ir milieutechnologie / Msc. geografie
> Oudburgstraat 16
> 9240 Zele
> 0485/16.07.08
>

Reply via email to