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:nl.mpi.tg.eg.experiment.client.view.ComplexView.java

License:Open Source License

protected void addSizeAttributes(final Element imageElement, int percentOfPage, int maxHeight, int maxWidth) {
    imageElement.getStyle().setProperty("imageOrientation", "from-image"); // the image-orientation style is not supported by most browsers yet
    if (percentOfPage > 0) {
        scaledImagesList.add(new ImageEntry(imageElement, percentOfPage));
        //            image.getElement().getStyle().setProperty("width", percentOfPage + "%");
        //            image.getElement().getStyle().setProperty("height", "auto");
        resizeImage(imageElement, Window.getClientHeight(), Window.getClientWidth(), percentOfPage);
    } else {//  w ww  .  ja  v a 2s.  com
        if (maxWidth > 0) {
            imageElement.getStyle().setProperty("maxWidth", maxWidth + "%");
        }
        if (maxHeight > 0) {
            imageElement.getStyle().setProperty("maxHeight", maxHeight + "%");
        }
    }
}

From source file:nl.mpi.tg.eg.experiment.client.view.ComplexView.java

License:Open Source License

public void showHtmlPopup(String popupText, final PresenterEventListner... buttonListeners) {
    final PopupPanel popupPanel = new PopupPanel(false); // the close action to this panel causes background buttons to be clicked
    popupPanel.setGlassEnabled(true);//from  www.  ja v a  2  s . com
    popupPanel.setStylePrimaryName("svgPopupPanel");
    final VerticalPanel popupverticalPanel = new VerticalPanel();
    final HTML htmlText = new HTML(new SafeHtmlBuilder().appendHtmlConstant(popupText).toSafeHtml());
    htmlText.setStylePrimaryName("popupTextBox");
    popupverticalPanel.add(htmlText);

    popupverticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    final HorizontalPanel buttonPanel = new HorizontalPanel();
    for (final PresenterEventListner buttonListener : buttonListeners) {
        final SingleShotEventListner okSingleShotEventListner = new SingleShotEventListner() {

            @Override
            protected void singleShotFired() {
                popupPanel.hide();
                buttonListener.eventFired(null, null);
            }
        };
        final Button okButton = new Button(buttonListener.getLabel());
        if (buttonListener.getStyleName() != null && !buttonListener.getStyleName().isEmpty()) {
            okButton.addStyleName(buttonListener.getStyleName());
        }
        okButton.addClickHandler(okSingleShotEventListner);
        okButton.addTouchStartHandler(okSingleShotEventListner);
        okButton.addTouchMoveHandler(okSingleShotEventListner);
        okButton.addTouchEndHandler(okSingleShotEventListner);
        buttonPanel.add(okButton);
    }
    popupverticalPanel.add(buttonPanel);
    popupPanel.setWidget(popupverticalPanel);
    popupPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            final int topPosition = Window.getClientHeight() / 2 - offsetHeight;
            // topPosition is used to make sure the dialogue is above the half way point on the screen to avoid the software keyboard covering the box
            // topPosition is also checked to make sure it does not show above the top of the page
            popupPanel.setPopupPosition(Window.getClientWidth() / 2 - offsetWidth / 2,
                    (topPosition < 0) ? 0 : topPosition);
        }
    });
}

From source file:nl.ru.languageininteraction.language.client.view.AbstractSvgView.java

License:Open Source License

public void showWidgetPopup(final PresenterEventListner saveEventListner, IsWidget popupContentWidget) {
    final PopupPanel popupPanel = new PopupPanel(false); // the close action to this panel causes background buttons to be clicked
    popupPanel.setGlassEnabled(true);//from  w  ww .  ja  v  a 2 s . co m
    popupPanel.setStylePrimaryName("svgPopupPanel");
    final VerticalPanel popupverticalPanel = new VerticalPanel();
    popupverticalPanel.add(popupContentWidget);

    popupverticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    final SingleShotEventListner cancelSingleShotEventListner = new SingleShotEventListner() {

        @Override
        protected void singleShotFired() {
            popupPanel.hide();
        }
    };
    final HorizontalPanel buttonPanel = new HorizontalPanel();
    String popupCancelButtonLabel = ""; // messages.popupCancelButtonLabel();
    final Button cancelButton = new Button(popupCancelButtonLabel);
    cancelButton.addClickHandler(cancelSingleShotEventListner);
    cancelButton.addTouchStartHandler(cancelSingleShotEventListner);
    cancelButton.addTouchMoveHandler(cancelSingleShotEventListner);
    cancelButton.addTouchEndHandler(cancelSingleShotEventListner);
    buttonPanel.add(cancelButton);
    if (saveEventListner != null) {
        final SingleShotEventListner okSingleShotEventListner = new SingleShotEventListner() {

            @Override
            protected void singleShotFired() {
                popupPanel.hide();
                saveEventListner.eventFired(null, this);
            }
        };
        String popupOkButtonLabel = ""; // messages.popupOkButtonLabel();
        final Button okButton = new Button(popupOkButtonLabel);
        okButton.addClickHandler(okSingleShotEventListner);
        okButton.addTouchStartHandler(okSingleShotEventListner);
        okButton.addTouchMoveHandler(okSingleShotEventListner);
        okButton.addTouchEndHandler(okSingleShotEventListner);
        buttonPanel.add(okButton);
    }
    popupverticalPanel.add(buttonPanel);
    popupPanel.setWidget(popupverticalPanel);
    popupPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {
            final int topPosition = Window.getClientHeight() / 2 - offsetHeight;
            // topPosition is used to make sure the dialogue is above the half way point on the screen to avoid the software keyboard covering the box
            // topPosition is also checked to make sure it does not show above the top of the page
            popupPanel.setPopupPosition(Window.getClientWidth() / 2 - offsetWidth / 2,
                    (topPosition < 0) ? 0 : topPosition);
        }
    });
}

From source file:nl.ru.languageininteraction.language.client.view.MapView.java

License:Open Source License

public void addMap() {
    final Label label = new Label("click a land mass");
    verticalPanel.add(label);/* ww  w.  j av a 2  s.co m*/
    //        String[] items = new String[]{"one", "two", "three"};
    SafeHtmlBuilder builder = new SafeHtmlBuilder();
    //        for (String item : items) {
    //            builder.appendEscaped(item).appendHtmlConstant("<br/>");
    //        }
    height = Window.getClientHeight();
    width = Window.getClientWidth();
    builder.append(SafeHtmlUtils.fromTrustedString("<style>.overlay {pointer-events: none;}</style>"));
    builder.append(SafeHtmlUtils
            .fromTrustedString("<svg id='ocean' height='" + height + "px' width='" + width + "px' >"));
    builder.append(SafeHtmlUtils.fromTrustedString("<g id='zoomableGroup'>"));
    builder.append(SafeHtmlUtils.fromTrustedString("<g transform='scale(0.3)'>"));
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idIndic(), autotypRegions.transformIndic()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97259(), autotypRegions.stylepath97259(), autotypRegions.datapath97259()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idBasinandPlains(), autotypRegions.transformBasinandPlains()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107611(), autotypRegions.stylepath107611(), autotypRegions.datapath107611()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idAlaskaOregon(), autotypRegions.transformAlaskaOregon()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107614(), autotypRegions.stylepath107614(), autotypRegions.datapath107614()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idCalifornia(), autotypRegions.transformCalifornia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107582(), autotypRegions.stylepath107582(), autotypRegions.datapath107582()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idMesoamerica(), autotypRegions.transformMesoamerica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97265(), autotypRegions.stylepath97265(), autotypRegions.datapath97265()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idSESouthAmerica(), autotypRegions.transformSESouthAmerica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107722(), autotypRegions.stylepath107722(), autotypRegions.datapath107722()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idNESouthAmerica(), autotypRegions.transformNESouthAmerica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97311(), autotypRegions.stylepath97311(), autotypRegions.datapath97311()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idAndean(), autotypRegions.transformAndean()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107701(), autotypRegions.stylepath107701(), autotypRegions.datapath107701()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idNAustralia(), autotypRegions.transformNAustralia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97635(), autotypRegions.stylepath97635(), autotypRegions.datapath97635()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idGreenland(), autotypRegions.transformGreenland()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140696(), autotypRegions.stylepath140696(), autotypRegions.datapath140696()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idSAustralia(), autotypRegions.transformSAustralia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107441(), autotypRegions.stylepath107441(), autotypRegions.datapath107441()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath99393(), autotypRegions.stylepath99393(), autotypRegions.datapath99393()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idNAfrica(), autotypRegions.transformNAfrica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140264(), autotypRegions.stylepath140264(), autotypRegions.datapath140264()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idSAfrica(), autotypRegions.transformSAfrica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140076(), autotypRegions.stylepath140076(), autotypRegions.datapath140076()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idGreaterMesopotamia(), autotypRegions.transformGreaterMesopotamia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97275(), autotypRegions.stylepath97275(), autotypRegions.datapath97275()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idInnerAsia(), autotypRegions.transformInnerAsia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97287(), autotypRegions.stylepath97287(), autotypRegions.datapath97287()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140112(), autotypRegions.stylepath140112(), autotypRegions.datapath140112()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idEurope(), autotypRegions.transformEurope()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97263(), autotypRegions.stylepath97263(), autotypRegions.datapath97263()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97585(), autotypRegions.stylepath97585(), autotypRegions.datapath97585()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97977(), autotypRegions.stylepath97977(), autotypRegions.datapath97977()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath98383(), autotypRegions.stylepath98383(), autotypRegions.datapath98383()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath99041(), autotypRegions.stylepath99041(), autotypRegions.datapath99041()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath100331(), autotypRegions.stylepath100331(), autotypRegions.datapath100331()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97431(), autotypRegions.stylepath97431(), autotypRegions.datapath97431()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath98187(), autotypRegions.stylepath98187(), autotypRegions.datapath98187()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath98391(), autotypRegions.stylepath98391(), autotypRegions.datapath98391()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath100255(), autotypRegions.stylepath100255(), autotypRegions.datapath100255()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath100829(), autotypRegions.stylepath100829(), autotypRegions.datapath100829()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath101047(), autotypRegions.stylepath101047(), autotypRegions.datapath101047()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath101127(), autotypRegions.stylepath101127(), autotypRegions.datapath101127()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath101193(), autotypRegions.stylepath101193(), autotypRegions.datapath101193()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath101671(), autotypRegions.stylepath101671(), autotypRegions.datapath101671()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140654(), autotypRegions.stylepath140654(), autotypRegions.datapath140654()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97911(), autotypRegions.stylepath97911(), autotypRegions.datapath97911()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath141650(), autotypRegions.stylepath141650(), autotypRegions.datapath141650()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath142374(), autotypRegions.stylepath142374(), autotypRegions.datapath142374()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath143814(), autotypRegions.stylepath143814(), autotypRegions.datapath143814()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath144104(), autotypRegions.stylepath144104(), autotypRegions.datapath144104()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140764(), autotypRegions.stylepath140764(), autotypRegions.datapath140764()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath140714(), autotypRegions.stylepath140714(), autotypRegions.datapath140714()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath143158(), autotypRegions.stylepath143158(), autotypRegions.datapath143158()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath144174(), autotypRegions.stylepath144174(), autotypRegions.datapath144174()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idSoutheast_Asia(), autotypRegions.transformSoutheast_Asia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97365(), autotypRegions.stylepath97365(), autotypRegions.datapath97365()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idNorthCoastAsia(), autotypRegions.transformNorthCoastAsia()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97393(), autotypRegions.stylepath97393(), autotypRegions.datapath97393()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idENorthAmerica(), autotypRegions.transformENorthAmerica()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107580(), autotypRegions.stylepath107580(), autotypRegions.datapath107580()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idPapua(), autotypRegions.transformPapua()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97649(), autotypRegions.stylepath97649(), autotypRegions.datapath97649()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idAfricanSavanah(), autotypRegions.transformAfricanSavanah()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath13257(), autotypRegions.stylepath13257(), autotypRegions.datapath13257()));
    //        builder.append(SVG_TEMPLATE.groupTagEnd());
    //        builder.append(SVG_TEMPLATE.groupTag(autotypRegions.idOceania(), autotypRegions.transformOceania()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath107904(), autotypRegions.stylepath107904(), autotypRegions.datapath107904()));
    //        builder.append(SVG_TEMPLATE.pathTag(autotypRegions.transformpath97885(), autotypRegions.stylepath97885(), autotypRegions.datapath97885()));
    builder.append(SVG_TEMPLATE.groupTagEnd());

    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='island' x='250' y='150' height='5px' width='5px' fill='blue'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='island' x='255' y='170' height='5px' width='5px' fill='blue'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='island' x='10' y='160' height='5px' width='5px' fill='blue'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='island' x='30' y='150' height='5px' width='5px' fill='blue'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='island' x='20' y='150' height='5px' width='5px' fill='blue'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='continent' x='0' y='10'height='88px' width='88px' fill='green'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='asia' x='250' y='50' height='88px' width='88px' fill='green'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='europe' x='150' y='10' height='88px' width='88px' fill='green'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='africa' x='100' y='110' height='88px' width='88px' fill='green'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='australia' x='400' y='100' height='88px' width='88px' fill='green'/>"));
    //        builder.append(SafeHtmlUtils.fromTrustedString("<rect id='newzealand' x='500' y='150' height='20px' width='10px' fill='green'/>"));
    builder.append(SafeHtmlUtils.fromTrustedString("</g>"));
    builder.append(SafeHtmlUtils.fromTrustedString("</g>"));
    builder.append(SafeHtmlUtils.fromTrustedString("<line id='horizontal' class='overlay' x1='0' y1='100' x2='"
            + width + "' y2='100' style='stroke:rgb(255,0,0);stroke-width:2'/>"));
    builder.append(
            SafeHtmlUtils.fromTrustedString("<line id='vertical' class='overlay' x1='100' y1='0' x2='100' y2='"
                    + height + "' style='stroke:rgb(255,0,0);stroke-width:2'/>"));
    builder.append(SafeHtmlUtils.fromTrustedString("</svg>"));
    final HTML html = new HTML(builder.toSafeHtml());
    html.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final Element targetElement = Element.as(event.getNativeEvent().getEventTarget());
            final Element parentElement = targetElement.getParentElement();
            if (!parentElement.getId().isEmpty()) {
                label.setText(parentElement.getId());
            } else {
                label.setText(targetElement.getId());
            }
            final Element horizontalLine = Document.get().getElementById("horizontal");
            final Element verticalLine = Document.get().getElementById("vertical");
            final Element svgElement = Document.get().getElementById("ocean");
            final int relativeX = event.getRelativeX(svgElement);
            final int relativeY = event.getRelativeY(svgElement);
            horizontalLine.setAttribute("y1", String.valueOf(relativeY));
            horizontalLine.setAttribute("y2", String.valueOf(relativeY));
            horizontalLine.setAttribute("x2", String.valueOf(width));
            verticalLine.setAttribute("x1", String.valueOf(relativeX));
            verticalLine.setAttribute("x2", String.valueOf(relativeX));
            verticalLine.setAttribute("y2", String.valueOf(height));
        }
    });
    verticalPanel.add(html);
    //        verticalPanel.add(new HTML(builder.toSafeHtml()));
    setContent(verticalPanel);
}

From source file:nl.ru.languageininteraction.synaesthesia.client.view.ColourPickerCanvasView.java

License:Open Source License

public ColourPickerCanvasView() throws CanvasError {
    setStylePrimaryName("stimulusScreen");
    final int clientHeight = Window.getClientHeight();
    final int clientWidth = Window.getClientWidth();
    final int minClient = (clientHeight > clientWidth) ? clientWidth : clientHeight;
    stimulusTextHeight = (int) (minClient * 0.08);
    selectedColourPanelHeight = (int) (minClient * 0.25);
    selectedColourPanelWidth = (int) (minClient * 0.47);
    buttonTextHeight = (int) (minClient * 0.05);
    buttonHeight = (int) (minClient * 0.1);
    buttonWidth = (int) (minClient * 0.47);
    stimulusPanel = new VerticalPanel();
    stimulusPanel.addStyleName("stimulusPanel");
    stimulusPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    outerGrid = new Grid(2, 2);
    innerGrid = new Grid(6, 2);
    pickerPanel = new Grid(1, 2);
    progressPanel = new Grid(1, 2);
    progressPanel.setWidth("100%");
    infoButton = new Button();
    infoButton.addStyleName("stimulusHelpButton");
    infoButton.getElement().getStyle().setFontSize(buttonTextHeight, Unit.PX);
    quitButton = new Button();
    quitButton.addStyleName("stimulusQuitButton");
    quitButton.getElement().getStyle().setFontSize(buttonTextHeight, Unit.PX);
    selectedColourPanel = new VerticalPanel();
    progressLabel = new Label();
    progressLabel.addStyleName("stimulusProgressLabel");
    mainCanvas = Canvas.createIfSupported();
    hueCanvas = Canvas.createIfSupported();

    if (mainCanvas == null || hueCanvas == null) {
        throw new CanvasError("Failed to create a canvas for the stimulus screen.");
    } else {/*from  w  ww . j  av  a2 s. c o m*/
        pickerPanel.setCellPadding(5);
        pickerPanel.setWidget(0, 0, mainCanvas);
        pickerPanel.setWidget(0, 1, hueCanvas);
        final Label selectedColourLabel = new Label("");
        selectedColourLabel.setHeight(selectedColourPanelHeight + "px");
        selectedColourLabel.setWidth(selectedColourPanelWidth + "px");
        selectedColourPanel.add(selectedColourLabel);
        mainCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
    }
    outerGrid.setWidget(0, 0, pickerPanel);
    add(outerGrid);
}

From source file:nl.strohalm.cyclos.mobile.client.ui.MainLayout.java

License:Open Source License

/**
 * Returns the available main screen/*w w w  . j  a v  a2  s . co m*/
 */
public int getMainHeight() {

    int menuHeight = 0;
    int bottomHeight = 0;
    if (page != null) {
        if (page.isDisplayMenu()) {
            menuHeight = menuContainer.getOffsetHeight();
        }
        if (actions != null && actions.size() > 0) {
            bottomHeight = bottomContainer.getOffsetHeight();
        }
    }

    int topHeight = topContainer.getOffsetHeight();
    int totalHeight = Window.getClientHeight();

    return totalHeight - topHeight - menuHeight - bottomHeight;
}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MappingList.java

License:Apache License

public static void doDialog(final LoginInfo loginInfo, final String packageName,
        final DialogCallback callback) {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(constants.mappingListLabelTitle(packageName));

    MappingList mappinglist = new MappingList(loginInfo, packageName, new DialogCallback() {

        @Override//from w w w  .j a  v  a2 s. c  om
        public void closed() {
            dialogBox.hide();
            callback.closed();
        }
    });

    mappinglist.setHeight(Window.getClientHeight() - 50 + "px");

    mappinglist.setWidth("500px");
    dialogBox.setWidget(mappinglist);
    dialogBox.center();
    dialogBox.show();
}

From source file:olanto.myTerm.client.ContainerPanels.ResultsContainerADMIN.java

License:Open Source License

public void adjustSize(float per_left, float per_right) {
    int h = Window.getClientHeight() - GuiConstant.ADMIN_HEADER_HEIGHT;
    int w = Window.getClientWidth() - GuiConstant.WIDTH_UNIT;
    sideRes.setPixelSize((int) (w * per_left), h);
    elementDetails.setPixelSize((int) (w * per_right), h);
}

From source file:olanto.myTerm.client.ContainerPanels.ResultsContainerBasic.java

License:Open Source License

public void adjustSize() {
    int h = Window.getClientHeight() - GuiConstant.HEADER_HEIGHT;
    int w = Window.getClientWidth() - GuiConstant.WIDTH_UNIT;
    sideRes.setPixelSize(w * 1 / 4, h);//from   w w  w. j  a  v  a2  s. com
    termsDetails.setPixelSize(w * 3 / 4, h * 5 / 6);
    conceptDetails.setPixelSize(w * 3 / 4, h * 1 / 6);
}

From source file:olanto.myTerm.client.ContainerPanels.ResultsContainerBasic.java

License:Open Source License

public void adjustSize(float s_widthper, float s_heightper) {
    int h = Window.getClientHeight() - GuiConstant.HEADER_HEIGHT;
    int w = Window.getClientWidth() - GuiConstant.WIDTH_UNIT;
    sideRes.setPixelSize((int) (w * s_widthper), h);
    termsDetails.setPixelSize((int) (w * (1 - s_widthper)), (int) (h * (1 - s_heightper)));
    conceptDetails.setPixelSize((int) (w * (1 - s_widthper)), (int) (h * s_heightper));
}