Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » table rows
table rows [message #440380] Wed, 28 July 2004 20:45 Go to next message
Geoffrey Ritchey is currently offline Geoffrey RitcheyFriend
Messages: 42
Registered: July 2009
Member
How can I tell how many rows in a table will be visible without scrolling?


Do I have to do some calcuation similar to tableHeight/rowHeight?
Re: table rows [message #440413 is a reply to message #440380] Thu, 29 July 2004 21:43 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 13
Registered: July 2009
Junior Member
Table.getItemCount() will tell you how many TableItems (ie rows) are in
the table.
-Tej
geoff wrote:

> How can I tell how many rows in a table will be visible without scrolling?


> Do I have to do some calcuation similar to tableHeight/rowHeight?
Re: table rows [message #440414 is a reply to message #440413] Thu, 29 July 2004 23:20 Go to previous messageGo to next message
Geoffrey Ritchey is currently offline Geoffrey RitcheyFriend
Messages: 42
Registered: July 2009
Member
But I don't want the total count. Just the number visible.

Here's what's going on. I'm getting the data out of an XML file on a web
server. The table may only have 10 lines showing, so I only want to get
10 lines of data from the server. Under the table I have a button labeled
"Next" to get the next group of 10 returned from the backend query.

Now if the user maximized the interface, the table may have more than 10
lines visible. If the server only returns 10 lines, it will look like the
table is only half full. Now I want the server to return, say 20 lines.

For this reason I need the client to be able to tell the server how many
lines are visible in the table.

Tej wrote:

> Table.getItemCount() will tell you how many TableItems (ie rows) are in
> the table.
> -Tej
> geoff wrote:

> > How can I tell how many rows in a table will be visible without scrolling?


> > Do I have to do some calcuation similar to tableHeight/rowHeight?
Re: table rows [message #440457 is a reply to message #440414] Sat, 31 July 2004 00:21 Go to previous messageGo to next message
Jelle Herold is currently offline Jelle HeroldFriend
Messages: 42
Registered: July 2009
Member
On 2004-07-29, geoff <geoffritchey@hotmail.com> wrote:
> But I don't want the total count. Just the number visible.
>
> Here's what's going on. I'm getting the data out of an XML file on a web
> server. The table may only have 10 lines showing, so I only want to get
> 10 lines of data from the server. Under the table I have a button labeled
> "Next" to get the next group of 10 returned from the backend query.
>
> Now if the user maximized the interface, the table may have more than 10
> lines visible. If the server only returns 10 lines, it will look like the
> table is only half full. Now I want the server to return, say 20 lines.
>
> For this reason I need the client to be able to tell the server how many
> lines are visible in the table.

Just a quick note: On swing there is a TableModel interface that
basically looks like this:

( http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/Ta bleModel.html)
interface TableModel
{
// ...
public int getRowCount();
public int getColCount();
public Object getValueAt(int row, int col);
// ...
}

The table view (JTable?) queries the model for the data it needs for the
rows that are visible at the moment. You could implement a TableModel
that when queried for values returns the string "..." for instance, and
then starts a thread and gets the needed values from a DB (or whatever
source). When done, the TableModel notifies it's observer that those
values have changed and then need to redraw.

I'm pretty sure either SWT or JFace provide a similar model.

HTH
Jelle.
--
http://o2w.nl/~jelle/
http://defekt.nl/
Re: table rows [message #440518 is a reply to message #440380] Tue, 03 August 2004 21:05 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Yes. Use table.getClientArea().height / table.getItemHeight(). This rounds
down.

"geoff" <geoffritchey@hotmail.com> wrote in message
news:ce9395$drt$1@eclipse.org...
>
>
> How can I tell how many rows in a table will be visible without scrolling?
>
>
> Do I have to do some calcuation similar to tableHeight/rowHeight?
>
>
>
Previous Topic:how to put java3d in spawned platform's system library
Next Topic:Make part a SWT application
Goto Forum:
  


Current Time: Thu Apr 25 17:32:11 GMT 2024

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

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

Back to the top