当前位置: 首页>>代码示例>>Java>>正文


Java Style.setMarginRight方法代码示例

本文整理汇总了Java中com.google.gwt.dom.client.Style.setMarginRight方法的典型用法代码示例。如果您正苦于以下问题:Java Style.setMarginRight方法的具体用法?Java Style.setMarginRight怎么用?Java Style.setMarginRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.dom.client.Style的用法示例。


在下文中一共展示了Style.setMarginRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setCellWidth

import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public void setCellWidth(int cellIx, int width) {
    // CAUTION: copied from VScrollTableRow with small changes
    final Element cell = DOM.getChild(tr, cellIx);
    Style wrapperStyle = cell.getFirstChildElement().getStyle();
    int wrapperWidth = width;
    if (BrowserInfo.get().isWebkit()
            || BrowserInfo.get().isOpera10()) {
                /*
                 * Some versions of Webkit and Opera ignore the width
                 * definition of zero width table cells. Instead, use 1px
                 * and compensate with a negative margin.
                 */
        if (width == 0) {
            wrapperWidth = 1;
            wrapperStyle.setMarginRight(-1, Style.Unit.PX);
        } else {
            wrapperStyle.clearMarginRight();
        }
    }
    wrapperStyle.setPropertyPx("width", wrapperWidth);
    cell.getStyle().setPropertyPx("width", width);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:TableAggregationRow.java

示例2: calcAndSetWidthForSpannedCell

import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
private void calcAndSetWidthForSpannedCell() {
    final int cells = tHead.getVisibleCellCount();
    for (int i = 0; i < groupColIndex; i++) {
        int w = CubaGroupTableWidget.this.getColWidth(getColKeyByIndex(i));
        if (w < 0) {
            w = 0;
        }
        super.setCellWidth(i, w);
    }

    Element tr = getElement();

    int totalSpannedWidth = 0;
    for (int i = groupColIndex; i < cells; i++) {
        HeaderCell headerCell = tHead.getHeaderCell(i);

        int headerWidth = headerCell.getOffsetWidth() > headerCell.getWidth() + MAX_ROUNDING_DIFF ?
                headerCell.getWidth() : headerCell.getOffsetWidth();

        totalSpannedWidth += headerWidth;
    }

    Element td = DOM.getChild(tr, DOM.getChildCount(tr) - 1);

    Style wrapperStyle = td.getFirstChildElement().getStyle();
    WidgetUtil.setWidthExcludingPaddingAndBorder(td, totalSpannedWidth, 13, false);

    int wrapperWidth;
    ComputedStyle style = new ComputedStyle(td);
    if (style.getPaddingWidth() > 1.0) {
        // this is applied for havana theme, because it has vertical padding
        // for cell-container and width of TD element must be less, then whole row
        String tdWidthPx = td.getStyle().getWidth().replace("px", "");
        wrapperWidth = Integer.parseInt(tdWidthPx);
    } else {
        // this is applied for halo theme, because it hasn't vertical padding
        // for cell-container and width of TD element must be equal to whole row - 1px
        // 1px is the padding-left of :first-child
        wrapperWidth = totalSpannedWidth - 1;
    }

    if (BrowserInfo.get().isWebkit()
            || BrowserInfo.get().isOpera10()) {
                /*
                 * Some versions of Webkit and Opera ignore the width
                 * definition of zero width table cells. Instead, use 1px
                 * and compensate with a negative margin.
                 */
        if (totalSpannedWidth == 0) {
            wrapperWidth = 1;
            wrapperStyle.setMarginRight(-1, Style.Unit.PX);
        } else {
            wrapperStyle.clearMarginRight();
        }
    }

    if (BrowserInfo.get().isChrome()) {
        if (groupColIndex == groupColumns.size() - 1) {
            wrapperWidth -= groupColIndex * 2;
        }
        wrapperWidth++;
    }

    wrapperStyle.setPropertyPx("width", wrapperWidth);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:66,代码来源:CubaGroupTableWidget.java


注:本文中的com.google.gwt.dom.client.Style.setMarginRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。