Package com.google.gwt.core.client

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


    return this.getValue(rowIndex, columnIndex);
  }-*/;

  public final TimeOfDay getValueTimeOfDay(int rowIndex, int columnIndex) {
    TimeOfDay result = new TimeOfDay();
    JsArrayInteger jsArray = getValueArrayInteger(rowIndex, columnIndex);
    try {
      result.setHour(jsArray.get(0));
      result.setMinute(jsArray.get(1));
      result.setSecond(jsArray.get(2));
      result.setMillisecond(jsArray.get(3));
    } catch (BadTimeException e) {
      // this should never happen, because setValue should catch an invalid
      // time of day
      throw new RuntimeException("Invalid time of day.");
    }
View Full Code Here


  }
  public static JsArrayInteger fromArray(int... values) {
    if (GWT.isScript()) {
      return reinterpretCast(values);
    } else {
      JsArrayInteger 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 String getModuleName() {
    return "com.google.gwt.ajaxloader.AjaxLoader";
  }

  public void testToJavaArrayBytes() {
    JsArrayInteger array;
    array = nativeGetJavaArrayBytes(1, 2, 3);
    assertEquals("array[0]", 1, array.get(0));
    assertEquals("array[2]", 2, array.get(1));
    assertEquals("array[3]", 3, array.get(2));

    byte[] result;
    result = ArrayHelper.toJavaArrayBytes(array);
    assertEquals("result[0] 1", 1, result[0]);
    assertEquals("result[2] 1", 2, result[1]);
View Full Code Here

    assertEquals("result[1]", false, result.get(1));
    assertEquals("result[2]", true, result.get(2));
  }

  public void testToJsArrayInteger() {
    JsArrayInteger result;
    result = ArrayHelper.toJsArrayInteger(1);
    assertEquals("length", 1, result.length());
    assertEquals("result[0]", 1, result.get(0));

    result = ArrayHelper.toJsArrayInteger(1, 2, -1);
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", 1, result.get(0));
    assertEquals("result[1]", 2, result.get(1));
    assertEquals("result[2]", -1, result.get(2));

    int[] integers = {1, 2, -1};
    result = ArrayHelper.toJsArrayInteger(integers);
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", 1, result.get(0));
    assertEquals("result[1]", 2, result.get(1));
    assertEquals("result[2]", -1, result.get(2));
  }
View Full Code Here

        dataTable.setValue(2, 0, "niv");
        dataTable.setValue(2, 1, 27);

        PatternFormat formatter = PatternFormat.create("{0} is {1} years old. \\{2\\}");
        int[] java = new int[]{0, 1};
        JsArrayInteger js = ArrayHelper.toJsArrayInteger(java);
        formatter.format(dataTable, js, 1);
        assertEquals("hillel is 25 years old. {2}",
            dataTable.getFormattedValue(0, 1));
        assertEquals("yoav is 24 years old. {2}", dataTable.getFormattedValue(
            1, 1));
View Full Code Here

        assertEquals("ImageMap length", map1.length, ic.getImageMap().length());
        for (int i = 0; i < map1.length; i++) {
          assertEquals("ImageMap", map1[i], ic.getImageMapArray()[i]);
        }

        JsArrayInteger map2 = JavaScriptObject.createArray().cast();
        map2.set(0, 4);
        map2.set(1, 5);
        map2.set(2, 6);
        map2.set(3, 7);
        ic.setImageMap(map2);
        for (int i = 0; i < map2.length(); i++) {
          assertEquals("ImageMap", map2.get(i), ic.getImageMap().get(i));
        }

        String dummyImage = "DummyImage";
        ic.setImageURL(dummyImage);
        assertEquals("ImageURL", dummyImage, ic.getImageURL());
View Full Code Here

      return out.toSafeHtml();
   }

   private ArrayList<Integer> getJavaArray(String property)
   {
      JsArrayInteger array = getArray(property);
      ArrayList<Integer> ints = new ArrayList<Integer>();
      for (int i = 0; i < array.length(); i++)
         ints.add(array.get(i));
      return ints;
   }
View Full Code Here

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

    int rightShift = bitOffset(fromIndex);

    if (rightShift == 0) {
      int subFrom = wordIndex(fromIndex);
      int subTo = wordIndex(toIndex + 31);
      JsArrayInteger subSet = slice(array, subFrom, subTo);
      int leftOvers = bitOffset(toIndex);
      if (leftOvers != 0) {
        maskOutWord(subSet, subTo - subFrom - 1, leftOvers, 32);
      }
      return new BitSet(subSet);
    }

    BitSet subSet = new BitSet();

    int first = wordIndex(fromIndex);
    int last = wordIndex(toIndex);

    if (first == last) {
      // number of bits to cut from the end
      int end = 32 - (bitOffset(toIndex));
      // raw bits
      int word = getWord(array, first);
      // shift out those bits
      word = ((word << end) >>> end) >>> rightShift;
      // set it
      if (word != 0) {
        subSet.set(0, word);
      }

    } else {
      // this will hold the newly packed bits
      int current = 0;
View Full Code Here

  /**
   * Calculate the HMAC-MD5, of a key and some data (raw strings)
   */
  public static String  rawHmacMD5(String key, String data)
  {
    JsArrayInteger bkey = rstr2binl(key);
    if(bkey.length() > 16) bkey = binl2md5(bkey, key.length() * 8);

    JsArrayInteger ipad = JsArrayInteger.createArray().cast();
    JsArrayInteger opad = JsArrayInteger.createArray().cast();
    ipad.setLength(16);
    opad.setLength(16);
    for(int i = 0; i < 16; i++)
    {
      ipad.set(i, bkey.get(i) ^ 0x36363636);
      opad.set(i, bkey.get(i) ^ 0x5C5C5C5C);
    }

    JsArrayInteger hash = binl2md5(concat(ipad, rstr2binl(data)), 512 + data.length() * 8);
    return binl2rstr(binl2md5(concat(opad, hash), 512 + 128));
  }
View Full Code Here

TOP

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

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.