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

Bug 315397

Summary: Column of GridCellRenderer not set in Grid.onPaint(PaintEvent)
Product: z_Archived Reporter: Thomas Halm <thha>
Component: NebulaAssignee: Thomas Schindl <tom.schindl>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: tom.schindl
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch for org.eclipse.nebula.widgets.grid.Grid
none
Proposed patch with new fixes
none
Proposed patch with new fixes tom.schindl: iplog+

Description Thomas Halm CLA 2010-06-02 10:12:03 EDT
Build Identifier: M20100211-1343

When the onPaint() method delegate the rendering of the cell to the cellRenderer of the current column, the column index is not propagated to the cell renderer.

In my opinion the call "column.getCellRenderer().setColumn(indexOf(column))" is missing around line 5496 in Class org.eclipse.nebula.widgets.grid.Grid.

I have implemented a GridCellRenderer, but with this bug I'm not able to get the right "column context" inside the paint(GC,Object) method.



Reproducible: Always
Comment 1 Thomas Schindl CLA 2010-06-02 10:14:36 EDT
If you attach a patch I can apply it ASAP
Comment 2 Thomas Halm CLA 2010-06-02 10:46:10 EDT
Created attachment 170809 [details]
Proposed patch for org.eclipse.nebula.widgets.grid.Grid
Comment 3 Thomas Halm CLA 2010-06-03 09:10:47 EDT
Created attachment 170948 [details]
Proposed patch with new fixes

I found two more calls to getCellRenderer() where the column index was not propagated. 

Changes in: 
      Grid.onPaint() -> old 
      Grid.computeItemHeight() -> new
GridColumn.pack() -> new
Comment 4 Thomas Schindl CLA 2010-06-03 09:15:43 EDT
Looks good, one minor thing - I think we should store the content of indexOf(column) call in an local variable
Comment 5 Thomas Halm CLA 2010-06-03 09:30:43 EDT
Created attachment 170951 [details]
Proposed patch with new fixes

Ok, there was already a local variable with the index of the column. I replaced the method calls in the new patch.
Comment 6 Thomas Schindl CLA 2010-06-08 02:05:06 EDT
Applied patch with attribution to CVS-HEAD