Package com.google.gwt.query.client

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


            detach();
        }
    }

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

        if (!enabled || noContentInTooltip()) {
            return;
        }

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

        setContent();

        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


        return result != null ? result : defaultData;
    }

    private void setContent() {
        GQuery inner = getTip().find("." + style.tooltipInner());
        if (options.getWidget() != null) {
            setWidgetContent(inner);
        } else {
            setContent(inner);
        }
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");

        if (options.getContainer() != null && options.getContainer().length() > 0) {
            tooltip.appendTo($(options.getContainer()));
        } else {
            tooltip.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 (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() {
        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

            detach();
        }
    }

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

        if (getTip().hasClass(style.in())) {
            return;
        }

        assignWidget();
        if (!enabled || noContentInTooltip()) {
            return;
        }

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

        setContent();

        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

        return result != null ? result : defaultData;
    }

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

     */
    public void addStyledItem(String label, String value, String className, int indentLevel) {
        if (indentLevel < 0) {
            throw new IllegalArgumentException("[indentLevel] must be non-negative.");
        }
        GQuery $selectElem = $(getElement());
        OptionElement option = Document.get().createOptionElement();
        option.setValue(value);
        option.setText(label);
        if (!(className == null || className.trim().isEmpty())) {
            option.addClassName(className);
        }
        if (indentLevel > 0) {
            int leftPadding = options.getResources().css().indent() * indentLevel;
            option.setAttribute("style", "padding-left: " + leftPadding + "px;");
        }
        $selectElem.append(option);
    }
View Full Code Here

     * @param label the text of the group to be added
     * @param id the id of the optgroup element
     * @param index the index at which to insert it
     */
    public void insertGroup(String label, String id, int index) {
        GQuery optGroup = $("<optgroup></optgroup>").attr("label", label);
        if (id != null){
            optGroup.attr("id", id);
        }
        GQuery select = $(getElement());

        int itemCount = SelectElement.as(getElement()).getLength();

        if (index < 0 || index > itemCount) {
            select.append(optGroup);
        } else {
            GQuery before = select.children().eq(index);
            before.before(optGroup);
        }
    }
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.