This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227203 - DefaultOutlineCellRenderer does not honor "Table.alternateRowColor" in UIManager .
Summary: DefaultOutlineCellRenderer does not honor "Table.alternateRowColor" in UIMana...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-08 10:51 UTC by AngeloD
Modified: 2013-05-13 11:14 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Poposed patch and Unit Test (6.31 KB, patch)
2013-03-13 10:40 UTC, AngeloD
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description AngeloD 2013-03-08 10:51:34 UTC
In UIManager it is possible to define a property that sets an alternate background color for even rows in tables. 
This behaviour is controlled by the key "Table.alternateRowColor" but the DefaultOutlineCellRenderer does not follow the super class behaviour for nodes columns.

Here:
http://hg.netbeans.org/main-golden/file/fccf6651ac38/o.n.swing.outline/src/org/netbeans/swing/outline/DefaultOutlineCellRenderer.java#l282

The background color is overridden while it should look like:

Color bg = rendata.getBackground(value);
// If the renderer has no special value to set...
if (bg == table.getBackground() { 
    bg = this.getBackground();  // Obey overall settings
}
Comment 1 AngeloD 2013-03-13 10:40:01 UTC
Created attachment 132552 [details]
Poposed patch and Unit Test
Comment 2 Martin Entlicher 2013-03-13 14:53:24 UTC
Thanks for your patch, but I've fixed it by providing null color, which is valid according to Javadoc: changeset:   248383:3c5247183f58
http://hg.netbeans.org/core-main/rev/3c5247183f58

And here is your slightly modified test:
changeset:   248387:93688e8b5a2f
http://hg.netbeans.org/core-main/rev/93688e8b5a2f
Thanks.
Comment 3 Quality Engineering 2013-03-14 02:09:50 UTC
Integrated into 'main-golden', will be available in build *201303132300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3c5247183f58
User: mentlicher@netbeans.org
Log: #227203: NodeRenderDataProvider should return null background and foreground, so that the default is not altered and DefaultOutlineCellRenderer should not touch the background and foreground that was set by Swing, unless the RenderDataProvider provides some.
Comment 4 Tomas Danek 2013-05-03 11:43:53 UTC
test is passing in recent dev sources, please backport.
Comment 5 Martin Entlicher 2013-05-03 13:44:39 UTC
Thanks. The fix was pushed into release73 branch as
changeset:   260421:6f4979ca253a and changeset:   260422:a5847f1ee551.
Spec. version increase by changeset:   260423:2a11204244c1

https://hg.netbeans.org/releases/rev/6f4979ca253a
https://hg.netbeans.org/releases/rev/a5847f1ee551
https://hg.netbeans.org/releases/rev/2a11204244c1
Comment 6 Quality Engineering 2013-05-05 00:26:41 UTC
Integrated into 'releases', will be available in build *201305042200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/6f4979ca253a
User: mentlicher@netbeans.org
Log: #227203: NodeRenderDataProvider should return null background and foreground, so that the default is not altered and DefaultOutlineCellRenderer should not touch the background and foreground that was set by Swing, unless the RenderDataProvider provides some.
Comment 7 Tomas Danek 2013-05-10 14:11:40 UTC
Martine,
I tried to run test from 7.3.1 branch on 7.3.1 bits and it failed; can you please evaluate? both IDE and testdist were from smetiste:
netbeans-7.3.1dev-201305092200-javase.zip
testdist-201305092200.zip


[junit] Testsuite: org.netbeans.swing.outline.DefaultOutlineCellRendererTest
    [junit] getTableCellRendererComponent
    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.648 sec
    [junit] 
    [junit] ------------- Standard Output ---------------
    [junit] getTableCellRendererComponent
    [junit] ------------- ---------------- ---------------
    [junit] Testcase: testGetTableCellRendererComponent(org.netbeans.swing.outline.DefaultOutlineCellRendererTest):	FAILED
    [junit] First line backgroundColor defaults to expected:<java.awt.Color[r=255,g=0,b=0]> but was:<javax.swing.plaf.ColorUIResource[r=255,g=255,b=255]>
    [junit] junit.framework.AssertionFailedError: First line backgroundColor defaults to expected:<java.awt.Color[r=255,g=0,b=0]> but was:<javax.swing.plaf.ColorUIResource[r=255,g=255,b=255]>
    [junit] 	at junit.framework.Assert.fail(Assert.java:50)
    [junit] 	at junit.framework.Assert.failNotEquals(Assert.java:287)
    [junit] 	at junit.framework.Assert.assertEquals(Assert.java:67)
    [junit] 	at org.netbeans.swing.outline.DefaultOutlineCellRendererTest.testGetTableCellRendererComponent(DefaultOutlineCellRendererTest.java:88)
    [junit] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    [junit] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Comment 8 Martin Entlicher 2013-05-10 15:37:58 UTC
The test was already fixed in trunk - see issue #228567.
It's broken by changed behavior in JDK 7.
Is it necessary to fix the test on release73 branch as well? But 7.3 can be run on JDK 6 as well, thus the test would have to have a condition on JDK version.
Comment 9 Tomas Danek 2013-05-10 16:10:01 UTC
Thanks for explanation; CCing Jirka Skrivanek - Jirko, are there any plans to re-build SSTD from 7.3(.1) sources? If so, I think it makes sense to backport #228567.

(In reply to comment #8)
> The test was already fixed in trunk - see issue #228567.
> It's broken by changed behavior in JDK 7.
> Is it necessary to fix the test on release73 branch as well? But 7.3 can be run
> on JDK 6 as well, thus the test would have to have a condition on JDK version.
Comment 10 Jiri Skrivanek 2013-05-10 16:49:04 UTC
I have already excluded the test from stable config in release73. So no need to backport #228567.

http://hg.netbeans.org/releases/rev/c7a775564bf5
Comment 11 Tomas Danek 2013-05-13 11:14:57 UTC
ok, thanks.
Test (fixed one) passes on 7.3.1:

    [junit] Testsuite: org.netbeans.swing.outline.DefaultOutlineCellRendererTest
    [junit] getTableCellRendererComponent
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.643 sec

Verified.