| Summary: | Grid.getVisibleRange() returns wrong number of columns | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Peer Törngren <mbr-eclipse> |
| Component: | Nebula | Assignee: | Thomas Schindl <tom.schindl> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | cgross, samuel |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
(In reply to comment #0) > However, although getVisibleRange() returns the visible items based on user > scrolling, it always returns all columns that are visible from a logical > perspective, not accounting for scrolling. Actually, it seems that the visible columns are properly registered when grid is opened. Alas, the visible range never changes when scrolling horizontally. (In reply to comment #1) > (In reply to comment #0) > > > However, although getVisibleRange() returns the visible items based on user > > scrolling, it always returns all columns that are visible from a logical > > perspective, not accounting for scrolling. > > Actually, it seems that the visible columns are properly registered when grid > is opened. Alas, the visible range never changes when scrolling horizontally. Looking more into this, I suspect that the problem actually lies in and org.eclipse.nebula.widgets.grid.Grid.getStartColumnIndex() and org.eclipse.nebula.widgets.grid.Grid.getEndColumnIndex(). A mere visual inspection suggests that these indices, once initially initialized, are never updated? The horizontal scroll is only questioned if there is no value. Not sure why this is (perhaps the values are not reset as expected?), but the effect seems to be consistent with the observed behavior; the grid always returns the start/end index as they were when the grid was first rendered, and the numbers don't change when the grid is scrolled horizontally. Oh well, these are just speculations, not sure if it helps. I just encountered this bug. The value returned by Grid.getEndColumnIndex() seems to be completely broken if columns are disposed. I.e. if the grid is initialized with a certain number of columns, the endColumnIndex value will be initialized accordingly. If columns are disposed, the endColumnIndex will not be updated, and even point beyound the existing columns. This effectively breaks the visible range support since calculating the visible range always produces an IndexOutOfBounds. It seems that someone on encountered this bug here: http://stackoverflow.com/questions/30240165/bug-when-removing-columns-from-nebula-grid-using-visual-range-support This bug does not have a target milestone assigned and is automatically closed as part of the 2.3.0 release cleanup. It could be that this bug is accidentally closed for which we apologize. If this bug is still relevant, please re-open and set a target milestone. |
Build Identifier: I20110613-1736 GridVisibleRangeSupport.calculateChange() calls org.eclipse.nebula.widgets.grid.Grid.getVisibleRange() to list currently visible GriItems and Columns with the primary objective to boost performance by allowing lazy init of label providers etc. However, although getVisibleRange() returns the visible items based on user scrolling, it always returns all columns that are visible from a logical perspective, not accounting for scrolling. This seriously degrades the use if this class; it cannot be used to boost performance if grid is opened with many columns that are only visible if scrolling horizontally. Problem seems to be on high-lighted line in the snippet from getVisibleRange() below; the check is made for GridColumn.isVisible(), which does not reflect the actual visibility of the column on screen? if( startColumnIndex <= endColumnIndex ) { if( displayOrderedColumns.size() > 0 ) { ArrayList cols = new ArrayList(); for( int i = startColumnIndex; i <= endColumnIndex; i++ ) { GridColumn col = (GridColumn) displayOrderedColumns.get(i); if( col.isVisible() ) { // THIS SEEMS WRONG? cols.add(col); Reproducible: Always Steps to Reproduce: 1. Debug a grid with GridVisualRangeSupport and many columns 2. Attach a RangeChangeListener or set a breakpoint on org.eclipse.nebula.widgets.grid.GridVisibleRangeSupport.calculateChange() 3. Scroll the grid and check org.eclipse.nebula.widgets.grid.Grid.GridVisibleRange.columns - it will always show all grid columns