Examples of JSONBoolean


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

    addAttributes(jsonObj, parent);
  }
  @Override
  protected void addAttributes(JSONObject childObj, Widget widget) {
    JSONString attributeStringObj;
    JSONBoolean attributeBooleanObj;
    JSONNumber attributeNumberObj;
    JSONValue attributeJsObj = childObj.get("style");
    if(attributeJsObj != null && (attributeStringObj = attributeJsObj.isString()) != null)
      DOM.setElementAttribute(widget.getElement(), "style", attributeStringObj.stringValue());
    attributeJsObj = childObj.get("title");
    if(attributeJsObj != null && (attributeStringObj = attributeJsObj.isString()) != null)
      DOM.setElementAttribute(widget.getElement(), "title", attributeStringObj.stringValue());
    attributeJsObj = childObj.get("className");
    if(attributeJsObj != null && (attributeStringObj = attributeJsObj.isString()) != null)
      DOM.setElementAttribute(widget.getElement(), "className", attributeStringObj.stringValue());
    attributeJsObj = childObj.get(HasVkAnimation.NAME);
    if(attributeJsObj != null && (attributeBooleanObj = attributeJsObj.isBoolean()) != null)
      ((HasVkAnimation)widget).setAnimationEnabled(attributeBooleanObj.booleanValue());
    attributeJsObj = childObj.get(HasVkSwitchNumberedWidget.NAME);
    if(attributeJsObj != null && (attributeNumberObj = attributeJsObj.isNumber()) != null)
      ((HasVkSwitchNumberedWidget)widget).showWidget((int)attributeNumberObj.doubleValue());
   
    attributeJsObj = childObj.get(HasVkBeforeSelectionHandler.NAME);
View Full Code Here

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

      return JSONBoolean.getInstance(checkbox.getValue());
    }

    @Override
    public void setJSONValue(JSONValue value) {
      JSONBoolean boolVal = value.isBoolean();
      JSONString stringVal = value.isString();
      if (boolVal != null) {
        checkbox.setValue(boolVal.booleanValue());
      } else if (stringVal != null) {
        checkbox.setValue(Boolean.parseBoolean(stringVal.stringValue()));
      } else {
        throw new JSONException("Not a valid JSON boolean: " + value.toString());
      }
View Full Code Here

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

        }
      }
      return true;
    }
    else if (v1.isBoolean() != null) {
      JSONBoolean b1 = v1.isBoolean();
      JSONBoolean b2 = v2.isBoolean();
      return b1.booleanValue() == b2.booleanValue();
    }
    else if (v1.isNull() != null) {
      // this case should never be triggered, because of the getClass() precheck above
      return v2.isNull() != null;
    }
View Full Code Here

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

      // Act
      JSONObject o = JSONParser.parseLenient(json).isObject();
      JSONString string = (JSONString) o.get("string");
      JSONNumber number = (JSONNumber) o.get("int");
      JSONNumber fl = (JSONNumber) o.get("float");
      JSONBoolean bool = (JSONBoolean) o.get("bool");
      JSONArray array = (JSONArray) o.get("array");
      JSONObject object = (JSONObject) o.get("object");

      // Assert
      assertEquals("json string", string.stringValue());
      assertEquals(3.0, number.doubleValue(), 0);
      assertEquals(3.1415, fl.doubleValue(), 0);
      assertTrue(bool.booleanValue());
      // array
      assertEquals(1.0, ((JSONNumber) array.get(0)).doubleValue(), 0);
      assertEquals(33.7, ((JSONNumber) array.get(1)).doubleValue(), 0);
      assertEquals("l33t", ((JSONString) array.get(2)).stringValue());
      // object
View Full Code Here

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

      // Act
      JSONObject o = JSONParser.parseStrict(json).isObject();
      JSONString string = (JSONString) o.get("string");
      JSONNumber number = (JSONNumber) o.get("int");
      JSONNumber fl = (JSONNumber) o.get("float");
      JSONBoolean bool = (JSONBoolean) o.get("bool");
      JSONArray array = (JSONArray) o.get("array");
      JSONObject object = (JSONObject) o.get("object");

      // Assert
      assertEquals("json string", string.stringValue());
      assertEquals(3.0, number.doubleValue(), 0);
      assertEquals(3.1415, fl.doubleValue(), 0);
      assertTrue(bool.booleanValue());
      // array
      assertEquals(1.0, ((JSONNumber) array.get(0)).doubleValue(), 0);
      assertEquals(33.7, ((JSONNumber) array.get(1)).doubleValue(), 0);
      assertEquals("l33t", ((JSONString) array.get(2)).stringValue());
      // object
View Full Code Here

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

   @Test
   public void addElements() {
      // Arrange
      JSONArray jsonArray = new JSONArray();
      JSONString string = new JSONString("myString");
      JSONBoolean bool = JSONBoolean.getInstance(true);
      // Pre-Assert
      assertEquals(0, jsonArray.size());

      // Act
      jsonArray.set(0, string);
View Full Code Here

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

   @Test
   public void addElements_unbounded() {
      // Arrange
      JSONArray jsonArray = new JSONArray();
      JSONString string = new JSONString("myString");
      JSONBoolean bool = JSONBoolean.getInstance(true);
      // Pre-Assert
      assertEquals(0, jsonArray.size());

      // Act
      jsonArray.set(0, string);
View Full Code Here

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

        {
            ctx.addBadTypeError("Boolean");

            return;
        }
        JSONBoolean s = jval.isBoolean();

        if (null == s)
        {
            ctx.addBadTypeError("Boolean");
        }
View Full Code Here

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

 
  private final int m_MaxHeight;
 

  public ResizeOptions(JSONObject a_Value){
    JSONBoolean jbool = a_Value.get("resize").isBoolean();
    if (jbool == null)
    {
      throw new RuntimeException("JBool was null.");
    }
    m_Resize = jbool.booleanValue();
    if (m_Resize)
    {
      m_MaxWidth  = Integer.parseInt(a_Value.get("max_width").toString());
      m_MaxHeight = Integer.parseInt(a_Value.get("max_height").toString());
    }
View Full Code Here

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

   * @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;
    }
  }
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.