Example usage for com.google.gwt.user.client Window getClientHeight

List of usage examples for com.google.gwt.user.client Window getClientHeight

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window getClientHeight.

Prototype

public static int getClientHeight() 

Source Link

Usage

From source file:com.urlisit.siteswrapper.cloud.widgets.BackgroundImage.java

License:Apache License

@Override
public void onResize() {
    if (isLoaded) {
        windowWidth = BigDecimal.valueOf(Window.getClientWidth());
        windowHeight = BigDecimal.valueOf(Window.getClientHeight());
        imageWidth = BigDecimal.valueOf(image.getWidth());
        imageHeight = BigDecimal.valueOf(image.getHeight());
        widthRatio = windowWidth.divide(imageWidth, 4, BigDecimal.ROUND_HALF_EVEN);
        heightRatio = windowHeight.divide(imageHeight, 4, BigDecimal.ROUND_HALF_EVEN);
        int left = 0;
        int top = 0;
        if (widthRatio.compareTo(heightRatio) >= 0) {
            scaledWidth = widthRatio.multiply(imageWidth);
            scaledHeight = widthRatio.multiply(imageHeight);
            top = scaledHeight.subtract(windowHeight).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(this, left, -top);
        } else {/*from w  w  w.ja v  a 2s.  c o  m*/
            scaledWidth = heightRatio.multiply(imageWidth);
            scaledHeight = heightRatio.multiply(imageHeight);
            left = scaledWidth.subtract(windowWidth).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(this, -left, top);
        }
    }
}

From source file:com.urlisit.siteswrapper.cloud.widgets.ImageLogo.java

License:Apache License

public void resize() {
    if (isLoaded()) {
        int left = leftPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientWidth()))).intValue();
        int top = topPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientHeight()))).intValue();
        newWidth = widthPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientWidth())));
        oldWidth = BigDecimal.valueOf(Integer.valueOf(logo.getWidth()).doubleValue());
        oldHeight = BigDecimal.valueOf(Integer.valueOf(logo.getHeight()).doubleValue());
        newHeight = newWidth.multiply(oldWidth.divide(oldHeight, 4, BigDecimal.ROUND_HALF_EVEN));
        logo.setPixelSize(newWidth.intValue(), newHeight.intValue());
        view.getPanel().setWidgetPosition(logo, left, top);
    } else {//from  w w  w. ja  v a2  s . c  om
        logo.addLoadHandler(new LoadHandler() {
            @Override
            public void onLoad(LoadEvent event) {
                //logo.setVisible(true);
                loaded = true;
                resize();
            }
        });
    }
}

From source file:com.urlisit.siteswrapper.cloud.widgets.InformationItemPopup.java

License:Apache License

public void show() {
    //Window.alert(Double.valueOf(Window.getClientWidth() * .75).intValue() + "");
    popup.setHeight(Double.valueOf(Window.getClientHeight() * .75).intValue() + "px");
    popup.setWidth(Double.valueOf(Window.getClientWidth() * .75).intValue() + "px");
    popup.center();// w  ww  . j a  v a  2s  .  co  m
    popup.show();
}

From source file:com.urlisit.siteswrapper.cloud.widgets.LogoHtml.java

License:Apache License

@Override
public void onResize() {
    int left = leftPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientWidth()))).intValue();
    int top = topPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientHeight()))).intValue();
    view.getPanel().setWidgetPosition(logo, left, top);
}

From source file:com.urlisit.siteswrapper.cloud.widgets.LogoImage.java

License:Apache License

@Override
public void onResize() {
    if (isLoaded()) {
        int left = leftPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientWidth()))).intValue();
        int top = topPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientHeight()))).intValue();
        newWidth = widthPercent.multiply(BigDecimal.valueOf(Double.valueOf(Window.getClientWidth())));
        oldWidth = BigDecimal.valueOf(Integer.valueOf(logo.getWidth()).doubleValue());
        oldHeight = BigDecimal.valueOf(Integer.valueOf(logo.getHeight()).doubleValue());
        newHeight = newWidth.multiply(oldWidth.divide(oldHeight, 4, BigDecimal.ROUND_HALF_EVEN));
        logo.setPixelSize(newWidth.intValue(), newHeight.intValue());
        view.getPanel().setWidgetPosition(logo, left, top);
    } else {//w  w w  .j  a va2  s  . co m
        logo.addLoadHandler(new LoadHandler() {
            @Override
            public void onLoad(LoadEvent event) {
                //logo.setVisible(true);
                loaded = true;
                onResize();
            }
        });
    }
}

From source file:com.urlisit.siteswrapper.cloud.widgets.MainMenu.java

License:Apache License

public void onResize(int viewNumber) {
    String title = Window.getTitle();
    Literals literals = entries.get(viewNumber).getView().getLiterals();
    LookAndFeel lookAndFeel = entries.get(viewNumber).getView().getLookAndFeel();
    ViewPanel panel = entries.get(viewNumber).getView().getPanel();
    int numCells = menu.getCellCount(literals.rowZero());
    double menuWidth = Window.getClientWidth()
            - (Window.getClientWidth() * Double.valueOf(lookAndFeel.getMainMenuLeft()));
    int cellWidth = (int) Math.round(menuWidth / numCells);
    for (int x = 0; x < numCells; x++) {
        menu.getCellFormatter().setWidth(literals.rowZero(), x, cellWidth + literals.px());
        menu.getCellFormatter().setHorizontalAlignment(literals.zero(), x, HasHorizontalAlignment.ALIGN_LEFT);
    }// w w  w .ja va  2  s .  c o  m
    int left = (int) Math.round(Window.getClientWidth() * Double.valueOf(lookAndFeel.getMainMenuLeft()));
    int top = (int) Math.round(Double.valueOf(lookAndFeel.getMainMenuTopPercent()) * Window.getClientHeight());
    panel.add(this, left, top);
    panel.onResize();
}

From source file:com.urlisit.siteswrapper.cloud.widgets.MessageGhost.java

License:Apache License

@Override
public void resize() {
    int left = BigDecimal.valueOf(Window.getClientWidth()).multiply(leftPercent).intValue();
    int top = BigDecimal.valueOf(Window.getClientHeight()).multiply(topPercent).intValue();
    int width = header.getCellFormatter().getElement(0, 0).getClientWidth();
    width += header.getCellFormatter().getElement(0, 1).getClientWidth();
    message.getElement().getStyle().setProperty("width", width + "px");
    view.getPanel().setWidgetPosition(message, left, top);
}

From source file:com.urlisit.siteswrapper.cloud.widgets.OldBackgroundImage.java

License:Apache License

@Override
public void onResize() {
    if (isLoaded) {
        windowWidth = BigDecimal.valueOf(Window.getClientWidth());
        windowHeight = BigDecimal.valueOf(Window.getClientHeight());
        imageWidth = BigDecimal.valueOf(image.getWidth());
        imageHeight = BigDecimal.valueOf(image.getHeight());
        widthRatio = windowWidth.divide(imageWidth, 4, BigDecimal.ROUND_HALF_EVEN);
        heightRatio = windowHeight.divide(imageHeight, 4, BigDecimal.ROUND_HALF_EVEN);
        int left = 0;
        int top = 0;
        if (widthRatio.compareTo(heightRatio) >= 0) {
            scaledWidth = widthRatio.multiply(imageWidth);
            scaledHeight = widthRatio.multiply(imageHeight);
            top = scaledHeight.subtract(windowHeight).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(image, left, -top);
        } else {//from w ww  .j  a v a2s.com
            scaledWidth = heightRatio.multiply(imageWidth);
            scaledHeight = heightRatio.multiply(imageHeight);
            left = scaledWidth.subtract(windowWidth).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(image, -left, top);
        }
    }
}

From source file:com.urlisit.siteswrapper.cloud.widgets.OldBackgroundImage.java

License:Apache License

public void resize() {
    if (isLoaded) {
        windowWidth = BigDecimal.valueOf(Window.getClientWidth());
        windowHeight = BigDecimal.valueOf(Window.getClientHeight());
        imageWidth = BigDecimal.valueOf(image.getWidth());
        imageHeight = BigDecimal.valueOf(image.getHeight());
        widthRatio = windowWidth.divide(imageWidth, 4, BigDecimal.ROUND_HALF_EVEN);
        heightRatio = windowHeight.divide(imageHeight, 4, BigDecimal.ROUND_HALF_EVEN);
        int left = 0;
        int top = 0;
        if (widthRatio.compareTo(heightRatio) >= 0) {
            scaledWidth = widthRatio.multiply(imageWidth);
            scaledHeight = widthRatio.multiply(imageHeight);
            top = scaledHeight.subtract(windowHeight).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(image, left, -top);
        } else {/*from  w w w . j a va 2s.  c  om*/
            scaledWidth = heightRatio.multiply(imageWidth);
            scaledHeight = heightRatio.multiply(imageHeight);
            left = scaledWidth.subtract(windowWidth).divide(new BigDecimal(2)).intValue();
            image.setWidth(scaledWidth.intValue() + "px");
            image.setHeight(scaledHeight.intValue() + "px");
            view.getPanel().setWidgetPosition(image, -left, top);
        }
    }
}

From source file:com.urlisit.siteswrapper.cloud.widgets.OldLogo.java

License:Apache License

public void resize() {
    if (loaded) {
        windowWidth = BigDecimal.valueOf(Window.getClientWidth());
        windowHeight = BigDecimal.valueOf(Window.getClientHeight());
        int left = leftPercent.multiply(windowWidth).intValue();
        int top = topPercent.multiply(windowHeight).intValue();

        BigDecimal newHeight = heightPercent.multiply(windowHeight);
        BigDecimal oldWidth = BigDecimal.valueOf(Integer.valueOf(imageLogo.getWidth()).doubleValue());
        BigDecimal oldHeight = BigDecimal.valueOf(Integer.valueOf(imageLogo.getHeight()).doubleValue());
        BigDecimal newWidth = newHeight.multiply(oldWidth.divide(oldHeight, 4, BigDecimal.ROUND_HALF_EVEN));

        switch (displayLogoAs) {
        case HTML:
            view.getPanel().setWidgetPosition(htmlLogo, left, top);
            break;
        case IMAGE:
            //imageLogo.setSize(width + "px", height + "px");
            imageLogo.setPixelSize(newWidth.intValue(), newHeight.intValue());
            view.getPanel().setWidgetPosition(imageLogo, left, top);
            break;
        case NONE:
            break;
        }//from  ww w . j av  a  2 s.  c o  m
    } else {
        imageLogo.addLoadHandler(new LoadHandler() {
            @Override
            public void onLoad(LoadEvent event) {
                loaded = true;
                resize();
                fadeIn();
            }
        });
    }
}