Example usage for com.google.gwt.query.client GQuery css

List of usage examples for com.google.gwt.query.client GQuery css

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery css.

Prototype

public GQuery css(TakesCssValue<?> cssProperty, String value) 

Source Link

Document

Set CSS a single style property on every matched element using type-safe enumerations.

Usage

From source file:com.arcbees.chosen.client.ChosenImpl.java

License:Apache License

private void winnowResultsClear() {
    searchField.val("");
    GQuery lis = searchResults.find("li");

    for (Element li : lis.elements()) {
        GQuery $li = $(li);
        if ($li.hasClass(css.groupResult())) {
            $li.css("display", "");
        } else if (shouldActivateResult($li)) {
            resultActivate($li);/*from   ww  w  . java  2  s.c o m*/
        }
        $li.removeClass(css.foundResult());
    }
}

From source file:com.arcbees.gquery.elastic.client.ElasticImpl.java

License:Apache License

private void init() {
    GQuery $container = $(container);

    $container.css("minHeight", $container.height() + "px");

    if ("static".equals($container.css("position", true))) {
        $container.css("position", "relative");
    }/*from   w w  w  . j  a v a 2s . c o m*/

    update(true);

    bind();
}

From source file:com.arcbees.gquery.elastic.client.ElasticImpl.java

License:Apache License

private StyleInfo initItem(Element e) {
    int span = getSpan(e);
    Integer floatColumn = null;/*from w w  w .ja va 2  s .c  o m*/

    String floatValue = e.getAttribute(Elastic.COLUMN_ATTRIBUTE);
    if (FIRST.equalsIgnoreCase(floatValue)) {
        floatColumn = 0;
    } else if (LAST.equalsIgnoreCase(floatValue)) {
        floatColumn = -span;
    } else {
        try {
            floatColumn = Integer.parseInt(floatValue) - 1;
        } catch (NumberFormatException ignored) {
        }
    }

    GQuery $e = $(e);

    StyleInfo styleInfo = new StyleInfo();
    styleInfo.span = getSpan(e);
    styleInfo.rowSpanAll = "all".equals(e.getAttribute(Elastic.ROW_SPAN_ATTRIBUTE));
    styleInfo.floatColumn = floatColumn;
    styleInfo.marginRight = $e.cur("marginRight", true);
    styleInfo.marginLeft = $e.cur("marginLeft", true);
    styleInfo.borderTopWidth = $e.cur("borderTopWidth", true);
    styleInfo.borderBottomWidth = $e.cur("borderBottomWidth", true);
    styleInfo.marginTop = $e.cur("marginTop", true);
    styleInfo.marginBottom = $e.cur("marginBottom", true);

    $e.data(STYLE_INFO_KEY, styleInfo);
    $e.css("position", "absolute");

    // TODO Ease next width computation but check the impact of this in the content of the item
    if (GQuery.browser.mozilla) {
        $e.css("moz-box-sizing", "border-box");
    } else {
        $e.css("box-sizing", "border-box");
    }

    return styleInfo;
}

From source file:com.arcbees.gquery.tooltip.client.TooltipImpl.java

License:Apache License

private void doShowTooltip() {
    GQuery tooltip = getTip();

    OffsetInfo oi = OffsetInfo.from($element);
    long actualWidth = tooltip.get(0).getOffsetWidth();
    long actualHeight = tooltip.get(0).getOffsetHeight();
    Offset additionalOffset = getAdditionalOffset();
    if (additionalOffset != null) {
        oi.top += additionalOffset.top;/*from   w w w .ja  v a 2 s  .co m*/
        oi.left += additionalOffset.left;
    }

    long finalTop = 0;
    long finalLeft = 0;
    String placementClass = null;

    switch (getPlacement(oi, actualHeight, actualWidth)) {
    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;
    }

    tooltip.offset((int) finalTop, (int) finalLeft);
    tooltip.addClass(placementClass).addClass(style.in());
    tooltip.css("visibility", "visible");

    if (options.getTrigger() != TooltipTrigger.HOVER && options.isAutoClose()) {
        $(document).delay(1, new Function() {
            @Override
            public void f() {
                $(document).click(autoCloseFunction);
            }
        });
    }

    if (options.getClosingPartner() != null) {
        tooltip.on(CLICK, options.getClosingPartner(), new Function() {
            @Override
            public void f() {
                hide();
            }
        });
    }
}

From source file:com.arcbees.website.client.application.slider.Slider.java

License:Apache License

private void displayCurrent(boolean previous) {
    activeAnimation = true;//from   w ww  .j a v  a  2s  .  c o m

    Element item = items.getItem(index);

    $(contents).children().attr("data-remove", true);
    if (previous) {
        $(contents).prepend($(item).clone());

        final GQuery element = $(contents).children().first();
        element.css("marginLeft", "-100%").addClass(sliderResources.style().contentTransition()).delay(100)
                .promise().done(new Function() {
                    @Override
                    public void f() {
                        element.css("marginLeft", "0");
                    }
                });
    } else {
        $(contents).append($(item).clone());
        $(contents).children().first().addClass(sliderResources.style().contentTransition()).css("marginLeft",
                "-100%");
    }

    setCurrentActive();
}

From source file:com.pronoiahealth.olhie.client.pages.search.SearchPagerWidget.java

License:Open Source License

/**
 * Helper to set button state//w w w.  j a v a  2 s.c  om
 * 
 * @param button
 * @param enabled
 */
private void setButtonState(GQuery button, boolean enabled) {
    if (enabled == true) {
        button.removeClass("disabled");
        button.css("opacity", "1.0");
    } else {
        button.addClass("disabled");
        button.css("opacity", "0.5");
    }
}

From source file:com.vaadin.addons.sliderlayout.gwt.client.VSliderLayout.java

License:Apache License

private void rollTo(String id, final int slideTo, String animation, int duration) {
    GQuery panel = $(SLIDE_DEFAULT_CLASS_NAME + "-" + uidlId);

    if (panel == null)
        return;/*from w w w.  ja v a 2s.  c o  m*/

    if (panel.widgets().size() == 0)
        panel.css(CSS.LEFT, "0");

    // animate slide to number
    panel.as(Effects)
            //.delay(1000)
            //.animate("left: -" + Integer.toString(100 * slideTo) + "%", 1000, EasingExt.EASE_OUT_BOUNCE, new Function() {
            // don't use 0% (only compatible with webkit browsers) for left property use 0px to be compatible with firefox and IE and opera !!!
            .animate("left: -" + Integer.toString(panel.outerWidth() * slideTo), duration, getEasing(animation),
                    new Function() {
                        boolean fistEvent = true;

                        public void f(Element e) {
                            // only send the first event from all slides movement 
                            if (fistEvent) {
                                client.updateVariable(uidlId, "fromSlideName", lastSlideName, false);
                                client.updateVariable(uidlId, "toSlideName", "v-slide-" + slideTo, true);

                                // save the last Slide name
                                lastSlideName = "v-slide-" + slideTo;

                                fistEvent = false;
                            }
                        }

                    });

}

From source file:com.watopi.chosen.client.ChosenImpl.java

License:Open Source License

private void winnowResultsClear() {
    searchField.val("");
    GQuery lis = searchResults.find("li");

    for (Element li : lis.elements()) {
        GQuery $li = $(li);
        if ($li.hasClass(css.groupResult())) {
            $li.css("display", "");
        } else if (!isMultiple || !$li.hasClass(css.resultSelected())) {
            resultActivate($li);//ww  w  . j  a  v  a  2s  .c o m
        }
    }

}

From source file:com.wcs.wcslib.vaadin.widget.filtertablestate.client.FilterTableStateConnector.java

License:Apache License

private void displayBtn(HTML profileLayoutDiv, boolean hide) {
    GQuery hideAble = $("." + HIDEABLE_STYLE, profileLayoutDiv);
    String opacity = hide ? "0" : "1";

    for (Element element : hideAble.elements()) {
        GQuery btns = $("." + BUTTON_STYLE, element);
        btns.css("opacity", opacity);
    }//www  .  j av  a2  s.  co  m
}

From source file:gwtquery.plugins.draggable.client.plugins.CursorPlugin.java

License:Apache License

public void onStop(DraggableHandler handler, DragContext ctx, GqEvent e) {
    if (ctx.getInitialDraggable() != ctx.getDraggable()) {
        return;//from  w w  w.  ja  v  a2 s  .  c o  m
    }
    GQuery $body = $(body);
    String oldCursor = $body.data(OLD_CURSOR_KEY, String.class);
    $body.css(CURSOR_CSS, oldCursor);
    isStarting = false;
}