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

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

Introduction

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

Prototype

public void setHeight(double value, Unit unit) 

Source Link

Usage

From source file:fr.mncc.gwttoolbox.ui.client.LightBox.java

License:Open Source License

private void addColumnElem(int i, Element elem, int elemWidth, int elemHeight, int rowspan) {
    ImageSize newSize = fitWidth(elemWidth, elemHeight, 1 + Math.abs(rowspan));
    newSize.height_ -= (columnsHeight_[i] + newSize.height_ + margin_) % DELTA;

    Style elemStyle = elem.getStyle();
    elemStyle.setMarginLeft(extraMargin_ + margin_ + (columnsWidth_ + margin_) * (i + (rowspan == -1 ? -1 : 0)),
            Style.Unit.PX);/*from   w w w.j  a  v a  2  s . c  om*/
    elemStyle.setMarginTop(columnsHeight_[i], Style.Unit.PX);
    elemStyle.setWidth(newSize.width_, Style.Unit.PX);
    elemStyle.setHeight(newSize.height_, Style.Unit.PX);

    int nextHeight = columnsHeight_[i] + newSize.height_ + margin_;
    columnsHeight_[i + rowspan] = columnsHeight_[i] = nextHeight;
}

From source file:fr.putnami.pwt.core.widget.client.Affix.java

License:Open Source License

protected void toggleAffix(Affixed affix) {
    Element e = this.getElement();
    Style style = e.getStyle();

    if (this.affixed != affix) {
        this.clearElementStyle();
        this.affixed = affix;
        StyleUtils.addStyle(e, this.affixed);
    }/* w w w.ja  v  a2s .c o m*/

    switch (affix) {
    case AFFIX:
        style.setTop(this.offsetTop, Unit.PX);
        style.setWidth(this.offsetWidth, Unit.PX);
        style.setHeight(this.offsetHeight, Unit.PX);
        style.setZIndex(this.layerIndex);
        e.getParentElement().getStyle().setPaddingTop(this.offsetHeight, Unit.PX);
        break;
    case BOTTOM:
        int docHeigth = Document.get().getScrollHeight();
        int scrollTop = Window.getScrollTop();

        int bottom = this.offsetBottom - (docHeigth - scrollTop - this.clientHeigth);
        if (this.fixBottom != Integer.MIN_VALUE) {
            bottom = Math.max(bottom, this.fixBottom);
        }
        style.setPosition(Position.FIXED);
        style.setBottom(bottom, Unit.PX);
        style.setWidth(this.offsetWidth, Unit.PX);
        style.setHeight(this.offsetHeight, Unit.PX);
        style.setZIndex(this.layerIndex);
        break;
    default:
        break;
    }
}

From source file:geogebra.web.gui.app.docklayout.LayoutImpl.java

License:Apache License

protected static DivElement createRuler(Unit widthUnit, Unit heightUnit) {
    DivElement ruler = Document.get().createDivElement();
    ruler.setInnerHTML(" ");
    Style style = ruler.getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(-32767);/* w  ww. ja  v  a 2s .c o  m*/

    // Position the ruler off the top edge, double the size just to be
    // extra sure it doesn't show up on the screen.
    style.setTop(-20, heightUnit);

    // Note that we are making the ruler element 10x10, because some browsers
    // generate non-integral ratios (e.g., 1em == 13.3px), so we need a little
    // extra precision.
    style.setWidth(10, widthUnit);
    style.setHeight(10, heightUnit);

    style.setVisibility(Visibility.HIDDEN);
    State.HIDDEN.set(ruler, true);
    return ruler;
}

From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java

License:Apache License

protected void setCutOutStyle() {
    Style style = getElement().getStyle();
    style.setWidth(100, Unit.PCT);/*from  w w w. j a va  2  s  .c  om*/
    style.setHeight(100, Unit.PCT);
    style.setPosition(Position.FIXED);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setZIndex(10000);

    focusElement.setClassName(AddinsCssName.MATERIAL_CUTOUT_FOCUS);
    style = focusElement.getStyle();
    style.setProperty("content", "\'\'");
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(-1);
}

From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java

License:Apache License

/**
 * Gets the computed background color, based on the backgroundColor CSS
 * class.//from www.  ja v a2s . co  m
 */
protected void setupComputedBackgroundColor() {
    // temp is just a widget created to evaluate the computed background
    // color
    MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
    temp.setBackgroundColor(backgroundColor);

    // setting a style to make it invisible for the user
    Style style = temp.getElement().getStyle();
    style.setPosition(Position.FIXED);
    style.setWidth(1, Unit.PX);
    style.setHeight(1, Unit.PX);
    style.setLeft(-10, Unit.PX);
    style.setTop(-10, Unit.PX);
    style.setZIndex(-10000);

    // adding it to the body (on Chrome the component must be added to the
    // DOM before getting computed values).
    String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor);

    // convert rgb to rgba, considering the opacity field
    if (opacity < 1 && computed.startsWith("rgb(")) {
        computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")");
    }

    computedBackgroundColor = computed;
}

From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java

License:Apache License

public MaterialCutOut() {
    super(Document.get().createDivElement());
    focus = Document.get().createDivElement();
    getElement().appendChild(focus);/*from ww w. j  a v  a2 s. c  o  m*/

    setStyleName("material-cutout");
    Style style = getElement().getStyle();
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setPosition(Position.FIXED);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setOverflow(Overflow.HIDDEN);
    style.setZIndex(10000);
    style.setDisplay(Display.NONE);

    focus.setClassName("material-cutout-focus");
    style = focus.getStyle();
    style.setProperty("content", "\'\'");
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(-1);
}

From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java

License:Apache License

/**
 * Gets the computed background color, based on the backgroundColor CSS
 * class.//from  w w w.  ja  v a  2  s.co  m
 */
private void setupComputedBackgroundColor() {
    // temp is just a widget created to evaluate the computed background
    // color
    MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
    temp.setBackgroundColor(backgroundColor);

    // setting a style to make it invisible for the user
    Style style = temp.getElement().getStyle();
    style.setPosition(Position.FIXED);
    style.setWidth(1, Unit.PX);
    style.setHeight(1, Unit.PX);
    style.setLeft(-10, Unit.PX);
    style.setTop(-10, Unit.PX);
    style.setZIndex(-10000);

    // adding it to the body (on Chrome the component must be added to the
    // DOM before getting computed values).
    String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor);

    // convert rgb to rgba, considering the opacity field
    if (opacity < 1 && computed.startsWith("rgb(")) {
        computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")");
    }

    computedBackgroundColor = computed;
}

From source file:ilarkesto.gwt.client.desktop.ASidebarWidget.java

License:Open Source License

@Override
public final Updatable update() {
    container.clear();/*from www .j a v  a 2 s . co m*/
    container.getElement().getStyle().setWidth(WIDTH - (Widgets.defaultSpacing * 2), Unit.PX);
    container.getElement().getStyle().setHeight(100, Unit.PCT);
    container.getElement().getStyle().setPosition(Position.FIXED);
    container.getElement().getStyle().setPadding(Widgets.defaultSpacing, Unit.PX);

    wrapper.getElement().setId("SidebarWidget");
    Style style = wrapper.getElement().getStyle();
    style.setWidth(WIDTH, Unit.PX);
    style.setHeight(100, Unit.PCT);
    style.setDisplay(Display.NONE);

    onUpdate();
    return this;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget verticalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setWidth(100, Unit.PCT);/*from   w ww .jav a2 s.  co m*/
    style.setHeight(1, Unit.PX);
    style.setBackgroundColor("#eeeeee");
    style.setMarginTop(margin, Unit.PX);
    style.setMarginBottom(margin, Unit.PX);
    return spacer;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget horizontalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setFloat(Float.LEFT);/*from  ww  w  .  ja  v  a 2 s  .  co  m*/
    style.setWidth(1, Unit.PX);
    style.setHeight(100, Unit.PCT);
    style.setBackgroundColor("#999999");
    style.setMarginLeft(margin, Unit.PX);
    style.setMarginRight(margin, Unit.PX);
    return spacer;
}