Package com.google.gwt.json.client

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


            return defaultValue;
        }

        JSONValue v = obj.get(key);
        if (v != null) {
            JSONString s = v.isString();
            if (s != null) {
                return s.stringValue();
            }
        }
       
        return defaultValue;
    }
View Full Code Here


                }
            }
        }
       
        if (v != null) {
            JSONString s = v.isString();
            if (s != null) {
                return s.stringValue();
            }
        }
       
        return defaultValue;
    }
View Full Code Here

        if (v != null) {
            JSONBoolean b = v.isBoolean();
            if (b != null) {
                return b.booleanValue();
            } else {
                JSONString s = v.isString();
                if (s != null) {
                    return Boolean.parseBoolean(s.stringValue());
                }
            }
        }
       
        return defaultValue;
View Full Code Here

    JSONObject trigger = new JSONObject();
    trigger.put( "repeatInterval", new JSONNumber( interval ) ); //$NON-NLS-1$
    trigger.put( "repeatCount", new JSONNumber( repeatCount ) ); //$NON-NLS-1$
    trigger
        .put(
            "startTime", startDate != null ? new JSONString( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDate ) ) : JSONNull.getInstance() ); //$NON-NLS-1$
    if ( endDate != null ) {
      endDate.setHours( 23 );
      endDate.setMinutes( 59 );
      endDate.setSeconds( 59 );
    }
    trigger
        .put(
            "endTime", endDate == null ? JSONNull.getInstance() : new JSONString( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) ) ); //$NON-NLS-1$
    return trigger;
  }
View Full Code Here

        }

        public void onResponseReceived( Request request, Response response ) {
          if ( response.getStatusCode() == Response.SC_OK ) {
            final JSONObject scheduleRequest = new JSONObject();
            scheduleRequest.put( "inputFile", new JSONString( filePath ) ); //$NON-NLS-1$

            // Set job name
            if ( StringUtils.isEmpty( getOutputName() ) ) {
              scheduleRequest.put( "jobName", JSONNull.getInstance() ); //$NON-NLS-1$
            } else {
              scheduleRequest.put( "jobName", new JSONString( getOutputName() ) ); //$NON-NLS-1$
            }

            // Set output path location
            if ( StringUtils.isEmpty( getOutputLocationPath() ) ) {
              scheduleRequest.put( "outputFile", JSONNull.getInstance() ); //$NON-NLS-1$
            } else {
              scheduleRequest.put( "outputFile", new JSONString( getOutputLocationPath() ) ); //$NON-NLS-1$
            }

            // BISERVER-9321
            scheduleRequest.put( "runInBackground", JSONBoolean.getInstance( true ) );
View Full Code Here

          String responseText = response.getText();
          JSONValue value = JSONParser.parseLenient( responseText );
          JSONObject object = value.isObject();
          value = object.get( "timeZones" );
          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 );
View Full Code Here

      String urlPath = NameUtils.encodeRepositoryPath( filePath );
      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

    return logRecordAsJsonObject(lr).toString();
  }
 
  private static JSONString getJsonString(String s) {
    if (s == null) {
      return new JSONString("");
    }
    return new JSONString(s);
  }
View Full Code Here

  private static JSONObject logRecordAsJsonObject(LogRecord lr) {
    JSONObject obj = new JSONObject();
    obj.put("level", getJsonString(lr.getLevel().toString()));
    obj.put("loggerName", getJsonString(lr.getLoggerName()));
    obj.put("msg", getJsonString(lr.getMessage()));
    obj.put("timestamp", new JSONString("" + lr.getMillis()));
    obj.put("thrown", throwableAsJsonObject(lr.getThrown()));
    return obj;
  }
View Full Code Here

   * 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));
        addChildren(child, jsonObject.get(key));
      }
    } else if ((jsonString = jsonValue.isString()) != null) {
      // Use stringValue instead of toString() because we don't want escaping
      treeItem.addItem(SafeHtmlUtils.fromString(jsonString.stringValue()));
    } else {
      // JSONBoolean, JSONNumber, and JSONNull work well with toString().
      treeItem.addItem(getChildText(jsonValue.toString()));
    }
  }
View Full Code Here

TOP

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

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.