Author: rwhitcomb
Date: Fri Feb 12 20:40:43 2016
New Revision: 1730103
URL: http://svn.apache.org/viewvc?rev=1730103&view=rev
Log:
PIVOT-985: Fix the ColorUtilities.decodeColor method to deal with the two
"standard" Java color names that didn't actually work: "darkgray" and
"lightgray" because their static field names are mixed case (as in
"darkGray") which wouldn't match our search using the lower case string.
Put in special cases for these two, plus support for the British
spellings (as in "darkgrey" and "lightgrey").
Modify one of the tutorials to test this functionality (changing "red"
to "lightGray").
Note: the other issue PIVOT-984 about supporting X11/CSS3 color names
could supercede this small fix, but I felt it was worth getting this
into the 2.0.4 branch, since the new colors wouldn't happen until 2.1.
This is a merge of revision 1730100 from "trunk" to "branches/2.0.x".
Modified:
pivot/branches/2.0.x/ (props changed)
pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/explorer/text_pane.bxml
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 12 20:40:43 2016
@@ -1 +1 @@
-/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493
+/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493,1730100
Modified:
pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/explorer/text_pane.bxml
URL:
http://svn.apache.org/viewvc/pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/explorer/text_pane.bxml?rev=1730103&r1=1730102&r2=1730103&view=diff
==============================================================================
---
pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/explorer/text_pane.bxml
(original)
+++
pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/explorer/text_pane.bxml
Fri Feb 12 20:40:43 2016
@@ -29,7 +29,7 @@ limitations under the License.
<Paragraph font="Arial BOLD 24">abcd</Paragraph>
<Paragraph font="Arial ITALIC 24">abcd</Paragraph>
<Paragraph foregroundColor="red">abcd</Paragraph>
- <Paragraph backgroundColor="red">abcd</Paragraph>
+ <Paragraph backgroundColor="lightGray">abcd</Paragraph>
<Paragraph>abcd</Paragraph>
<NumberedList style="decimal">
<List.Item>
Modified:
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL:
http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1730103&r1=1730102&r2=1730103&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
(original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
Fri Feb 12 20:40:43 2016
@@ -227,7 +227,16 @@ public final class GraphicsUtilities {
try {
color =
(Color)Color.class.getDeclaredField(valueLowercase).get(null);
} catch (Exception exception) {
- throw new IllegalArgumentException("\"" + valueLowercase + "\"
is not a valid color constant.");
+ // PIVOT-985: special case for two values (plus spelling
variants)
+ // that don't work with just a pure lower case name lookup
+ if (valueLowercase.equals("darkgray") ||
valueLowercase.equals("darkgrey")) {
+ color = Color.darkGray;
+ } else if (valueLowercase.equals("lightgray") ||
valueLowercase.equals("lightgrey")) {
+ color = Color.lightGray;
+ } else {
+ throw new IllegalArgumentException("\"" + valueLowercase
+ + "\" is not a valid color constant.");
+ }
}
}