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) {
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 );
}
}