com.google.gwt.json.client.JSONValue Java Examples

The following examples show how to use com.google.gwt.json.client.JSONValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadResponse.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String extractFailure(final JSONObject response) {
    String failure = "n/a";
    JSONValue failureValue = response.get(FAILURE_DESCRIPTION);
    if (failureValue.isString() != null) {
        failure = failureValue.isString().stringValue();
    } else if (failureValue.isObject() != null) {
        JSONObject failureObject = failureValue.isObject();
        for (String key : failureObject.keySet()) {
            if (key.contains("failure") && failureObject.get(key).isString() != null) {
                failure = failureObject.get(key).isString().stringValue();
                break;
            }
        }
    }
    return failure;
}
 
Example #2
Source File: WaitForBuildResultCommand.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private static String extractFormName(RpcResult result) {
  String extraString = result.getExtra();
  if (extraString != null) {
    JSONValue extraJSONValue = JSONParser.parseStrict(extraString);
    JSONObject extraJSONObject = extraJSONValue.isObject();
    if (extraJSONObject != null) {
      JSONValue formNameJSONValue = extraJSONObject.get("formName");
      if (formNameJSONValue != null) {
        JSONString formNameJSONString = formNameJSONValue.isString();
        if (formNameJSONString != null) {
          return formNameJSONString.stringValue();
        }
      }
    }
  }
  return "Screen1";
}
 
Example #3
Source File: GadgetUserPrefs.java    From swellrt with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts default preference values from the gadget metadata JSON object
 * returned from GGS.
 *
 * @param prefs the preference JSON object received from GGS.
 */
public void parseDefaultValues(JSONObject prefs) {
  if (prefs != null) {
    for (String pref : prefs.keySet()) {
      if (!has(pref)) {
        JSONObject prefJson = prefs.get(pref).isObject();
        if (prefJson != null) {
          JSONValue value = prefJson.get("default");
          if ((value != null) && (value.isString() != null)) {
            put(pref, value.isString().stringValue());
            log("Gadget pref '" + pref + "' = '" + get(pref) + "'");
          }
        } else {
          log("Invalid pref '" + pref + "' value in Gadget metadata.");
        }
      }
    }
  }
}
 
Example #4
Source File: GwtGadgetInfoParser.java    From swellrt with Apache License 2.0 6 votes vote down vote up
@Override
public List<GadgetInfo> parseGadgetInfoJson(String json) {
  List<GadgetInfo> gadgetList = new ArrayList<GadgetInfo>();
  JSONValue value = JSONParser.parseStrict(json);
  JSONArray array = value.isArray();
  if (array != null) {
    for (int i = 0; i < array.size(); i++) {
      JSONValue item = array.get(i);
      GadgetInfo info = parseGadgetInfo(item);
      if (info != null) {
        gadgetList.add(info);
      }
    }
  }
  return gadgetList;
}
 
Example #5
Source File: LeafletStyle.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
public static ProjectLayerStyle getStyle(String geoJSONCSS) {
	ProjectLayerStyle style = null;
	final JSONValue jsonValue = JSONParser.parseLenient(geoJSONCSS);
	final JSONObject geoJSONCssObject = jsonValue.isObject();

	if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {

		JSONObject styleObject = geoJSONCssObject
				.get(GeoJSONCSS.STYLE_NAME).isObject();

		String fillColor = getStringValue(styleObject, FILL_COLOR_NAME);
		Double fillOpacity = getDoubleValue(styleObject, FILL_OPACITY_NAME);
		if(fillOpacity == null) {
			fillOpacity = getDoubleValue(styleObject, FILL_OPACITY2_NAME);				
		}
		String strokeColor = getStringValue(styleObject, STROKE_COLOR_NAME);
		Double strokeWidth = getDoubleValue(styleObject, STROKE_WIDTH_NAME);

		style = new ProjectLayerStyle(fillColor, fillOpacity, strokeColor,
				strokeWidth);
	}

	return style;
}
 
Example #6
Source File: GwtGadgetInfoParser.java    From swellrt with Apache License 2.0 6 votes vote down vote up
private GadgetInfo parseGadgetInfo(JSONValue item) {
  JSONObject object = item.isObject();
  if (object != null) {
    String name = object.get("name").isString().stringValue();
    String desc = object.get("desc").isString().stringValue();
    GadgetCategoryType primaryCategory =
        GadgetCategoryType.of(object.get("primaryCategory").isString().stringValue());
    GadgetCategoryType secondaryCategory =
        GadgetCategoryType.of(object.get("secondaryCategory").isString().stringValue());
    String gadgetUrl = object.get("gadgetUrl").isString().stringValue();
    String author = object.get("author").isString().stringValue();
    String submittedBy = object.get("submittedBy").isString().stringValue();
    String imageUrl = object.get("imageUrl").isString().stringValue();

    return new GadgetInfo(name, desc, primaryCategory, secondaryCategory, gadgetUrl, author,
        submittedBy, imageUrl);
  }
  return null;
}
 
Example #7
Source File: GadgetUserPrefs.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts default preference values from the gadget metadata JSON object
 * returned from GGS.
 *
 * @param prefs the preference JSON object received from GGS.
 */
public void parseDefaultValues(JSONObject prefs) {
  if (prefs != null) {
    for (String pref : prefs.keySet()) {
      if (!has(pref)) {
        JSONObject prefJson = prefs.get(pref).isObject();
        if (prefJson != null) {
          JSONValue value = prefJson.get("default");
          if ((value != null) && (value.isString() != null)) {
            put(pref, value.isString().stringValue());
            log("Gadget pref '" + pref + "' = '" + get(pref) + "'");
          }
        } else {
          log("Invalid pref '" + pref + "' value in Gadget metadata.");
        }
      }
    }
  }
}
 
Example #8
Source File: GwtGadgetInfoParser.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
@Override
public List<GadgetInfo> parseGadgetInfoJson(String json) {
  List<GadgetInfo> gadgetList = new ArrayList<GadgetInfo>();
  JSONValue value = JSONParser.parseStrict(json);
  JSONArray array = value.isArray();
  if (array != null) {
    for (int i = 0; i < array.size(); i++) {
      JSONValue item = array.get(i);
      GadgetInfo info = parseGadgetInfo(item);
      if (info != null) {
        gadgetList.add(info);
      }
    }
  }
  return gadgetList;
}
 
Example #9
Source File: GwtGadgetInfoParser.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
private GadgetInfo parseGadgetInfo(JSONValue item) {
  JSONObject object = item.isObject();
  if (object != null) {
    String name = object.get("name").isString().stringValue();
    String desc = object.get("desc").isString().stringValue();
    GadgetCategoryType primaryCategory =
        GadgetCategoryType.of(object.get("primaryCategory").isString().stringValue());
    GadgetCategoryType secondaryCategory =
        GadgetCategoryType.of(object.get("secondaryCategory").isString().stringValue());
    String gadgetUrl = object.get("gadgetUrl").isString().stringValue();
    String author = object.get("author").isString().stringValue();
    String submittedBy = object.get("submittedBy").isString().stringValue();
    String imageUrl = object.get("imageUrl").isString().stringValue();

    return new GadgetInfo(name, desc, primaryCategory, secondaryCategory, gadgetUrl, author,
        submittedBy, imageUrl);
  }
  return null;
}
 
Example #10
Source File: BootstrapServerStore.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public List<BootstrapServer> load() {
    List<BootstrapServer> servers = new ArrayList<BootstrapServer>();
    if (storage != null) {
        //noinspection MismatchedQueryAndUpdateOfCollection
        StorageMap storageMap = new StorageMap(storage);
        if (storageMap.containsKey(KEY)) {
            String json = storageMap.get(KEY);
            if (json != null) {
                JSONValue jsonValue = JSONParser.parseStrict(json);
                if (jsonValue != null) {
                    JSONArray jsonArray = jsonValue.isArray();
                    if (jsonArray != null) {
                        for (int i = 0; i < jsonArray.size(); i++) {
                            AutoBean<BootstrapServer> bean = AutoBeanCodex
                                    .decode(factory, BootstrapServer.class, jsonArray.get(i).toString());
                            servers.add(bean.as());
                        }
                    }
                }
            }
        }
    }
    return servers;
}
 
Example #11
Source File: BootstrapServerStore.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public BootstrapServer restoreSelection() {
    if (storage != null) {
        //noinspection MismatchedQueryAndUpdateOfCollection
        StorageMap storageMap = new StorageMap(storage);
        if (storageMap.containsKey(KEY)) {
            String json = storageMap.get(SELECTED);
            if (json != null) {
                JSONValue jsonValue = JSONParser.parseStrict(json);
                if (jsonValue != null) {
                    JSONObject jsonObject = jsonValue.isObject();
                    if (jsonObject != null) {
                        AutoBean<BootstrapServer> bean = AutoBeanCodex
                                .decode(factory, BootstrapServer.class, jsonObject.toString());
                        return bean.as();
                    }
                }
            }
        }
    }
    return null;
}
 
Example #12
Source File: GadgetMetadata.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a boolean value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Boolean object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static Boolean getJsonBooleanValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONBoolean bool = (value == null) ? null : value.isBoolean();
  if (bool != null) {
    return bool.booleanValue();
  } else {
    return null;
  }
}
 
Example #13
Source File: GadgetMetadata.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a long value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Long object extracted from JSON (can be null if the value does
 *         not exist or is invalid.
 */
private static Long getJsonLongValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONNumber number = (value == null) ? null : value.isNumber();
  if (number != null) {
    return Math.round(number.doubleValue());
  } else {
    return null;
  }
}
 
Example #14
Source File: GadgetMetadata.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a string value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the string object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static String getJsonStringValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONString string = (value == null) ? null : value.isString();
  if (string != null) {
    return string.stringValue();
  } else {
    return null;
  }
}
 
Example #15
Source File: LoadCompatMatrix.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void execute(Control<BootstrapContext> control) {

    TextResource compat = TextResources.INSTANCE.compat();
    JSONValue root = JSONParser.parseLenient(compat.getText());
    JSONObject versionList = root.isObject();
    Set<String> keys = versionList.keySet();
    for (String key : keys) {
        modelVersions.put(key, versionList.get(key).isString().stringValue());
    }

    System.out.println("Build against Core Model Version: " + modelVersions.get("core-version"));
    control.proceed();
}
 
Example #16
Source File: GadgetMetadata.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a boolean value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Boolean object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static Boolean getJsonBooleanValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONBoolean bool = (value == null) ? null : value.isBoolean();
  if (bool != null) {
    return bool.booleanValue();
  } else {
    return null;
  }
}
 
Example #17
Source File: GadgetMetadata.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a long value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the Long object extracted from JSON (can be null if the value does
 *         not exist or is invalid.
 */
private static Long getJsonLongValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONNumber number = (value == null) ? null : value.isNumber();
  if (number != null) {
    return Math.round(number.doubleValue());
  } else {
    return null;
  }
}
 
Example #18
Source File: GadgetMetadata.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to extract a string value from given JSON object.
 *
 * @param json JSON object to extract the value from.
 * @param key key of the value to extract.
 * @return the string object extracted from JSON (can be null if the value
 *         does not exist or is invalid.
 */
private static String getJsonStringValue(JSONObject json, String key) {
  JSONValue value = json.get(key);
  JSONString string = (value == null) ? null : value.isString();
  if (string != null) {
    return string.stringValue();
  } else {
    return null;
  }
}
 
Example #19
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the dynamic template Urls from a jsonStr.  This method is
 * called during start up where jsonStr is retrieved from User
 * settings.
 *
 * @param jsonStr
 */
public static void setStoredTemplateUrls(String jsonStr) {
  if (jsonStr == null || jsonStr.length() == 0)
    return;
  JSONValue jsonVal = JSONParser.parseLenient(jsonStr);
  JSONArray jsonArr = jsonVal.isArray();
  for (int i = 0; i < jsonArr.size(); i++) {
    JSONValue value = jsonArr.get(i);
    JSONString str = value.isString();
    dynamicTemplateUrls.add(str.stringValue());
  }
}
 
Example #20
Source File: GeoJSONCSS.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public VectorStyleDef getLayerStyle(String vectorFormatString) {
	VectorFeatureStyleDef def = null;
	
	final JSONValue jsonValue = JSONParser.parseLenient(vectorFormatString);
	final JSONObject geoJSONCssObject = jsonValue.isObject();

	if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {

		JSONObject styleObject = geoJSONCssObject.get(GeoJSONCSS.STYLE_NAME).isObject();
		JSObject styleJSObject = styleObject.getJavaScriptObject().cast();
		def = getStyleDef(styleJSObject);
	}

	return def;
}
 
Example #21
Source File: TemplateUploadWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a list of Template objects containing data needed
 *  to load a template from a zip file. Each non-null template object
 *  is created from its Json string
 *
 * @return ArrayList of TemplateInfo objects
 */
protected static ArrayList<TemplateInfo> getTemplates() {
  JSONValue jsonVal = JSONParser.parseLenient(templateDataString);
  JSONArray jsonArr = jsonVal.isArray();
  ArrayList<TemplateInfo> templates = new ArrayList<TemplateInfo>();
  for (int i = 0; i < jsonArr.size(); i++) {
    JSONValue value = jsonArr.get(i);
    JSONObject obj = value.isObject();
    if (obj != null)
      templates.add(new TemplateInfo(obj)); // Create TemplateInfo from Json
  }
  return templates;
}
 
Example #22
Source File: MockMapFeatureBaseWithFill.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
protected void processPropertyFromGeoJSON(String key, JSONValue value) {
  if (key.equalsIgnoreCase(PROPERTY_NAME_FILLCOLOR) ||
      key.equalsIgnoreCase(CSS_PROPERTY_FILL)) {
    String v = value.isString().stringValue();
    changeProperty(PROPERTY_NAME_FILLCOLOR, v);
    onPropertyChange(PROPERTY_NAME_FILLCOLOR, v);
  } else {
    super.processPropertyFromGeoJSON(key, value);
  }
}
 
Example #23
Source File: Project.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public Project(String json) {
	final JSONValue jsonValue = JSONParser.parseLenient(json);
	final JSONObject jsonObject = jsonValue.isObject();
	
	String projectDate = jsonObject.get(DATE_NAME).isString().stringValue();
	String projectTitle = jsonObject.get(TITLE_NAME).isString().stringValue();
	String projectVersion = jsonObject.get(VERSION_NAME).isString().stringValue();
	String projectDescription = jsonObject.get(DESCRIPTION_NAME).isString().stringValue();
	
	setDate(projectDate);
	setTitle(projectTitle);
	setVersion(projectVersion);
	setDescription(projectDescription);
	
	JSONArray layersArray = jsonObject.get(VECTORS_NAME).isArray();
	
	if (layersArray != null) {
        for (int i = 0; i < layersArray.size(); i++) {
            JSONObject projectLayerObj = layersArray.get(i).isObject();
            String name = projectLayerObj.get(NAME).isString().stringValue();
            String content = projectLayerObj.get(CONTENT_NAME).isString().stringValue();	            
            JSONObject styleProjectLayer = projectLayerObj.get(STYLE_NAME).isObject();
            
            String fillColor = styleProjectLayer.get(ProjectLayerStyle.FILL_COLOR_NAME).isString().stringValue();
            Double fillOpacity = styleProjectLayer.get(ProjectLayerStyle.FILL_OPACITY_NAME).isNumber().doubleValue();
            String strokeColor = styleProjectLayer.get(ProjectLayerStyle.STROKE_COLOR_NAME).isString().stringValue();
            Double strokeWidth = styleProjectLayer.get(ProjectLayerStyle.STROKE_WIDTH_NAME).isNumber().doubleValue();
            
            add(name, content, fillColor, fillOpacity, strokeColor, strokeWidth);	           
        }
	
	}
}
 
Example #24
Source File: GWTFileUploadResponse.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * GWTFileUploadResponse
 *
 * @param text json encoded parameters.
 */
public GWTFileUploadResponse(String text) {
	text = text.substring(text.indexOf("{"));
	text = text.substring(0, text.lastIndexOf("}") + 1);
	JSONValue responseValue = JSONParser.parseStrict(text);
	JSONObject response = responseValue.isObject();

	// Deserialize information
	hasAutomation = response.get("hasAutomation").isBoolean().booleanValue();
	path = URL.decodeQueryString(response.get("path").isString().stringValue());
	error = response.get("error").isString().stringValue();
	showWizardCategories = response.get("showWizardCategories").isBoolean().booleanValue();
	showWizardKeywords = response.get("showWizardKeywords").isBoolean().booleanValue();
	digitalSignature = response.get("digitalSignature").isBoolean().booleanValue();

	// Getting property groups
	JSONArray groupsArray = response.get("groupsList").isArray();

	if (groupsArray != null) {
		for (int i = 0; i <= groupsArray.size() - 1; i++) {
			groupsList.add(groupsArray.get(i).isString().stringValue());
		}
	}

	// Getting workflows
	JSONArray workflowArray = response.get("workflowList").isArray();

	if (workflowArray != null) {
		for (int i = 0; i <= workflowArray.size() - 1; i++) {
			workflowList.add(workflowArray.get(i).isString().stringValue());
		}
	}
}
 
Example #25
Source File: JsonTokenizer.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public static JSONValue parse(String token) {
    try {
        if (JsonUtils.safeToEval(token)) {
            JSONValue jsonv = JSONParser.parseStrict(token);
            return jsonv;
        }
    } catch (Exception ex) {
        LOG.log(Level.SEVERE, token, ex);
    }
    return null;
}
 
Example #26
Source File: ErrorHandler.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/**
     * Creates response object from JSON response string in
     * {@link com.smartgwt.client.data.RestDataSource SmartGWT format}.
     * @param response JSON response string
     * @return response object
     */
    public static DSResponse getDsResponse(String response) {
        DSResponse dsResponse;
//        ClientUtils.info(LOG, "response: %s", response);
        if (response == null || response.isEmpty()) {
            // not JSON response
            LOG.log(Level.WARNING, null, new IllegalStateException("Empty response!"));
            dsResponse = new DSResponse();
            dsResponse.setStatus(RPCResponse.STATUS_SUCCESS);
        } else {
            JSONValue rVal = JSONParser.parseStrict(response);
            if (rVal.isObject() != null) {
                rVal = rVal.isObject().get("response");
            }
            if (rVal != null && rVal.isObject() != null) {
                JSONObject rObj = rVal.isObject();
                dsResponse = DSResponse.getOrCreateRef(rObj.getJavaScriptObject());
            } else {
                // not JSON response in expected format
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("data", new JSONString(response));
                dsResponse = new DSResponse(jsonObject.getJavaScriptObject());
                dsResponse.setStatus(RPCResponse.STATUS_FAILURE);
            }
        }
        return dsResponse;
    }
 
Example #27
Source File: SubsetJSONPropertyEditor.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
private void loadComponents(JSONObject jsonObj) {
  // TODO: Review JSON format. There has to be a better way to store and retrieve this info.
  JSONObject shownComponents = jsonObj.get("shownComponentTypes").isObject();
  JSONObject shownComponentBlocks = jsonObj.get("shownBlockTypes").isObject().get("ComponentBlocks").isObject();
  for (int i = 0; i < componentTree.getItemCount(); ++i) {
    TreeItem componentCatItem = componentTree.getItem(i);
    CheckBox componentCatCb = (CheckBox)componentCatItem.getWidget();
    String catName = componentCatCb.getName().toUpperCase();
    if (shownComponents.containsKey(catName)) {
      JSONArray jsonComponentCat = shownComponents.get(catName).isArray();
      if (jsonComponentCat.size() > 0) {
        componentCatCb.setValue(true, false);
        HashMap<String, String> jsonComponentHash = new HashMap<String, String>();
        for (int j = 0; j < jsonComponentCat.size(); ++j) {
          JSONValue jsonComponentHashCat = jsonComponentCat.get(j);
          if (jsonComponentHashCat != null) {
            jsonComponentHash.put(jsonComponentHashCat.isObject().get("type").isString().stringValue(), "type");
          }
        }
        for (int j = 0; j < componentCatItem.getChildCount(); ++j) {
          TreeItem componentItem = componentCatItem.getChild(j);
          CheckBox componentCb = (CheckBox) componentItem.getWidget();
          if (jsonComponentHash.get(componentCb.getName()) != null) {
            componentCb.setValue(true, false);
            JSONArray jsonComponentBlockProps = shownComponentBlocks.get(componentCb.getName()).isArray();
            HashMap<String, String> componentPropHash = new HashMap<String, String>();
            for (int k = 0; k < jsonComponentBlockProps.size(); ++k) {
              JSONObject jsonComponentBlockType = jsonComponentBlockProps.get(k).isObject();
              String componentBlockType = jsonComponentBlockType.get("type").isString().stringValue();
              if ("component_set_get".equals(componentBlockType)) {
                componentPropHash.put(jsonComponentBlockType.get("mutatorNameToValue").isObject().get("property_name").isString().stringValue(), "PROP");
              } else if ("component_event".equals(componentBlockType)) {
                JSONValue mutatorValue = jsonComponentBlockType.get("mutatorNameToValue");
                JSONValue event_name = mutatorValue.isObject().get("event_name");
                componentPropHash.put(event_name.isString().stringValue(), "EVENT");
              } else if ("component_method".equals(componentBlockType)) {
                componentPropHash.put(jsonComponentBlockType.get("mutatorNameToValue").isObject().get("method_name").isString().stringValue(), "METHOD");
              }
            }
            for (int k = 0; k < componentItem.getChildCount(); ++k) {
              TreeItem componentPropItem = componentItem.getChild(k);
              CheckBox componentPropCb = (CheckBox) componentPropItem.getWidget();
              if (componentPropHash.get(componentPropCb.getText()) != null) {
                componentPropCb.setValue(true, false);
              } else {
                componentPropCb.setValue(false, false);
              }
            }

          } else {
            componentCb.setValue(false, false);
            toggleChildren(componentItem, false);
          }
        }
      } else {
        componentCatCb.setValue(false, false);
        toggleChildren(componentCatItem, false);
      }
    } else {
      componentCatCb.setValue(false, false);
      toggleChildren(componentCatItem, false);
    }
  }
}
 
Example #28
Source File: JsonTable.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
/**
 * Will set the value of provided json values.
 */
public void setValue(JSONValue value) {
    this.value = value;
    reload();
}
 
Example #29
Source File: JsonTokenizer.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public static JSONObject parseObject(String token) {
    JSONValue val = parse(token);
    return val == null ? null : val.isObject();
}
 
Example #30
Source File: JsonTokenizer.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public static String getString(JSONObject json, String name) {
    JSONValue jsonVal = json.get(name);
    JSONString jsonString = (jsonVal == null) ? null : jsonVal.isString();
    return (jsonString == null) ? null : jsonString.stringValue();
}