You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by He...@sz.murata.com.cn on 2010/12/09 09:59:43 UTC
how to set large data using getquery and jsonserializer?
Dear all
I'd like to build a demo following the large data set sample in
Apache Pivot official web site .
The sample is using CSVSerializer and calling a thead class [
AddRowsCallback] in method endList() and readitem().
Question:
1.Can any one demonstrate the 2 method of endList() and
readItem()?
2.if using JSONSerializer and accept ArrayList parameter.do i
still have to overwrite endList() and readItem()?I tried
but it seams wrong.
I just want to set ArrayList into tableview.As when the list'length is
over about 500 hundreds,UI becomes
frozen a few minutes.
I really appreciate it if anyone can give me some help.
Thanks and regards
Hero
Re: how to set large data using getquery and jsonserializer?
Posted by He...@sz.murata.com.cn.
Thanks for your professional answer.
I' ll try it again.
Thanks and best regards
Hero.
Greg Brown <gk...@verizon.net>
12/09/2010 09:13 PM
Please respond to
user@pivot.apache.org
To
user@pivot.apache.org
cc
Subject
Re: how to set large data using getquery and jsonserializer?
I'd like to build a demo following the large data set sample in
Apache Pivot official web site .
The sample is using CSVSerializer and calling a thead class [
AddRowsCallback] in method endList() and readitem().
Question:
1.Can any one demonstrate the 2 method of endList() and
readItem()?
The code at the beginning of this file is the best example of how to use
these methods:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
The execute() method opens a stream from the given URL and wraps it in a
MonitoredInputStream. MonitoredInputStream is an inner class of IOTask
that will respect the abort flag if it is set by the caller.
It then reads the data from the input stream using CSVSerializer.
CSVSerializer fires 3 events:
beginList() -- called when the list is created
endList() -- called after the last item has been read
readItem() -- called after each item is read
In this example, the listener implementation builds up pages of results
before adding them to the table view, since this will generally perform
better for a large number of rows. The add is done in a callback so the UI
does not get bogged down.
2.if using JSONSerializer and accept ArrayList parameter.do i
still have to overwrite endList() and readItem()?I tried
but it seams wrong.
If you are reading JSON data, you will probably want to implement
endList() and endDictionary() (assuming that your items are stored as JSON
objects). endDictionary() will be called for each "row" in your data set.
I just want to set ArrayList into tableview.As when the list'length is
over about 500 hundreds,UI becomes
frozen a few minutes.
Yes, that is why we use the callback with the listeners. Make sure that
you are calling the asynchronous version of Task#execute() (the one that
takes a TaskListener). The synchronous one won't do you much good, since
you'll be executing the actual query on the UI thread and it won't get any
updates until the task is done.
Re: how to set large data using getquery and jsonserializer?
Posted by He...@sz.murata.com.cn.
It seems that I must clear up my mind entirely.
Thanks for your help.
Hero.
Greg Brown <gk...@verizon.net>
12/10/2010 11:16 AM
Please respond to
user@pivot.apache.org
To
user@pivot.apache.org
cc
Subject
Re: how to set large data using getquery and jsonserializer?
Does your code compile? JSONSerializerListener does not define endList()
or readItem().
On Dec 9, 2010, at 9:47 PM, HeroLi@sz.murata.com.cn wrote:
Sorry for bothering you again.
I use JSONSerializer to read ArrayList.
Code:
JSONSerializer jsonSerializer = new JSONSerializer();
jsonSerializer.getJSONSerializerListeners().add(
new JSONSerializerListener.Adapter(){
private ArrayList<Object> page = new
ArrayList<Object>(200);
public void endList(JSONSerializer jsonSerializer) {
..
}
public void readItem(JSONSerializer jsonSerializer,
Object item) {
..
}
public void endDictionary(JSONSerializer
jsonSerializer) {
..
});
}
An exception is thrown out
java.lang.NoSuchMethodError:
org.apache.pivot.json.JSONSerializer.getJSONSerializerListeners()Lorg/apache/pivot/util/ListenerList;
Since I get data from db in a jsp(or from a servlet.).
1.i can't use the callback class
2.from jsonSerializer.getJSONSerializerListeners () throwing
error.
I am totally stranded..
Looking forward to the reply.Thanks very much
Hero.
Greg Brown <gk...@verizon.net>
12/09/2010 09:13 PM
Please respond to
user@pivot.apache.org
To
user@pivot.apache.org
cc
Subject
Re: how to set large data using getquery and jsonserializer?
I'd like to build a demo following the large data set sample in
Apache Pivot official web site .
The sample is using CSVSerializer and calling a thead class [
AddRowsCallback] in method endList() and readitem().
Question:
1.Can any one demonstrate the 2 method of endList() and
readItem()?
The code at the beginning of this file is the best example of how to use
these methods:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
The execute() method opens a stream from the given URL and wraps it in a
MonitoredInputStream. MonitoredInputStream is an inner class of IOTask
that will respect the abort flag if it is set by the caller.
It then reads the data from the input stream using CSVSerializer.
CSVSerializer fires 3 events:
beginList() -- called when the list is created
endList() -- called after the last item has been read
readItem() -- called after each item is read
In this example, the listener implementation builds up pages of results
before adding them to the table view, since this will generally perform
better for a large number of rows. The add is done in a callback so the UI
does not get bogged down.
2.if using JSONSerializer and accept ArrayList parameter.do i
still have to overwrite endList() and readItem()?I tried
but it seams wrong.
If you are reading JSON data, you will probably want to implement
endList() and endDictionary() (assuming that your items are stored as JSON
objects). endDictionary() will be called for each "row" in your data set.
I just want to set ArrayList into tableview.As when the list'length is
over about 500 hundreds,UI becomes
frozen a few minutes.
Yes, that is why we use the callback with the listeners. Make sure that
you are calling the asynchronous version of Task#execute() (the one that
takes a TaskListener). The synchronous one won't do you much good, since
you'll be executing the actual query on the UI thread and it won't get any
updates until the task is done.
Re: how to set large data using getquery and jsonserializer?
Posted by Greg Brown <gk...@verizon.net>.
Does your code compile? JSONSerializerListener does not define endList() or readItem().
On Dec 9, 2010, at 9:47 PM, HeroLi@sz.murata.com.cn wrote:
>
> Sorry for bothering you again.
>
> I use JSONSerializer to read ArrayList.
>
> Code:
>
> JSONSerializer jsonSerializer = new JSONSerializer();
> jsonSerializer.getJSONSerializerListeners().add(new JSONSerializerListener.Adapter(){
> private ArrayList<Object> page = new ArrayList<Object>(200);
>
> public void endList(JSONSerializer jsonSerializer) {
> ..
> }
>
> public void readItem(JSONSerializer jsonSerializer, Object item) {
> ..
> }
>
> public void endDictionary(JSONSerializer jsonSerializer) {
> ..
> });
> }
> An exception is thrown out
>
> java.lang.NoSuchMethodError: org.apache.pivot.json.JSONSerializer.getJSONSerializerListeners()Lorg/apache/pivot/util/ListenerList;
>
> Since I get data from db in a jsp(or from a servlet.).
> 1.i can't use the callback class
> 2.from jsonSerializer.getJSONSerializerListeners () throwing error.
>
> I am totally stranded..
>
> Looking forward to the reply.Thanks very much
>
> Hero.
>
>
>
>
>
>
> Greg Brown <gk...@verizon.net>
> 12/09/2010 09:13 PM
> Please respond to
> user@pivot.apache.org
>
> To
> user@pivot.apache.org
> cc
> Subject
> Re: how to set large data using getquery and jsonserializer?
>
>
>
>
>
> I'd like to build a demo following the large data set sample in Apache Pivot official web site .
>
> The sample is using CSVSerializer and calling a thead class [AddRowsCallback] in method endList() and readitem().
>
> Question:
> 1.Can any one demonstrate the 2 method of endList() and readItem()?
>
> The code at the beginning of this file is the best example of how to use these methods:
>
> http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
>
> The execute() method opens a stream from the given URL and wraps it in a MonitoredInputStream. MonitoredInputStream is an inner class of IOTask that will respect the abort flag if it is set by the caller.
>
> It then reads the data from the input stream using CSVSerializer. CSVSerializer fires 3 events:
>
> beginList() -- called when the list is created
> endList() -- called after the last item has been read
> readItem() -- called after each item is read
>
> In this example, the listener implementation builds up pages of results before adding them to the table view, since this will generally perform better for a large number of rows. The add is done in a callback so the UI does not get bogged down.
>
> 2.if using JSONSerializer and accept ArrayList parameter.do i still have to overwrite endList() and readItem()?I tried
> but it seams wrong.
>
> If you are reading JSON data, you will probably want to implement endList() and endDictionary() (assuming that your items are stored as JSON objects). endDictionary() will be called for each "row" in your data set.
>
> I just want to set ArrayList into tableview.As when the list'length is over about 500 hundreds,UI becomes
> frozen a few minutes.
>
> Yes, that is why we use the callback with the listeners. Make sure that you are calling the asynchronous version of Task#execute() (the one that takes a TaskListener). The synchronous one won't do you much good, since you'll be executing the actual query on the UI thread and it won't get any updates until the task is done.
>
>
Re: how to set large data using getquery and jsonserializer?
Posted by He...@sz.murata.com.cn.
Sorry for bothering you again.
I use JSONSerializer to read ArrayList.
Code:
JSONSerializer jsonSerializer = new JSONSerializer();
jsonSerializer.getJSONSerializerListeners().add(
new JSONSerializerListener.Adapter(){
private ArrayList<Object> page = new
ArrayList<Object>(200);
public void endList(JSONSerializer jsonSerializer) {
..
}
public void readItem(JSONSerializer jsonSerializer,
Object item) {
..
}
public void endDictionary(JSONSerializer
jsonSerializer) {
..
});
}
An exception is thrown out
java.lang.NoSuchMethodError:
org.apache.pivot.json.JSONSerializer.getJSONSerializerListeners()Lorg/apache/pivot/util/ListenerList;
Since I get data from db in a jsp(or from a servlet.).
1.i can't use the callback class
2.from jsonSerializer.getJSONSerializerListeners () throwing
error.
I am totally stranded..
Looking forward to the reply.Thanks very much
Hero.
Greg Brown <gk...@verizon.net>
12/09/2010 09:13 PM
Please respond to
user@pivot.apache.org
To
user@pivot.apache.org
cc
Subject
Re: how to set large data using getquery and jsonserializer?
I'd like to build a demo following the large data set sample in
Apache Pivot official web site .
The sample is using CSVSerializer and calling a thead class [
AddRowsCallback] in method endList() and readitem().
Question:
1.Can any one demonstrate the 2 method of endList() and
readItem()?
The code at the beginning of this file is the best example of how to use
these methods:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
The execute() method opens a stream from the given URL and wraps it in a
MonitoredInputStream. MonitoredInputStream is an inner class of IOTask
that will respect the abort flag if it is set by the caller.
It then reads the data from the input stream using CSVSerializer.
CSVSerializer fires 3 events:
beginList() -- called when the list is created
endList() -- called after the last item has been read
readItem() -- called after each item is read
In this example, the listener implementation builds up pages of results
before adding them to the table view, since this will generally perform
better for a large number of rows. The add is done in a callback so the UI
does not get bogged down.
2.if using JSONSerializer and accept ArrayList parameter.do i
still have to overwrite endList() and readItem()?I tried
but it seams wrong.
If you are reading JSON data, you will probably want to implement
endList() and endDictionary() (assuming that your items are stored as JSON
objects). endDictionary() will be called for each "row" in your data set.
I just want to set ArrayList into tableview.As when the list'length is
over about 500 hundreds,UI becomes
frozen a few minutes.
Yes, that is why we use the callback with the listeners. Make sure that
you are calling the asynchronous version of Task#execute() (the one that
takes a TaskListener). The synchronous one won't do you much good, since
you'll be executing the actual query on the UI thread and it won't get any
updates until the task is done.
Re: how to set large data using getquery and jsonserializer?
Posted by Greg Brown <gk...@verizon.net>.
> I'd like to build a demo following the large data set sample in Apache Pivot official web site .
>
> The sample is using CSVSerializer and calling a thead class [AddRowsCallback] in method endList() and readitem().
>
> Question:
> 1.Can any one demonstrate the 2 method of endList() and readItem()?
The code at the beginning of this file is the best example of how to use these methods:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
The execute() method opens a stream from the given URL and wraps it in a MonitoredInputStream. MonitoredInputStream is an inner class of IOTask that will respect the abort flag if it is set by the caller.
It then reads the data from the input stream using CSVSerializer. CSVSerializer fires 3 events:
beginList() -- called when the list is created
endList() -- called after the last item has been read
readItem() -- called after each item is read
In this example, the listener implementation builds up pages of results before adding them to the table view, since this will generally perform better for a large number of rows. The add is done in a callback so the UI does not get bogged down.
> 2.if using JSONSerializer and accept ArrayList parameter.do i still have to overwrite endList() and readItem()?I tried
> but it seams wrong.
If you are reading JSON data, you will probably want to implement endList() and endDictionary() (assuming that your items are stored as JSON objects). endDictionary() will be called for each "row" in your data set.
> I just want to set ArrayList into tableview.As when the list'length is over about 500 hundreds,UI becomes
> frozen a few minutes.
Yes, that is why we use the callback with the listeners. Make sure that you are calling the asynchronous version of Task#execute() (the one that takes a TaskListener). The synchronous one won't do you much good, since you'll be executing the actual query on the UI thread and it won't get any updates until the task is done.