Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339704

Summary: SortArrowRenderer paints chevron in opposite direction than standard TableColumn
Product: z_Archived Reporter: Peer Törngren <mbr-eclipse>
Component: NebulaAssignee: Laurent CARON <laurent.caron>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cgross, laurent.caron, mbr-eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
See Also: https://github.com/eclipse/nebula/pull/151
Whiteboard:
Attachments:
Description Flags
Screenshot SWT Snippet002
none
Screenshot Nebula GridSnippet002 none

Description Peer Törngren CLA 2011-03-11 10:14:43 EST
Build Identifier: 20100617-1415

When setting org.eclipse.nebula.widgets.grid.GridColumn.setSort(SWT.UP), the SortArrowRenderer paints an arrow/chevron pointing down. Default Eclipse tables render an arrow/chevron pointing in the opposite direction (i.e. upwards).

Reproducible: Always

Steps to Reproduce:
1. Run SWT Snippet002, observe the direction of the chevron in column header 1
2. Modify Nebula GridSnippet2 and insert "column.setSort(SWT.UP)" at line 40 or later
3. Run GridSnippet2, observe the direction of the chevron in column header 1

They point in different directions for the same sort order setting (SWT.UP)
Comment 1 Peer Törngren CLA 2011-03-11 10:19:28 EST
Created attachment 190992 [details]
Screenshot SWT Snippet002
Comment 2 Peer Törngren CLA 2011-03-11 10:20:45 EST
Created attachment 190993 [details]
Screenshot Nebula GridSnippet002
Comment 3 Peer Törngren CLA 2011-03-11 10:29:58 EST
A fix is extremely simple. 

Alternative 1: org.eclipse.nebula.widgets.grid.internal.DefaultColumnHeaderRenderer.paint(GC, Object)

On line 225 (in the version I have):
          arrowRenderer.setSelected(column.getSort() == SWT.UP);
change to:
          arrowRenderer.setSelected(column.getSort() == SWT.DOWN);
 
Alternative 2:
org.eclipse.nebula.widgets.grid.internal.SortArrowRenderer.paint(GC, Object)

On line 43 (in the version I have):
        if (isSelected())
change to:
        if (!isSelected())

For bonus points, expose the SortArrowRender in the API to let me assign my own arrow renderer:
gridColumn.getHeaderRenderer().setArrowRenderer(myArrowRenderer)
Comment 4 Laurent CARON CLA 2019-09-25 12:12:20 EDT
Bug fixed in Nebula 2.3.0