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 286568 Details for
Bug 574150
[macOS11] Table: vertical scrollbar is not initialized correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Snippet to reproduce
LazyTableLoading.java (text/plain), 1.93 KB, created by
Thomas Singer
on 2021-06-11 04:30:02 EDT
(
hide
)
Description:
Snippet to reproduce
Filename:
MIME Type:
Creator:
Thomas Singer
Created:
2021-06-11 04:30:02 EDT
Size:
1.93 KB
patch
obsolete
>import org.eclipse.swt.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; > >/** > * @author Thomas Singer > */ >public class LazyTableLoading { > > public static void main(String[] args) { > final Display display = new Display(); > > final Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > > final Table table = new Table(shell, SWT.BORDER | SWT.V_SCROLL); > table.setHeaderVisible(true); > > final TableColumn column = new TableColumn(table, SWT.LEFT); > column.setText("Column"); > column.setWidth(150); > > for (int i = 0; i < 4; i++) { > createItem(table); > } > > final boolean[] loading = new boolean[1]; > table.addListener(SWT.Paint, new Listener() { > @Override > public void handleEvent(Event event) { > if (table.isDisposed()) { > return; > } > > if (!shouldLoad()) { > return; > } > > if (loading[0]) { > return; > } > > loading[0] = true; > display.timerExec(1000, () -> { > for (int i = 0; i < 50; i++) { > if (table.getItemCount() == 300) { > break; > } > > createItem(table); > } > loading[0] = false; > }); > } > > private boolean shouldLoad() { > final ScrollBar scrollBar = table.getVerticalBar(); > if (!scrollBar.isVisible()) { > return true; > } > > final int maximum = scrollBar.getMaximum(); > if (maximum == 0) { > return true; > } > > final int scrollBarPosition = scrollBar.getSelection() + scrollBar.getThumb(); > System.out.println(scrollBarPosition + " of " + maximum); > return scrollBarPosition > maximum * 0.75; > } > }); > > shell.setSize(400, 300); > shell.open(); > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > > display.dispose(); > } > > private static void createItem(Table table) { > final TableItem item = new TableItem(table, SWT.LEFT); > item.setText(0, "Row " + table.getItemCount()); > } >}
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 574150
: 286568 |
286569
|
286570
|
286571