Examples of GQuery


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

  public String getName() {
    return "Simple manipulation";
  }

  public void setupDemoElement(final Element demo) {
    final GQuery tab_title_input = $("#tab_title");
    final GQuery tab_content_input = $("#tab_content");
    tab_counter = 2;

    final Function removeTab = new Function() {
      public boolean f(Event close) {
        // Find the tab's index
        int index = $("#tabs li").index($(close).parent().get(0));
        $("#tabs").as(Ui).tabs().remove(index);
        return false;
      };
    };

    // tabs init with a custom tab template and an "add" callback filling in the content
    final Tabs tabs = $("#tabs").as(Ui).tabs( //
    Tabs.Options.create().tabTemplate("<li><a href=\"#{href}\">#{label}</a> <span class=\"ui-icon ui-icon-close\">Remove Tab</span></li>")) //
    .bind(Tabs.Event.add, new Function() {
      @Override
      public boolean f(Event e, Object data) {
        final Tabs.Event event = ((JavaScriptObject) data).cast();
        String tab_content = tab_content_input.val();
        if(tab_content == null || tab_content.isEmpty()) {
          tab_content = "Tab " + tab_counter + " content.";
        }
        $(event.panel()).append("<p>" + tab_content + "</p>");
View Full Code Here

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

  public void setupDemoElement(Element demo) {
    $("#selectable").as(Ui).selectable().bind(Selectable.Event.stop, new Function() {
      @Override
      public boolean f(Event e, Object o) {
        final GQuery result = $("#select-result").empty();
        $(".ui-selected").each(new Function() {
          @Override
          public void f(Element e) {
            int index = $("#selectable li").index(e);
            result.append(" #" + (index + 1));
          }
        });
        return true;
      }
    });
View Full Code Here

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

  public String getName() {
    return "Events";
  }

  public void setupDemoElement(Element demo) {
    final GQuery start_counter = $("#event-start");
    final GQuery drag_counter = $("#event-drag");
    final GQuery stop_counter = $("#event-stop");
    final int[] counts = new int[] { 0, 0, 0 };

    $("#draggable").as(Ui).draggable().bind(Draggable.Event.start, new Function() {
      @Override
      public boolean f(com.google.gwt.user.client.Event e, Object data) {
View Full Code Here

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

    public void enable() {
        enabled = true;
    }

    public void hide() {
        final GQuery tooltip = getTip();

        tooltip.removeClass(style.in());

        if (options.isAnimation()) {
            tooltip.fadeOut(ANIMATION_DURATION, new Function() {
                @Override
                public void f() {
                    tooltip.detach();
                }
            });
        } else {
            tooltip.detach();
        }
    }
View Full Code Here

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

            tooltip.detach();
        }
    }

    public void show() {
        GQuery tooltip = getTip();

        String title = getTitle();

        if (!enabled || title == null || title.length() == 0) {
            return;
        }

        setContent(title);

        tooltip.detach()
                .removeClass(style.in(), style.top(), style.bottom(), style.left(), style.right())
                .css("top", "0")
                .css("left", "0")
                .css("display", "block");

        String container = options.getContainer();

        if (container == null || "parent".equals(container)) {
            tooltip.insertAfter($element);
        } else if ("element".equals(container)) {
            tooltip.appendTo($element);
        } else {
            tooltip.appendTo($(container));
        }

        OffsetInfo oi = OffsetInfo.from($element);
        long actualWidth = tooltip.get(0).getOffsetWidth();
        long actualHeight = tooltip.get(0).getOffsetHeight();
        long finalTop = -1;
        long finalLeft = -1;
        String placementClass = null;

        switch (getPlacement()) {
            case BOTTOM:
                finalTop = oi.top + oi.height;
                finalLeft = oi.left + oi.width / 2 - actualWidth / 2;
                placementClass = style.bottom();
                break;
            case TOP:
                finalTop = oi.top - actualHeight;
                finalLeft = oi.left + oi.width / 2 - actualWidth / 2;
                placementClass = style.top();
                break;
            case LEFT:
                finalTop = oi.top + oi.height / 2 - actualHeight / 2;
                finalLeft = oi.left - actualWidth;
                placementClass = style.left();
                break;
            case RIGHT:
                finalTop = oi.top + oi.height / 2 - actualHeight / 2;
                finalLeft = oi.left + oi.width;
                placementClass = style.right();
                break;
        }

        Offset additionalOffset = getAdditionalOffset();
        if (additionalOffset != null) {
            finalTop += additionalOffset.top;
            finalLeft += additionalOffset.left;
        }

        tooltip.offset((int) finalTop, (int) finalLeft);
        tooltip.addClass(placementClass)
                .addClass(style.in());
    }
View Full Code Here

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

        return result != null ? result : defaultData;
    }

    private void setContent(String title) {
        GQuery inner = getTip().find("." + style.tooltipInner());
        if (options.isHtml()) {
            inner.html(title);
        } else {
            inner.text(title);
        }
    }
View Full Code Here

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

      public BorderColorFx(Element e, String endColorString) {

        endColor = parseColor(endColorString);
        startColors = JsNamedArray.create();

        GQuery $e = GQuery.$(e);

        for (String border : borderColorProperties) {
          int[] startColor = parseColor($e.css(border, true));
          startColors.put(border, startColor);
        }
      }
View Full Code Here

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

   *
   * @deprecated use {@link com.google.gwt.query.client.plugins.ajax.Ajax#loadScript(String)}
   */
  @Deprecated
  public static void loadScript(String url, String id) {
    GQuery gs = GQuery.$(DOM.createElement("script"));
    GQuery gp = GQuery.$("#" + id).parent();
    if (gp.size() != 1) {
      gp = GQuery.$(GQuery.document.getBody());
    }
    GQuery.$("#" + id).remove();
    gp.append(gs.attr("src", url).attr("type", "text/javascript").attr("id", id));
  }
View Full Code Here

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

  }

  public void testClipAnimation() {
    $(e).html("<p id='idtest'>Content 1</p></p>");

    final GQuery g = $("#idtest");
    final int duration = 1000;

    // Clip effect places a relative div in the position of the original element
    // So check that there is not any div.
    GQuery back = $("div", e);
    assertEquals(0, back.size());

    // Configure the max duration for this test
    delayTestFinish(duration * 3);

    // each timer calls the next one
    final Timer endTimer = new Timer() {
      public void run() {
        // Check that the back div has been removed
        GQuery back = $("div", e);
        assertEquals(0, back.size());
        // Check that the attribute clip has been removed
        assertTrue(g.css("clip").matches("(|auto)"));
        finishTest();
      }
    };
   
    Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() {
      int c = 0;
      // Run until we detect the rect has been changed or timeout
      public boolean execute() {
        String re = "rect\\(\\d+px[, ]+\\d+px[, ]+\\d+px[, ]+\\d+px\\)";
        if (g.css("clip").matches(re)) {
          endTimer.schedule(duration);
          return false;
        }
        if (duration < (c += 10))  {
          fail(g.css("clip") + " does not matched " + re);
          return false;
        }
        return true;
      }
    }, 100);
   
    g.as(Effects).clipDisappear(duration);

    // Check that the back div has been created
    back = $("div", e);
    assertEquals(1, back.size());
  }
View Full Code Here

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

  }

  public void testEffectsShouldBeQueued() {
    $(e).html("<p id='idtest'>Content 1</p></p>");

    final GQuery g = $("#idtest").css("position", "absolute");
    final Offset o = g.offset();

    final int duration = 1000;
    g.as(Effects).
        animate($$("left: '+=100'"), duration, EasingCurve.linear).
        animate($$("top: '+=100'"), duration, EasingCurve.linear).
        animate($$("left: '-=100'"), duration, EasingCurve.linear).
        animate($$("top: '-=100'"), duration, EasingCurve.linear);
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.