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

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

Introduction

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

Prototype

public static int getClientWidth() 

Source Link

Usage

From source file:fr.fg.client.core.EventDialog.java

License:Open Source License

public void onWindowResized(int width, int height) {
    int clientWidth = Window.getClientWidth();
    highres = clientWidth > 1024;/* w w  w  .java  2  s  . co m*/

    if (currentClientWidth > 1024 && clientWidth <= 1024) {
        scrollPane.setPixelSize(550, 345);
        viewPane.setPixelWidth(550);

        updateUI();

        if (isVisible())
            centerOnScreen();
    } else if (currentClientWidth <= 1024 && clientWidth > 1024) {
        scrollPane.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 345 + HIGH_RES_EXTRA_HEIGHT);
        viewPane.setPixelWidth(550 + HIGH_RES_EXTRA_WIDTH);

        updateUI();

        if (isVisible())
            centerOnScreen();
    }

    currentClientWidth = clientWidth;
}

From source file:fr.fg.client.core.Messenger.java

License:Open Source License

public void onWindowResized(int width, int height) {
    int clientWidth = Window.getClientWidth();
    highres = clientWidth > 1024;//from   www.  j  av  a2s  .c o m

    if (currentClientWidth > 1024 && clientWidth <= 1024) {
        foldersPane.setPixelWidth(550);
        messagesList.setPixelSize(550, (messagesList.getSelectedIndex() != -1 ? 70 : 280));
        messageScrollPane.setPixelSize(550, 182);
        horizontalSeparator.setWidth("550px");
        separator.setPixelWidth(248);

        layout.update();

        updateUI();

        if (isVisible())
            centerOnScreen();
    } else if (currentClientWidth <= 1024 && clientWidth > 1024) {
        foldersPane.setPixelWidth(550 + HIGH_RES_EXTRA_WIDTH);
        messagesList.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH,
                messagesList.getSelectedIndex() != -1 ? 70 + HIGH_RES_EXTRA_HEIGHT / 2
                        : 280 + HIGH_RES_EXTRA_HEIGHT);
        messageScrollPane.setPixelSize(550 + HIGH_RES_EXTRA_WIDTH, 182 + HIGH_RES_EXTRA_HEIGHT / 2);
        horizontalSeparator.setWidth((550 + HIGH_RES_EXTRA_WIDTH) + "px");
        separator.setPixelWidth(248 + HIGH_RES_EXTRA_WIDTH);

        layout.update();

        updateUI();

        if (isVisible())
            centerOnScreen();
    }

    currentClientWidth = clientWidth;
}

From source file:fr.fg.client.core.ResearchManager.java

License:Open Source License

public void show() {
    updateUI();//from   www  .  j a  va  2s.  c  o  m

    // Passe en plein cran
    Client.getInstance().setFullScreenMode(true);
    Client.getInstance().getFullScreenPanel().add(rootContainer);

    halfWindowWidth = Window.getClientWidth() / 2;
    halfWindowHeight = Window.getClientHeight() / 2;

    // Centre la vue sur la technologie en cours
    int currentTechnologyId = researchData.getPendingTechnologiesCount() > 0
            ? researchData.getPendingTechnologyAt(0)
            : 0;

    if (currentTechnologyId != 0) {
        TechnologyData currentTechnology = TechnologyData.getTechnologyById(currentTechnologyId);
        setView(new Point(currentTechnology.getX() - 80, currentTechnology.getY() - 15));
    } else {
        setView(new Point(halfWindowWidth - 200, halfWindowHeight - 200));
    }

    controller.setEnabled(true);
    Client.getInstance().getAreaContainer().getScrollController().setEnabled(false);

    researchDialog.setVisible(true);

    EventManager.addEventHook(this);

    Client.getInstance().getTutorial().setLesson(Tutorial.LESSON_RESEARCH);

    updateResearches();
}

From source file:fr.fg.client.map.impl.BaseMap.java

License:Open Source License

public BaseMap(String id) {
    DOM.setElementAttribute(getElement(), "id", id); //$NON-NLS-1$
    DOM.setElementAttribute(getElement(), "unselectable", "on"); //$NON-NLS-1$ //$NON-NLS-2$

    this.size = new Dimension();
    this.view = new Point();
    this.miniMaps = new ArrayList<MiniMap>();
    this.zoom = 1;
    this.bounds = new Dimension(Window.getClientWidth(), Window.getClientHeight());
    this.margin = new Rectangle(500, 500, 500, 500);

    Window.addWindowResizeListener(this);
}

From source file:fr.fg.client.map.impl.BaseMap.java

License:Open Source License

public void centerView(Point view) {
    setView(new Point(view.getX() - (int) Math.floor(Window.getClientWidth() / (2 * zoom)),
            view.getY() - (int) Math.floor(Window.getClientHeight() / (2 * zoom))));
}

From source file:fr.fg.client.map.impl.BaseMap.java

License:Open Source License

public void onWindowResized(int width, int height) {
    this.bounds = new Dimension(Window.getClientWidth(), Window.getClientHeight());
    updateView();/*from w ww.  j  a  v a2 s.  c o  m*/
}

From source file:fr.fg.client.openjwt.ui.JSDialog.java

License:Open Source License

/**
 * Dplace le dialogue  une position donne sur l'cran.
 *
 * @param x L'abscisse du coin suprieur gauche du dialogue par rapport au
 * coin suprieur de la page, en pixels./*from w  ww . j  a va  2  s . co  m*/
 * @param y L'ordonne du coin suprieur gauche du dialogue par rapport au
 * coin suprieur de la page, en pixels.
 * @param withinPage Indique si la fentre doit rester dans les
 * limites de la page. Vaut false par dfaut.
 */
public void setLocation(int x, int y, boolean withinPage) {
    if (withinPage) {
        int clientWidth = Window.getClientWidth();
        int clientHeight = Window.getClientHeight();
        int width = getPixelWidth();
        int height = getPixelHeight();

        // Vrifie que le dialogue ne sort pas de la page
        if (x + width >= clientWidth)
            x = clientWidth - width - 1;
        if (x < 0)
            x = 0;
        if (y + height >= clientHeight)
            y = clientHeight - height - 1;
        if (y < 0)
            y = 0;
    }

    this.dialogX = x;
    this.dialogY = y;
    getElement().getStyle().setProperty("left", x + "px");
    getElement().getStyle().setProperty("top", y + "px");
}

From source file:fr.fg.client.openjwt.ui.JSDialog.java

License:Open Source License

/**
 * Centre le dialogue  l'cran.//from  w w  w  . j  a v a2 s  . c o  m
 */
public void centerOnScreen() {
    // Dimensions de l'cran
    int clientWidth = Window.getClientWidth();
    int clientHeight = Window.getClientHeight();

    if (!isAttached()) {
        boolean visible = isVisible();
        super.setVisible(true);
        RootPanel.get().add(this, 0, 0);

        // Centre le dialogue
        setLocation((clientWidth - getPixelWidth()) / 2, (clientHeight - getPixelHeight()) / 2, true);

        RootPanel.get().remove(this);
        super.setVisible(visible);
    } else {
        // Centre le dialogue
        setLocation((clientWidth - getPixelWidth()) / 2, (clientHeight - getPixelHeight()) / 2, true);
    }
}

From source file:fr.putnami.pwt.core.widget.client.base.SimpleDropdown.java

License:Open Source License

@Override
public void open() {
    StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN);
    Element menuElt = this.menuContainer.getElement();
    int topMenu = menuElt.getAbsoluteTop() - Window.getScrollTop();
    int menuHeight = menuElt.getOffsetHeight();
    int anchorHeight = this.anchor.getOffsetHeight();
    int clientHeight = Window.getClientHeight();
    if (topMenu + menuHeight > clientHeight && topMenu >= anchorHeight + menuHeight) {
        StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_UP);
    }//ww w. ja  va  2s .co m
    int leftMenu = menuElt.getAbsoluteLeft() - Window.getScrollLeft();
    int menuWidth = menuElt.getOffsetWidth();
    int anchorWidth = this.anchor.getOffsetWidth();
    int clientWidth = Window.getClientWidth();
    if (leftMenu + menuWidth > clientWidth && leftMenu >= anchorWidth + menuWidth) {
        StyleUtils.addStyle(this, SimpleDropdown.STYLE_OPEN_LEFT);
    }
    this.open = true;
    this.updateHandlers();
}

From source file:geogebra.web.gui.advanced.client.ui.widget.LockingPanel.java

License:Apache License

/**
 * Shows the panel./*from ww  w.  j  a v a 2  s  .  co m*/
 */
public void lock() {
    setStyleName("advanced-LockingPanel");
    setPopupPosition(0, 0);
    setWidth("100%");
    setHeight("100%");
    setPixelSize(Window.getClientWidth(), Window.getClientHeight());

    show();
}