Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Loading data in a background thread and later update Table with it
Loading data in a background thread and later update Table with it [message #81491] Fri, 04 April 2008 11:45 Go to next message
Eclipse UserFriend
Hello guys,

I have an application which fetches about 1500 rows of data and displays
10 rows at a time on the tableviewer. I currently have to wait on the UI
thread for the data to be retrieved before I begin displaying. Is it
possible for me to fork a separate thread which fills up the model.
Also, the UI thread can listen on this background thread and as soon as
that background thread has 30 rows the UI thread renders the contents
and waits for background thread to fetch the rest of data.

Once the model is totally fetched than the table viewer can refresh with
entire data set.

Is this doable ? If so could someone point me to an example or some
tutorial.

I am new to RAP (even RCP) so not sure how to work with threads and
handle inter process communications.

Any help is appreciated.

Thanks,

Arpit
Re: Loading data in a background thread and later update Table with it [message #81549 is a reply to message #81491] Sat, 05 April 2008 00:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I think a better solution would be to use the SWT.VIRTUAL Flag on the
table to handle your problem. You may have a look at the controls demo
(org.eclipse.rap.demo.controls.TableViewerTab) to see how to handle
this.

But in general I want to note that I don't think displaying 1500 or more
rows in a table is good user-experience. What is the user expected to do
with 1500 rows? Read them one by one so that he's busy for the rest of
his working day? Additionally once he has scrolled to the bottom of the
table all the 1500 rows of data are represented in the table viewer on
the serverside too. So this have a huge impact to the available memory
on the serverside and therefore on the amount of possible concurrent
users.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Arpit Desai [mailto:arpitdesai23@gmail.com]
Bereitgestellt: Freitag, 4. April 2008 17:46
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Loading data in a background thread and later update Table
with it
Betreff: Loading data in a background thread and later update Table with
it


Hello guys,

I have an application which fetches about 1500 rows of data and displays
10 rows at a time on the tableviewer. I currently have to wait on the UI
thread for the data to be retrieved before I begin displaying. Is it
possible for me to fork a separate thread which fills up the model.
Also, the UI thread can listen on this background thread and as soon as
that background thread has 30 rows the UI thread renders the contents
and waits for background thread to fetch the rest of data.

Once the model is totally fetched than the table viewer can refresh with
entire data set.

Is this doable ? If so could someone point me to an example or some
tutorial.

I am new to RAP (even RCP) so not sure how to work with threads and
handle inter process communications.

Any help is appreciated.

Thanks,

Arpit
Re: Loading data in a background thread and later update Table with it [message #81598 is a reply to message #81549] Sat, 05 April 2008 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Frank,

That is a good point and that's what I was trying to achieve, use the
SWT.VIRTUAL flag on the table. I currently have the tableviewer with
SWT.VIRTUAL flag on it. However, its content provider implements
IStructuredContentProvider and not ILazyContentProvider. I was forced to
do this because I need sorting support on the table and if my content
provider implements ILazyContentProvider I was loosing the sorting
capabilities.

So, I have the table marked as SWT.VIRTUAL but its model and content
provider are conventional. Hopefully, by doing this, any time a user
scrolls to the bottom of the table not all the records are stored in the
serverside. Please correct me if I am wrong here.

Additionally, my data fetching API (fetches data from Siebel using Java
Data Beans) is written in such a way that it fetches all the records for
the query once. It does not support fetching it piece by piece.

So, I intend to write a background thread which fetches data and UI
thread can show something like "Loading data ..." message on screen so
the user does not feel that the UI is stuck. Could you share some code
to achieve this kind of behavior.

I appreciate you advice and hope to have made my point clear. I want to
write an optimal code while maintaining the functionality required.

Looking forward to your response.

Thanks,

Arpit


Frank Appel wrote:
> Hi,
>
> I think a better solution would be to use the SWT.VIRTUAL Flag on the
> table to handle your problem. You may have a look at the controls demo
> (org.eclipse.rap.demo.controls.TableViewerTab) to see how to handle
> this.
>
> But in general I want to note that I don't think displaying 1500 or more
> rows in a table is good user-experience. What is the user expected to do
> with 1500 rows? Read them one by one so that he's busy for the rest of
> his working day? Additionally once he has scrolled to the bottom of the
> table all the 1500 rows of data are represented in the table viewer on
> the serverside too. So this have a huge impact to the available memory
> on the serverside and therefore on the amount of possible concurrent
> users.
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Arpit Desai [mailto:arpitdesai23@gmail.com]
> Bereitgestellt: Freitag, 4. April 2008 17:46
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Loading data in a background thread and later update Table
> with it
> Betreff: Loading data in a background thread and later update Table with
> it
>
>
> Hello guys,
>
> I have an application which fetches about 1500 rows of data and displays
> 10 rows at a time on the tableviewer. I currently have to wait on the UI
> thread for the data to be retrieved before I begin displaying. Is it
> possible for me to fork a separate thread which fills up the model.
> Also, the UI thread can listen on this background thread and as soon as
> that background thread has 30 rows the UI thread renders the contents
> and waits for background thread to fetch the rest of data.
>
> Once the model is totally fetched than the table viewer can refresh with
> entire data set.
>
> Is this doable ? If so could someone point me to an example or some
> tutorial.
>
> I am new to RAP (even RCP) so not sure how to work with threads and
> handle inter process communications.
>
> Any help is appreciated.
>
> Thanks,
>
> Arpit
>
Re: Loading data in a background thread and later update Table with it [message #81707 is a reply to message #81598] Mon, 07 April 2008 03:21 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

to the best of my knowledge: if you scroll to the bottom of the table
using a tableviewer all records are stored at the server side. This is
done even if using SWT.VIRTUAL since data-beans are mapped to table
items in the table viewer and rows that have already been displayed are
not getting disposed of.

To do the data fetching in the background you may use jobs like
org.eclipse.rap.demo.actions.JobActionWithDialog for example. After
you've fetched your data you can use Display.asyncExec to update your
tableviewer.

Ciao
Frank


-----Ursprüngliche Nachricht-----
Von: Arpit Desai [mailto:arpitdesai23@gmail.com]
Bereitgestellt: Samstag, 5. April 2008 19:15
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Loading data in a background thread and later update Table
with it
Betreff: Re: Loading data in a background thread and later update Table
with it


Frank,

That is a good point and that's what I was trying to achieve, use the
SWT.VIRTUAL flag on the table. I currently have the tableviewer with
SWT.VIRTUAL flag on it. However, its content provider implements
IStructuredContentProvider and not ILazyContentProvider. I was forced to
do this because I need sorting support on the table and if my content
provider implements ILazyContentProvider I was loosing the sorting
capabilities.

So, I have the table marked as SWT.VIRTUAL but its model and content
provider are conventional. Hopefully, by doing this, any time a user
scrolls to the bottom of the table not all the records are stored in the
serverside. Please correct me if I am wrong here.

Additionally, my data fetching API (fetches data from Siebel using Java
Data Beans) is written in such a way that it fetches all the records for
the query once. It does not support fetching it piece by piece.

So, I intend to write a background thread which fetches data and UI
thread can show something like "Loading data ..." message on screen so
the user does not feel that the UI is stuck. Could you share some code
to achieve this kind of behavior.

I appreciate you advice and hope to have made my point clear. I want to
write an optimal code while maintaining the functionality required.

Looking forward to your response.

Thanks,

Arpit


Frank Appel wrote:
> Hi,
>
> I think a better solution would be to use the SWT.VIRTUAL Flag on the
> table to handle your problem. You may have a look at the controls demo
> (org.eclipse.rap.demo.controls.TableViewerTab) to see how to handle
> this.
>
> But in general I want to note that I don't think displaying 1500 or
> more rows in a table is good user-experience. What is the user
> expected to do with 1500 rows? Read them one by one so that he's busy
> for the rest of his working day? Additionally once he has scrolled to
> the bottom of the table all the 1500 rows of data are represented in
> the table viewer on the serverside too. So this have a huge impact to
> the available memory on the serverside and therefore on the amount of
> possible concurrent users.
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Arpit Desai [mailto:arpitdesai23@gmail.com]
> Bereitgestellt: Freitag, 4. April 2008 17:46 Bereitgestellt in:
> eclipse.technology.rap
> Unterhaltung: Loading data in a background thread and later update
> Table with it
> Betreff: Loading data in a background thread and later update Table
> with it
>
>
> Hello guys,
>
> I have an application which fetches about 1500 rows of data and
> displays 10 rows at a time on the tableviewer. I currently have to
> wait on the UI thread for the data to be retrieved before I begin
> displaying. Is it possible for me to fork a separate thread which
fills up the model.
> Also, the UI thread can listen on this background thread and as soon
> as that background thread has 30 rows the UI thread renders the
> contents and waits for background thread to fetch the rest of data.
>
> Once the model is totally fetched than the table viewer can refresh
> with entire data set.
>
> Is this doable ? If so could someone point me to an example or some
> tutorial.
>
> I am new to RAP (even RCP) so not sure how to work with threads and
> handle inter process communications.
>
> Any help is appreciated.
>
> Thanks,
>
> Arpit
>
Previous Topic:BIRT Chart Problem
Next Topic:theme.properties file
Goto Forum:
  


Current Time: Sat Aug 30 05:56:34 EDT 2025

Powered by FUDForum. Page generated in 0.03975 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top