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


Java Style.setPropertyPx方法代码示例

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


在下文中一共展示了Style.setPropertyPx方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ensureFocusElement

import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
private void ensureFocusElement() {
  if (focusEl != null) {
    focusEl.removeFromParent();
  }
  focusEl = getElement().appendChild(focusImpl.createFocusable());
  focusEl.addClassName(treeStyles.styles().noFocusOutline());
  if (focusEl.hasChildNodes()) {
    focusEl.getFirstChildElement().addClassName(treeStyles.styles().noFocusOutline());
    Style focusElStyle = focusEl.getFirstChildElement().getStyle();
    focusElStyle.setBorderWidth(0, Style.Unit.PX);
    focusElStyle.setFontSize(1, Style.Unit.PX);
    focusElStyle.setPropertyPx("lineHeight", 1);
  }
  focusEl.getStyle().setLeft(0, Style.Unit.PX);
  focusEl.getStyle().setTop(0, Style.Unit.PX);
  focusEl.getStyle().setPosition(Style.Position.ABSOLUTE);

  // subscribe for Event.FOCUSEVENTS
  int bits =
      DOM.getEventsSunk(
          (Element) focusEl.cast()); // do not remove redundant cast, GWT tests will fail
  DOM.sinkEvents((Element) focusEl.cast(), bits | Event.FOCUSEVENTS);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:Tree.java

示例3: initUI

import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
@PostConstruct
private void initUI() {
    initWidget(mainPanel);

    Tree tree = initNavigationTree();
    tree.setWidth("150px");
    Style leftStyle = mainPanel.getElement().getStyle();
    leftStyle.setPropertyPx("margin", 5);
    mainPanel.add(tree);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:11,代码来源:GalleryTreeViewImpl.java

示例4: 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

示例5: fixElementHeight

import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
 * Fixes element's height with the given value.
 */
public static void fixElementHeight(Element element, int fixedHeight) {
  Style style = element.getStyle();
  style.setPropertyPx(STYLE_MIN_HEIGHT_PROPERTY, fixedHeight);
  style.setPropertyPx(STYLE_MAX_HEIGHT_PROPERTY, fixedHeight);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:9,代码来源:DomUtil.java


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