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

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

Introduction

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

Prototype

public void clearLeft() 

Source Link

Usage

From source file:burrito.client.widgets.form.EditForm.java

License:Apache License

public void makeButtonsStick(boolean stick) {
    getElement().getStyle().setPropertyPx("minHeight", getOffsetHeight());
    Style style = buttonWrapper.getElement().getStyle();
    buttonWrapper.addStyleName("k5-EditForm-fixedButtons");
    if (stick) {//from w  ww.ja v  a 2s  .c o  m
        style.setPosition(Position.FIXED);
        style.setBottom(0, Unit.PX);
        style.setLeft(getAbsoluteLeft(), Unit.PX);
        style.setWidth(getOffsetWidth(), Unit.PX);
    } else {
        style.clearPosition();
        style.clearBottom();
        style.clearLeft();
        style.clearWidth();
    }

}

From source file:com.alkacon.acacia.client.ui.AttributeValueView.java

License:Open Source License

/**
 * Removes the drag helper styles from the given element.<p>
 * /*from w w  w  .  j av a 2  s . c  o m*/
 * @param helper the helper element
 */
private void removeDragHelperStyles(Element helper) {

    Style style = helper.getStyle();
    style.clearTop();
    style.clearLeft();
    style.clearPosition();
    style.clearWidth();
    helper.removeClassName(formCss().dragHelper());
}

From source file:com.dianaui.universal.core.client.ui.DateTimePicker.java

License:Apache License

@Override
public void setVisible(final boolean visible) {
    Style style = container.getElement().getStyle();

    if (visible) {
        style.setDisplay(Style.Display.BLOCK);
        style.setZIndex(9999);/*ww  w . ja  v a  2  s.  c o m*/
        style.setPosition(Style.Position.ABSOLUTE);
        style.setProperty("right", "auto");
    } else {
        super.setVisible(false);

        style.clearDisplay();
        style.clearZIndex();
        style.clearPosition();
        style.clearTop();
        style.clearLeft();
    }
}

From source file:com.google.appinventor.client.editor.simple.components.MockImageBase.java

License:Open Source License

private void unclipImage() {
    Style style = image.getElement().getStyle();
    style.clearLeft();
    style.clearTop();//w  ww .j  a  va2s  .c o m
    style.clearWidth();
    style.clearHeight();
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgrouplayout.CubaFieldGroupLayoutComponentSlot.java

License:Apache License

@Override
public void positionHorizontally(double currentLocation, double allocatedSpace, double marginRight) {
    if (!isCaptionInline()) {
        super.positionHorizontally(currentLocation, allocatedSpace, marginRight);
        return;/*from   w ww .java  2 s .  com*/
    }

    // CAUTION copied from VLayoutSlot.positionHorizontally(~)

    Style style = wrapper.getStyle();

    double availableWidth = allocatedSpace;

    VCaption caption = getCaption();
    Style captionStyle = caption != null ? caption.getElement().getStyle() : null;
    int captionWidth = getCaptionWidth();

    boolean clearCaptionRight = false;

    boolean captionAboveCompnent;
    if (caption == null) {
        captionAboveCompnent = false;
        style.clearPaddingLeft();

        clearCaptionRight = true;
    } else {
        captionAboveCompnent = !caption.shouldBePlacedAfterComponent();
        if (!captionAboveCompnent) {
            availableWidth -= captionWidth;
            if (availableWidth < 0) {
                availableWidth = 0;
            }
            captionStyle.clearLeft();
            captionStyle.setRight(0, Style.Unit.PX);
            style.setPaddingRight(captionWidth, Style.Unit.PX);
        } else {
            availableWidth -= captionWidth;
            if (availableWidth < 0) {
                availableWidth = 0;
            }
            style.setPaddingLeft(captionWidth, Style.Unit.PX);
            captionStyle.setLeft(0, Style.Unit.PX);
            captionStyle.clearRight();

            clearCaptionRight = true;
        }
    }

    // Take into account right indicators
    double indicatorsWidth = 0;
    if (rightCaption != null) {
        indicatorsWidth = WidgetUtil.getRequiredWidth(rightCaption);
        availableWidth -= indicatorsWidth;
        if (availableWidth < 0) {
            availableWidth = 0;
        }
        style.setPaddingRight(indicatorsWidth, Style.Unit.PX);
    } else if (clearCaptionRight) {
        style.clearPaddingRight();
    }

    if (marginRight > 0) {
        style.setMarginRight(marginRight, Style.Unit.PX);
    } else {
        style.clearMarginRight();
    }

    if (isRelativeWidth()) {
        style.setPropertyPx("width", (int) availableWidth);
    } else {
        style.clearProperty("width");
    }

    double allocatedContentWidth = 0;
    if (isRelativeWidth()) {
        String percentWidth = getWidget().getElement().getStyle().getWidth();
        double percentage = parsePercent(percentWidth);
        allocatedContentWidth = availableWidth * (percentage / 100);
        reportActualRelativeWidth(Math.round((float) allocatedContentWidth));
    }

    AlignmentInfo alignment = getAlignment();
    if (!alignment.isLeft()) {
        double usedWidth;
        if (isRelativeWidth()) {
            if (isCaptionInline()) {
                usedWidth = allocatedContentWidth + indicatorsWidth + captionWidth;
            } else {
                usedWidth = allocatedContentWidth + indicatorsWidth;
            }
        } else {
            usedWidth = getWidgetWidth() + indicatorsWidth;
        }
        if (alignment.isHorizontalCenter()) {
            currentLocation += (allocatedSpace - usedWidth) / 2d;
            if (captionAboveCompnent) {
                captionStyle.setLeft(Math.round(usedWidth - captionWidth) / 2, Style.Unit.PX);
            }
        } else {
            currentLocation += (allocatedSpace - usedWidth);
            if (captionAboveCompnent) {
                captionStyle.setLeft(Math.round(usedWidth - captionWidth), Style.Unit.PX);
            }
        }
    } else {
        if (captionAboveCompnent) {
            captionStyle.setLeft(0, Style.Unit.PX);
        }
    }

    style.setLeft(Math.round(currentLocation), Style.Unit.PX);
}

From source file:com.vaadin.client.ui.calendar.schedule.DateCellDayEvent.java

License:Apache License

private void cancelMouseMove() {
    mouseMoveCanceled = true;/*  w  w  w  .  ja  va 2 s  . c om*/

    // reset and remove everything related to the event handling
    Event.releaseCapture(getElement());
    setFocus(false);

    if (moveRegistration != null) {
        moveRegistration.removeHandler();
        moveRegistration = null;
    }

    mouseMoveStarted = false;
    removeGlobalResizeStyle();

    Style s = getElement().getStyle();
    s.setZIndex(1);

    // reset the position of the event
    int dateCellWidth = getDateCellWidth();
    int dayOffset = startXrelative / dateCellWidth;
    s.clearLeft();

    calendarEvent.setStartTime(startDatetimeFrom);
    calendarEvent.setEndTime(startDatetimeTo);

    long startFromMinutes = (startDatetimeFrom.getHours() * 60) + startDatetimeFrom.getMinutes();
    long range = calendarEvent.getRangeInMinutes();

    startFromMinutes = calculateStartFromMinute(startFromMinutes, startDatetimeFrom, startDatetimeTo,
            dayOffset);
    if (startFromMinutes < 0) {
        range += startFromMinutes;
    }

    updatePosition(startFromMinutes, range);

    startY = -1;
    startX = -1;

    // to reset the event width
    ((DateCell) getParent()).recalculateEventWidths();
}

From source file:com.vaadin.client.ui.layout.VLayoutSlot.java

License:Apache License

public void positionHorizontally(double currentLocation, double allocatedSpace, double marginRight) {
    Style style = wrapper.getStyle();

    double availableWidth = allocatedSpace;

    VCaption caption = getCaption();/*from ww w .  j ava  2  s  .com*/
    Style captionStyle = caption != null ? caption.getElement().getStyle() : null;
    int captionWidth = getCaptionWidth();

    boolean captionAboveCompnent;
    if (caption == null) {
        captionAboveCompnent = false;
        style.clearPaddingRight();
    } else {
        captionAboveCompnent = !caption.shouldBePlacedAfterComponent();
        if (!captionAboveCompnent) {
            availableWidth -= captionWidth;
            if (availableWidth < 0) {
                availableWidth = 0;
            }
            captionStyle.clearLeft();
            captionStyle.setRight(0, Unit.PX);
            style.setPaddingRight(captionWidth, Unit.PX);
        } else {
            captionStyle.setLeft(0, Unit.PX);
            captionStyle.clearRight();
            style.clearPaddingRight();
        }
    }

    if (marginRight > 0) {
        style.setMarginRight(marginRight, Unit.PX);
    } else {
        style.clearMarginRight();
    }

    style.setPropertyPx("width", (int) availableWidth);

    double allocatedContentWidth = 0;
    if (isRelativeWidth()) {
        String percentWidth = getWidget().getElement().getStyle().getWidth();
        double percentage = parsePercent(percentWidth);
        allocatedContentWidth = availableWidth * (percentage / 100);
        reportActualRelativeWidth(Math.round((float) allocatedContentWidth));
    }

    style.setLeft(Math.round(currentLocation), Unit.PX);
    AlignmentInfo alignment = getAlignment();
    if (!alignment.isLeft()) {
        double usedWidth;
        if (isRelativeWidth()) {
            usedWidth = allocatedContentWidth;
        } else {
            usedWidth = getWidgetWidth();
        }

        double padding = (allocatedSpace - usedWidth);
        if (alignment.isHorizontalCenter()) {
            padding = padding / 2;
        }

        long roundedPadding = Math.round(padding);
        if (captionAboveCompnent) {
            captionStyle.setLeft(roundedPadding, Unit.PX);
        }
        widget.getElement().getStyle().setLeft(roundedPadding, Unit.PX);
    } else {
        if (captionAboveCompnent) {
            captionStyle.setLeft(0, Unit.PX);
        }
        // Reset left when changing back to align left
        widget.getElement().getStyle().clearLeft();
    }

}

From source file:com.vaadin.client.ui.VGridLayout.java

License:Apache License

@Override
public boolean remove(Widget w) {
    boolean removed = super.remove(w);
    if (removed) {
        Cell cell = widgetToCell.remove(w);
        if (cell != null) {
            cell.slot.setCaption(null);/*from ww  w  . ja v a  2s.  c o m*/
            cell.slot.getWrapperElement().removeFromParent();
            cell.slot = null;
            Style style = w.getElement().getStyle();
            style.clearTop();
            style.clearLeft();
            style.clearPosition();

            if (cells.length < cell.col && cells.length != 0 && cells[0].length < cell.row
                    && cells[cell.col][cell.row] == cell) {
                cells[cell.col][cell.row] = null;
            }
        }
    }
    return removed;
}

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();//from ww w .  j av  a2  s .c o  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:geogebra.web.gui.app.docklayout.LayoutImpl.java

License:Apache License

public void removeChild(Element container, Element child) {
    container.removeFromParent();/*w  w w.j av a2 s. c om*/

    // We want this code to be resilient to the child having already been
    // removed from its container (perhaps by widget code).
    if (child.getParentElement() == container) {
        child.removeFromParent();
    }

    // Cleanup child styles set by fillParent().
    Style style = child.getStyle();
    style.clearPosition();
    style.clearLeft();
    style.clearTop();
    style.clearWidth();
    style.clearHeight();
}