pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Form setLabel
Date Wed, 14 Apr 2010 22:44:22 GMT
This example works because the <Label> tags are direct descendants of <Form.Section>.
In your example, they were descendants of the <Border>.

On Apr 14, 2010, at 6:42 PM, Shahzad Bhatti wrote:

> Thanks, I modeled it after stocktracker.detail.wtkx that uses similar Label with Form.label,
such as:
> 
> 
> <BoxPane wtkx:id="rootPane" orientation="vertical" styles="{fill:true}"
>    xmlns:wtkx="http://pivot.apache.org/wtkx"
>    xmlns="org.apache.pivot.wtk">
>    <Label textKey="companyName" styles="{font:{size:12, bold:true}}"/>
>    <Separator/>
>    <Form styles="{rightAlignLabels:true, fill:true}">
>        <sections>
>            <Form.Section>
>                <Label Form.label="%value" textKey="value"
>                    styles="{horizontalAlignment:'right'}"/>
>                <Label wtkx:id="changeLabel" Form.label="%change" textKey="change"
>                    styles="{horizontalAlignment:'right'}"/>
>                <Label Form.label="%openingValue" textKey="openingValue"
>                    styles="{horizontalAlignment:'right'}"/>
>                <Label Form.label="%highValue" textKey="highValue"
>                    styles="{horizontalAlignment:'right'}"/>
>                <Label Form.label="%lowValue" textKey="lowValue"
>                    styles="{horizontalAlignment:'right'}"/>
>                <Label Form.label="%volume" textKey="volume"
>                    styles="{horizontalAlignment:'right'}"/>
>            </Form.Section>
>        </sections>
>    </Form>
> </BoxPane>
> 
> Why does above example work? Also, I removed Border and replaced with BoxPane.
> 
> 
> On 4/14/10 3:30 PM, "Greg Brown" <gkbrown@mac.com> wrote:
> 
> I assume you are using Pivot 1.4? The problem is that the Label instances are not direct
descendants of the Form.Section. In Pivot 1.4 and earlier, this throws an exception. In Pivot
1.5+, an exception is not thrown, but you still won't see the labels attached to your Label
elements - forms only recognize labels attached to section children.
> 
> Also, a Border can only have one content element. You'll need to nest a layout container
in the Border instance if you want to display multiple child elements.
> 
> On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
> 
>> I am trying to use Label along with Form such as
>>                                                         <BoxPane styles="{horizontalAlignment:'left'}">
>>                                                             <Form wtkx:id="form"
styles="{rightAlignLabels:true, fill:true}">
>>                                                                 <sections>
>>                                                                     <Form.Section>
>>                                                                         <Border
styles="{backgroundColor:null, padding:2}">
>>                                                                             <content>
>>                                                                               <Label
Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
>>                                                                             </content>
>>                                                                         </Border>
>>                                                                     </Form.Section>
>>                                                                     <Form.Section>
>>                                                                         <Border
styles="{backgroundColor:null, padding:2}">
>>                                                                             <content>
>>                                                                                 
     <Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
>>                                                                                 
     <Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
>>                                                                                 
     <Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
>>                                                                                 
     <Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
>>                                                                                 
     <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
>>                                                                             </content>
>>                                                                         </Border>
>>                                                                     </Form.Section>
>> ...
>> 
>> 
>> But I am getting following error:
>> Caused by: java.lang.reflect.InvocationTargetException    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)    ... 19 more Caused by: java.lang.IllegalStateException
   at org.apache.pivot.wtk.Form.setLabel(Unknown Source)    ... 23 more
>> 
>> 
>> Looking at the source, this happens when the attributes of component are null. Any
idea how to fix it?
>> 
>> Thanks.
>> 
>> 
>> ______________________________________________
>> 
>> See  http://www.peak6.com/email_disclaimer.php
>> for terms and conditions related to this email
> 
> 


Mime
View raw message