Example usage for com.google.gwt.user.client.ui Widget setSize

List of usage examples for com.google.gwt.user.client.ui Widget setSize

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget setSize.

Prototype

public void setSize(String width, String height) 

Source Link

Document

Sets the object's size.

Usage

From source file:org.pepstock.jem.gwt.client.panels.Administration.java

License:Open Source License

@Override
public void onResize(int availableWidth, int availableHeight) {
    setSize(Sizes.toString(availableWidth), Sizes.toString(availableHeight));

    int desiredWidth = availableWidth
            - (resized ? options.getOffsetWidth() : Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE)
            - Sizes.SPLIT_PANEL_SEPARATOR;
    int desiredHeight = availableHeight;

    for (Widget w : viewStack.getWidgets()) {
        w.setSize(Sizes.toString(desiredWidth), Sizes.toString(desiredHeight));
        if (w instanceof ResizeCapable) {
            ((ResizeCapable) w).onResize(desiredWidth, desiredHeight);
        }//from  w  ww. j a v  a 2 s.  c o  m
    }
}

From source file:org.pepstock.jem.gwt.client.panels.Gfs.java

License:Open Source License

@Override
public void onResize(int availableWidth, int availableHeight) {
    setSize(Sizes.toString(availableWidth), Sizes.toString(availableHeight));

    int desiredWidth = availableWidth
            - (resized ? options.getOffsetWidth() : Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE)
            - Sizes.SPLIT_PANEL_SEPARATOR;
    int desiredHeight = availableHeight;

    for (Widget w : viewStack.getWidgets()) {
        w.setSize(Sizes.toString(desiredWidth), Sizes.toString(desiredHeight));
        if (w instanceof ResizeCapable) {
            ((ResizeCapable) w).onResize(desiredWidth, desiredHeight);
        }//from ww  w .  ja va 2  s .  c  o m
    }

}

From source file:org.pepstock.jem.gwt.client.panels.roles.inspector.PermissionsPanel.java

License:Open Source License

@Override
public void onResize(int availableWidth, int availableHeight) {
    this.setWidth(Sizes.toString(availableWidth));
    this.setHeight(Sizes.toString(availableHeight));

    int desiredWidth = availableWidth - Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE - Sizes.SPLIT_PANEL_SEPARATOR
            - viewStack.getSpacing() - viewStack.getSpacing();// spacing 
    int desiredHeight = availableHeight - viewStack.getSpacing() - viewStack.getSpacing(); //spacing
    desiredHeight -= InputPanel.LABEL_HEIGHT;

    options.setSize(Sizes.toString(Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE), Sizes.toString(desiredHeight));
    for (Widget w : viewStack.getWidgets()) {
        w.setSize(Sizes.toString(desiredWidth), Sizes.toString(desiredHeight));
        if (w instanceof ResizeCapable) {
            ((ResizeCapable) w).onResize(desiredWidth, desiredHeight);
        }//w w w . j  a v a  2s  . c  om
    }
}

From source file:org.rstudio.studio.client.common.vcs.ignore.IgnoreDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    VerticalPanel verticalPanel = new VerticalPanel();

    verticalPanel.add(dirChooser_);//from   w ww .  ja  v a 2  s.  c om

    verticalPanel.add(ignoresCaption_);

    final String aceWidth = "400px";
    final String aceHeight = "300px";

    Widget editorWidget = editor_.getWidget();
    editorWidget.setSize(aceWidth, aceHeight);

    SimplePanel panel = new SimplePanel();
    panel.addStyleName(RES.styles().editorFrame());
    panel.setSize(aceWidth, aceHeight);
    panel.setWidget(editor_.getWidget());
    verticalPanel.add(panel);

    return verticalPanel;
}

From source file:org.rstudio.studio.client.workbench.ui.DelayLoadTabShim.java

License:Open Source License

@Override
protected void onDelayLoadSuccess(T obj) {
    super.onDelayLoadSuccess(obj);
    final Widget child = obj.asWidget();

    if (child instanceof HasEnsureVisibleHandlers) {
        ((HasEnsureVisibleHandlers) child).addEnsureVisibleHandler(new EnsureVisibleHandler() {
            public void onEnsureVisible(EnsureVisibleEvent event) {
                parentTab_.ensureVisible(event.getActivate());
            }/*from  w  w w . j av a2s. co m*/
        });
    }

    if (child instanceof HasEnsureHeightHandlers) {
        ((HasEnsureHeightHandlers) child).addEnsureHeightHandler(new EnsureHeightHandler() {
            @Override
            public void onEnsureHeight(EnsureHeightEvent event) {
                parentTab_.ensureHeight(event.getHeight());
            }
        });
    }

    if (child instanceof HasEnsureHiddenHandlers) {
        ((HasEnsureHiddenHandlers) child).addEnsureHiddenHandler(new EnsureHiddenHandler() {
            public void onEnsureHidden(EnsureHiddenEvent event) {
                parentTab_.ensureHidden();
            }
        });
    }

    child.setSize("100%", "100%");
    parentTab_.getPanel().add(child);
}

From source file:org.rstudio.studio.client.workbench.views.edit.ui.EditDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    // create widget and set size
    Widget editWidget = editor_.getWidget();
    Size size = DomMetrics.adjustedCodeElementSize(sourceText_, 25, 100);
    if (!minimumSize_.isEmpty()) {
        size = new Size(Math.max(size.width, minimumSize_.width), Math.max(size.height, minimumSize_.height));
    }/*from   w  ww.  ja v  a 2  s  . co  m*/
    editWidget.setSize(size.width + "px", size.height + "px");

    editor_.setCode(sourceText_, false);
    if (isRCode_) {
        // NOTE: line wrapping is ignored for R code since it has its
        // own localized setting for enabled/disable of line wrapping

        editor_.setFileType(FileTypeRegistry.R);

        setEscapeDisabled(true);
    } else {
        editor_.setUseWrapMode(lineWrapping_);
        editor_.setShowLineNumbers(false);
    }

    // return the widget
    SimplePanel panel = new SimplePanel();
    panel.addStyleName("EditDialog");
    panel.setSize(size.width + "px", size.height + "px");
    panel.setWidget(editWidget);
    return panel;
}

From source file:org.rstudio.studio.client.workbench.views.vcs.console.ConsoleBarView.java

License:Open Source License

public ConsoleBarView() {
    Widget w = GWT.<MyBinder>create(MyBinder.class).createAndBindUi(this);
    w.setSize("100%", "100%");

    LeftCenterRightBorder border = new LeftCenterRightBorder(res_, -1, 3, 0, 3);
    border.setWidget(w);/*from   www  .  jav  a 2  s  .c  om*/

    LayoutPanel outer = new LayoutPanel();
    outer.getElement().getStyle().setBackgroundImage("url(" + res_.barTile().getURL() + ")");
    outer.getElement().getStyle().setProperty("backgroundRepeat", "repeat-x");
    outer.add(border);
    outer.setWidgetTopHeight(border, 3, Unit.PX, 18, Unit.PX);
    outer.setWidgetLeftRight(border, 3, Unit.PX, 21, Unit.PX);

    expand_ = new ClickImage(res_.chevronUp());
    outer.add(expand_);
    outer.setWidgetTopHeight(expand_, 6, Unit.PX, expand_.getHeight(), Unit.PX);
    outer.setWidgetRightWidth(expand_, 5, Unit.PX, expand_.getWidth(), Unit.PX);

    initWidget(outer);

    expand_.setResource(res_.chevronUp());
}

From source file:org.rstudio.studio.client.workbench.views.vcs.frame.VCSPopup.java

License:Open Source License

public static Controller show(final LayoutPanel swapContainer, final ReviewPresenter rpres,
        final HistoryPresenter hpres, boolean showHistory) {
    final Widget review = rpres.asWidget();
    review.setSize("100%", "100%");

    final Widget history = hpres.asWidget();
    history.setSize("100%", "100%");

    swapContainer.setSize("100%", "100%");
    swapContainer.add(review);//from  ww w .ja  v a  2  s .  c o  m
    swapContainer.setWidgetLeftRight(review, 0, Unit.PX, 0, Unit.PX);
    swapContainer.setWidgetTopBottom(review, 0, Unit.PX, 0, Unit.PX);
    swapContainer.add(history);
    swapContainer.setWidgetLeftRight(history, 0, Unit.PX, 0, Unit.PX);
    swapContainer.setWidgetTopBottom(history, 0, Unit.PX, 0, Unit.PX);

    if (showHistory) {
        swapContainer.setWidgetVisible(review, false);
        hpres.onShow();
    } else {
        swapContainer.setWidgetVisible(history, false);
        rpres.onShow();
    }

    // create a controller used to implement switch view and to return 
    final Controller controller = new Controller() {
        @Override
        public void switchToHistory(FileSystemItem fileFilter) {
            if (fileFilter != null)
                hpres.setFileFilter(fileFilter);

            hpres.onShow();
            swapContainer.setWidgetVisible(history, true);
            swapContainer.setWidgetVisible(review, false);
        }

        @Override
        public void switchToReview(ArrayList<StatusAndPath> selected) {
            if (selected != null)
                rpres.setSelectedPaths(selected);

            rpres.onShow();
            swapContainer.setWidgetVisible(review, true);
            swapContainer.setWidgetVisible(history, false);
        }

    };

    rpres.addSwitchViewHandler(new SwitchViewEvent.Handler() {
        @Override
        public void onSwitchView(SwitchViewEvent event) {
            controller.switchToHistory(null);
        }
    });
    hpres.addSwitchViewHandler(new SwitchViewEvent.Handler() {
        @Override
        public void onSwitchView(SwitchViewEvent event) {
            controller.switchToReview(null);
        }
    });

    return controller;
}

From source file:org.rstudio.studio.client.workbench.views.workspace.WorkspacePane.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    Widget objectsTableView = (Widget) objectsTable_.getView();
    objectsTableView.setSize("100%", "100%");
    objectsTableView.getElement().getStyle().setProperty("overflowX", "hidden");
    return objectsTableView;
}

From source file:org.utgenome.gwt.widget.client.Style.java

License:Apache License

public static void fullSize(Widget w) {
    w.setSize("100%", "100%");
}