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

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

Introduction

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

Prototype

public void setTop(double value, Unit unit) 

Source Link

Usage

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);/*from w  w w .  ja va  2s . co 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:geogebra.web.gui.app.docklayout.LayoutImpl.java

License:Apache License

public void fillParent(Element elem) {
    Style style = elem.getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setLeft(0, PX);/*ww  w  .  j av  a 2s  .  c o  m*/
    style.setTop(0, PX);
    style.setRight(0, PX);
    style.setBottom(0, PX);
}

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

License:Apache License

public void layout(Layer layer) {
    Style style = layer.container.getStyle();

    if (layer.visible) {
        style.clearDisplay();/* w  w w  .j a va2 s  . co m*/
    } else {
        style.setDisplay(Display.NONE);
    }

    style.setProperty("left", layer.setLeft ? (layer.left + layer.leftUnit.getType()) : "");
    style.setProperty("top", layer.setTop ? (layer.top + layer.topUnit.getType()) : "");
    style.setProperty("right", layer.setRight ? (layer.right + layer.rightUnit.getType()) : "");
    style.setProperty("bottom", layer.setBottom ? (layer.bottom + layer.bottomUnit.getType()) : "");
    style.setProperty("width", layer.setWidth ? (layer.width + layer.widthUnit.getType()) : "");
    style.setProperty("height", layer.setHeight ? (layer.height + layer.heightUnit.getType()) : "");

    style = layer.child.getStyle();
    switch (layer.hPos) {
    case BEGIN:
        style.setLeft(0, Unit.PX);
        style.clearRight();
        break;
    case END:
        style.clearLeft();
        style.setRight(0, Unit.PX);
        break;
    case STRETCH:
        style.setLeft(0, Unit.PX);
        style.setRight(0, Unit.PX);
        break;
    }

    switch (layer.vPos) {
    case BEGIN:
        style.setTop(0, Unit.PX);
        style.clearBottom();
        break;
    case END:
        style.clearTop();
        style.setBottom(0, Unit.PX);
        break;
    case STRETCH:
        style.setTop(0, Unit.PX);
        style.setBottom(0, Unit.PX);
        break;
    }
}

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);//  w  w  w  .  j av a  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   w  w w  .  j ava  2s  .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);/*w  w  w  .  j ava 2  s  . c om*/

    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.//w w  w.j  a v a 2 s .c o  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:info.magnolia.ui.vaadin.gwt.client.richtext.TextAreaStretcherConnector.java

License:Open Source License

private void updateSize() {
    if (!getState().isCollapsed) {
        stretchControl.replaceClassName("icon-open-fullscreen-2", "icon-close-fullscreen-2");
        stretchControl.replaceClassName(COLLAPSED, STRETCHED);
        form.asWidget().addStyleName("textarea-stretched");

        Style style = textWidget.getElement().getStyle();
        style.setPosition(Style.Position.ABSOLUTE);
        Element header = getDialogHeaderElement();
        ComputedStyle headerCS = new ComputedStyle(header);

        int top = form.getAbsoluteTop() - dialog.getAbsoluteTop();
        top = isOverlay ? top : top + headerCS.getPadding()[0] + headerCS.getPadding()[2];

        int left = isOverlay ? 0 : form.getAbsoluteLeft();

        style.setLeft(left, Style.Unit.PX);
        style.setTop(top, Style.Unit.PX);

        stretchTextArea(style);//from w w  w .  j  a  v  a  2  s.  com
        style.setZIndex(5);

        if (!isOverlay && !isRichTextEditor) {
            stretchControl.getStyle().setTop(top + 5, Style.Unit.PX);
            stretchControl.getStyle().setLeft(
                    left + textWidget.getOffsetWidth() - stretchControl.getOffsetWidth() - 5, Style.Unit.PX);

        }

        hideOtherStretchers();
    } else {
        stretchControl.replaceClassName(STRETCHED, COLLAPSED);
        stretchControl.replaceClassName("icon-close-fullscreen-2", "icon-open-fullscreen-2");
        form.asWidget().removeStyleName(TEXTAREA_STRETCHED);
        clearTraces();
    }
}

From source file:jetbrains.jetpad.cell.toDom.CellContainerToDomMapper.java

License:Apache License

private void refreshLineHighlight() {
    if (myLineHighlightUpToDate || !isAttached())
        return;/*from  ww  w. j a  va  2  s.  co  m*/
    Cell current = getSource().focusedCell.get();
    for (Element e : Arrays.asList(myLineHighlight1, myLineHighlight2)) {
        Style style = e.getStyle();
        if (current == null || !Cells.isLeaf(current)) {
            style.setVisibility(Style.Visibility.HIDDEN);
        } else {
            int deltaTop = myContent.getAbsoluteTop() - getTarget().getAbsoluteTop();
            style.setVisibility(Style.Visibility.VISIBLE);
            int rootTop = myContent.getAbsoluteTop();
            final Element currentElement = getElement(current);
            int currentTop = currentElement.getAbsoluteTop();
            style.setTop(currentTop - rootTop + deltaTop, Style.Unit.PX);
            style.setHeight(currentElement.getClientHeight(), Style.Unit.PX);
            if (e == myLineHighlight2) {
                style.setWidth(0, Style.Unit.PX);
                style.setWidth(getTarget().getScrollWidth(), Style.Unit.PX);
            }
        }
    }
    myLineHighlightUpToDate = true;
}

From source file:jetbrains.jetpad.cell.toDom.PopupPositioner.java

License:Apache License

private void setPosition(Element child, int left, int top) {
    Style style = child.getStyle();
    style.setLeft(left - myContext.rootElement.getAbsoluteLeft(), Style.Unit.PX);
    style.setTop(top - myContext.rootElement.getAbsoluteTop(), Style.Unit.PX);
}