Example usage for com.google.gwt.dom.client Style setWidth

List of usage examples for com.google.gwt.dom.client Style setWidth

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Style setWidth.

Prototype

public void setWidth(double value, Unit unit) 

Source Link

Usage

From source file:org.eclipse.che.ide.ui.window.CompositeWindowView.java

License:Open Source License

private void addModality() {
    windowFrameGlassPanel = new HTMLPanel("div", "");

    Style style = windowFrameGlassPanel.getElement().getStyle();
    style.setPosition(FIXED);//from  ww w .  j  ava 2  s.  c o m
    style.setWidth(100., PCT);
    style.setHeight(100., PCT);
    style.setTop(0., PX);
    style.setLeft(0., PX);

    RootPanel.get().add(windowFrameGlassPanel);
}

From source file:org.eclipse.swt.widgets.Text.java

License:Open Source License

@Override
public void setBounds(int x, int y, int width, int height) {
    if (textArea.isAttached()) {
        textArea.setFocus(true);/*from   w  w  w.  ja  va2s . c o  m*/
        textArea.setText(getText());
        Style textAreaStyle = textArea.getElement().getStyle();
        textAreaStyle.setProperty("resize", "none");
        textAreaStyle.setBorderStyle(BorderStyle.NONE);
        panel.setWidgetLeftWidth(textArea, x - 6, Unit.PX, width + 5, Unit.PX);
        panel.setWidgetTopHeight(textArea, y - 6, Unit.PX, height + 7, Unit.PX);
        textAreaStyle.setWidth(width + 5, Unit.PX);
        textAreaStyle.setHeight(height + 7, Unit.PX);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.ShelfPresenter.java

License:Open Source License

public void increaseGlassHeight(Element glass) {

    Style style = glass.getStyle();

    int winWidth = Window.getClientWidth();
    int winHeight = Window.getClientHeight();

    // Hide the glass while checking the document size. Otherwise it would
    // interfere with the measurement.
    style.setDisplay(Display.NONE);//from   ww  w  .  j  a  v  a  2  s  .co m
    style.setWidth(0, Unit.PX);
    style.setHeight(0, Unit.PX);

    int width = Document.get().getScrollWidth();
    int height = Document.get().getScrollHeight();

    // Set the glass size to the larger of the window's client size or the
    // document's scroll size.
    style.setWidth(Math.max(width, winWidth), Unit.PX);
    style.setHeight(Math.max(height, winHeight), Unit.PX);

    // The size is set. Show the glass again.
    style.setDisplay(Display.BLOCK);
}

From source file:org.guvnor.client.editors.GeneralTextEditorScreenView.java

License:Apache License

@PostConstruct
public void setup() {
    initWidget(editor);/*from w w  w. j a v  a  2 s.c o m*/

    final Style s = getElement().getStyle();
    s.setPosition(Style.Position.ABSOLUTE);
    s.setOverflow(Style.Overflow.HIDDEN);
    s.setTop(0.0, Style.Unit.PX);
    s.setLeft(0.0, Style.Unit.PX);
    s.setWidth(100.0, Style.Unit.PCT);
    s.setHeight(100.0, Style.Unit.PCT);

    editor.startEditor();
    editor.setTheme(AceEditorTheme.CLOUD9_NIGHT);
}

From source file:org.guvnor.client.editors.GeneralTextEditorScreenView.java

License:Apache License

@Override
public void onAttach() {
    super.onAttach();
    final Style s = editor.getElement().getParentElement().getStyle();
    s.setPosition(Style.Position.ABSOLUTE);
    s.setOverflow(Style.Overflow.HIDDEN);
    s.setTop(0.0, Style.Unit.PX);
    s.setLeft(0.0, Style.Unit.PX);
    s.setWidth(100.0, Style.Unit.PCT);
    s.setHeight(100.0, Style.Unit.PCT);
}

From source file:org.jbpm.dashboard.renderer.client.panel.widgets.MetricViewExt.java

License:Apache License

public void applySettings(DisplayerSettings displayerSettings) {
    this.displayerSettings = displayerSettings;
    int w = displayerSettings.getChartWidth();
    int h = displayerSettings.getChartHeight();
    int mtop = displayerSettings.getChartMarginTop();
    int mbottom = displayerSettings.getChartMarginBottom();
    int mleft = displayerSettings.getChartMarginLeft();
    int mright = displayerSettings.getChartMarginRight();

    // Hero panel (size)
    Style style = centerPanel.getElement().getStyle();
    style.setPadding(0, Style.Unit.PX);
    style.setWidth(w, Style.Unit.PX);
    style.setHeight(h, Style.Unit.PX);
    style.setTextAlign(Style.TextAlign.CENTER);
    style.setVerticalAlign(Style.VerticalAlign.MIDDLE);
    if (!StringUtils.isBlank(displayerSettings.getChartBackgroundColor())) {
        style.setBackgroundColor("#" + displayerSettings.getChartBackgroundColor());
    }/* w  w w  . ja va2 s  .  c o  m*/

    // Center panel (paddings)
    style = centerPanel.getElement().getStyle();
    style.setPaddingTop(mtop, Style.Unit.PX);
    style.setPaddingBottom(mbottom, Style.Unit.PX);
    style.setPaddingLeft(mleft, Style.Unit.PX);
    style.setPaddingRight(mright, Style.Unit.PX);

    // Title panel
    titlePanel.setVisible(displayerSettings.isTitleVisible());
    titlePanel.setText(displayerSettings.getTitle());
}

From source file:org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.dom.ListBoxDOMElement.java

License:Apache License

public ListBoxDOMElement(final ListBox widget, final GridLayer gridLayer, final GridWidget gridWidget,
        final SessionManager sessionManager,
        final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
        final Function<GridCellTuple, Command> hasNoValueCommand,
        final Function<GridCellValueTuple, Command> hasValueCommand) {
    super(widget, gridLayer, gridWidget);
    this.sessionManager = sessionManager;
    this.sessionCommandManager = sessionCommandManager;
    this.hasNoValueCommand = hasNoValueCommand;
    this.hasValueCommand = hasValueCommand;

    final Style style = widget.getElement().getStyle();
    style.setWidth(100, Style.Unit.PCT);

    getContainer().getElement().getStyle().setPaddingLeft(PADDING, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(PADDING, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingTop(PADDING, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingBottom(PADDING, Style.Unit.PX);
    getContainer().setWidget(widget);/*  w w  w . ja  v a 2s  .  c  o  m*/
}

From source file:org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.dom.TextAreaDOMElement.java

License:Apache License

public TextAreaDOMElement(final TextArea widget, final GridLayer gridLayer, final GridWidget gridWidget,
        final SessionManager sessionManager,
        final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
        final Function<GridCellTuple, Command> hasNoValueCommand,
        final Function<GridCellValueTuple, Command> hasValueCommand) {
    super(widget, gridLayer, gridWidget);
    this.sessionManager = sessionManager;
    this.sessionCommandManager = sessionCommandManager;
    this.hasNoValueCommand = hasNoValueCommand;
    this.hasValueCommand = hasValueCommand;

    final Style style = widget.getElement().getStyle();
    style.setWidth(100, Style.Unit.PCT);
    style.setHeight(100, Style.Unit.PCT);
    style.setPaddingLeft(2, Style.Unit.PX);
    style.setPaddingRight(2, Style.Unit.PX);
    style.setPaddingTop(2, Style.Unit.PX);
    style.setPaddingBottom(2, Style.Unit.PX);
    style.setFontSize(10, Style.Unit.PX);
    style.setProperty("resize", "none");

    getContainer().getElement().getStyle().setPaddingLeft(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingRight(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingTop(5, Style.Unit.PX);
    getContainer().getElement().getStyle().setPaddingBottom(5, Style.Unit.PX);
    getContainer().setWidget(widget);/*from w ww  .j  a  v  a  2  s  .c  om*/
}

From source file:org.komodo.web.client.panels.vdb.VdbEditPanel.java

License:Apache License

private Widget createObjectPropertiesPanel() {
    Style objPropPanelStyle = objectPropertiesPanel.getElement().getStyle();

    /*//from  w  ww.  j  a  v  a2  s.  co m
     * Want to position the properties panel so its always to the right
     * of the diagram panel, even when zoomed in. Float: left fails to
     * work at this point since zoom in enough and the properties
     * panel jumps down below.
     */

    /*
     * Set the position of the properties panel to absolute so that we
     * are now in charge of its location
     */
    objPropPanelStyle.setPosition(Position.ABSOLUTE);

    /*
     * Set its position as being on same level as diagram panel
     */
    objPropPanelStyle.setTop(0, Unit.EM);

    /*
     * Move it to the right of the diagram panel which is the
     * diagram panel width + border width + an extra 2 units
     * to account for the vertical scrollbar width
     */
    objPropPanelStyle.setLeft(DIAGRAM_PANEL_WIDTH + BORDER_WIDTH + 2, Unit.EM);

    /*
     * Set its width and height to appropriate values
     */
    objPropPanelStyle.setWidth((DIAGRAM_PANEL_WIDTH * 3) / 5, Unit.EM);
    objPropPanelStyle.setHeight(EDIT_PANEL_HEIGHT, Unit.EM);

    /*
     * Set its background colour to a subtle shade that just frames the panel
     */
    objPropPanelStyle.setBackgroundColor("#fAfAfA"); //$NON-NLS-1$

    /*
     * Set overflow to use scrollbars if required
     */
    objPropPanelStyle.setOverflow(Overflow.AUTO);

    /*
     * Add the title
     */
    Label propertyTitle = new Label("Property Editor"); //$NON-NLS-1$
    Style titleStyle = propertyTitle.getElement().getStyle();

    /*
     * Centre the title
     * Set its font size and make it bold
     * Set its height as this ensures a value we can know when
     * passing on the remaining content area to the sub panels, ie.
     * SUB_PANEL_HEIGHT = DIAGRAM_PANEL_HEIGHT
     *                                          - PROPERTY_TITLE_HEIGHT + (BORDER_WIDTH * 2)
     */
    titleStyle.setTextAlign(TextAlign.CENTER);
    titleStyle.setFontSize(1, Unit.EM);
    titleStyle.setFontWeight(FontWeight.BOLD);
    titleStyle.setLineHeight(PROPERTY_TITLE_HEIGHT, Unit.EM);
    titleStyle.setHeight(PROPERTY_TITLE_HEIGHT, Unit.EM);
    objectPropertiesPanel.add(propertyTitle);

    return objectPropertiesPanel;
}

From source file:org.nsesa.editor.gwt.core.client.ui.document.sourcefile.actionbar.ActionBarController.java

License:EUPL

/**
 * Adapts the position of this 'hoovering' toolbar to be placed just above the {@link OverlayWidget}.
 *//*from ww w  .  java  2 s.  com*/
public void adaptPosition(final Widget container) {
    // hide the panel with our creation elements
    actionBarCreatePanelController.getView().asWidget().setVisible(false);
    if (overlayWidget != null) {
        final Style style = view.asWidget().getElement().getStyle();
        final int coordinateY = overlayWidget.asWidget().getAbsoluteTop()
                - (view.asWidget().getOffsetHeight() - 1);
        style.setTop(coordinateY, Style.Unit.PX);
        style.setLeft(overlayWidget.asWidget().getAbsoluteLeft(), Style.Unit.PX);

        // we need to limit the width to make sure it does not
        final int width = (container.getOffsetWidth() + container.getAbsoluteLeft())
                - overlayWidget.asWidget().getAbsoluteLeft();
        style.setWidth((width), Style.Unit.PX);
        adaptVisibility();
    }
}