Example usage for com.google.gwt.dom.builder.shared StylesBuilder paddingLeft

List of usage examples for com.google.gwt.dom.builder.shared StylesBuilder paddingLeft

Introduction

In this page you can find the example usage for com.google.gwt.dom.builder.shared StylesBuilder paddingLeft.

Prototype

StylesBuilder paddingLeft(double value, Unit unit);

Source Link

Document

Set the padding-left css property.

Usage

From source file:org.roda.wui.common.client.widgets.wcag.AccessibleHeaderOrFooterBuilder.java

protected final void updatedRenderSortableHeader(ElementBuilderBase<?> out, Context context, Header<?> header,
        boolean isSorted, boolean isSortAscending) {
    ElementBuilderBase<?> headerContainer = out;

    // Wrap the header in a sort icon if sorted.
    boolean isSortedAndNotFooter = isSorted && !footer;
    if (isSortedAndNotFooter) {
        // Determine the position of the sort icon.
        boolean posRight = LocaleInfo.getCurrentLocale().isRTL() ? isSortIconStartOfLine()
                : !isSortIconStartOfLine();

        // Create an outer container to hold the icon and the header.
        int iconWidth = isSortAscending ? getTable().getResources().sortAscending().getWidth() + 6
                : getTable().getResources().sortDescending().getWidth() + 6;
        int halfHeight = isSortAscending
                ? (int) Math.round(getTable().getResources().sortAscending().getHeight() / 2.0)
                : (int) Math.round(getTable().getResources().sortDescending().getHeight() / 2.0);
        DivBuilder outerDiv = out.startDiv();
        StylesBuilder style = outerDiv.style().position(Position.RELATIVE).trustedProperty("zoom", "1");
        if (posRight) {
            style.paddingRight(iconWidth, Unit.PX);
        } else {/*w w w.  j a  v  a2s .c o  m*/
            style.paddingLeft(iconWidth, Unit.PX);
        }
        style.endStyle();

        // Add the icon.
        DivBuilder imageHolder = outerDiv.startDiv();
        style = outerDiv.style().position(Position.ABSOLUTE).top(50.0, Unit.PCT).lineHeight(0.0, Unit.PX)
                .marginTop(-halfHeight, Unit.PX);
        if (posRight) {
            style.right(0, Unit.PX);
        } else {
            style.left(0, Unit.PX);
        }

        style.endStyle();
        imageHolder.html(getSortingIcon(isSortAscending));
        imageHolder.endDiv();

        // Create the header wrapper.
        headerContainer = outerDiv.startDiv();
    }

    // Build the header.
    renderHeader(headerContainer, context, header);

    // Close the elements used for the sort icon.
    if (isSortedAndNotFooter) {
        headerContainer.endDiv(); // headerContainer.
        headerContainer.endDiv(); // outerDiv
    }
}