You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/10/28 15:17:41 UTC

svn commit: r1536363 - in /pivot/trunk: demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java tests/src/org/apache/pivot/tests/ColorPaletteTest.java

Author: smartini
Date: Mon Oct 28 14:17:41 2013
New Revision: 1536363

URL: http://svn.apache.org/r1536363
Log:
PIVOT-689, small updates to sample application and retrofit even ColorPaletteTest

Modified:
    pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
    pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java?rev=1536363&r1=1536362&r2=1536363&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java Mon Oct 28 14:17:41 2013
@@ -269,8 +269,9 @@ public class ColorSchemeBuilderWindow ex
     }
 
     private void resetPalette() {
-        ArrayList<String> colors = new ArrayList<>(8);
-        for (int i = 0; i < 8; i++) {
+        int numberOfPaletteColors = getNumberOfPaletteColors();
+        ArrayList<String> colors = new ArrayList<>(numberOfPaletteColors);
+        for (int i = 0; i < numberOfPaletteColors; i++) {
             ColorChooserButton colorChooserButton = colorChooserButtons.get(i);
 
             colorChooserButton.setSelectedColor(themeOriginalColors.get(i));

Modified: 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=1536363&r1=1536362&r2=1536363&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/ColorPaletteTest.java Mon Oct 28 14:17:41 2013
@@ -29,25 +29,31 @@ import org.apache.pivot.wtk.HorizontalAl
 import org.apache.pivot.wtk.Label;
 import org.apache.pivot.wtk.StackPane;
 import org.apache.pivot.wtk.TablePane;
+import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.VerticalAlignment;
 import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.skin.terra.TerraTheme;
 
 public class ColorPaletteTest extends Application.Adapter {
     private Window window = null;
 
     @Override
     public void startup(Display display, Map<String, String> properties) throws Exception {
+        TerraTheme terraTheme = (TerraTheme) Theme.getTheme();
+
         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++) {
+        int numberOfPaletteColors = terraTheme.getNumberOfPaletteColors();
+        // ArrayList<String> colors = new ArrayList<>(numberOfPaletteColors);
+        for (int i = 0; i < numberOfPaletteColors; i++) {
             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));
+            row.add(createCell(i * 3));
+            row.add(createCell(i * 3 + 1));
+            row.add(createCell(i * 3 + 2));
 
             tablePane.getRows().add(row);
         }