I should also have added that it might be easier to track this down if you
can attach a complete example including the WTKX file (zipped for the
mailing list).
Are you using Pivot 1.5 or 1.5.1?

Regards,

Chris

On 9 September 2010 22:18, Chris Bartlett <[email protected]> wrote:

> I think it might be down to the introduction of the inline attribute for
> wtkx:include in 1.5.
> <wtkc:include src="other_file.wtkx" inline="true"/>
>
> http://pivot.apache.org/tutorials/wtkx-primer.html
>
> Chris
>
> On 9 September 2010 21:34, David McNelis <[email protected]>wrote:
>
>>  Actually, adding an additional serializer seemed to take care of that
>> issue.  So I suppose I’m passed that and on to updating other areas of my
>> code.
>>
>>
>>
>> Out of curiosity, is this change by design, or did I stumble on to
>> something unintentional?
>>
>>
>>
>> *From:* David McNelis [mailto:[email protected]]
>> *Sent:* Thursday, September 09, 2010 9:24 AM
>>
>> *To:* [email protected]
>> *Subject:* RE: Null pointer with ListButton setListData
>>
>>
>>
>> Here is a bit more complete sample, the wtkx file has a ListButton in it
>> with a wtkx:id that matches my ListButton in the code….
>>
>>
>>
>> public MyClass implements Application {
>>
>>   @WTKX private ListButton myListButton = null;
>>
>>
>>
>>   public void startup(Display display, Map<String, String> properties)
>>
>>     throws Exception {
>>
>>
>>
>>     WTKXSerializer wtkxSerializer = new WTKXSerializer();
>>
>>     window = (Window)wtkxSerializer.readObject(this,
>> "templateBuilderUi.xml");
>>
>>     window.open(display);
>>
>>     wtkxSerializer.bind(this, MyClass.class);
>>
>>
>>
>>     List<ListItem> myList = getList(); //Returns 13 items
>>
>>     myListButton.setListData(myList);
>>
>>
>>
>>   }
>>
>> private List<ListItem> getList(){
>>
>>                 List<ListItem> list = new ArrayList<ListItem>();
>>
>>                 ListItem listItem = new ListItem();
>>
>>                 listItem.setText(“X”);
>>
>>                 list.add(listItem);
>>
>>
>>
>> return list;
>>
>> }
>>
>> //other req. methods, ect
>>
>> }
>>
>>
>>
>> I am getting the NPE on the line myListButton.setListData(myList);.  All
>> I’m seeing is the NPE stack trace with the line number pointing to the line
>> with myListButton.setListData(myList);
>>
>>
>>
>> The myListButton is defined in an included file…where I am serializing
>> file X which has a wtkx:include directive that pulls in file Y, and
>> myListButton is defined in file Y.  That worked fine previously…but I
>> suppose that could impact this as well.  The UI itself draws correctly,
>> pulling in file Y, but it seems that when I try to access any of the
>> controls defined in file Y I am getting an NPE.  Should I specifically be
>> running the serializer on file Y?
>>
>>
>>
>> *From:* Greg Brown [mailto:[email protected]]
>> *Sent:* Thursday, September 09, 2010 9:05 AM
>> *To:* [email protected]
>> *Subject:* Re: Null pointer with ListButton setListData
>>
>>
>>
>> What is actually null in this case? Is it the "lb" variable?
>>
>>
>>
>> On Sep 9, 2010, at 9:52 AM, David McNelis wrote:
>>
>>
>>
>> Hey folks,
>>
>>
>>
>> I know I’m late to update to 1.5, but when I try to run my application, a
>> list button that was previously working fine (all list buttons actually)
>> where I am setting the list data programmatically are returning NPEs.  My
>> list contains 13 values and here is a sample of code.
>>
>>
>>
>> @WTKX ListButton lb = null;
>>
>>
>>
>> //run through the serializer blah blah
>>
>> List<ListItem> data = FunctionThatReturnsArrayListOfListItems();
>>
>> lb.setListData(data);
>>
>>
>>
>> When I spit out the length of data I get 13 items.  I originally had the
>> list of type String, and tried ListItem, hoping that was the cause of my
>> issue.
>>
>>
>>
>> Did something about this change between 1.4 and 1.5 that I’m not seeing?
>> Note, I am not currently defining any ListData in my wtkx files.
>>
>>
>>
>> Thanks,
>>
>> David
>>
>>
>>
>
>

Reply via email to