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:opus.gwt.management.console.client.deployer.ProjectDeployerController.java

License:Apache License

private void deployProject() {
    createdProjectName = deploymentOptionsPanel.getProjectName();

    ArrayList<String> paths = appBrowserPanel.getAppPaths();
    ArrayList<String> apptypes = appBrowserPanel.getAppTypes();
    ArrayList<String> appNames = appBrowserPanel.getAppNames();

    StringBuffer formBuilder = new StringBuffer();
    formBuilder.append("csrfmiddlewaretoken=");
    formBuilder.append(URL.encodeQueryString(jsVarHandler.getCSRFTokenURL()));

    formBuilder.append("&form-TOTAL_FORMS=");
    formBuilder.append(URL.encodeQueryString(String.valueOf(paths.size())));
    formBuilder.append("&form-INITIAL_FORMS=");
    formBuilder.append(URL.encodeQueryString(String.valueOf(0)));
    formBuilder.append("&form-MAX_NUM_FORMS=");

    for (int i = 0; i < paths.size(); i++) {
        formBuilder.append("&form-" + i + "-apptype=");
        formBuilder.append(apptypes.get(i));

        formBuilder.append("&form-" + i + "-apppath=");
        formBuilder.append(paths.get(i));

        formBuilder.append("&form-" + i + "-appname=");
        formBuilder.append(appNames.get(i));
    }/* w  w  w  .jav a 2  s.  co  m*/

    formBuilder.append(deploymentOptionsPanel.getPostData());
    formBuilder.append(projectOptionsPanel.getPostData());
    formBuilder.append(databaseOptionsPanel.getPostData());

    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
            "/deployments/" + createdProjectName + "/");
    builder.setHeader("Content-type", "application/x-www-form-urlencoded");
    //builder.setHeader(header, value);

    try {
        Request request = builder.sendRequest(formBuilder.toString(), new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                ErrorPanel ep = new ErrorPanel(clientFactory);
                ep.errorHTML.setHTML("<p>Error Occured</p>");
                deployerDeckPanel.add(ep);
                deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep));
            }

            public void onResponseReceived(Request request, Response response) {
                if (response.getText().contains("Back to")) {
                    loadingPopup.hide();
                    eventBus.fireEvent(new AsyncRequestEvent("addProject", createdProjectName));
                } else {
                    loadingPopup.hide();
                    ErrorPanel ep = new ErrorPanel(clientFactory);
                    ep.errorHTML.setHTML(response.getText());
                    deployerDeckPanel.add(ep);
                    deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep));
                }
            }
        });
    } catch (RequestException e) {

    }

    loadingPopup.setGlassEnabled(true);
    loadingPopup.setGlassStyleName(style.loadingGlass());
    loadingPopup.show();
    int left = (Window.getClientWidth() / 2) - 150;
    int top = (Window.getClientHeight() / 2) - 10;
    loadingPopup.setPopupPosition(left, top);
    loadingPopup.show();
}

From source file:org.activityinfo.ui.client.page.app.AppBar.java

License:Open Source License

@UiHandler("settingsButton")
void handleSettingsClick(ClickEvent e) {
    if (settingsPopup == null) {
        settingsPopup = new SettingsPopup(eventBus, offlineController);
    }//www . j a  va2 s. co m
    settingsPopup.setPopupPosition(Window.getClientWidth() - SettingsPopup.WIDTH, HEIGHT - 3);
    settingsPopup.show();
}

From source file:org.activityinfo.ui.client.page.report.editor.ElementDialog.java

License:Open Source License

public void show(ReportElement element, Callback callback) {
    this.callback = callback;

    setWidth((int) (Window.getClientWidth() * 0.90));
    setHeight((int) (Window.getClientHeight() * 0.90));
    if (element.getTitle() == null) {
        setHeadingText("New Report Element");
    } else {/*from www  .  ja  va 2s. c  o  m*/
        setHeadingText(element.getTitle());
    }

    removeAll();

    bind(element);

    this.editor = editorProvider.create(model);
    this.editor.bind(model);
    add(editor.getWidget());
    layout();

    super.show();
}

From source file:org.apache.openjpa.trader.client.OpenTrader.java

License:Apache License

/**
 * Builds up the widgets once the login is complete i.e. the server has supplied
 * the initialization data./*from   ww w.  j ava2 s.  co m*/
 *
 */
void init(Trader trader, String uri, List<Stock> stocks) {
    this.trader = trader;
    _serviceURI = uri;

    Window.setTitle(trader.getName());

    int W = Window.getClientWidth();
    int H = 900;//Window.getClientHeight();

    int headerHeight = 05 * H / 100;
    int westWidth = 25 * W / 100;
    int westHeight = 80 * H / 100;
    int centerWidth = 60 * W / 100;
    int centerHeight = 80 * H / 100;
    int footerHeight = 02 * H / 100;
    Unit unit = Unit.PX;

    stockPanel = new MarketDataPanel(this, westWidth - 10, 40 * westHeight / 100);
    int N = stocks.size();
    for (int i = 0; i < N; i++) {
        stockPanel.insert(stocks.get(i));
    }

    soldTradePanel = new TradeHistoryPanel(this, Ask.class, westWidth - 10, 20 * westHeight / 100);
    boughtTradePanel = new TradeHistoryPanel(this, Bid.class, westWidth - 10, 20 * westHeight / 100);
    serverPanel = new ServerLogPanel(this, centerWidth, 40 * centerHeight / 100);
    tradePanel = new TradingWindow(this, centerWidth, 40 * centerHeight / 100);
    orderPanel = new TradeOrderWindow(this, centerWidth, 10 * centerHeight / 100);

    FlowPanel west = new FlowPanel();
    west.setSize((westWidth - 10) + "px", westHeight + "px");
    west.add(decorate(stockPanel));
    west.add(new HTML("<p>"));
    west.add(decorate(soldTradePanel));
    west.add(new HTML("<p>"));
    west.add(decorate(boughtTradePanel));

    FlowPanel center = new FlowPanel();
    center.setSize(centerWidth + "px", centerHeight + "px");
    center.add(decorate(orderPanel));
    center.add(new HTML("<p>"));
    center.add(decorate(tradePanel));
    center.add(new HTML("<p>"));
    center.add(decorate(serverPanel));

    DockLayoutPanel main = new DockLayoutPanel(unit);

    main.addNorth(createHeader(), headerHeight);
    main.addSouth(createFooter(), footerHeight);
    main.addWest(west, westWidth);
    main.add(center);

    RootLayoutPanel.get().add(main);
    main.animate(500);
    setUpHelp();
    stockPanel.startStockWatcher();
    tradePanel.startTradableRefresher();
}

From source file:org.apache.servicemix.gshellweb.client.Console.java

License:Apache License

public Console() {

    addStyleName("console");
    addStyleName("console-pro");
    setAnimationEnabled(true);/* ww  w  . ja  va  2 s .  c  om*/

    FlowPanel panel = new FlowPanel();
    add(panel);

    // Setup the output area.
    output = new HTML();
    output.setStyleName("output");
    panel.add(output);

    // Setup the prompt Area..
    prompt = new HTML();
    prompt.setStyleName("prompt");
    input = new TextBox();
    input.setStyleName("input");
    Grid promptTable = new Grid(1, 2);
    promptTable.setWidget(0, 0, prompt);
    promptTable.getCellFormatter().setStyleName(0, 0, "prompt");
    promptTable.setWidget(0, 1, input);
    promptTable.getCellFormatter().setStyleName(0, 1, "input");
    panel.add(promptTable);

    input.addKeyboardListener(new KeyboardListenerAdapter() {
        public void onKeyPress(Widget sender, char keyCode, int modifiers) {
            switch (keyCode) {
            case KEY_TAB:
                onTab();
                input.cancelKey();
                break;
            case KEY_UP:
                onUpHistory();
                input.cancelKey();
                break;
            case KEY_DOWN:
                onDownHistroy();
                input.cancelKey();
                break;
            case KEY_ENTER:
                onEnter();
                input.cancelKey();
                break;
            }
        }

    });

    getElement().getStyle().setProperty("margin", "20px");
    getElement().getStyle().setProperty("minWidth", (Window.getClientWidth() - 100) + "px");
    getElement().getStyle().setProperty("minHeight", (Window.getClientHeight() - 100) + "px");

    Window.addWindowResizeListener(new WindowResizeListener() {
        public void onWindowResized(int width, int height) {
            getElement().getStyle().setProperty("minWidth", (Window.getClientWidth() - 100) + "px");
            getElement().getStyle().setProperty("minHeight", (Window.getClientHeight() - 100) + "px");
            input.getElement().scrollIntoView();
        }
    });

}

From source file:org.apache.solr.explorer.client.core.manager.ui.DefaultProgressIndicator.java

License:Apache License

/**
 * Constructs a new MessageProgressIndicator with a given initial message to be displayed.
 *
 * @param message The initial message to be displayed.
 *//*from   ww  w  .ja v  a2  s  .  c  o m*/
public DefaultProgressIndicator(String message) {
    super(false, true);
    messageLabel = new Label(message);
    messageLabel.setStyleName("Label");
    setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
            int x = Window.getClientWidth() / 2 - offsetWidth / 2;
            setPopupPosition(x, 0);
        }
    });
    setWidget(messageLabel);
    setStyleName("DefaultProgressIndicator");
}

From source file:org.appverse.web.showcases.gwtshowcase.gwtfrontend.admin.common.layout.views.impl.gxt.AdminLayoutViewImpl.java

License:Appverse Public License

private void centerBorderLayout() {
    int width = Window.getClientWidth();
    int desiredWidth = 1024;
    int leftMargin = (width - desiredWidth) / 2;
    if (leftMargin < 0)
        leftMargin = 0;// ww w . j  a  va 2 s.  c o m
    borderCon.setPosition(leftMargin, 0);
}

From source file:org.artificer.ui.client.local.services.notification.NotificationWidget.java

License:Apache License

/**
 * Returns true if the given screen coordinates lie within the boundary of the growl dialog.
 * @param clientX//from   w  w w  . java  2s .co  m
 * @param clientY
 */
private boolean isMouseInMe(int clientX, int clientY) {
    try {
        String bottomStyle = getElement().getStyle().getBottom();
        int bottom = new Integer(bottomStyle.split("px")[0]).intValue();
        bottom = Window.getClientHeight() - bottom;

        int top = bottom - getOffsetHeight();
        int left = Window.getClientWidth() - NotificationConstants.WIDTH - NotificationConstants.MARGIN;
        int right = left + NotificationConstants.WIDTH;

        return clientX >= left && clientX <= right && clientY >= top && clientY <= bottom;
    } catch (Throwable t) {
        return false;
    }
}

From source file:org.atmosphere.samples.client.Info.java

License:Apache License

protected Info(String title, String message) {

    add(new InfoWidget(title, message));
    setWidth("300px");
    setHeight("50px");

    int root_width = Window.getClientWidth();
    int root_height = Window.getClientHeight();

    level = findAvailableLevel();/*from   w ww  .j  a  v  a 2  s  . c  o m*/

    int left = root_width - 320;
    int top = root_height - 80 - (level * 60);

    setPopupPosition(left, top);
}

From source file:org.bonitasoft.console.client.view.labels.LabelsManagementList.java

License:Open Source License

protected void addLabel() {
    myCreateDialogBox.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(int anOffsetWidth, int anOffsetHeight) {
            int left = ((Window.getClientWidth() / 2) - (anOffsetWidth / 2));
            int top = (Window.getClientHeight() / 3) - (anOffsetHeight / 2);
            myCreateDialogBox.setPopupPosition(left, top);
        }/*from  www. j av a  2 s. co  m*/
    });
    myNewLabelName.setFocus(true);

}