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:edu.caltech.ipac.firefly.visualize.VisMenuBar.java

void updateLayout() {

    ToolbarRows rows = (Window.getClientWidth() > 1210 + toolPopLeftOffset || !asPopup) ? ToolbarRows.ONE
            : ToolbarRows.MULTI;// ww w .  ja v a2s . co m

    mbarVP.clear();
    if (asPopup) {
        FlowPanel mbarHor;
        FlowPanel mbarHor2 = null;
        MenuGeneratorV2 menuGen = MenuGeneratorV2.create(allPlots.getCommandMap(), new OverNotify(), true);
        if (rows == ToolbarRows.ONE) {
            mbarHor = menuGen.makeMenuToolBarFromProp("VisMenuBar.all", true);
            mbarVP.add(mbarHor);
            _toolbarHelpLabel.setWidth("500px");
        } else {
            mbarHor = menuGen.makeMenuToolBarFromProp("VisMenuBar.row1", true);
            mbarHor2 = menuGen.makeMenuToolBarFromProp("VisMenuBar.row2", true);
            mbarVP.add(mbarHor);
            mbarVP.add(mbarHor2);
            _toolbarHelpLabel.setWidth("300px");
        }
        GwtUtil.setStyles(mbarHor, "border", "none", "background", "transparent", "paddingTop", "3px");
        if (mbarHor2 != null) {
            GwtUtil.setStyles(mbarHor2, "border", "none", "background", "transparent", "paddingTop", "3px");
        }
        mbarHor.add(makeHelp());
        mbarVP.add(mbarPopBottom);
    } else {
        MenuGeneratorV2 menuGen = MenuGeneratorV2.create(allPlots.getCommandMap(), new OverNotify(), true);
        FlowPanel mbarHor = menuGen.makeMenuToolBarFromProp("VisMenuBar.all", false);
        mbarVP.add(mbarHor);
        GwtUtil.setStyles(mbarHor, "padding", "3px 0 0 4px", "whitespace", "normal");
        //            _toolbarHelpLabel.setSize("500px", "13px");
        mbarHor.add(makeHelp());
    }

    adjustSize();
    updateVisibleWidgets();
}

From source file:edu.caltech.ipac.firefly.visualize.VisMenuBar.java

void updateToolbarAlignment() {
    if (popup != null) {
        if (Window.getClientWidth() > 1220 + toolPopLeftOffset
                && Application.getInstance().getCreator().isApplication()) {
            popup.alignTo(RootPanel.get(), PopupPane.Align.TOP_LEFT, 130 + toolPopLeftOffset, 0);
        } else {/*from   w  w w.  j  av a  2 s .  c o  m*/
            popup.alignTo(RootPanel.get(), PopupPane.Align.TOP_LEFT, toolPopLeftOffset, 0);
        }

    }
}

From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java

private ScreenPt computeLeftRight(int mouseX, int mouseY, Side side, boolean choose) {

    WebAssert.argTst((side == Side.Left || side == Side.Right || side == Side.IRSA_LOGO),
            "Side must be left, right, or IRSA_LOGO");

    int x = 0;//  w  w  w.ja  v a2 s.c o m
    Side otherSide;
    int popWidth = _popupPanel.getPopupPanel().getOffsetWidth();
    int popHeight = _popupPanel.getPopupPanel().getOffsetHeight();

    if (side == Side.Left) {
        otherSide = Side.Right;

        switch (_mode) {
        case Quick:
            x = _plotView.getAbsoluteLeft() - popWidth;
            break;
        case Group:
            x = 3;
            break;
        default:
            WebAssert.argTst(false, "not a supported mode");
            break;
        }

    } else {
        otherSide = Side.Left;

        switch (_mode) {
        case Quick:
            x = _plotView.getAbsoluteLeft() + _plotView.getOffsetWidth();
            break;
        case Group:
            x = Window.getClientWidth() - popWidth;
            if (side == Side.IRSA_LOGO && x > IRSA_LOGO_X) {
                x = IRSA_LOGO_X;
            }
            break;
        default:
            WebAssert.argTst(false, "not a supported mode");
            break;
        }
    }

    int y = 0;
    switch (_mode) {
    case Quick:
        y = _plotView.getAbsoluteTop();
        break;
    //            case Group : y= Window.getClientWidth()- popHeight-3; break;
    case Group:
        y = 0;
        break;
    default:
        WebAssert.argTst(false, "not a supported mode");
        break;
    }

    ScreenPt op1Pt = adjustXY(x, y);
    x = op1Pt.getIX();

    ScreenPt retval = op1Pt;

    if (INTELLIGENT_CHOICE) {
        ScreenPt op2Pt = null;
        ScreenPt op3Pt = null;

        Choice op2Choice = Choice.Bad;
        Choice op3Choice = Choice.Bad;
        Choice op1Choice = computeChoice(op1Pt, mouseX, mouseY);

        if (op1Choice != Choice.Good) {
            y = _plotView.getAbsoluteTop() + _plotView.getOffsetHeight();
            op2Pt = adjustXY(x, y);

            op2Choice = computeChoice(op2Pt, mouseX, mouseY);
        }

        if (op1Choice != Choice.Good && op2Choice != Choice.Good) {
            y = _plotView.getAbsoluteTop() - popHeight;
            op3Pt = adjustXY(x, y);

            op3Choice = computeChoice(op3Pt, mouseX, mouseY);
        }

        retval = chooseBest(op1Choice, op1Pt, op2Choice, op2Pt, op3Choice, op3Pt);

        if (retval == null && choose) {
            retval = computeLeftRight(mouseX, mouseY, otherSide, false);
            if (retval == null)
                retval = op1Pt;
        }
    }

    return retval;
}

From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java

private ScreenPt adjustXY(int x, int y) {
    int popWidth = _popupPanel.getPopupPanel().getOffsetWidth();
    int popHeight = _popupPanel.getPopupPanel().getOffsetHeight();
    int bWidth = Window.getClientWidth();
    int bHeight = Window.getClientHeight();
    int sx = Window.getScrollLeft();
    int sy = Window.getScrollTop();
    if (x + popWidth > bWidth)
        x = (bWidth - popWidth) + sx;/*from www.  j av a2  s .co m*/
    if (y + popHeight > bHeight)
        y = (bHeight - popHeight) + sy;

    if (x < sx)
        x = sx;
    if (y < sy)
        y = sy;
    return new ScreenPt(x, y);

}

From source file:edu.oswego.csc480_hci521_2013.client.activity.DoublePanelActivity.java

License:Apache License

private void popoutConfusionMatrixTab(ConfusionMatrixPlace place, int id) {
    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features = "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    ConfusionMatrixActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
}

From source file:edu.oswego.csc480_hci521_2013.client.activity.DoublePanelActivity.java

License:Apache License

private void popoutTreeVisTab(TreeVisPlace place, int id) {
    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features = "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    TreeVisActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
}

From source file:edu.oswego.csc480_hci521_2013.client.activity.DoublePanelActivity.java

License:Apache License

private void popoutDataTab(DataTablePlace place, int id) {
    logger.log(Level.INFO, "Popping data panel: " + place.getDataKey());

    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features = "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    DataPanelActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
}

From source file:edu.ucla.loni.pipeline.client.Charts.LineChartPanel.java

License:Open Source License

private void initialize(String mt) {
    monitorType = mt;/*from  www  .  ja va2s  . com*/

    if (monitorType.equals("Memory")) {
        initializeMemory();
    } else if (monitorType.equals("Thread")) {
        initializeThread();
    } else {
        System.err.println(
                "Incorrect monitorType provided. Check initialize() in LineChartPanel.java for errors.");
        return;
    }

    // set up chart
    ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
    chartLoader.loadApi(new Runnable() {

        @Override
        public void run() {
            // Create and attach the chart
            chart = new LineChart();
            int height = Window.getClientHeight() - 330;
            int width = Window.getClientWidth() - 75;
            chart.setSize(width + "px", height + "px");

            // listen to resize events
            Window.addResizeHandler(new ResizeHandler() {
                @Override
                public void onResize(ResizeEvent event) {
                    int height = event.getHeight() - 330;
                    int width = event.getWidth() - 75;
                    chart.setHeight(height + "px");
                    chart.setWidth(width + "px");
                    draw();
                }
            });

            addChild(chart);
            draw();
        }
    });
}

From source file:edu.ucsc.robot.client.MainScreen.java

License:Apache License

@Override
public void onModuleLoad() {
    screenWidth = Window.getClientWidth();
    screenHeight = Window.getClientHeight();

    setupRenderer();/*from  w ww  .  j a  va 2s.  c om*/
    setupWebGLCanvas(renderer);
    RootLayoutPanel.get().add(canvas);
    setupScene();
    setupCamera();

    rootGroup = THREE.Object3D();
    scene.add(rootGroup);

    backgroundContainer = THREE.Object3D();
    rootGroup.add(backgroundContainer);

    final Geometry geo = THREE.PlaneGeometry(100, 100, 20, 20);
    final Mesh mesh = THREE.Mesh(geo, THREE.MeshBasicMaterial().color(0x666666).wireFrame(true).build());
    mesh.setRotation(Math.toRadians(-90), 0, 0);
    backgroundContainer.add(mesh);

    setupUpdater();

    dialog = new PopupPanel();

    setupDialogRoot();
    createPlayer(main);

    dialog.show();
    Util.rightTop(dialog);

    Window.addResizeHandler(new IndexResizeHandler(this));

    HTMLPanel html = new HTMLPanel(getHtml());
    html.setWidth("100%");
    html.setHeight("20px");
    html.setStyleName("text");

    htmlDialog = new PopupPanel();
    htmlDialog.add(html);
    htmlDialog.setPopupPosition(150, 30);
    htmlDialog.setWidth("100%");
    htmlDialog.setStyleName("transparent");
    htmlDialog.show();

}

From source file:edu.udes.bio.genus.client.GenUS.java

License:Open Source License

/**
 * This is the entry point method./*from ww w.j a v a2 s.c  om*/
 */
public void onModuleLoad() {
    // Setup the browser window
    Window.enableScrolling(false);
    Window.setMargin("0px");
    Window.setTitle("GenUS : Genetic profiling tool");

    // Setup the root panel
    RootPanel.get().setSize("100%", "100%");

    // Setup the background panel
    setSize("100%", "100%");
    RootPanel.get().add(this);

    // Set display area
    this.add(GenUS.displayArea, 0, 0);

    // Add the zoomer
    final Scaler zoomer = new Scaler(GenUS.displayArea);
    this.add(zoomer, Window.getClientWidth() - 21, 0);

    // Add the main menu
    this.add(GenUS.mainMenu, 0, 0);

    // Add the properties panel
    this.add(GenUS.propMenu, Window.getClientWidth() - 502, Window.getClientHeight() - 125);

    // ### TESTING : Add a strand to pool
    // try {
    // // final RNAssDrawable testStrand = new RNAssDrawable("..((((((((......))))))))..", "ACGUGCCACGAUUCAACGUGGCACAG", GenUS.displayArea);
    // // testStrand.setName("TEST").scale(GenUS.displayArea.scaleFactor);
    // //
    // // GenUS.rnaPool.addToPool(testStrand);
    // //
    // // final RNAssDrawable testStrand2 = new RNAssDrawable(".(((....)..))..", "ACGUGCCACGAU", GenUS.displayArea);
    // // testStrand.setName("TEST2").scale(GenUS.displayArea.scaleFactor).setDrawStyle(DrawStyle.Linear_Round);
    // //
    // // GenUS.rnaPool.addToPool(testStrand2);
    //
    // /*
    // * for (int i = 0; i < 5; i++) { RNAssDrawable testStrand2 = new RNAssDrawable("..((......))", i + "  ", displayArea); testStrand2.setName("TEST" + i).scale(displayArea.scaleFactor); testStrand2.setDrawStyle(RNAssDrawable.DrawStyle.Linear_Round);
    // *
    // * rnaPool.addToPool(testStrand2); }
    // */
    //
    // } catch (final Exception e) {
    // Window.alert("TESTING STRAND ERROR GOTTA FIX TAHT SHIT: " + e.getMessage());
    // }
}