Package com.google.gwt.core.client

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


  }
  public static JsArrayBoolean fromArray(boolean... values) {
    if (GWT.isScript()) {
      return reinterpretCast(values);
    } else {
      JsArrayBoolean 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


    // should be negative - overflows a byte
    assertEquals("result[3] 2", -128, result[2]);
  }

  public void testToJsArrayBoolean() {
    JsArrayBoolean result;
    result = ArrayHelper.toJsArrayBoolean(true);
    assertEquals("length", 1, result.length());
    assertEquals("result[0]", true, result.get(0));

    result = ArrayHelper.toJsArrayBoolean(true, false, true);
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", true, result.get(0));
    assertEquals("result[1]", false, result.get(1));
    assertEquals("result[2]", true, result.get(2));

    boolean[] bools = {true, false, true};
    result = ArrayHelper.toJsArrayBoolean(bools);
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", true, result.get(0));
    assertEquals("result[1]", false, result.get(1));
    assertEquals("result[2]", true, result.get(2));
  }
View Full Code Here

   * Converts a Java array of booleans to a JavaScript boolean array.
   *
   * @param bits array of booleans to convert.
   */
  public static JsArrayBoolean toJsArrayBoolean(boolean... bits) {
    JsArrayBoolean result = JsArrayBoolean.createArray().cast();
    for (int i = 0; i < bits.length; i++) {
      result.set(i, bits[i]);
    }
    nativePatchConstructorForSafari(result);
    return result;
  }
View Full Code Here

         boolean implicit,
         ServerRequestCallback<CompletionResult> callback)
   {
      JsArrayString comp = response.getCompletions();
      JsArrayString pkgs = response.getPackages();
      JsArrayBoolean quote = response.getQuote();
      JsArrayInteger type = response.getType();
      ArrayList<QualifiedName> newComp = new ArrayList<QualifiedName>();
      for (int i = 0; i < comp.length(); i++)
      {
         newComp.add(new QualifiedName(comp.get(i), pkgs.get(i), quote.get(i), type.get(i)));
      }

      CompletionResult result = new CompletionResult(
            response.getToken(),
            newComp,
View Full Code Here

            cachedLinePrefix_ = token;
            String token = response.getToken();

            JsArrayString comp = response.getCompletions();
            JsArrayString pkgs = response.getPackages();
            JsArrayBoolean quote = response.getQuote();
            JsArrayInteger type = response.getType();
            ArrayList<QualifiedName> newComp = new ArrayList<QualifiedName>();
           
            // Get function completions from the server
            for (int i = 0; i < comp.length(); i++)
               if (comp.get(i).endsWith(" = "))
                  newComp.add(new QualifiedName(comp.get(i), pkgs.get(i), quote.get(i), type.get(i)));
           
            // Try getting our own function argument completions
            if (!response.getExcludeOtherCompletions())
            {
               addFunctionArgumentCompletions(token, newComp);
               addScopedArgumentCompletions(token, newComp);
            }
           
            // Get variable completions from the current scope
            if (!response.getExcludeOtherCompletions())
            {
               addScopedCompletions(token, newComp, "variable");
               addScopedCompletions(token, newComp, "function");
            }
           
            // Get other server completions
            for (int i = 0; i < comp.length(); i++)
               if (!comp.get(i).endsWith(" = "))
                  newComp.add(new QualifiedName(comp.get(i), pkgs.get(i), quote.get(i), type.get(i)));
           
            CompletionResult result = new CompletionResult(
                  response.getToken(),
                  newComp,
                  response.getGuessedFunctionName(),
View Full Code Here

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

    }
  }

  public void testWrapBoolean() {
    boolean[] array = new boolean[] {Boolean.TRUE, Boolean.FALSE};
    JsArrayBoolean wrappedArray = JsArrayUtil.wrapArray(array);

    assertEquals(array.length, wrappedArray.length());

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

  }
  public static JsArrayBoolean fromArray(boolean... values) {
    if (GWT.isScript()) {
      return reinterpretCast(values);
    } else {
      JsArrayBoolean 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

  }
  public static JsArrayBoolean fromArray(boolean... values) {
    if (GWT.isScript()) {
      return reinterpretCast(values);
    } else {
      JsArrayBoolean 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

        // Window.alert("Got message as string: " + event.getBody());
        assertFalse("!isMessageNumber()", event.isMessageNumber());
        assertFalse("!isMessageString()", event.isMessageString());
        assertTrue("isMessageObject()", event.isMessageObject());
        assertFalse("!isMessageBoolean()", event.isMessageBoolean());
        JsArrayBoolean result = event.getBodyArrayBoolean();
        assertEquals("length of array", 5, result.length());
        assertEquals("array[0]", true, result.get(0));
        assertEquals("array[1]", false, result.get(1));
        assertEquals("array[2]", true, result.get(2));
        assertEquals("array[3]", false, result.get(3));
        assertEquals("array[4]", true, result.get(4));
        finishTest();
      }
    });
    wp.sendMessage("arrayBoolean", workerID);
  }
View Full Code Here

TOP

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

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.