Package com.google.gwt.core.client

Examples of com.google.gwt.core.client.JsArrayString


   */
  public static JsArrayString wrapArray(String[] srcArray) {
    if (GWT.isScript()) {
      return arrayAsJsArrayForProdMode(srcArray);
    }
    JsArrayString result = JavaScriptObject.createArray().cast();
    for (int i = 0; i < srcArray.length; i++) {
      result.set(i, srcArray[i]);
    }
    return result;
  }
View Full Code Here


      assertEquals(array[i], JsArrayUtil.getLongFromJsArrayInteger(jsArray, i));
    }
  }

  public void testUnwrapString() {
    JsArrayString wrappedArray = createTestdataJsArrayString();

    // check that the contents are exactly the expected.
    assertEquals(3, wrappedArray.length());
    assertEquals("Test", wrappedArray.get(0));
    assertEquals("abc", wrappedArray.get(1));
    assertEquals("", wrappedArray.get(2));

    String[] unwrappedArray = JsArrayUtil.unwrapArray(wrappedArray);

    assertEquals(wrappedArray.length(), unwrappedArray.length);
    for (int i = 0; i < wrappedArray.length(); i++) {
      assertEquals(wrappedArray.get(i), unwrappedArray[i]);
    }
  }
View Full Code Here

  }

  public void testWrapString() {
    String[] array = new String[] {"Test", "abc", "123", ""};

    JsArrayString wrappedArray = JsArrayUtil.wrapArray(array);

    assertEquals(array.length, wrappedArray.length());
    for (int i = 0; i < array.length; i++) {
      assertEquals(array[i], wrappedArray.get(i));
    }

    String[] unwrappedArray = JsArrayUtil.unwrapArray(wrappedArray);

    // wrapping/unwrapping must not change the contents and order of the array. unwrappedArray must
View Full Code Here

            uidlSecurityKey = json.getString(UIDL_SECURITY_TOKEN_ID);
        }

        if (json.containsKey("resources")) {
            ValueMap resources = json.getValueMap("resources");
            JsArrayString keyArray = resources.getKeyArray();
            int l = keyArray.length();
            for (int i = 0; i < l; i++) {
                String key = keyArray.get(i);
                resourcesMap.put(key, resources.getAsString(key));
            }
        }

        if (json.containsKey("typeMappings")) {
View Full Code Here

            Set<String> attributeNames = uidl.getAttributeNames();
            for (String name : attributeNames) {
                if (uidl.isMapAttribute(name)) {
                    try {
                        ValueMap map = uidl.getMapAttribute(name);
                        JsArrayString keyArray = map.getKeyArray();
                        nodeName += " " + name + "=" + "{";
                        for (int i = 0; i < keyArray.length(); i++) {
                            nodeName += keyArray.get(i) + ":"
                                    + map.getAsString(keyArray.get(i)) + ",";
                        }
                        nodeName += "}";
                    } catch (Exception e) {

                    }
View Full Code Here

            return VUnknownComponent.class;
        }
    }

    public void addComponentMappings(ValueMap valueMap, WidgetSet widgetSet) {
        JsArrayString keyArray = valueMap.getKeyArray();
        for (int i = 0; i < keyArray.length(); i++) {
            String key = keyArray.get(i).intern();
            int value = valueMap.getInt(key);
            classes[value] = widgetSet.getImplementationByClassName(key);
            if (classes[value] == VUnknownComponent.class) {
                if (unknownComponents == null) {
                    unknownComponents = new HashMap<String, String>();
View Full Code Here

public final class ArrayHelper {
  public static JsArrayString fromArray(String... values) {
    if (GWT.isScript()) {
      return reinterpretCast(values);
    } else {
      JsArrayString ret = JavaScriptObject.createArray().cast();
      for (int i = 0, l = values.length; i < l; i++) {
        ret.set(i, values[i]);
      }
      return ret;
    }
  }
View Full Code Here

    if(tag==null)
      tag="span";
    Node thisNode = null;
    thisNode = Y.one("document").create("<"+tag+"></"+tag+">");
   
    JsArrayString attrNames = JsUtil.props(attrsObj);
    for (int i = 0; i < attrNames.length(); i++) {
      String attr = attrNames.get(i);
      if(attr!=null && !attr.equals("tag") && !attr.equals("cdata"))
        thisNode.setAttribute(attr, (String) JsUtil.get(attrsObj, attr));
    }
    if(cdata!=null)
      thisNode.setContent(cdata);
View Full Code Here

    if(tag==null) //required
      return null;
    Node thisNode = null;
    thisNode = Y.one("document").create("<"+tag+"></"+tag+">");
   
    JsArrayString attrNames = JsUtil.props(attrsObj);
    for (int i = 0; i < attrNames.length(); i++) {
      String attr = attrNames.get(i);
      if(attr!=null && !attr.equals("tag") && !attr.equals("cdata"))
        thisNode.setAttribute(attr, (String) JsUtil.get(attrsObj, attr));
    }
    if(cdata!=null)
      thisNode.setContent(cdata);
View Full Code Here

        /* first recreate neccesary data */
        util = Gallery.instance().getUtil();
        final Set<Test> tests = util.getTests();

        JsArray<JavaScriptObject> testsArr = JsArray.createArray().cast();
        JsArrayString testNames = JsArrayString.createArray().cast();

        for (Test test : tests) {
          JsObject testObj = testToJsObject(test);
          testsArr.push(testObj);
          testNames.push(test.getName());
        }

        // an autocomplete and button search box
        final Node byNameInput = parent.appendChild("<input type=\"\"></input>");
        AutoComplete ac = Y
View Full Code Here

TOP

Related Classes of com.google.gwt.core.client.JsArrayString

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.