Package com.google.gwt.query.client

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


        return result != null ? result : defaultData;
    }

    private void setContent() {
        GQuery inner = getInner();
        if (widget != null) {
            setWidgetContent(inner);
        } else {
            setContent(inner);
        }
View Full Code Here


        return tooltip(new TooltipOptions());
    }

    public Tooltip tooltip(TooltipOptions options) {
        for (Element e : elements()) {
            GQuery $e = $(e);
            if ($e.data(TOOLTIP_DATA_KEY) == null) {
                TooltipImpl impl;
                //use 2 different constructors for GWT optimization purpose
                if (options.getResources() == null){
                    impl = new TooltipImpl(e, options);
                }else{
                    impl = new TooltipImpl(e, options, options.getResources());
                }
                $e.data(TOOLTIP_DATA_KEY, impl);
            }
        }
        return this;
    }
View Full Code Here

    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

            tooltip.detach();
        }
    }

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

        String title = getTitle();

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

        setContent(title);

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

        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 (options.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;
        }

        //TODO use GQuery.offset() method when it will be implemented
        setOffset(tooltip, finalTop, finalLeft);
        tooltip.addClass(placementClass)
                .addClass(style.in());
    }
View Full Code Here

        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

    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

            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;
        }

        //TODO use GQuery.offset() method when it will be implemented
        tooltip.offset((int) finalTop, (int) finalLeft);
        tooltip.addClass(placementClass)
                .addClass(style.in());
    }
View Full Code Here

        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

        return tooltip(new TooltipOptions());
    }

    public Tooltip tooltip(TooltipOptions options) {
        for (Element e : elements()) {
            GQuery $e = $(e);
            if ($e.data(TOOLTIP_DATA_KEY) == null) {
                TooltipImpl impl;
                //use 2 different constructors for GWT optimization purpose
                if (options.getResources() == null) {
                    impl = new TooltipImpl(e, options);
                } else {
                    impl = new TooltipImpl(e, options, options.getResources());
                }
                $e.data(TOOLTIP_DATA_KEY, impl);
            }
        }
        return this;
    }
View Full Code Here

    public void enable() {
        enabled = true;
    }

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

        tooltip.removeClass(style.in());

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

TOP

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

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.