Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Table/TableViewer paging rows(Table/TableViewer paging rows)
Table/TableViewer paging rows [message #490037] Tue, 06 October 2009 22:02 Go to next message
Luis Carlos Moreira da Costa is currently offline Luis Carlos Moreira da Costa
Messages: 40
Registered: July 2009
Location: Brazil
Member

Please you could help me? He would like to know if you have or where I could find a SWT Table/JFace TableViewer with paging (Eclipse RCP and Eclipse RAP)?
Example: First, Next, Prior and Last

Regards, Luis


Luís Carlos Moreira da Costa
Eclipse RAP, RCP, eRCP, GEF, EMF, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil
Re: Table/TableViewer paging rows [message #496466 is a reply to message #490037] Tue, 10 November 2009 03:51 Go to previous messageGo to next message
Shonof  is currently offline Shonof
Messages: 5
Registered: November 2009
Junior Member
I need also something like that.

When i have 100 rows, i only want to show 10 rows in a table and with the 'next button' it will load the next 10 rows.
Re: Table/TableViewer paging rows [message #496496 is a reply to message #496466] Tue, 10 November 2009 06:03 Go to previous messageGo to next message
Luis Carlos Moreira da Costa is currently offline Luis Carlos Moreira da Costa
Messages: 40
Registered: July 2009
Location: Brazil
Member

You would have some ready example, to send me in my email: tcljava@gmail.com I am thankful for its reply

Luís Carlos Moreira da Costa
Eclipse RAP, RCP, eRCP, GEF, EMF, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil
Re: Table/TableViewer paging rows [message #497089 is a reply to message #496496] Thu, 12 November 2009 08:48 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 1
Registered: November 2009
Junior Member
Were you able to achieve the pagination successfully?
Re: Table/TableViewer paging rows [message #497700 is a reply to message #497089] Fri, 13 November 2009 06:02 Go to previous messageGo to next message
Shonof  is currently offline Shonof
Messages: 5
Registered: November 2009
Junior Member
nope
Re: Table/TableViewer paging rows [message #497974 is a reply to message #497700] Fri, 13 November 2009 10:11 Go to previous message
Grant Gayed is currently offline Grant Gayed
Messages: 2148
Registered: July 2009
Senior Member
Is this what you're trying to do?

public class Snippet51 {
public static void main(String [] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,300,300);
shell.setLayout(new GridLayout(2,true));
final Table table = new Table(shell, SWT.NONE);
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
table.setLayoutData(data);
for (int i = 0; i < 99; i++) {
new TableItem(table, SWT.NONE).setText("item " + i);
}
Button upButton = new Button(shell, SWT.PUSH);
upButton.setText("Scroll up one page");
upButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
upButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
int height = table.getClientArea().height;
int visibleItemCount = height / table.getItemHeight();
int topIndex = table.getTopIndex();
int newTopIndex = Math.max(0, topIndex - visibleItemCount);
if (topIndex != newTopIndex) {
table.setTopIndex(newTopIndex);
}
}
});
Button downButton = new Button(shell, SWT.PUSH);
downButton.setText("Scroll down one page");
downButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
downButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
int height = table.getClientArea().height;
int visibleItemCount = height / table.getItemHeight();
int topIndex = table.getTopIndex();
int newTopIndex = Math.min(table.getItemCount(), topIndex +
visibleItemCount);
if (topIndex != newTopIndex) {
table.setTopIndex(newTopIndex);
}
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}

or...

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet296.java?view=co

or...

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet201.java?view=co

Grant


"Shonof" <shonof@gmail.com> wrote in message
news:hdjebt$i7k$1@build.eclipse.org...
> nope
Previous Topic:PresentationReconciler getDamage
Next Topic:[Databinding] How can I use a DialogCellEditor with databinding?
Goto Forum:
  


Current Time: Fri Aug 01 04:04:02 EDT 2014

Powered by FUDForum. Page generated in 0.02967 seconds