Example usage for com.vaadin.client BrowserInfo get

List of usage examples for com.vaadin.client BrowserInfo get

Introduction

In this page you can find the example usage for com.vaadin.client BrowserInfo get.

Prototype

public static BrowserInfo get() 

Source Link

Document

Singleton method to get BrowserInfo object.

Usage

From source file:annis.gui.widgets.gwt.client.ui.VAudioPlayer.java

License:Apache License

@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    if (client.updateComponent(this, uidl, true)) {
        return;/*from  w ww.  j a v  a2  s.  co  m*/
    }
    super.updateFromUIDL(uidl, client);
    Style mediaStyle = getMedia().getStyle();

    // ensure control visibility
    if ((mediaStyle.getHeight() == null || "".equals(mediaStyle.getHeight()))) {
        if (BrowserInfo.get().isChrome()) {
            mediaStyle.setHeight(32, Style.Unit.PX);
        } else {
            mediaStyle.setHeight(25, Style.Unit.PX);
        }
    }
}

From source file:com.cbnserver.gwtp4vaadin.core.googleanalytics.client.VGoogleAnalytics.java

License:Apache License

@Override
protected void init() {
    super.init();
    RootPanel.get().add(getWidget());/*from ww  w  .  java2  s  . co  m*/
    if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() == 6) {
        getWidget().getElement().getStyle().setProperty("overflow", "hidden");
        getWidget().getElement().getStyle().setProperty("height", "0");
        getWidget().getElement().getStyle().setProperty("width", "0");
    }
    registerRpc(GoogleAnalyticsRPC.class, new GoogleAnalyticsRPC() {
        @Override
        public void trackPageview(String pageId) {
            _trackPageview(getState().getTrackerId(), pageId, getState().getDomainName(),
                    getState().isAllowAnchor());
        }
    });
}

From source file:com.example.test.client.VMultiSelectCalendarWidget.java

License:Apache License

public VMultiSelectCalendarWidget() {
    getElement().setId(DOM.createUniqueId());
    setStyleName(STYLE_PRIMARY + "-calendarpanel");
    Roles.getGridRole().set(getElement());

    /*/* w  w w. ja va 2s.  c  om*/
     * Firefox auto-repeat works correctly only if we use a key press handler, other browsers handle it correctly
     * when using a key down handler
     */
    if (BrowserInfo.get().isGecko()) {
        addKeyPressHandler(this);
    } else {
        addKeyDownHandler(this);
    }
    addFocusHandler(this);
    addBlurHandler(this);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.aggregation.TableAggregationRow.java

License:Apache License

public void setCellWidth(int cellIx, int width) {
    // CAUTION: copied from VScrollTableRow with small changes
    final Element cell = DOM.getChild(tr, cellIx);
    Style wrapperStyle = cell.getFirstChildElement().getStyle();
    int wrapperWidth = width;
    if (BrowserInfo.get().isWebkit() || BrowserInfo.get().isOpera10()) {
        /*//from w w  w  .j ava2 s.  c o m
         * Some versions of Webkit and Opera ignore the width
         * definition of zero width table cells. Instead, use 1px
         * and compensate with a negative margin.
         */
        if (width == 0) {
            wrapperWidth = 1;
            wrapperStyle.setMarginRight(-1, Style.Unit.PX);
        } else {
            wrapperStyle.clearMarginRight();
        }
    }
    wrapperStyle.setPropertyPx("width", wrapperWidth);
    cell.getStyle().setPropertyPx("width", width);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.button.CubaButtonWidget.java

License:Apache License

@Override
public void onBrowserEvent(Event event) {
    if (BrowserInfo.get().isIE9()) {
        int type = DOM.eventGetType(event);
        switch (type) {
        case Event.ONMOUSEOVER:
            if (isEnabled() && !getStyleName().contains("ie9-hover")) {
                addStyleName("ie9-hover");
            }//w  w w . ja v  a  2s  .  c  o  m
            break;
        case Event.ONMOUSEOUT:
            if (getStyleName().contains("ie9-hover")) {
                removeStyleName("ie9-hover");
            }
            break;
        }
    }

    super.onBrowserEvent(event);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.button.CubaButtonWidget.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() >= 11) {
        // fix focusing of button-wrap in IE11
        setFocus(true);/*from www  .j  ava  2  s. c o m*/
    }

    super.onClick(event);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.checkbox.CubaCheckBoxWidget.java

License:Apache License

@Override
public void setFocus(boolean focused) {
    super.setFocus(focused);

    if (BrowserInfo.get().isWebkit()) {
        clearWebkitTextSelection();//from ww w.  ja  v a 2s .c o m
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.historycontrol.HistoryGwtApi.java

License:Apache License

protected void handleHistoryStep() {
    if (!isEnabled()) {
        disable();//from   w ww  .j a v  a2 s.c  o  m
        return;
    }

    if (!BrowserInfo.get().isIE()) {
        goForward();
    } else {
        goForwardDelayed();
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.image.CubaImageWidget.java

License:Apache License

public void applyScaling(String scaleMode) {
    removeStyleName(OBJECT_FIT + this.scaleMode);

    this.scaleMode = scaleMode;

    addStyleName(OBJECT_FIT + scaleMode);

    if (BrowserInfo.get().isIE() || BrowserInfo.get().isEdge()) {
        applyScaling(Integer.valueOf(getElement().getAttribute(OBJECT_FIT_ATTRIBUTE)));
    }//  w  w  w.  j a  v a 2  s .com
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadProgressWindow.java

License:Apache License

@Override
protected void onAttach() {
    super.onAttach();

    /*/*from   www.  j  a v a  2  s . c om*/
     * When this window gets reattached, set the tabstop to the previous
     * state.
     */
    setTabStopEnabled(doTabStop);

    // Fix for #14413. Any pseudo elements inside these elements are not
    // visible on initial render unless we shake the DOM.
    if (BrowserInfo.get().isIE8()) {
        closeBox.getStyle().setDisplay(Style.Display.NONE);
        Scheduler.get().scheduleFinally(new Command() {
            @Override
            public void execute() {
                closeBox.getStyle().clearDisplay();
            }
        });
    }
}