Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONArray


        ArrayList<Message> list = new ArrayList<Message>();
        JSONValue a = JSONParser.parse(str);

        if (a instanceof JSONArray) {
            JSONArray arr = (JSONArray) a;

            for (int i = 0; i < arr.size(); i++) {
                a = arr.get(i);

                if (a instanceof JSONObject) {
                    final JSONObject eMap = (JSONObject) a;
                    final String subject = eMap.keySet().iterator().next();
View Full Code Here


  {
    // parse roles
    List<String> roles = new ArrayList<String>();

    JSONValue root = JSONParser.parse(json);
    JSONArray array = JSONWalk.on(root).next("roles").asArray();

    for (int i = 0; i < array.size(); ++i)
    {
      JSONObject item = array.get(i).isObject();
      boolean assigned = JSONWalk.on(item).next("assigned").asBool();
      String roleName = JSONWalk.on(item).next("role").asString();

      if (assigned)
      {
View Full Code Here

        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
            @Override
            public void onSelectionChange(final SelectionChangeEvent event) {
                code.clear();
                AuditLogItem item = selectionModel.getSelectedObject();
                JSONArray jsonArray = JSONParser.parseStrict(item.getOperations().getPayload()).isArray();
                if (jsonArray != null) {
                    String stringify = stringify(jsonArray.getJavaScriptObject());
                    code.setValue(SafeHtmlUtils.fromString(stringify));
                }
            }
        });
View Full Code Here

          JSONValue serverTZvalue = object.get( "serverTzId" );
          JSONString serverTZIdString = serverTZvalue.isString();
          String serverTZId = serverTZIdString.stringValue();
          object = value.isObject();
          value = object.get( "entry" );
          JSONArray timeZonesJSONArray = value.isArray();
          for ( int i = 0; i < timeZonesJSONArray.size(); i++ ) {
            JSONValue entryValue = timeZonesJSONArray.get( i );
            JSONObject entryObject = entryValue.isObject();
            JSONValue keyValue = entryObject.get( "key" );
            JSONValue theValue = entryObject.get( "value" );
            String key = keyValue.isString().stringValue();
            String valueForKey = theValue.isString().stringValue();
View Full Code Here

    addStyleName( "schedule-params-dialog" );
  }

  JSONArray getScheduleParams( boolean suppressAlerts ) {
    JsArray<JsSchedulingParameter> schedulingParams = scheduleParamsWizardPanel.getParams( suppressAlerts );
    JSONArray params = new JSONArray();
    for ( int i = 0; i < schedulingParams.length(); i++ ) {
      params.set( i, new JSONObject( schedulingParams.get( i ) ) );
    }
    return params;
  }
View Full Code Here

      String urlParams = "";
      for ( int i = 0; i < scheduleParams.size(); i++ ) {
        JSONObject o = scheduleParams.get( i ).isObject();
        // keys: name, stringValue, type
        JSONString name = o.get( "name" ).isString();
        JSONArray stringValueArr = o.get( "stringValue" ).isArray();

        for ( int j = 0; j < stringValueArr.size(); j++ ) {
          urlParams += ( i == 0 && j == 0 ) ? "?" : "&";
          urlParams +=
              name.stringValue().replace( "\"", "" ) + "=" + stringValueArr.get( j ).toString().replace( "\"", "" );
        }
      }
      setParametersUrl( "api/repos/" + urlPath + "/parameterUi" + urlParams ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    super.center();
View Full Code Here

        for ( int j = 0; j < result.length(); j++ ) {
          setting = result.get( j );
          if ( "favorites".equalsIgnoreCase( setting.getName() ) ) { //$NON-NLS-1$
            try {
              // handle favorite
              JSONArray favorites = JSONParser.parseLenient( setting.getValue() ).isArray();
              if ( favorites != null ) {
                // Create the FavoritePickList object from the JSONArray
                favoritePickList = FavoritePickList.getInstanceFromJSON( favorites );
              } else {
                favoritePickList = FavoritePickList.getInstance();
              }
            } catch ( Throwable t ) {
              //ignore
            }
          } else if ( "recent".equalsIgnoreCase( setting.getName() ) ) { //$NON-NLS-1$
            try {
              // handle recent
              JSONArray recents = JSONParser.parseLenient( setting.getValue() ).isArray();
              if ( recents != null ) {
                // Create the RecentPickList object from the JSONArray
                recentPickList = RecentPickList.getInstanceFromJSON( recents );
              } else {
                recentPickList = RecentPickList.getInstance();
View Full Code Here

  protected boolean onFinish() {
    final JSONObject scheduleRequest = (JSONObject) JSONParser.parseStrict( jobSchedule.toString() );
    JsArray<JsSchedulingParameter> emailParams = scheduleEmailWizardPanel.getEmailParams();

    if ( scheduleParams == null ) {
      scheduleParams = new JSONArray();
    }
    if ( emailParams != null ) {
      int index = scheduleParams.size();
      for ( int i = 0; i < emailParams.length(); i++ ) {
        scheduleParams.set( index++, new JSONObject( emailParams.get( i ) ) );
View Full Code Here

      obj.put("type", getJsonString(t.getClass().getName()));
      obj.put("message", getJsonString(t.getMessage()));
      obj.put("cause", throwableAsJsonObject(t.getCause()));
      StackTraceElement[] stackTrace = t.getStackTrace();
      if (stackTrace != null && stackTrace.length > 0) {
        JSONArray arr = new JSONArray();
        for (int i = 0; i < stackTrace.length; i++) {
          arr.set(i, stackTraceElementAsJsonObject(stackTrace[i]));
        }
        obj.put("stackTrace", arr);
      }
    }
    return obj;
View Full Code Here

  /*
   * Add the object presented by the JSONValue as a children to the requested
   * TreeItem.
   */
  private void addChildren(TreeItem treeItem, JSONValue jsonValue) {
    JSONArray jsonArray;
    JSONObject jsonObject;
    JSONString jsonString;

    if ((jsonArray = jsonValue.isArray()) != null) {
      for (int i = 0; i < jsonArray.size(); ++i) {
        TreeItem child = treeItem.addItem(getChildText("["
            + Integer.toString(i) + "]"));
        addChildren(child, jsonArray.get(i));
      }
    } else if ((jsonObject = jsonValue.isObject()) != null) {
      Set<String> keys = jsonObject.keySet();
      for (String key : keys) {
        TreeItem child = treeItem.addItem(getChildText(key));
View Full Code Here

TOP

Related Classes of com.google.gwt.json.client.JSONArray

Copyright © 2018 www.massapicom. 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.