本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}