You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/01/21 17:49:53 UTC

svn commit: r901769 - in /pivot/trunk: tests/src/org/apache/pivot/tests/ tutorials/src/org/apache/pivot/tutorials/layout/ tutorials/www/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/doc-files/

Author: gbrown
Date: Thu Jan 21 16:49:51 2010
New Revision: 901769

URL: http://svn.apache.org/viewvc?rev=901769&view=rev
Log:
Eliminate redundant blue color from Terra palette; make Terra icons configurable via scheme definition file.

Added:
    pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java
Removed:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/doc-files/palette_test.png
Modified:
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.wtkx
    pivot/trunk/tutorials/www/hello-world.xml
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_test.json
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/doc-files/palette.png
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html

Added: pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java?rev=901769&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java Thu Jan 21 16:49:51 2010
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tests;
+
+import java.awt.Color;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Border;
+import org.apache.pivot.wtk.BoxPane;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.HorizontalAlignment;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.StackPane;
+import org.apache.pivot.wtk.TablePane;
+import org.apache.pivot.wtk.VerticalAlignment;
+import org.apache.pivot.wtk.Window;
+
+public class ColorPaletteTest implements Application {
+    private Window window = null;
+
+    @Override
+    public void startup(Display display, Map<String, String> properties)
+        throws Exception {
+        TablePane tablePane = new TablePane();
+        tablePane.getColumns().add(new TablePane.Column(1, true));
+        tablePane.getColumns().add(new TablePane.Column(1, true));
+        tablePane.getColumns().add(new TablePane.Column(1, true));
+
+        for (int j = 0; j < 8; j++) {
+            TablePane.Row row = new TablePane.Row(1, true);
+
+            row.add(createCell(j * 3));
+            row.add(createCell(j * 3 + 1));
+            row.add(createCell(j * 3 + 2));
+
+            tablePane.getRows().add(row);
+        }
+
+        tablePane.getStyles().put("horizontalSpacing", 4);
+        tablePane.getStyles().put("verticalSpacing", 4);
+
+        Border border = new Border(tablePane);
+        border.getStyles().put("padding", 6);
+
+        window = new Window(border);
+        window.setTitle("Color Palette");
+        window.setMaximized(true);
+        window.open(display);
+    }
+
+    @Override
+    public boolean shutdown(boolean optional) {
+        if (window != null) {
+            window.close();
+        }
+
+        return false;
+    }
+
+    @Override
+    public void suspend() {
+    }
+
+    @Override
+    public void resume() {
+    }
+
+    private Component createCell(int index) {
+        StackPane stackPane = new StackPane();
+
+        Border border = new Border();
+        border.getStyles().put("backgroundColor", index);
+
+        stackPane.add(border);
+
+        Label label = new Label();
+        label.setText(Integer.toString(index));
+        label.getStyles().put("backgroundColor", Color.WHITE);
+        label.getStyles().put("padding", 2);
+
+        BoxPane boxPane = new BoxPane();
+        boxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
+        boxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+
+        boxPane.add(new Border(label));
+        stackPane.add(boxPane);
+
+        return stackPane;
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(ColorPaletteTest.class, args);
+    }
+}

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java Thu Jan 21 16:49:51 2010
@@ -35,6 +35,8 @@
 public class Forms implements Application {
     private Window window = null;
     private BoxPane nameBoxPane = null;
+    private BoxPane homeAddressBoxPane = null;
+    private BoxPane workAddressBoxPane = null;
     private TextInput lastNameTextInput = null;
     private TextInput firstNameTextInput = null;
     private PushButton submitButton = null;
@@ -45,6 +47,8 @@
         WTKXSerializer wtkxSerializer = new WTKXSerializer();
         window = (Window)wtkxSerializer.readObject(this, "forms.wtkx");
         nameBoxPane = (BoxPane)wtkxSerializer.get("nameBoxPane");
+        homeAddressBoxPane = (BoxPane)wtkxSerializer.get("homeAddressBoxPane");
+        workAddressBoxPane = (BoxPane)wtkxSerializer.get("workAddressBoxPane");
         lastNameTextInput = (TextInput)wtkxSerializer.get("lastNameTextInput");
         firstNameTextInput = (TextInput)wtkxSerializer.get("firstNameTextInput");
         submitButton = (PushButton)wtkxSerializer.get("submitButton");
@@ -63,6 +67,8 @@
                 }
 
                 Form.setFlag(nameBoxPane, flag);
+                Form.setFlag(homeAddressBoxPane, new Form.Flag(MessageType.WARNING, "This is a warning."));
+                Form.setFlag(workAddressBoxPane, new Form.Flag(MessageType.WARNING, "This is also a warning."));
 
                 if (flag == null) {
                     errorLabel.setText(null);

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.wtkx
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.wtkx?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.wtkx (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/forms.wtkx Thu Jan 21 16:49:51 2010
@@ -28,7 +28,7 @@
                     </columns>
                     <rows>
                         <TablePane.Row height="1*">
-                            <Form>
+                            <Form styles="{showFlagIcons:true}">
                                 <sections>
                                     <Form.Section>
                                         <BoxPane wtkx:id="nameBoxPane" Form.label="Name">
@@ -37,7 +37,7 @@
                                         </BoxPane>
                                     </Form.Section>
                                     <Form.Section heading="Addresses">
-                                        <BoxPane Form.label="Home" orientation="vertical">
+                                        <BoxPane wtkx:id="homeAddressBoxPane" Form.label="Home" orientation="vertical">
                                             <TextInput prompt="Street" textSize="24"/>
                                             <BoxPane>
                                                 <TextInput prompt="City"/>
@@ -45,7 +45,7 @@
                                                 <TextInput prompt="Zip" textSize="10"/>
                                             </BoxPane>
                                         </BoxPane>
-                                        <BoxPane Form.label="Work" orientation="vertical">
+                                        <BoxPane wtkx:id="workAddressBoxPane" Form.label="Work" orientation="vertical">
                                             <TextInput prompt="Street" textSize="24"/>
                                             <BoxPane>
                                                 <TextInput prompt="City"/>

Modified: pivot/trunk/tutorials/www/hello-world.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/hello-world.xml?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/hello-world.xml (original)
+++ pivot/trunk/tutorials/www/hello-world.xml Thu Jan 21 16:49:51 2010
@@ -139,7 +139,7 @@
         <p>
             A Pivot application can be run in the browser using the <tt>&lt;applet&gt;</tt> tag, as
             shown below; the class name of the Pivot application is specified by the
-            "applicationClassName" applet parameter (see
+            "application_class_name" applet parameter (see
             <a href="http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit">this article</a>
             for more information on how to deploy Java applets):
         </p>
@@ -149,7 +149,7 @@
             <applet code="org.apache.pivot.wtk.BrowserApplicationContext$HostApplet"
                 archive="lib/pivot-core-[version].jar,lib/pivot-wtk-[version].jar,lib/pivot-wtk-terra-[version].jar,lib/pivot-tutorials-[version].jar"
                 width="160" height="80">
-                <param name="applicationClassName" value="org.apache.pivot.tutorials.HelloJava">
+                <param name="application_class_name" value="org.apache.pivot.tutorials.HelloJava">
             </applet>
             ]]>
         </source>

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java Thu Jan 21 16:49:51 2010
@@ -382,7 +382,7 @@
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
         selectionColor = theme.getColor(4);
-        selectionBackgroundColor = theme.getColor(19);
+        selectionBackgroundColor = theme.getColor(13);
         highlightColor = theme.getColor(1);
         highlightBackgroundColor = theme.getColor(10);
         dividerColor = theme.getColor(9);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java Thu Jan 21 16:49:51 2010
@@ -130,7 +130,7 @@
 
                         case WARNING: {
                             color = theme.getColor(1);
-                            backgroundColor = theme.getColor(25);
+                            backgroundColor = theme.getColor(19);
                             break;
                         }
 
@@ -205,18 +205,22 @@
     private ArrayList<ArrayList<BoxPane>> rowHeaders = new ArrayList<ArrayList<BoxPane>>();
     // TODO private ArrayList<ArrayList<Label>> flagMessages = new ArrayList<ArrayList<Label>>();
 
-    private int horizontalSpacing = 6;
-    private int verticalSpacing = 6;
-    private int flagImageOffset = 4;
-    private boolean fill = false;
-    private boolean showFirstSectionHeading = false;
-    private boolean showFlagIcons = true;
-    private boolean showFlagHighlight = true;
-    private boolean showFlagMessagesInline = false;
-    private boolean leftAlignLabels = false;
-    private String delimiter = DEFAULT_DELIMITER;
+    private int horizontalSpacing;
+    private int verticalSpacing;
+    private int flagImageOffset;
+    private boolean fill;
+    private boolean showFirstSectionHeading;
+    private boolean showFlagIcons;
+    private boolean showFlagHighlight;
+    private boolean showFlagMessagesInline;
+    private boolean leftAlignLabels;
+    private String delimiter;
+    private Image errorMessageIcon = null;
+    private Image warningMessageIcon = null;
+    private Image questionMessageIcon = null;
+    private Image infoMessageIcon = null;
+    private int flagImageWidth = -1;
 
-    private static final int FLAG_IMAGE_SIZE = 16;
     private static final int FLAG_HIGHLIGHT_PADDING = 2;
     private static final int FIELD_INDICATOR_WIDTH = 13;
     private static final int FIELD_INDICATOR_HEIGHT = 6;
@@ -225,6 +229,31 @@
 
     private static final String DEFAULT_DELIMITER = ":";
 
+    public TerraFormSkin() {
+        horizontalSpacing = 6;
+        verticalSpacing = 6;
+        flagImageOffset = 4;
+        fill = false;
+        showFirstSectionHeading = false;
+        showFlagIcons = true;
+        showFlagHighlight = true;
+        showFlagMessagesInline = false;
+        leftAlignLabels = false;
+        delimiter = DEFAULT_DELIMITER;
+
+        TerraTheme terraTheme = (TerraTheme)Theme.getTheme();
+        errorMessageIcon = terraTheme.getSmallMessageIcon(MessageType.ERROR);
+        warningMessageIcon = terraTheme.getSmallMessageIcon(MessageType.WARNING);
+        questionMessageIcon = terraTheme.getSmallMessageIcon(MessageType.QUESTION);
+        infoMessageIcon = terraTheme.getSmallMessageIcon(MessageType.INFO);
+
+        // Determine maximum icon size
+        flagImageWidth = Math.max(flagImageWidth, errorMessageIcon.getWidth());
+        flagImageWidth = Math.max(flagImageWidth, warningMessageIcon.getWidth());
+        flagImageWidth = Math.max(flagImageWidth, questionMessageIcon.getWidth());
+        flagImageWidth = Math.max(flagImageWidth, infoMessageIcon.getWidth());
+    }
+
     @Override
     public void install(Component component) {
         super.install(component);
@@ -654,7 +683,7 @@
                         }
 
                         case WARNING: {
-                            highlightColor = theme.getColor(24);
+                            highlightColor = theme.getColor(18);
                             break;
                         }
 
@@ -980,7 +1009,7 @@
         rowHeader.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
 
         ImageView flagImageView = new ImageView();
-        flagImageView.setPreferredSize(FLAG_IMAGE_SIZE, FLAG_IMAGE_SIZE);
+        flagImageView.setPreferredWidth(flagImageWidth);
         flagImageView.setVisible(showFlagIcons);
 
         rowHeader.add(flagImageView);
@@ -1046,18 +1075,40 @@
         Form form = (Form)getComponent();
         Component field = section.get(fieldIndex);
 
-        TerraTheme theme = (TerraTheme)Theme.getTheme();
-
         int sectionIndex = form.getSections().indexOf(section);
         BoxPane rowHeader = rowHeaders.get(sectionIndex).get(fieldIndex);
         ImageView flagImageView = (ImageView)rowHeader.get(0);
 
         Form.Flag flag = Form.getFlag(field);
+
         if (flag == null) {
             flagImageView.setImage((Image)null);
         } else {
             MessageType messageType = flag.getMessageType();
-            flagImageView.setImage(theme.getSmallMessageIcon(messageType));
+            Image messageIcon = null;
+            switch (messageType) {
+                case ERROR: {
+                    messageIcon = errorMessageIcon;
+                    break;
+                }
+
+                case WARNING: {
+                    messageIcon = warningMessageIcon;
+                    break;
+                }
+
+                case QUESTION: {
+                    messageIcon = questionMessageIcon;
+                    break;
+                }
+
+                case INFO: {
+                    messageIcon = infoMessageIcon;
+                    break;
+                }
+            }
+
+            flagImageView.setImage(messageIcon);
         }
 
         if (showFlagHighlight) {

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Thu Jan 21 16:49:51 2010
@@ -85,7 +85,7 @@
         disabledColor = theme.getColor(7);
         backgroundColor = theme.getColor(4);
         selectionColor = theme.getColor(4);
-        selectionBackgroundColor = theme.getColor(19);
+        selectionBackgroundColor = theme.getColor(13);
         inactiveSelectionColor = theme.getColor(1);
         inactiveSelectionBackgroundColor = theme.getColor(9);
         highlightColor = theme.getColor(1);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuBarSkin.java Thu Jan 21 16:49:51 2010
@@ -47,7 +47,7 @@
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
         activeColor = theme.getColor(4);
-        activeBackgroundColor = theme.getColor(20);
+        activeBackgroundColor = theme.getColor(14);
         spacing = 2;
     }
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java Thu Jan 21 16:49:51 2010
@@ -58,7 +58,7 @@
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
         activeColor = theme.getColor(4);
-        activeBackgroundColor = theme.getColor(19);
+        activeBackgroundColor = theme.getColor(13);
         marginColor = theme.getColor(11);
         marginColor = new Color(marginColor.getRed(), marginColor.getGreen(),
             marginColor.getBlue(), 228);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java Thu Jan 21 16:49:51 2010
@@ -92,7 +92,7 @@
         disabledColor = theme.getColor(7);
         backgroundColor = theme.getColor(4);
         selectionColor = theme.getColor(4);
-        selectionBackgroundColor = theme.getColor(19);
+        selectionBackgroundColor = theme.getColor(13);
         inactiveSelectionColor = theme.getColor(1);
         inactiveSelectionBackgroundColor = theme.getColor(9);
         highlightBackgroundColor = theme.getColor(10);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java Thu Jan 21 16:49:51 2010
@@ -27,7 +27,7 @@
         setColor(1);
         setInactiveColor(7);
         setSelectionColor(4);
-        setSelectionBackgroundColor(19);
+        setSelectionBackgroundColor(13);
         setInactiveSelectionColor(1);
         setInactiveSelectionBackgroundColor(9);
     }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java Thu Jan 21 16:49:51 2010
@@ -172,7 +172,7 @@
         strictValidation = false;
 
         selectionColor = theme.getColor(4);
-        selectionBackgroundColor = theme.getColor(19);
+        selectionBackgroundColor = theme.getColor(13);
         inactiveSelectionColor = theme.getColor(1);
         inactiveSelectionBackgroundColor = theme.getColor(9);
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java Thu Jan 21 16:49:51 2010
@@ -22,6 +22,8 @@
 import java.io.InputStream;
 import java.net.URL;
 
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.HashMap;
 import org.apache.pivot.collections.List;
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.serialization.JSONSerializer;
@@ -31,7 +33,6 @@
 import org.apache.pivot.wtk.Accordion;
 import org.apache.pivot.wtk.ActivityIndicator;
 import org.apache.pivot.wtk.Alert;
-import org.apache.pivot.wtk.ApplicationContext;
 import org.apache.pivot.wtk.Border;
 import org.apache.pivot.wtk.BoxPane;
 import org.apache.pivot.wtk.Calendar;
@@ -86,7 +87,9 @@
  */
 public final class TerraTheme extends Theme {
     private Font font = null;
-    private Color[] colors = null;
+    private ArrayList<Color> colors = null;
+    private HashMap<MessageType, Image> messageIcons = null;
+    private HashMap<MessageType, Image> smallMessageIcons = null;
 
     public static final String LOCATION_PROPERTY = "org.apache.pivot.wtk.skin.terra.location";
 
@@ -183,16 +186,24 @@
                 font = Font.decode((String)properties.get("font"));
 
                 List<String> colorCodes = (List<String>)properties.get("colors");
-                colors = new Color[colorCodes.getLength() * 3];
+                colors = new ArrayList<Color>(colorCodes.getLength() * 3);
 
-                for (int i = 0, n = colorCodes.getLength(); i < n; i++) {
-                    int baseIndex = i * 3 + 1;
-                    Color baseColor = Color.decode(colorCodes.get(i));
-
-                    colors[baseIndex] = baseColor;
-                    colors[baseIndex - 1] = darken(baseColor);
-                    colors[baseIndex + 1] = brighten(baseColor);
+                for (String colorCode : colorCodes) {
+                    Color baseColor = Color.decode(colorCode);
+                    colors.add(darken(baseColor));
+                    colors.add(baseColor);
+                    colors.add(brighten(baseColor));
                 }
+
+                Map<String, String> messageIconNames =
+                    (Map<String, String>)properties.get("messageIcons");
+                messageIcons = new HashMap<MessageType, Image>();
+                loadMessageIcons(messageIconNames, messageIcons);
+
+                Map<String, String> smallMessageIconNames =
+                    (Map<String, String>)properties.get("smallMessageIcons");
+                smallMessageIcons = new HashMap<MessageType, Image>();
+                loadMessageIcons(smallMessageIconNames, smallMessageIcons);
             } finally {
                 inputStream.close();
             }
@@ -203,6 +214,22 @@
         }
     }
 
+    private void loadMessageIcons(Map<String, String> messageIconNames,
+        HashMap<MessageType, Image> messageIcons) {
+        for (String messageIconType : messageIconNames) {
+            String messageIconName = messageIconNames.get(messageIconType);
+
+            Image messageIcon;
+            try {
+                messageIcon = Image.load(getClass().getResource(messageIconName));
+            } catch (TaskExecutionException exception) {
+                throw new RuntimeException(exception);
+            }
+
+            messageIcons.put(MessageType.valueOf(messageIconType.toUpperCase()), messageIcon);
+        }
+    }
+
     /**
      * Gets the theme's font.
      */
@@ -227,7 +254,7 @@
      * A color palette index, from 0 to 23.
      */
     public Color getColor(int index) {
-        return colors[index];
+        return colors.get(index);
     }
 
     /**
@@ -235,57 +262,7 @@
      * specified type.
      */
     public Image getMessageIcon(MessageType messageType) {
-        String messageIconName;
-
-        switch (messageType) {
-            case ERROR: {
-                messageIconName = "message_type-error-32x32.png";
-                break;
-            }
-
-            case WARNING: {
-                messageIconName = "message_type-warning-32x32.png";
-                break;
-            }
-
-            case QUESTION: {
-                messageIconName = "message_type-question-32x32.png";
-                break;
-            }
-
-            case INFO: {
-                messageIconName = "message_type-info-32x32.png";
-                break;
-            }
-
-            case APPLICATION: {
-                messageIconName = null;
-                break;
-            }
-
-            default: {
-                throw new IllegalArgumentException();
-            }
-        }
-
-        Image messageIcon = null;
-
-        if (messageIconName != null) {
-            URL location = getClass().getResource(messageIconName);
-            messageIcon = (Image)ApplicationContext.getResourceCache().get(location);
-
-            if (messageIcon == null) {
-                try {
-                    messageIcon = Image.load(location);
-                } catch (TaskExecutionException exception) {
-                    throw new RuntimeException(exception);
-                }
-
-                ApplicationContext.getResourceCache().put(location, messageIcon);
-            }
-        }
-
-        return messageIcon;
+        return messageIcons.get(messageType);
     }
 
     /**
@@ -293,57 +270,7 @@
      * specified type.
      */
     public Image getSmallMessageIcon(MessageType messageType) {
-        String smallMessageIconName;
-
-        switch (messageType) {
-            case ERROR: {
-                smallMessageIconName = "message_type-error-16x16.png";
-                break;
-            }
-
-            case WARNING: {
-                smallMessageIconName = "message_type-warning-16x16.png";
-                break;
-            }
-
-            case QUESTION: {
-                smallMessageIconName = "message_type-question-16x16.png";
-                break;
-            }
-
-            case INFO: {
-                smallMessageIconName = "message_type-info-16x16.png";
-                break;
-            }
-
-            case APPLICATION: {
-                smallMessageIconName = null;
-                break;
-            }
-
-            default: {
-                throw new IllegalArgumentException();
-            }
-        }
-
-        Image smallMessageIcon = null;
-
-        if (smallMessageIconName != null) {
-            URL location = getClass().getResource(smallMessageIconName);
-            smallMessageIcon = (Image)ApplicationContext.getResourceCache().get(location);
-
-            if (smallMessageIcon == null) {
-                try {
-                    smallMessageIcon = Image.load(location);
-                } catch (TaskExecutionException exception) {
-                    throw new RuntimeException(exception);
-                }
-
-                ApplicationContext.getResourceCache().put(location, smallMessageIcon);
-            }
-        }
-
-        return smallMessageIcon;
+        return smallMessageIcons.get(messageType);
     }
 
     /**

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_test.json
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_test.json?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java Thu Jan 21 16:49:51 2010
@@ -462,7 +462,7 @@
         disabledColor = theme.getColor(7);
         backgroundColor = theme.getColor(4);
         selectionColor = theme.getColor(4);
-        selectionBackgroundColor = theme.getColor(19);
+        selectionBackgroundColor = theme.getColor(13);
         inactiveSelectionColor = theme.getColor(1);
         inactiveSelectionBackgroundColor = theme.getColor(10);
         highlightColor = theme.getColor(1);
@@ -472,9 +472,9 @@
         showHighlight = true;
         showBranchControls = true;
         showEmptyBranchControls = true;
-        branchControlColor = theme.getColor(18);
+        branchControlColor = theme.getColor(12);
         branchControlSelectionColor = theme.getColor(4);
-        branchControlInactiveSelectionColor = theme.getColor(19);
+        branchControlInactiveSelectionColor = theme.getColor(13);
         gridColor = theme.getColor(11);
         showGridLines = false;
     }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/doc-files/palette.png
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/doc-files/palette.png?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html?rev=901769&r1=901768&r2=901769&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html Thu Jan 21 16:49:51 2010
@@ -23,7 +23,7 @@
 </p>
 <p>
 Terra skins get their colors from the theme's color palette, which contains
-27 indexed colors.  Most Terra skins expose a setter methods for each color
+24 indexed colors.  Most Terra skins expose a setter methods for each color
 style that accepts an integer value; such methods allow callers to style
 the component by referencing the theme's color palette.  The default palette
 is shown below:
@@ -36,7 +36,7 @@
 </font>
 </p>
 
-<p>The font and color palette is defined in a JSON file that should contain a
+<p>The font, color palette, and message icons are defined in a JSON file that should contain a
 <tt>Map</tt> containing the following properties:</p>
 
 <p>
@@ -58,15 +58,30 @@
 <td><tt>colors</tt></td>
 <td><tt>List&lt;String&gt;</tt></td>
 <td>
-This list should contain 9 colors in a form understandable by
+This list should contain eight colors in a form understandable by
 <tt>java.awt.Color.decode()</tt>. This list represents the theme's
 "base color palette", from which the full color palette is
-derived. Each of these 9 colors will be expanded to three
+derived. Each of these eight colors will be expanded to three
 colors in the final palette: a darker version, the color itself,
 and a lighter version. Thus, the final color palette will contain
-27 colors. For instance, in the <a href="#palette">default color
-palette</a> the "base palette" colors are the colors in the middle
-column.
+24 colors. For instance, in the default color palette, the "base palette"
+colors are the colors in the middle column.
+</td>
+</tr>
+<tr valign="top">
+<td><tt>messageIcons</tt></td>
+<td><tt>Map</tt></td>
+<td>
+Message icon names; must include values for "error", "warning", "question", and "info".
+Names are specified as resource named relative to the <tt>TerraTheme</tt> class.
+</td>
+</tr>
+<tr valign="top">
+<td><tt>smallMessageIcons</tt></td>
+<td><tt>Map</tt></td>
+<td>
+Small message icon names; must include values for "error", "warning", "question", and "info".
+Names are specified as resource named relative to the <tt>TerraTheme</tt> class.
 </td>
 </tr>
 </table>