Example usage for com.vaadin.server Page getBrowserWindowWidth

List of usage examples for com.vaadin.server Page getBrowserWindowWidth

Introduction

In this page you can find the example usage for com.vaadin.server Page getBrowserWindowWidth.

Prototype

public int getBrowserWindowWidth() 

Source Link

Document

Gets the last known width of the browser window in which this uI resides.

Usage

From source file:fr.amapj.view.engine.tools.BaseUiTools.java

License:Open Source License

/**
 * On distingue deux modes d'affichage dans le logiciel : un mode compact pour les smartphone,
 * et un mode classique dans les autres cas
 *//* w ww  .j a  v a  2s . com*/
static public boolean isCompactMode() {
    Page page = UI.getCurrent().getPage();
    int width = page.getBrowserWindowWidth();
    int height = page.getBrowserWindowHeight();

    if ((height < 700) || (width < 700)) {
        return true;
    }
    return false;
}

From source file:fr.amapj.view.engine.tools.BaseUiTools.java

License:Open Source License

/**
 * /*  w w w . jav  a  2s .c o m*/
 * @param width en pixel 
 * @return
 */
public static boolean isWidthBelow(int width) {
    Page page = UI.getCurrent().getPage();
    int currentWidth = page.getBrowserWindowWidth();
    return currentWidth < width;
}

From source file:fr.amapj.view.engine.tools.BaseUiTools.java

License:Open Source License

/**
 * Calcule la taille en pixel du popup, en prenant en compte le ratio du popup 
 *//*from   w  w w . j ava 2  s.c o m*/
public static int computePopupWidth(int widthRatio) {
    Page page = UI.getCurrent().getPage();
    int currentWidth = page.getBrowserWindowWidth();
    return (currentWidth * widthRatio) / 100;
}

From source file:org.jumpmind.vaadin.ui.common.ResizableWindow.java

License:Open Source License

public void showAtSize(double percentOfBrowserSize) {
    Page page = Page.getCurrent();

    setWindowMode(WindowMode.NORMAL);/*from w w  w.  j ava2s  .co m*/

    int pageHeight = page.getBrowserWindowHeight();
    int pageWidth = page.getBrowserWindowWidth();

    setHeight((int) (pageHeight * percentOfBrowserSize), Unit.PIXELS);
    setWidth((int) (pageWidth * percentOfBrowserSize), Unit.PIXELS);

    show();

}

From source file:org.lucidj.ui.gauss.GaussUI.java

License:Apache License

private int get_def_column_width_px() {
    Page page = UI.getCurrent().getPage();
    int page_width = page.getBrowserWindowWidth();
    int column_width = page_width / 6;

    if (column_width < MIN_DEF_COLUMN_WIDTH_PX) {
        return (MIN_DEF_COLUMN_WIDTH_PX);
    }//from ww w  .jav  a 2s .c  om
    return (column_width);
}