DATABIND: syntax changes(switch -> if). 99/18699/1
authorparary <kyunghan80.park@samsung.com>
Fri, 28 Mar 2014 08:22:17 +0000 (17:22 +0900)
committerparary <kyunghan80.park@samsung.com>
Fri, 28 Mar 2014 08:22:17 +0000 (17:22 +0900)
Change-Id: I60d55dfa21cf67e2c864c5aecc3061caa1988d18
Signed-off-by: parary <kyunghan80.park@samsung.com>
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/dialog/Helper.java

index c011bf1..9bccb50 100644 (file)
@@ -231,20 +231,19 @@ public class Helper {
         treeItem.setData("TREEITEMDATA", treeItemData);
 
         String imageName = null;
-        switch (type) {
-            case "Boolean":
-                break;
-            case "Number":
-                break;
-            case "String":
-                break;
-            case "Array":
-                imageName = "temp.png";
-                break;
-            case "Index":
-                break;
-            default:
-                break;
+        
+        if( type.equals("Boolean") ){
+            imageName = null;
+        }else if( type.equals( "Number" ) ){
+            imageName = null;
+        }else if( type.equals( "String" ) ){
+            imageName = null;
+        }else if( type.equals( "Array" ) ){
+            imageName = "temp.png";
+        }else if( type.equals( "Index" ) ){
+            imageName = null;
+        }else{
+            imageName = null;
         }
 
         if (imageName != null) {
@@ -272,56 +271,46 @@ public class Helper {
         
         JsonObject jsonOb = null;
         
-        switch(type){
-            case "Array":
-                JsonArray array = new JsonArray();
-                parentJson.add(key, array);
-                jsonOb = null;
-                for (TreeItem item : items) {
-                    if( item.getText(2).equals("Index") ){
-                        makeJsonFromTree( item, array );
-                    }else{
-                        if( jsonOb == null){
-                            jsonOb = new JsonObject();
-                            array.add(jsonOb);
-                        }
-                        makeJsonFromTree( item, jsonOb );
+        if( type.equals("Array") ){
+            JsonArray array = new JsonArray();
+            parentJson.add(key, array);
+            jsonOb = null;
+            for (TreeItem item : items) {
+                if( item.getText(2).equals("Index") ){
+                    makeJsonFromTree( item, array );
+                }else{
+                    if( jsonOb == null){
+                        jsonOb = new JsonObject();
+                        array.add(jsonOb);
                     }
-                }
-                break;
-            case "Object":
-                jsonOb = new JsonObject();
-                parentJson.add(key, jsonOb);
-                for (TreeItem item : items) {
                     makeJsonFromTree( item, jsonOb );
                 }
-                break;
-            case "Index":
-                jsonOb = new JsonObject();; 
-                for (TreeItem item : items) {
-                    if(item.getText().length() > 0){
-                        makeJsonFromTree( item, jsonOb );
-                    }else{
-                        parentArray.add( new JsonPrimitive(item.getText(1)) );
-                    }
+            }
+        }else if( type.equals("Object") ){
+            jsonOb = new JsonObject();
+            parentJson.add(key, jsonOb);
+            for (TreeItem item : items) {
+                makeJsonFromTree( item, jsonOb );
+            }
+        }else if( type.equals("Index") ){
+            jsonOb = new JsonObject();; 
+            for (TreeItem item : items) {
+                if(item.getText().length() > 0){
+                    makeJsonFromTree( item, jsonOb );
+                }else{
+                    parentArray.add( new JsonPrimitive(item.getText(1)) );
                 }
-                if( !jsonOb.entrySet().isEmpty() )
-                    parentArray.add(jsonOb);
-                break;
-            case "String":
-                    parentJson.addProperty( key, value );
-                break;
-            case "Boolean":
-                parentJson.addProperty( key, Boolean.valueOf( value ) );
-                break;
-            case "Number":
-                parentJson.addProperty( key, Long.parseLong( value ) );
-                break;
-            case "undefined":
-                parentJson.add( key, null );
-                break;
-            default:
-                break;
+            }
+            if( !jsonOb.entrySet().isEmpty() )
+                parentArray.add(jsonOb);
+        }else if( type.equals("String") ){
+            parentJson.addProperty( key, value );
+        }else if( type.equals("Boolean") ){
+            parentJson.addProperty( key, Boolean.valueOf( value ) );
+        }else if( type.equals("Number") ){
+            parentJson.addProperty( key, Long.parseLong( value ) );
+        }else{
+            parentJson.add( key, null );
         }
     }