本文整理了Java中com.google.gwt.dom.client.Element.getClientWidth()
方法的一些代码示例,展示了Element.getClientWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getClientWidth()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getClientWidth
[英]Returns the inner width of an element in pixels, including padding but not the vertical scrollbar width, border, or margin.
[中]返回元素的内部宽度(以像素为单位),包括填充,但不包括垂直滚动条宽度、边框或边距。
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* The width of the document's client area.
*
* @return the document's client width
*/
public final int getClientWidth() {
return getViewportElement().getClientWidth();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Get the maximum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the maximum scroll position
*/
public int getMaximumHorizontalScrollPosition(Element scrollable) {
return isRtl(scrollable) ? 0 : scrollable.getScrollWidth() - scrollable.getClientWidth();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Get the minimum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the minimum scroll position
*/
public int getMinimumHorizontalScrollPosition(Element scrollable) {
return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void setScrollLeft(Element elem, int left) {
if (!isGecko19() && isRTL(elem)) {
left += elem.getScrollWidth() - elem.getClientWidth();
}
super.setScrollLeft(elem, left);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void setScrollLeft(Element elem, int left) {
if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
left += elem.getScrollWidth() - elem.getClientWidth();
}
super.setScrollLeft(elem, left);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public int getScrollLeft(Element elem) {
if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
return super.getScrollLeft(elem)
- (elem.getScrollWidth() - elem.getClientWidth());
}
return super.getScrollLeft(elem);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public int getScrollLeft(Element elem) {
if (!isGecko19() && isRTL(elem)) {
return super.getScrollLeft(elem)
- (elem.getScrollWidth() - elem.getClientWidth());
}
return super.getScrollLeft(elem);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
void scrollToEnd() {
Element elem = getElement();
targetScrollLeft = elem.getScrollWidth() - elem.getClientWidth();
if (LocaleInfo.getCurrentLocale().isRTL()) {
targetScrollLeft *= -1;
}
if (isAnimationEnabled()) {
// Animate the scrolling.
startScrollLeft = elem.getScrollLeft();
run(250, elem);
} else {
// Scroll instantly.
onComplete();
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public double getUnitSizeInPixels(
Element parent, Unit unit, boolean vertical) {
if (unit == null) {
return 1;
}
switch (unit) {
case PCT:
return (vertical ? parent.getClientHeight() : parent.getClientWidth())
/ 100.0;
case EM:
return relativeRuler.getOffsetWidth() / 10.0;
case EX:
return relativeRuler.getOffsetHeight() / 10.0;
case CM:
return fixedRuler.getOffsetWidth() * 0.1; // 1.0 cm / cm
case MM:
return fixedRuler.getOffsetWidth() * 0.01; // 0.1 cm / mm
case IN:
return fixedRuler.getOffsetWidth() * 0.254; // 2.54 cm / in
case PT:
return fixedRuler.getOffsetWidth() * 0.00353; // 0.0353 cm / pt
case PC:
return fixedRuler.getOffsetWidth() * 0.0423; // 0.423 cm / pc
default:
case PX:
return 1;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
int parentWidth = parentElem.getClientWidth();
int parentHeight = parentElem.getClientHeight();
for (Layer l : layers) {
代码示例来源:origin: net.wetheinter/gwt-user
/**
* The width of the document's client area.
*
* @return the document's client width
*/
public final int getClientWidth() {
return getViewportElement().getClientWidth();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Get the minimum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the minimum scroll position
*/
public int getMinimumHorizontalScrollPosition(Element scrollable) {
return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0;
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Get the maximum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the maximum scroll position
*/
public int getMaximumHorizontalScrollPosition(Element scrollable) {
return isRtl(scrollable) ? 0 : scrollable.getScrollWidth() - scrollable.getClientWidth();
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Get the minimum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the minimum scroll position
*/
public int getMinimumHorizontalScrollPosition(Element scrollable) {
return isRtl(scrollable) ? scrollable.getClientWidth() - scrollable.getScrollWidth() : 0;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Recalculate the height and width of a native scrollbar.
*/
private static void maybeRecalculateNativeScrollbarSize() {
// Check if the size has already been calculated.
if (nativeHeight > -1) {
return;
}
// Create a scrollable element and attach it to the body.
Element scrollable = Document.get().createDivElement();
scrollable.getStyle().setPosition(Position.ABSOLUTE);
scrollable.getStyle().setTop(-1000.0, Unit.PX);
scrollable.getStyle().setLeft(-1000.0, Unit.PX);
scrollable.getStyle().setHeight(100.0, Unit.PX);
scrollable.getStyle().setWidth(100.0, Unit.PX);
scrollable.getStyle().setOverflow(Overflow.SCROLL);
scrollable.getStyle().setProperty("direction", "rtl");
Document.get().getBody().appendChild(scrollable);
// Add some content.
Element content = Document.get().createDivElement();
content.setInnerText("content");
scrollable.appendChild(content);
// Measure the height and width.
nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight();
nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth();
nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft());
// Detach the scrollable element.
scrollable.removeFromParent();
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
public void setScrollLeft(Element elem, int left) {
if (!isGecko19() && isRTL(elem)) {
left += elem.getScrollWidth() - elem.getClientWidth();
}
super.setScrollLeft(elem, left);
}
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
public int getWidth(Element e) {
fixInlineElement(e);
return (int) (e.getClientWidth() - num(curCSS(e, "paddingLeft", true)) - num(curCSS(e,
"paddingRight", true)));
}
代码示例来源:origin: net.wetheinter/gwt-user
@Override
public int getScrollLeft(Element elem) {
if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
return super.getScrollLeft(elem)
- (elem.getScrollWidth() - elem.getClientWidth());
}
return super.getScrollLeft(elem);
}
代码示例来源:origin: playn/playn
@Override public IDimension screenSize () {
// TODO: inverse scale?
screenSize.width = Document.get().getDocumentElement().getClientWidth();
screenSize.height = Document.get().getDocumentElement().getClientHeight();
return screenSize;
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
public int getScrollLeft(Element elem) {
if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
return super.getScrollLeft(elem)
- (elem.getScrollWidth() - elem.getClientWidth());
}
return super.getScrollLeft(elem);
}
内容来源于网络,如有侵权,请联系作者删除!