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:com.risevision.ui.client.presentation.common.HtmlEditorWidget.java

License:Open Source License

private void resize() {
    this.setWidth(Math.max(Window.getClientWidth() - 31, 200) + "px");

    this.setHeight(Math.max(CommonHeaderController.getContentHeight() - 50, 50) + "px");

    refresh();/*from   w  ww. j a  va 2 s  .  c  o  m*/
}

From source file:com.risevision.ui.client.presentation.placeholder.PlaceholderManageWidget.java

License:Open Source License

private void movePopup(int leftMove) {
    int left;//from  www  .jav a2  s.co m
    left = (int) (getAbsoluteLeft() + ((Window.getClientWidth() / 100.0) * leftMove));

    left = left < 0 ? 0 : left;

    setPopupPosition(left, 0);
}

From source file:com.risevision.ui.client.presentation.placeholder.PlaylistItemManageWidget.java

License:Open Source License

private void movePopup(int leftMove) {
    int left;//from   ww w  . j  av  a2  s  . c  om
    left = (int) (getAbsoluteLeft() + ((Window.getClientWidth() / 100.0) * leftMove));

    left = left < 0 ? 0 : left;

    setPopupPosition(left, 5);
}

From source file:com.risevision.ui.client.presentation.PresentationLayoutWidget.java

License:Open Source License

protected void onLoad() {
    super.onLoad();

    resizeHandler = Window.addResizeHandler(new ResizeHandler() {
        @Override/*  www .  j ava  2s . c o  m*/
        public void onResize(ResizeEvent event) {
            getElement().getParentElement().getStyle().setPropertyPx("width",
                    (int) (Window.getClientWidth() - 31));
            getElement().getParentElement().getStyle().setPropertyPx("height",
                    CommonHeaderController.getContentHeight() - 50);

            resizeCanvas();
        }
    });
}

From source file:com.risevision.ui.client.presentation.PresentationLayoutWidget.java

License:Open Source License

public void initWidget(PresentationInfo presentation) {
    getElement().getStyle().setBackgroundColor("#DDDDDD");

    getElement().getParentElement().setPropertyString("className", "rdn-DeckPanel");
    getElement().getParentElement().getStyle().setPropertyPx("width", (int) (Window.getClientWidth() - 31));
    getElement().getParentElement().getStyle().setPropertyPx("height",
            (int) (CommonHeaderController.getContentHeight() - 50));
    getElement().getParentElement().getStyle().setBackgroundColor("#DDDDDD");
    getElement().getParentElement().getStyle().setOverflow(Overflow.AUTO);

    if (presentation == null || presentation.getPlaceholders() == null) {
        clear();/*w  ww .  j  a  v a2 s  .c  om*/
        return;
    }

    this.presentation = presentation;
    fixPlaceholderOrder(null);

    bindData();
}

From source file:com.risevision.ui.client.UiControlBinder.java

License:Open Source License

private void styleControls() {
    startFrame.getElement().getStyle().setHeight((int) (Window.getClientHeight() - 145), Unit.PX);
    startFrame.getElement().getStyle().setWidth((int) (Window.getClientWidth() - 29), Unit.PX);
    startFrame.getElement().getStyle().setBorderWidth(0, Unit.PX);
    startFrame.getElement().setAttribute("frameBorder", "0px");
    startFrame.getElement().setAttribute("allowTransparency", "true");

    contentDeckPanel.getElement().getStyle().setHeight(100, Unit.PCT);
}

From source file:com.risevision.viewer.client.controller.ViewerGadgetController.java

License:Open Source License

private String updateUrlParams(String urlParams) {
    int height, width;
    //      int top = 0, left = 0;
    urlParams = removeIdParameter(urlParams);
    //      urlParams = addVersionNumber(urlParams);

    if (placeholderInfo.getWidthUnits().equals("%")) {
        width = (int) ((placeholderInfo.getWidth() / 100.0) * Window.getClientWidth());
    } else {//w  w  w. j  a  v  a2  s  . c  o m
        width = (int) placeholderInfo.getWidth();
    }
    //         
    if (placeholderInfo.getHeightUnits().equals("%")) {
        height = (int) ((placeholderInfo.getHeight() / 100.0) * Window.getClientHeight());
    } else {
        height = (int) placeholderInfo.getHeight();
    }

    urlParams += "&up_rsW=" + width;
    urlParams += "&up_rsH=" + height;

    //"&pid=test1&up_id=test1"
    //      urlParams += "&pid=" + htmlName;
    urlParams += "&up_id=" + htmlName;
    //      urlParams += "&parent=" + URL.encodeQueryString(Window.Location.getHref());
    //      urlParams += ViewerEntryPoint.getDisplayId().isEmpty() ? "": "&up_displayid=" + ViewerEntryPoint.getDisplayId();

    urlParams = urlParams.replace("'", "\\'");

    return urlParams;
}

From source file:com.risevision.viewer.client.controller.ViewerPresentationController.java

License:Open Source License

private void addPresentation() {
    int height = Window.getClientHeight();
    int width = Window.getClientWidth();
    int top = 0, left = 0;
    //      double scale = ViewerUtils.getItemScale(item.getScale());

    //      height = (int)(Window.getClientHeight() * scale);
    //      width = (int)(Window.getClientWidth() * scale);

    //        top = ViewerUtils.getPositionTop(item.getPosition(), 0, Window.getClientHeight(), height);
    //        left = ViewerUtils.getPositionLeft(item.getPosition(), 0, Window.getClientWidth(), width);

    if (items.get(0).getType().equals(PlaylistItemInfo.TYPE_PRESENTATION)) {
        ViewerHtmlUtils.addPresentation(htmlName, containerName, width, height, top, left,
                presentation.getLayout(), presentation.getWidth() + presentation.getWidthUnits(),
                presentation.getHeight() + presentation.getHeightUnits(),
                (presentation.getHidePointer() && ViewerEntryPoint.isDisplay()),
                !ViewerEntryPoint.isDisplay() && !ViewerEntryPoint.isEmbed());

        // set presentation size in the entry point to make it available for Embed IFrame size
        ViewerEntryPoint.setPresentationSize(presentation.getWidth(), presentation.getHeight());
    } else {// www  . j a  v a2 s .c  o  m
        ViewerHtmlUtils.addUrl(htmlName, containerName, width, height, top, left, items.get(0).getObjectRef());
    }

    // Timer that will cut loading to a maximum of 20 seconds.
    readyTimer.schedule(20 * 1000);

    status = ADDED_STATUS;
}

From source file:com.risevision.viewer.client.controller.ViewerScheduleController.java

License:Open Source License

private void onWindowResize() {
    int height = Window.getClientHeight();
    int width = Window.getClientWidth();
    //      double scale = ViewerUtils.getItemScale(schedule.getScale());

    //      height = (int)(Window.getClientHeight() * scale);
    //      width = (int)(Window.getClientWidth() * scale);

    //      ViewerHtmlUtils.resizeContainer("sc" + thisCount, width, height);
    for (int i = 0; i < presentations.size(); i++) {
        //         ViewerHtmlUtils.resizeContainer("sc" + thisCount + "_pre" + i, width, height);

        // [ad] bug fix - automatically re-size URL iframe size as well
        if (items.get(i).getType().equals(PlaylistItemInfo.TYPE_URL)) {
            ViewerHtmlUtils.resizeContainer("iFrame_sc" + thisCount + "_pre" + i, width, height);
        }//from  w w  w . j av  a2s. c  om
    }
}

From source file:com.risevision.viewer.client.controller.ViewerWidgetController.java

License:Open Source License

private String updateUrlParams(String urlParams) {
    int height, width;
    //      int top = 0, left = 0;
    //      urlParams = removeIdParameter(urlParams);
    //      urlParams = addVersionNumber(urlParams);

    if (placeholderInfo.getWidthUnits().equals("%")) {
        width = (int) ((placeholderInfo.getWidth() / 100.0) * Window.getClientWidth());
    } else {/*from w  w w .ja v  a 2  s .  c om*/
        width = (int) placeholderInfo.getWidth();
    }

    if (placeholderInfo.getHeightUnits().equals("%")) {
        height = (int) ((placeholderInfo.getHeight() / 100.0) * Window.getClientHeight());
    } else {
        height = (int) placeholderInfo.getHeight();
    }

    //"&pid=test1&up_id=test1"
    //      urlParams += "&pid=" + htmlName;
    urlParams += urlParams.contains("?") ? "&" : "?";
    urlParams += "up_id=" + htmlName;
    urlParams += "&parent=" + URL.encodeQueryString(Window.Location.getHref());
    urlParams += "&up_rsW=" + width;
    urlParams += "&up_rsH=" + height;

    String displayId = ViewerEntryPoint.getDisplayId();
    if (displayId != null && !displayId.isEmpty()) {
        urlParams += "&up_displayId=" + displayId;
    }

    urlParams = urlParams.replace("'", "\\'");

    return urlParams;
}