Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » SWT.VIRTUAL & SWT.CHECK table
SWT.VIRTUAL & SWT.CHECK table [message #971422] Sun, 04 November 2012 22:07 Go to next message
bogdan toma is currently offline bogdan tomaFriend
Messages: 39
Registered: February 2010
Member
Hello all,
I have the following code.
There is a button and virtual SWT.CHECK table.
When the button "Select" is pressed all table items should be checked.
When i am using rap 1.4.0 it works perfectly; after the items are selected the table still behaves as VIRTUAL.
In rap 1.5.1; if I press the button and afterwards scroll, i get empty rows; no data is loaded anymore. If I do not press the button, the table behaves like virtual table.
Can you help me to figure out what am I doing wrong here ?
Thank you.
public void createPartControl(Composite parent)
    {
        parent.setLayout(new GridLayout(1, false));

        Button selectAll = new Button(parent, SWT.NONE);
        selectAll.setText("Select");
        selectAll.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
                for (TableItem tableItem : tableViewer.getTable().getItems())
                {
                    tableItem.setChecked(true);
                }
            }
        });

        final Composite tableComposite = new Composite(parent, SWT.NONE);
        tableComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
                true, true));
        TableColumnLayout tcl_topicsTableComposite = new TableColumnLayout();
        tableComposite.setLayout(tcl_topicsTableComposite);

        tableViewer = new TableViewer(tableComposite, SWT.BORDER
                | SWT.FULL_SELECTION  | SWT.CHECK | SWT.VIRTUAL);
        Table topicsTable = tableViewer.getTable();
        topicsTable.setHeaderVisible(true);
        topicsTable.setLinesVisible(true);

        TableViewerColumn firstViewerColumn = new TableViewerColumn(
                tableViewer, SWT.NONE);
        final TableColumn firstColumn = firstViewerColumn.getColumn();
        firstColumn.setToolTipText("atring"); //$NON-NLS-1$
        tcl_topicsTableComposite.setColumnData(firstColumn, new ColumnWeightData(
                1, ColumnWeightData.MINIMUM_WIDTH, true));
        firstColumn.setText("first column"); //$NON-NLS-1$

        TableViewerColumn secondViewerColumn = new TableViewerColumn(
                tableViewer, SWT.NONE);
        final TableColumn secondColumn = secondViewerColumn.getColumn();
        secondColumn.setToolTipText("second column"); //$NON-NLS-1$
        tcl_topicsTableComposite.setColumnData(secondColumn, new ColumnWeightData(
                1, ColumnWeightData.MINIMUM_WIDTH, true));
        secondColumn.setText("second column");

        tableViewer.setContentProvider(ArrayContentProvider.getInstance());
        tableViewer.setLabelProvider(new ITableLabelProvider()
        {
            @Override
            public void removeListener(ILabelProviderListener listener)
            {
            }

            @Override
            public boolean isLabelProperty(Object element, String property)
            {
                return false;
            }

            @Override
            public void dispose()
            {
            }

            @Override
            public void addListener(ILabelProviderListener listener)
            {
            }

            @Override
            public String getColumnText(Object element, int columnIndex)
            {
                return ((String[]) element)[columnIndex];
            }

            @Override
            public Image getColumnImage(Object element, int columnIndex)
            {
                return null;
            }
        });

        tableViewer.setInput(new String[][] {
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" },
                { "getStringValue1", "getStringValue2" } });
    }
Re: SWT.VIRTUAL & SWT.CHECK table [message #971953 is a reply to message #971422] Mon, 05 November 2012 08:37 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
when you call TableItem#setChecked the item is marked as materialized
and no further data are requested. The old behavior (RAP 1.4) was wrong.
Now the behavior is exactly the same like in SWT (just checked it). If
you have suspicions that something is not working correctly always check
your snippet against SWT.
Best,
Ivan

On 11/5/2012 12:07 AM, bogdan toma wrote:
> Hello all,
> I have the following code.
> There is a button and virtual SWT.CHECK table.
> When the button "Select" is pressed all table items should be checked.
> When i am using rap 1.4.0 it works perfectly; after the items are
> selected the table still behaves as VIRTUAL.
> In rap 1.5.1; if I press the button and afterwards scroll, i get empty
> rows; no data is loaded anymore. If I do not press the button, the
> table behaves like virtual table.
> Can you help me to figure out what am I doing wrong here ?
> Thank you.
>
> public void createPartControl(Composite parent)
> {
> parent.setLayout(new GridLayout(1, false));
>
> Button selectAll = new Button(parent, SWT.NONE);
> selectAll.setText("Select");
> selectAll.addSelectionListener(new SelectionAdapter()
> {
> @Override
> public void widgetSelected(SelectionEvent e)
> {
> for (TableItem tableItem :
> tableViewer.getTable().getItems())
> {
> tableItem.setChecked(true);
> }
> }
> });
>
> final Composite tableComposite = new Composite(parent, SWT.NONE);
> tableComposite.setLayoutData(new GridData(GridData.FILL,
> GridData.FILL,
> true, true));
> TableColumnLayout tcl_topicsTableComposite = new
> TableColumnLayout();
> tableComposite.setLayout(tcl_topicsTableComposite);
>
> tableViewer = new TableViewer(tableComposite, SWT.BORDER
> | SWT.FULL_SELECTION | SWT.CHECK | SWT.VIRTUAL);
> Table topicsTable = tableViewer.getTable();
> topicsTable.setHeaderVisible(true);
> topicsTable.setLinesVisible(true);
>
> TableViewerColumn firstViewerColumn = new TableViewerColumn(
> tableViewer, SWT.NONE);
> final TableColumn firstColumn = firstViewerColumn.getColumn();
> firstColumn.setToolTipText("atring"); //$NON-NLS-1$
> tcl_topicsTableComposite.setColumnData(firstColumn, new
> ColumnWeightData(
> 1, ColumnWeightData.MINIMUM_WIDTH, true));
> firstColumn.setText("first column"); //$NON-NLS-1$
>
> TableViewerColumn secondViewerColumn = new TableViewerColumn(
> tableViewer, SWT.NONE);
> final TableColumn secondColumn = secondViewerColumn.getColumn();
> secondColumn.setToolTipText("second column"); //$NON-NLS-1$
> tcl_topicsTableComposite.setColumnData(secondColumn, new
> ColumnWeightData(
> 1, ColumnWeightData.MINIMUM_WIDTH, true));
> secondColumn.setText("second column");
>
> tableViewer.setContentProvider(ArrayContentProvider.getInstance());
> tableViewer.setLabelProvider(new ITableLabelProvider()
> {
> @Override
> public void removeListener(ILabelProviderListener listener)
> {
> }
>
> @Override
> public boolean isLabelProperty(Object element, String
> property)
> {
> return false;
> }
>
> @Override
> public void dispose()
> {
> }
>
> @Override
> public void addListener(ILabelProviderListener listener)
> {
> }
>
> @Override
> public String getColumnText(Object element, int columnIndex)
> {
> return ((String[]) element)[columnIndex];
> }
>
> @Override
> public Image getColumnImage(Object element, int columnIndex)
> {
> return null;
> }
> });
>
> tableViewer.setInput(new String[][] {
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" },
> { "getStringValue1", "getStringValue2" } });
> }
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: SWT.VIRTUAL & SWT.CHECK table [message #972152 is a reply to message #971953] Mon, 05 November 2012 11:51 Go to previous message
bogdan toma is currently offline bogdan tomaFriend
Messages: 39
Registered: February 2010
Member
Ok. Thank you.
Previous Topic:Parent accessible on primary modal dialog
Next Topic:IE launch error post migration to 2.0M2
Goto Forum:
  


Current Time: Thu Apr 25 18:52:22 GMT 2024

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

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

Back to the top