]> source.dussan.org Git - vaadin-framework.git/commitdiff
Resolve some merge conflicts.
authorHenri Sara <hesara@vaadin.com>
Wed, 25 Jan 2012 12:07:56 +0000 (14:07 +0200)
committerHenri Sara <hesara@vaadin.com>
Wed, 25 Jan 2012 12:07:56 +0000 (14:07 +0200)
src/com/vaadin/terminal/gwt/client/Util.java
src/com/vaadin/terminal/gwt/client/communication/JsonEncoder.java

index bcbe0de22c31f07e69275ae269cf3f5f60bd4bef..a3cf20ae285f9da8b28e9dd3f8a4d070dea0cc1e 100644 (file)
@@ -954,8 +954,9 @@ public class Util {
                     Object value = parameters[1];
                     // TODO paintables inside lists/maps get rendered as
                     // components in the debug console
-                    String formattedValue = value instanceof Paintable ? c
-                            .getPid((Paintable) value) : String.valueOf(value);
+                    String formattedValue = value instanceof VPaintable ? c
+                            .getPaintableMap().getPid((VPaintable) value)
+                            : String.valueOf(value);
                     formattedParams = parameters[0] + " : " + formattedValue;
                 }
                 if (null == formattedParams) {
index a4aaee1a61e82e3c60e53c9e9c82db7e613731b1..6f429df30ce6ffd212bcb61629e78a9fa735e121 100644 (file)
@@ -8,7 +8,8 @@ import com.google.gwt.json.client.JSONNull;
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONString;
 import com.google.gwt.json.client.JSONValue;
-import com.vaadin.terminal.gwt.client.Paintable;
+import com.vaadin.terminal.gwt.client.VPaintable;
+import com.vaadin.terminal.gwt.client.VPaintableMap;
 
 /**
  * Encoder for converting RPC parameters and other values to JSON for transfer
@@ -45,15 +46,11 @@ public class JsonEncoder {
      * 
      * @param value
      *            value to convert
-     * @param paintableMapper
+     * @param paintableMap
      *            mapper from paintables to paintable IDs
      * @return JSON representation of the value
      */
-    public static JSONValue encode(Object value,
-            PaintableIdMapper paintableMapper) {
-        char type = getTransportType(value);
-        Object encodedValue = null;
-
+    public static JSONValue encode(Object value, VPaintableMap paintableMap) {
         if (null == value) {
             // TODO as undefined type?
             return combineTypeAndValue(VTYPE_UNDEFINED, JSONNull.getInstance());
@@ -75,7 +72,7 @@ public class JsonEncoder {
             JSONArray jsonArray = new JSONArray();
             for (int i = 0; i < array.length; ++i) {
                 // TODO handle object graph loops?
-                jsonArray.set(i, encode(array[i], paintableMapper));
+                jsonArray.set(i, encode(array[i], paintableMap));
             }
             return combineTypeAndValue(VTYPE_ARRAY, jsonArray);
         } else if (value instanceof Map) {
@@ -85,13 +82,13 @@ public class JsonEncoder {
             for (String mapKey : map.keySet()) {
                 // TODO handle object graph loops?
                 Object mapValue = map.get(mapKey);
-                jsonMap.put(mapKey, encode(mapValue, paintableMapper));
+                jsonMap.put(mapKey, encode(mapValue, paintableMap));
             }
             return combineTypeAndValue(VTYPE_MAP, jsonMap);
-        } else if (value instanceof Paintable) {
-            Paintable paintable = (Paintable) value;
+        } else if (value instanceof VPaintable) {
+            VPaintable paintable = (VPaintable) value;
             return combineTypeAndValue(VTYPE_PAINTABLE, new JSONString(
-                    paintableMapper.getPid(paintable)));
+                    paintableMap.getPid(paintable)));
         } else {
             return combineTypeAndValue(getTransportType(value), new JSONString(
                     String.valueOf(value)));
@@ -108,7 +105,7 @@ public class JsonEncoder {
     private static char getTransportType(Object value) {
         if (value instanceof String) {
             return VTYPE_STRING;
-        } else if (value instanceof Paintable) {
+        } else if (value instanceof VPaintable) {
             return VTYPE_PAINTABLE;
         } else if (value instanceof Boolean) {
             return VTYPE_BOOLEAN;