Package com.google.gwt.query.client

Examples of com.google.gwt.query.client.Function


      requestPermissionException.initCause(new RequestException(e.getMessage()));
      onError(null, e);
      return;
    }

    JsUtils.prop(xmlHttpRequest, "onprogress", JsUtils.wrapFunction(new Function() {
      public void f() {
        JsCache p = arguments(0);
        double total = p.getDouble("total");
        double loaded = p.getDouble("loaded");
        double percent = loaded == 0 ? 0 : total == 0 ? 100 : (100 * loaded / total);
        dfd.notify(total, loaded, percent, "download");
      }
    }));

    JavaScriptObject upload = JsUtils.prop(xmlHttpRequest, "upload");
    JsUtils.prop(upload, "onprogress", JsUtils.wrapFunction(new Function() {
      public void f() {
        JsCache p = arguments(0);
        double total = p.getDouble("total");
        double loaded = p.getDouble("loaded");
        double percent = 100 * loaded / total;
View Full Code Here


  private void queueAnimation(final Element e, final GQAnimation anim, final int duration) {
    if (isOff()) {
      anim.onStart();
      anim.onComplete();
    } else {
      queue(e, DEFAULT_NAME, new Function() {
        public void cancel(Element e) {
          Animation anim = (Animation) data(e, GQAnimation.ACTUAL_ANIMATION, null);
          if (anim != null) {
            anim.cancel();
          }
View Full Code Here

  private Callbacks resolve = new Callbacks("once memory");

  private String state = PENDING;

  public Deferred() {
    resolve.add(new Function() {
      public void f() {
        state = RESOLVED;
        resolve.disable();
        notify.lock();
      }
    });

    reject.add(new Function() {
      public void f() {
        state = REJECTED;
        reject.disable();
        notify.lock();
      }
View Full Code Here

  protected void initMouseHandler(MouseOptions options) {
    this.options = options;

    for (final Element e : elements()) {

      $(e).as(Events).bind(Event.ONMOUSEDOWN, getPluginName(), (Object) null, new Function() {
        @Override
        public boolean f(com.google.gwt.user.client.Event event) {
          if (touchSupported) {
            return true;
          }
          return mouseDown(e, GqEvent.create(event));

        }
      }).bind(Event.ONTOUCHSTART, getPluginName(), (Object) null, new Function() {
        public boolean f(com.google.gwt.user.client.Event event) {
          if (event.getTouches().length() > 1) {
            return true;
          }

          touchSupported = true;
          return mouseDown(e, GqEvent.create(event));

        }
      }).bind(Event.ONCLICK, getPluginName(), (Object) null, new Function() {
        @Override
        public boolean f(com.google.gwt.user.client.Event event) {
          preventClickEvent |= !mouseClick(e, GqEvent.create(event));

          if (preventClickEvent) {
View Full Code Here

    int moveEvent = touchSupported ? Event.ONTOUCHMOVE : Event.ONMOUSEMOVE;

    int endEvents = touchSupported ? Event.ONTOUCHEND : Event.ONMOUSEUP;

    $(document).as(Events).bind(moveEvent, getPluginName(), (Object) null, new Function() {
      @Override
      public boolean f(com.google.gwt.user.client.Event e) {
        mouseMove(element, (GqEvent) GqEvent.create(e));
        return false;
      }
    }).bind(endEvents, getPluginName(), (Object) null, new Function() {
      @Override
      public boolean f(com.google.gwt.user.client.Event e) {
        mouseUp(element, (GqEvent) GqEvent.create(e));
        return false;
      }
    });

    // TODO Event.ONTOUCHEND | Event.ONTOUCHCANCEL don't work -> investigate
    if (touchSupported) {
      $(document).as(Events).bind(Event.ONTOUCHCANCEL, getPluginName(), (Object) null,
          new Function() {
            @Override
            public boolean f(com.google.gwt.user.client.Event e) {
              mouseUp(element, (GqEvent) GqEvent.create(e));
              return false;
            }
View Full Code Here

          if (newArgs instanceof Promise) {
            // If filter function returns a promise we pipeline it.
            final Promise p = (Promise) newArgs;
            if (type == PROGRESS) {
              p.progress(new Function(){public void f() {
                settle(PROGRESS, getArguments());
              }});
            } else {
              p.always(new Function(){public void f() {
                settle((type == DONE || type == FAIL && cont) && p.isResolved() ? DONE : FAIL, getArguments());
              }});
            }
          } else {
            // Otherwise we change the arguments by the new ones
View Full Code Here

  }
 
  private Promise performAjaxJsonTest(Settings s) {
    delayTestFinish(5000);
    return Ajax.ajax(s)
      .done(new Function(){public void f() {
        IsProperties p = arguments(0);
        assertEquals("abc", p.get("a"));
        finishTest();
      }})
      .fail(failFunction);
View Full Code Here

      .fail(failFunction);
  }
 
  private Promise performAjaxJsonTest_CORS(Settings s) {
    return performAjaxJsonTest(s)
      .done(new Function() {public void f() {
        Response r = arguments(3);
        assertNotNull(r.getHeader("Access-Control-Allow-Origin"));
      }});
  }
View Full Code Here

      .setUrl(echoUrlCORS)
      .setData(jsonGET)
      .setDataType("json");

    performAjaxJsonTest_CORS(s)
      .done(new Function() {
          public void f() {
            Response r = arguments(3);
            Assert.assertNotNull(r.getHeader("Access-Control-Allow-Origin"));
            Assert.assertNull(r.getHeader("Access-Control-Allow-Credentials"));
          }
View Full Code Here

      .setData(jsonGET)
      .setDataType("json")
      .setWithCredentials(true);

    performAjaxJsonTest_CORS(s)
      .done(new Function() {
        public void f() {
          Response r = arguments(3);
          Assert.assertNotNull(r.getHeader("Access-Control-Allow-Origin"));
          Assert.assertNotNull(r.getHeader("Access-Control-Allow-Credentials"));
        }
View Full Code Here

TOP

Related Classes of com.google.gwt.query.client.Function

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.