Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » UICallBack and Table with SWT.VIRTUAL option
UICallBack and Table with SWT.VIRTUAL option [message #105784] Fri, 19 September 2008 09:11 Go to next message
Eclipse UserFriend
Good day!

I tried to use a virtual table created by using class Table,
data which should be updated to a client side.
Clarify the following details:
1. If you create a virtual table through a "new Table (...)", and then
specify setItemsCount for the table, so that updates do not come to the
client, the function setItemsCount runs fine, but the event SWT.SetData
for not occur or occurs once during the open session and then take off for
bugs.
2. But if create TableViewer and do the same thing, but update data
through the Content and Label providers then all working properly.

In the case at No. 1 this is a bug?

Thank you very much.
Re: UICallBack and Table with SWT.VIRTUAL option [message #105873 is a reply to message #105784] Mon, 22 September 2008 07:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Sergei,

even though I would recommend to use the JFace TableViewer (No. 2),
doing the same thing with only the Table widget should work.
Have a look at the TableTab class in the ControlsDemo on how to use
VIRTUAL tables and SetData.
If your Table-code works in SWT but not in RAP, please file a bug
report along with a standalone code snippet.

Cheers,
Rüdiger
-----------------------------
Rüdiger Herrmann
Innoopract
http://innoopract.com
delivering eclipse technology

Sergei wrote:
> Good day!
>
> I tried to use a virtual table created by using class Table,
> data which should be updated to a client side.
> Clarify the following details:
> 1. If you create a virtual table through a "new Table (...)", and then
> specify setItemsCount for the table, so that updates do not come to the
> client, the function setItemsCount runs fine, but the event SWT.SetData
> for not occur or occurs once during the open session and then take off
> for bugs.
> 2. But if create TableViewer and do the same thing, but update data
> through the Content and Label providers then all working properly.
>
> In the case at No. 1 this is a bug?
>
> Thank you very much.
>
>
Re: UICallBack and Table with SWT.VIRTUAL option [message #135799 is a reply to message #105873] Thu, 11 June 2009 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rüdiger,

for case at No. 1, after adding items with Table.setItemCount should be
called Table.checkData for items visible to the user?

In the following snippet, when clicked the Add button, the list item
count is incremented by 50 and the event SetData doesn't be called until
an event occurs from the browser:

public class RapTest implements IEntryPoint {

@Override
public int createUI() {
Display d = new Display();
final Shell s = new Shell(d);
s.setSize(800, 600);

final Table t = new Table(s, SWT.BORDER | SWT.VIRTUAL);
t.setBounds(20, 40, 350, 500);
t.setHeaderVisible(true);

TableColumn tc1 = new TableColumn(t, SWT.LEFT);
tc1.setText("A");
tc1.setWidth(100);
TableColumn tc2 = new TableColumn(t, SWT.LEFT);
tc2.setText("B");
tc2.setWidth(100);
TableColumn tc3 = new TableColumn(t, SWT.LEFT);
tc3.setText("C");
tc3.setWidth(100);

Button b = new Button(s, SWT.PUSH);
b.setBounds(450, 40, 50, 50);
b.setText("Add");
b.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
t.setItemCount(t.getItemCount() + 50);
}
});

t.addListener(SWT.SetData, new Listener() {
@Override
public void handleEvent(Event event) {
TableItem item = (TableItem) event.item;
int index = event.index;
item.setText(0, String.format("A%05d", index));
item.setText(1, String.format("B%05d", index));
item.setText(2, String.format("C%05d", index));
}
});

s.open();
while( !s.isDisposed() )
if( !d.readAndDispatch() )
d.sleep();

s.dispose();
d.dispose();
return 0;
}

}


Thanks,
Enrico


Rüdiger Herrmann ha scritto:
> Sergei,
>
> even though I would recommend to use the JFace TableViewer (No. 2),
> doing the same thing with only the Table widget should work.
> Have a look at the TableTab class in the ControlsDemo on how to use
> VIRTUAL tables and SetData.
> If your Table-code works in SWT but not in RAP, please file a bug
> report along with a standalone code snippet.
>
> Cheers,
> Rüdiger
> -----------------------------
> Rüdiger Herrmann
> Innoopract
> http://innoopract.com
> delivering eclipse technology
>
> Sergei wrote:
>> Good day!
>>
>> I tried to use a virtual table created by using class Table,
>> data which should be updated to a client side.
>> Clarify the following details:
>> 1. If you create a virtual table through a "new Table (...)", and then
>> specify setItemsCount for the table, so that updates do not come to
>> the client, the function setItemsCount runs fine, but the event
>> SWT.SetData for not occur or occurs once during the open session and
>> then take off for bugs.
>> 2. But if create TableViewer and do the same thing, but update data
>> through the Content and Label providers then all working properly.
>>
>> In the case at No. 1 this is a bug?
>>
>> Thank you very much.
>>
>>
Re: UICallBack and Table with SWT.VIRTUAL option [message #135837 is a reply to message #135799] Fri, 12 June 2009 04:34 Go to previous message
Eclipse UserFriend
Enrico Zanaga wrote:
> Hi Rüdiger,
>
> for case at No. 1, after adding items with Table.setItemCount should be
> called Table.checkData for items visible to the user?
yes

>
> In the following snippet, when clicked the Add button, the list item
> count is incremented by 50 and the event SetData doesn't be called until
> an event occurs from the browser:
you may need to call Table#redraw() after calling setItemCount. If
this still doesn't help and you are working with the latest version
of RAP and the same code works in SWT, feel free to file a bugzilla.

>
> public class RapTest implements IEntryPoint {
>
> @Override
> public int createUI() {
> Display d = new Display();
> final Shell s = new Shell(d);
> s.setSize(800, 600);
>
> final Table t = new Table(s, SWT.BORDER | SWT.VIRTUAL);
> t.setBounds(20, 40, 350, 500);
> t.setHeaderVisible(true);
>
> TableColumn tc1 = new TableColumn(t, SWT.LEFT);
> tc1.setText("A");
> tc1.setWidth(100);
> TableColumn tc2 = new TableColumn(t, SWT.LEFT);
> tc2.setText("B");
> tc2.setWidth(100);
> TableColumn tc3 = new TableColumn(t, SWT.LEFT);
> tc3.setText("C");
> tc3.setWidth(100);
>
> Button b = new Button(s, SWT.PUSH);
> b.setBounds(450, 40, 50, 50);
> b.setText("Add");
> b.addSelectionListener(new SelectionAdapter(){
> @Override
> public void widgetSelected(SelectionEvent e) {
> t.setItemCount(t.getItemCount() + 50);
> }
> });
>
> t.addListener(SWT.SetData, new Listener() {
> @Override
> public void handleEvent(Event event) {
> TableItem item = (TableItem) event.item;
> int index = event.index;
> item.setText(0, String.format("A%05d", index));
> item.setText(1, String.format("B%05d", index));
> item.setText(2, String.format("C%05d", index));
> }
> });
>
> s.open();
> while( !s.isDisposed() )
> if( !d.readAndDispatch() )
> d.sleep();
>
> s.dispose();
> d.dispose();
> return 0;
> }
>
> }
>
>
> Thanks,
> Enrico
>
>
> Rüdiger Herrmann ha scritto:
>> Sergei,
>>
>> even though I would recommend to use the JFace TableViewer (No. 2),
>> doing the same thing with only the Table widget should work.
>> Have a look at the TableTab class in the ControlsDemo on how to use
>> VIRTUAL tables and SetData.
>> If your Table-code works in SWT but not in RAP, please file a bug
>> report along with a standalone code snippet.
>>
>> Cheers,
>> Rüdiger
>> -----------------------------
>> Rüdiger Herrmann
>> Innoopract
>> http://innoopract.com
>> delivering eclipse technology
>>
>> Sergei wrote:
>>> Good day!
>>>
>>> I tried to use a virtual table created by using class Table,
>>> data which should be updated to a client side.
>>> Clarify the following details:
>>> 1. If you create a virtual table through a "new Table (...)", and
>>> then specify setItemsCount for the table, so that updates do not come
>>> to the client, the function setItemsCount runs fine, but the event
>>> SWT.SetData for not occur or occurs once during the open session and
>>> then take off for bugs.
>>> 2. But if create TableViewer and do the same thing, but update data
>>> through the Content and Label providers then all working properly.
>>>
>>> In the case at No. 1 this is a bug?
>>>
>>> Thank you very much.
>>>
>>>
Previous Topic:qooxdoo plan
Next Topic:Language pack
Goto Forum:
  


Current Time: Thu May 08 14:33:12 EDT 2025

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

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

Back to the top