Bug 510728 - [API] Allow styling of tree headers foreground and background color
Summary: [API] Allow styling of tree headers foreground and background color
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.7 M7   Edit
Assignee: Conrad Groth CLA
QA Contact: Niraj Modi CLA
URL:
Whiteboard:
Keywords: api, feep
Depends on: 63038 384906 513405 514424
Blocks: 481227 497562 514387 514388 527103
  Show dependency tree
 
Reported: 2017-01-20 03:23 EST by Niraj Modi CLA
Modified: 2017-11-12 03:01 EST (History)
26 users (show)

See Also:
akurtakov: pmc_approved+
niraj.modi: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niraj Modi CLA 2017-01-20 03:23:18 EST
+++ This bug was initially created as a clone of Bug #384906 +++

SWT Tree also has header, so same set of APIs as added for bug 384906 also needs to be added in Tree, for consistency and completeness sake.
Comment 1 Conrad Groth CLA 2017-01-28 12:28:41 EST
The code provided for Bug 384906 works also for Tree headers.
Comment 2 Lars Vogel CLA 2017-02-09 08:26:30 EST
(In reply to Conrad Groth from comment #1)
> The code provided for Bug 384906 works also for Tree headers.

Can you create a Gerrit for Windows for it? I can afterwards add the GTK implementation. We should try to finish this before M6 as this is our last milestone in which we can do API changes without PMC approval.
Comment 3 Conrad Groth CLA 2017-02-18 11:29:02 EST
I added a Gerrit patch just with the API.
Comment 4 Niraj Modi CLA 2017-02-23 09:43:21 EST
(In reply to Conrad Groth from comment #3)
> I added a Gerrit patch just with the API.

We need the changes in ControlExample's TreeTab as well to verify/test the proposed patch.
Comment 5 Conrad Groth CLA 2017-02-23 13:54:13 EST
(In reply to Niraj Modi from comment #4)
> (In reply to Conrad Groth from comment #3)
> > I added a Gerrit patch just with the API.
> 
> We need the changes in ControlExample's TreeTab as well to verify/test the
> proposed patch.

I added only the API for all platforms, because API freeze for Oxygen is soon. There is no implementation for any platform. I will add that, after the patch for the Table was merged, because it's basically the same code.
Comment 6 Eclipse Genie CLA 2017-02-24 13:46:05 EST
New Gerrit change created: https://git.eclipse.org/r/91822
Comment 7 Niraj Modi CLA 2017-02-26 22:59:26 EST
(In reply to Conrad Groth from comment #5)
> (In reply to Niraj Modi from comment #4)
> > (In reply to Conrad Groth from comment #3)
> > > I added a Gerrit patch just with the API.
> > 
> > We need the changes in ControlExample's TreeTab as well to verify/test the
> > proposed patch.
> 
> I added only the API for all platforms, because API freeze for Oxygen is
> soon. There is no implementation for any platform. I will add that, after
> the patch for the Table was merged, because it's basically the same code.
Ok, but we cannot add new APIs to SWT without implementation, at-least implementation on one platform is must to make it to M6.
Comment 8 Niraj Modi CLA 2017-03-06 03:47:20 EST
(In reply to Niraj Modi from comment #7)
> (In reply to Conrad Groth from comment #5)
> > (In reply to Niraj Modi from comment #4)
> > > (In reply to Conrad Groth from comment #3)
> > > > I added a Gerrit patch just with the API.
> > > 
> > > We need the changes in ControlExample's TreeTab as well to verify/test the
> > > proposed patch.
> > 
> > I added only the API for all platforms, because API freeze for Oxygen is
> > soon. There is no implementation for any platform. I will add that, after
> > the patch for the Table was merged, because it's basically the same code.
> Ok, but we cannot add new APIs to SWT without implementation, at-least
> implementation on one platform is must to make it to M6.

Moving out of M6. We still have a chance to get the Tree header APIs into M7 but only after verification followed by PMC approval.
Comment 9 Niraj Modi CLA 2017-03-16 06:51:43 EDT
Tested both the patches combined, noticed few problems:
Win7:
- foreground/background coloring works fine on Tree header only when Tree header is visible
- Try setting the Tree header's background/foreground first and then turn the Tree header visible & Multiple columns check-boxes on. No coloring applies to Tree header.

Ubuntu:
- am getting compilation error highlighted in the patch.

ControlExample:
- I see icons before header background and header foreground option missing.
[Become visible only when colors are set]

JavaDoc:
New API JavaDocs needs to be addressed for all platform according to the feedback given on bug 513405

JUnits:
Also we will need to have JUnits against the new APIs, suggest we add them as separate gerrit patch or it can also be part of ControlExampe patch.
Comment 10 Conrad Groth CLA 2017-03-17 16:36:41 EDT
(In reply to Niraj Modi from comment #9)
> Tested both the patches combined, noticed few problems:
> Win7:
> - foreground/background coloring works fine on Tree header only when Tree
> header is visible
> - Try setting the Tree header's background/foreground first and then turn
> the Tree header visible & Multiple columns check-boxes on. No coloring
> applies to Tree header.
This is the method org.eclipse.swt.examples.controlexample.TreeTab.setExampleWidgetState():
It's missing 'setHeaderBackground (); setHeaderForeground ();' directly after 'setCellFont ();'

> 
> Ubuntu:
> - am getting compilation error highlighted in the patch.
Fixed that.

> 
> ControlExample:
> - I see icons before header background and header foreground option missing.
> [Become visible only when colors are set]
Same cause like above in the TreeTab class.

> 
> JavaDoc:
> New API JavaDocs needs to be addressed for all platform according to the
> feedback given on bug 513405
Fixed that.

> 
> JUnits:
> Also we will need to have JUnits against the new APIs, suggest we add them
> as separate gerrit patch or it can also be part of ControlExampe patch.
I will make a separate patch.
Comment 11 Niraj Modi CLA 2017-03-23 03:42:36 EDT
(In reply to Conrad Groth from comment #10)
> (In reply to Niraj Modi from comment #9)
> > Tested both the patches combined, noticed few problems:
> > Win7:
> > - foreground/background coloring works fine on Tree header only when Tree
> > header is visible
> > - Try setting the Tree header's background/foreground first and then turn
> > the Tree header visible & Multiple columns check-boxes on. No coloring
> > applies to Tree header.
> This is the method
> org.eclipse.swt.examples.controlexample.TreeTab.setExampleWidgetState():
> It's missing 'setHeaderBackground (); setHeaderForeground ();' directly
> after 'setCellFont ();'
> 
> > 
> > Ubuntu:
> > - am getting compilation error highlighted in the patch.
> Fixed that.
> 
> > 
> > ControlExample:
> > - I see icons before header background and header foreground option missing.
> > [Become visible only when colors are set]
> Same cause like above in the TreeTab class.
> 
> > 
> > JavaDoc:
> > New API JavaDocs needs to be addressed for all platform according to the
> > feedback given on bug 513405
> Fixed that.
> 
> > 
> > JUnits:
> > Also we will need to have JUnits against the new APIs, suggest we add them
> > as separate gerrit patch or it can also be part of ControlExampe patch.
> I will make a separate patch.

I confirm above issues are resolved. Tested the patch on Win7, it looks good.
Few improvement in JavaDocs needs to be addressed see gerrit: https://git.eclipse.org/r/#/c/91422

Hi Lars,
I don't see the expected behavior on GTK, it seems only stubs are present.
We need to implement the Tree header on GTK as well on same lines as you did in bug 509648.

Once we have all the patches in place, then only we can seek PMC approval. Thanks!
Comment 12 Eric Williams CLA 2017-03-23 23:56:02 EDT
(In reply to Niraj Modi from comment #11)
> (In reply to Conrad Groth from comment #10)
> I confirm above issues are resolved. Tested the patch on Win7, it looks good.
> Few improvement in JavaDocs needs to be addressed see gerrit:
> https://git.eclipse.org/r/#/c/91422
> 
> Hi Lars,
> I don't see the expected behavior on GTK, it seems only stubs are present.
> We need to implement the Tree header on GTK as well on same lines as you did
> in bug 509648.
> 
> Once we have all the patches in place, then only we can seek PMC approval.
> Thanks!

Hi everyone:

I implemented the GTK functionality, as was implemented in bug 509648. I tested it out, and seems to work without issue.

There is one important note: I noticed that in ControlExample, for Table the "multiple columns" box is checked by default. For Tree it isn't, meaning that if you try to set the header background/foreground without checking it first, you will get a NPE since no columns exist. This would affect Table too, so I added a null check in both Tree and Table to prevent this case.
Comment 13 Lars Vogel CLA 2017-03-29 07:05:28 EDT
Niraj, could you please review this with priority? 

We in Platform UI need to provide the CSS styling implementation based on the SWT change and the css for the dark theme. We really would like to have this in for M7 so that we can deliver (finally) a (relative) decent dark theme.
Comment 14 Lars Vogel CLA 2017-03-29 09:20:58 EDT
To avoid delays in this I will ask already for PMC approval for this change. 

Of course, this change needs still the final code review by the SWT team but as it is almost the same as the already integrated change for table headers, I expect no surprises in this code review. And I would like to avoid missing M7 due to missing PMC approval.
Comment 15 Dani Megert CLA 2017-03-29 10:39:32 EDT
(In reply to Lars Vogel from comment #14)
> To avoid delays in this I will ask already for PMC approval for this change. 
> 
> Of course, this change needs still the final code review by the SWT team but
> as it is almost the same as the already integrated change for table headers,
> I expect no surprises in this code review. And I would like to avoid missing
> M7 due to missing PMC approval.

NOTE: PMC approval depends on whether this change is accepted by SWT.
Comment 16 Niraj Modi CLA 2017-03-30 11:20:47 EDT
+1 from me.
Verified/Tested latest patch both the patches combined on Win7 and a quick round of verification on Ubuntu16.04 as well.
Comment 17 Alexander Kurtakov CLA 2017-03-30 11:21:56 EDT
(In reply to Niraj Modi from comment #16)
> +1 from me.
> Verified/Tested latest patch both the patches combined on Win7 and a quick
> round of verification on Ubuntu16.04 as well.

Are you going to push it now or you want me to do it?
Comment 18 Niraj Modi CLA 2017-03-30 11:49:19 EDT
(In reply to Alexander Kurtakov from comment #17)
> (In reply to Niraj Modi from comment #16)
> > +1 from me.
> > Verified/Tested latest patch both the patches combined on Win7 and a quick
> > round of verification on Ubuntu16.04 as well.
> 
> Are you going to push it now or you want me to do it?

Both the patches are now in master.
JUnits/Examples patch was manually merged to master via below git commit:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=0311cc0637c61d3d24e0d166c4c80fa4679b51cf
Comment 19 Lars Vogel CLA 2017-03-31 06:52:51 EDT
Marking as fixed, Till(Brychcy) can you open a bug for Cocoa
Comment 20 Lars Vogel CLA 2017-03-31 07:34:57 EDT
Marking as fixed, Bug 514424 handles Cocoa.