pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David McNelis" <Dmcne...@sharedmarketing.com>
Subject RE: Null pointer with ListButton setListData
Date Thu, 09 Sep 2010 14:34:49 GMT
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:Dmcnelis@sharedmarketing.com] 
Sent: Thursday, September 09, 2010 9:24 AM
To: user@pivot.apache.org
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:gkbrown@mac.com] 
Sent: Thursday, September 09, 2010 9:05 AM
To: user@pivot.apache.org
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

 


Mime
View raw message