Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 103542 Details for
Bug 235583
[table] Selecting multiple items sometimes doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
snippet to reproduce the bug
clipboard.txt (text/plain), 4.27 KB, created by
Stefan Röck
on 2008-06-04 09:12:28 EDT
(
hide
)
Description:
snippet to reproduce the bug
Filename:
MIME Type:
Creator:
Stefan Röck
Created:
2008-06-04 09:12:28 EDT
Size:
4.27 KB
patch
obsolete
>public class VirtualTableTest{ > > private static final int ADD_ENTRIES = 100; > private static final int PREFETCH_TRESHOLD = 50; > private static final int MAX_ENTRIES= 700; > > private int rowcounter = 0; > > private List<String> model = new ArrayList<String>(); > > private void createContent(Composite parent) { > initModel(); > > Composite container = new Composite(parent, SWT.NONE); > container.setLayout(new GridLayout(1, false)); > > final TableViewer tableViewer = new TableViewer(container, SWT.VIRTUAL | SWT.BORDER | SWT.MULTI); > tableViewer.setContentProvider(new ILazyContentProvider(){ > > public void updateElement(int index){ > tableViewer.replace(getModel().get(index), index); > if (index > getModel().size() - PREFETCH_TRESHOLD && (getModel().size() < MAX_ENTRIES)) { > // simulate loading the next page of data from db > int approxRecordCount = addElementsToModel(); > > System.out.println("approx. record count: " + approxRecordCount); > tableViewer.setItemCount(approxRecordCount); > updateRowCountStatus(tableViewer); > } > } > > public void dispose(){ > } > > public void inputChanged(Viewer arg0, Object arg1, Object arg2){ > } > }); > String[] columnProperties = new String[] { "Spalte 1", "Virtual Tables rock" }; > tableViewer.setColumnProperties(columnProperties); > > final Table table = tableViewer.getTable(); > > TableColumn col = new TableColumn(table, SWT.NONE); > col.setText(columnProperties[0]); > col.setWidth(200); > > col = new TableColumn(table, SWT.NONE); > col.setText(columnProperties[1]); > col.setWidth(400); > > table.setHeaderVisible(true); > table.setLinesVisible(true); > > GridDataFactory.fillDefaults().grab(true, true).applyTo(tableViewer.getTable()); > tableViewer.setItemCount(getModel().size()); > tableViewer.setInput(getModel()); > > table.setSelection(0); > > updateRowCountStatus(tableViewer); > > } > // Methods returns an approximate record count which is always > // one page size larger than the actually fetched records, until > // all records have been fetched and the end of list has been reached. > protected int addElementsToModel(){ > int approxRecordCount = 0; > int itemsToAdd; > > if (getModel().size() + ADD_ENTRIES < MAX_ENTRIES) { > itemsToAdd = ADD_ENTRIES; > } else { > itemsToAdd = MAX_ENTRIES - getModel().size(); > } > > for (int i = 0; i < itemsToAdd; i++) { > getModel().add("Item " + rowcounter++); > } > > if (getModel().size() == MAX_ENTRIES) { > approxRecordCount = MAX_ENTRIES; > } else { > approxRecordCount = getModel().size() + ADD_ENTRIES; > } > > return approxRecordCount; > } > > private void initModel(){ > rowcounter = 0; > getModel().clear(); > addElementsToModel(); > } > > private List<String> getModel(){ > return this.model; > } > > public int runTableTest(Display display){ > final Shell mainShell = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX); > mainShell.setLayout(new FillLayout()); > mainShell.setMaximized(true); > > > createContent(mainShell); > > mainShell.addShellListener(new ShellAdapter() { > > > public void shellClosed(ShellEvent e){ > mainShell.dispose(); > } > }); > > mainShell.open(); > while( !mainShell.isDisposed() ) { > if( !display.readAndDispatch() ) { > display.sleep(); > } > } > > return 0; > } > > /** > * @param tableViewer > * <p><b>Author:</b> stefan.roeck (<a href="mailto:stefan.roeck@cas.de">stefan.roeck@cas.de</a>)</p> > * @since 09.05.2008 > */ > private void updateRowCountStatus(final TableViewer tableViewer){ > tableViewer.getTable().getShell().setText(getModel().size() + " rows"); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 235583
:
103542
|
111652
|
111773