Examples of optJSONObject()


Examples of org.json.JSONArray.optJSONObject()

        if (0 == array.length()) {
            return -1;
        }

        return array.optJSONObject(0).optInt(Page.PAGE_ORDER);
    }

    @Override
    public JSONObject getUpper(final String id) throws RepositoryException {
        final JSONObject page = get(id);
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        if (1 != array.length()) {
            return null;
        }

        return array.optJSONObject(0);
    }

    @Override
    public JSONObject getUnder(final String id) throws RepositoryException {
        final JSONObject page = get(id);
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        final JSONArray array = instance.optJSONArray(id);
        final List<StateReader> readers = new ArrayList<StateReader>();
        if (array != null) {
            final int size = array.length();
            for (int i = 0; i < size; i++) {
                readers.add(new JsonStateReader(array.optJSONObject(i)));
            }
        }
        return readers;
    }
}
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

      JSONArray children = ensureChildren(context.getWidgetElement(), true, context.getWidgetId());
    if (children != null)
    {
      for(int i=0; i< children.length(); i++)
      {
        JSONObject child = children.optJSONObject(i);
        if (isWidget(child))
        {
          String childWidget = createChildWidget(out, child, context);
          boolean childPartialSupport = hasChildPartialSupport(child);
          if (childPartialSupport)
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

      JSONArray children = ensureChildren(child, true, parentWidgetId);
      if (children != null)
      {
        for (int i=0; i< children.length(); i++)
        {
          JSONObject optionElement = children.optJSONObject(i);
          String textOption = ensureTextChild(optionElement, true, parentWidgetId, true);
          out.println(options+".add("+textOption+");");
        }
      }
      out.println("new "+SelectionCell.class.getCanonicalName()+"("+options+");");
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

      int length = children.length();
      String picker = null;
     
      for (int i=0; i<length; i++)
      {
        JSONObject childElement = children.optJSONObject(i);
        if (childElement != null)
        {
          if (isWidget(childElement))
          {
            picker = createChildWidget(out, childElement, null, false, context);
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

    JSONArray elementsMetaData = this.view.getElements();
    processViewEvents(printer);
    processViewDimensions(printer);
    for (int i = 0; i < elementsMetaData.length(); i++)
    {
      JSONObject metaElement = elementsMetaData.optJSONObject(i);

      if (!metaElement.has("_type"))
      {
        throw new CruxGeneratorException("Crux Meta Data contains an invalid meta element (without type attribute). View ID["+view.getId()+"]. "
            + "Validate your view file.");
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

    }
    if (!acceptsNoChild && (children == null || children.length() == 0))
    {
      throw new CruxGeneratorException("The widget ["+parentWidgetId+"], declared on view ["+getView().getId()+"], must contain at least one child.");
    }
    JSONObject firstChild = children.optJSONObject(0);
    if (!acceptsNoChild && firstChild == null)
    {
      throw new CruxGeneratorException("The widget ["+parentWidgetId+"], declared on View ["+getView().getId()+"], must contain at least one child.");
    }
    return firstChild;
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

          JSONArray children = widgetCreator.ensureChildren(context.getChildElement(), acceptNoChildren, context.getWidgetId());
          if (children != null)
          {
            for (int i = 0; i < children.length(); i++)
            {
              JSONObject child = children.optJSONObject(i);

              childName = getChildName(child);
              context.setChildElement(child);
              processChild(out, context, childName);
            }
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

            protected Set<String> parseResponse(String httpResponse) throws JSONException {
                JSONObject jsonObject = new JSONObject(httpResponse);

                JSONArray json = jsonObject.getJSONArray("data");
                if (json != null) {
                    jsonObject = json.optJSONObject(0);
                    if (jsonObject != null) {
                        String[] names = JSONObject.getNames(jsonObject);
                        if (names != null) {
                            Set<String> scopes = new HashSet<String>();
                            for (String name : names) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.