當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。