Author: rwhitcomb
Date: Tue Feb  6 22:20:32 2018
New Revision: 1823404

URL: http://svn.apache.org/viewvc?rev=1823404&view=rev
Log:
PIVOT-999: Remove the really unnecessary "putInt" and "putBoolean" methods
from Dictionary and Component.StyleDictionary, because the default "put"
method (with autoboxing) is perfectly able to handle those values.

Add a default "copy" method to the Dictionary interface to copy a key/value
pair from another dictionary.  Also add the "Style" overload of this method
to Component.StyleDictionary for completeness.

Modified:
    pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java
    
pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java?rev=1823404&r1=1823403&r2=1823404&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java 
(original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java Tue 
Feb  6 22:20:32 2018
@@ -40,15 +40,15 @@ public class RSSItemRenderer extends Box
         super(Orientation.VERTICAL);
 
         getStyles().put(Style.padding, new Insets(2, 2, 8, 2));
-        getStyles().putBoolean(Style.fill, true);
+        getStyles().put(Style.fill, true);
 
-        titleLabel.getStyles().putBoolean(Style.wrapText, true);
+        titleLabel.getStyles().put(Style.wrapText, true);
         add(titleLabel);
 
-        categoriesLabel.getStyles().putBoolean(Style.wrapText, true);
+        categoriesLabel.getStyles().put(Style.wrapText, true);
         add(categoriesLabel);
 
-        submitterLabel.getStyles().putBoolean(Style.wrapText, true);
+        submitterLabel.getStyles().put(Style.wrapText, true);
         add(submitterLabel);
     }
 

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=1823404&r1=1823403&r2=1823404&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
 Tue Feb  6 22:20:32 2018
@@ -43,6 +43,7 @@ import org.apache.pivot.wtk.Prompt;
 import org.apache.pivot.wtk.PushButton;
 import org.apache.pivot.wtk.Spinner;
 import org.apache.pivot.wtk.SpinnerSelectionListener;
+import org.apache.pivot.wtk.Style;
 import org.apache.pivot.wtk.TablePane;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.VerticalAlignment;
@@ -81,7 +82,7 @@ public class ColorSchemeBuilderWindow ex
 
             NumericSpinnerData colorSpinnerData = new NumericSpinnerData(0, 
255);
             SpinnerItemRenderer colorSpinnerItemRenderer = new 
SpinnerItemRenderer();
-            colorSpinnerItemRenderer.getStyles().put("horizontalAlignment",
+            colorSpinnerItemRenderer.getStyles().put(Style.horizontalAlignment,
                 HorizontalAlignment.RIGHT);
 
             final Spinner redSpinner = new Spinner();
@@ -103,8 +104,8 @@ public class ColorSchemeBuilderWindow ex
             blueSpinner.setSelectedIndex(0);
 
             BoxPane colorBoxPane = new BoxPane();
-            colorBoxPane.getStyles().put("fill", new Boolean(true));
-            colorBoxPane.getStyles().put("padding", "{left:4}");
+            colorBoxPane.getStyles().put(Style.fill, true);
+            colorBoxPane.getStyles().put(Style.padding, "{left:4}");
             colorBoxPane.add(redSpinner);
             colorBoxPane.add(greenSpinner);
             colorBoxPane.add(blueSpinner);
@@ -133,7 +134,7 @@ public class ColorSchemeBuilderWindow ex
                     int offset = iLocal * 3;
                     for (int j = 0; j < 3; j++) {
                         Component colorPaletteCell = 
colorPaletteTablePane.getRows().get(iLocal).get(j);
-                        colorPaletteCell.getStyles().putInt("backgroundColor", 
offset + j);
+                        
colorPaletteCell.getStyles().put(Style.backgroundColor, offset + j);
                     }
 
                     // Reload the sample part of the content (but not all the 
application),
@@ -204,26 +205,26 @@ public class ColorSchemeBuilderWindow ex
             row.add(createColorPaletteCell(offset + 2));
         }
 
-        colorPaletteTablePane.getStyles().putInt("horizontalSpacing", 4);
-        colorPaletteTablePane.getStyles().putInt("verticalSpacing", 4);
+        colorPaletteTablePane.getStyles().put(Style.horizontalSpacing, 4);
+        colorPaletteTablePane.getStyles().put(Style.verticalSpacing, 4);
     }
 
     private static Component createColorPaletteCell(int index) {
         Border border = new Border();
-        border.getStyles().putInt("backgroundColor", index);
+        border.getStyles().put(Style.backgroundColor, index);
 
         Theme theme = Theme.getTheme();
 
         Label label = new Label();
         label.setText(Integer.toString(index));
-        label.getStyles().put("font", "{size:'80%'}");
-        label.getStyles().put("backgroundColor", theme.getColor(4));
-        label.getStyles().putInt("padding", 1);
+        label.getStyles().put(Style.font, "{size:'80%'}");
+        label.getStyles().put(Style.backgroundColor, 4);
+        label.getStyles().put(Style.padding, 1);
 
         BoxPane boxPane = new BoxPane();
-        boxPane.getStyles().putInt("padding", 2);
-        boxPane.getStyles().put("horizontalAlignment", 
HorizontalAlignment.CENTER);
-        boxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+        boxPane.getStyles().put(Style.padding, 2);
+        boxPane.getStyles().put(Style.horizontalAlignment, 
HorizontalAlignment.CENTER);
+        boxPane.getStyles().put(Style.verticalAlignment, 
VerticalAlignment.CENTER);
 
         boxPane.add(new Border(label));
         border.setContent(boxPane);


Reply via email to