本文整理了Java中com.google.gwt.user.client.Element.getOffsetWidth()
方法的一些代码示例,展示了Element.getOffsetWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getOffsetWidth()
方法的具体详情如下:
包路径:com.google.gwt.user.client.Element
类名称:Element
方法名:getOffsetWidth
暂无
代码示例来源:origin: libgdx/libgdx
/** Update the current sizes.
*
* @return true if the sizes changed, false if not. */
public boolean updateSizes () {
int offsetWidth = widget.getElement().getOffsetWidth();
int offsetHeight = widget.getElement().getOffsetHeight();
int clientWidth = widget.getElement().getClientWidth();
int clientHeight = widget.getElement().getClientHeight();
if (offsetWidth != curOffsetWidth || offsetHeight != curOffsetHeight || clientWidth != curClientWidth
|| clientHeight != curClientHeight) {
this.curOffsetWidth = offsetWidth;
this.curOffsetHeight = offsetHeight;
this.curClientWidth = clientWidth;
this.curClientHeight = clientHeight;
return true;
}
return false;
}
}
代码示例来源:origin: libgdx/libgdx
/** Update the current sizes.
*
* @return true if the sizes changed, false if not. */
public boolean updateSizes () {
int offsetWidth = widget.getElement().getOffsetWidth();
int offsetHeight = widget.getElement().getOffsetHeight();
int clientWidth = widget.getElement().getClientWidth();
int clientHeight = widget.getElement().getClientHeight();
if (offsetWidth != curOffsetWidth || offsetHeight != curOffsetHeight || clientWidth != curClientWidth
|| clientHeight != curClientHeight) {
this.curOffsetWidth = offsetWidth;
this.curOffsetHeight = offsetHeight;
this.curClientWidth = clientWidth;
this.curClientHeight = clientHeight;
return true;
}
return false;
}
}
代码示例来源:origin: com.extjs/gxt
/**
* Returns the offset width.
*
* @return the width
*/
public int getWidth() {
return dom.getOffsetWidth();
}
代码示例来源:origin: stackoverflow.com
NodeList<Element> nodeList = frame.getElement().getElementsByTagName("table");
for (int i = 0; i < nodeList.getLength(); i++) {
Element element = nodeList.getItem(i);
System.out.println(element);
System.out.println(element.getOffsetWidth());
System.out.println(element.getStyle().getWidth());
}
代码示例来源:origin: com.ebmwebsourcing.geasytools/geasy-ui
public int getWidth() {
return this.getElement().getOffsetWidth();
}
代码示例来源:origin: com.extjs/gxt
protected boolean isHorizontalScrollBarShowing() {
return cm.getTotalWidth() + getScrollAdjust() > scroller.dom.getOffsetWidth();
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Draw the knob where it is supposed to be relative to the line.
*/
private void drawKnob() {
// Abort if not attached
if (!isAttached()) {
return;
}
// Move the knob to the correct position
Element knobElement = knobImage.getElement();
int lineWidth = lineElement.getOffsetWidth();
int knobWidth = knobElement.getOffsetWidth();
int knobLeftOffset = lineLeftOffset
+ ((int) getKnobPercent() * lineWidth) - (knobWidth / 2);
knobLeftOffset = Math.min(knobLeftOffset, lineLeftOffset + lineWidth
- (knobWidth / 2) - 1);
DOM.setStyleAttribute(knobElement, "left", knobLeftOffset + "px"); //$NON-NLS-1$ //$NON-NLS-2$
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
@Override
public void execute() {
presenter.setSize(getElement().getOffsetWidth(), getElement().getOffsetHeight());
}
});
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
@Override
public void execute() {
presenter.setSize(getElement().getOffsetWidth(), getElement().getOffsetHeight());
}
});
代码示例来源:origin: oVirt/ovirt-engine
/**
* Slide the knob to a new location.
*
* @param event
* the mouse event
*/
private void slideKnob(Event event) {
int x = DOM.eventGetClientX(event);
if (x > 0) {
int lineWidth = lineElement.getOffsetWidth();
int lineLeft = lineElement.getAbsoluteLeft();
double percent = (double) (x - lineLeft) / lineWidth * 1.0;
setCurrentValue(getTotalRange() * percent + minValue, true);
}
}
代码示例来源:origin: org.uberfire/uberfire-wires-core-grids
@Test
public void testScrollbarWidth() {
final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
final Element element = mock(Element.class);
final Integer offsetWidth = 1014;
final Integer clientWidth = 1000;
doReturn(offsetWidth).when(element).getOffsetWidth();
doReturn(clientWidth).when(element).getClientWidth();
doReturn(element).when(scrollPanel).getElement();
doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();
final Integer expectedScrollbarWidth = offsetWidth - clientWidth;
final Integer actualScrollbarWidth = gridLienzoScrollHandler.scrollbarWidth();
assertEquals(expectedScrollbarWidth,
actualScrollbarWidth);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testScrollbarWidth() {
final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
final Element element = mock(Element.class);
final Integer offsetWidth = 1014;
final Integer clientWidth = 1000;
doReturn(offsetWidth).when(element).getOffsetWidth();
doReturn(clientWidth).when(element).getClientWidth();
doReturn(element).when(scrollPanel).getElement();
doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();
final Integer expectedScrollbarWidth = offsetWidth - clientWidth;
final Integer actualScrollbarWidth = gridLienzoScrollHandler.scrollbarWidth();
assertEquals(expectedScrollbarWidth,
actualScrollbarWidth);
}
代码示例来源:origin: org.uberfire/uberfire-wires-core-grids
public Integer scrollbarWidth() {
return getScrollPanel().getElement().getOffsetWidth() - getScrollPanel().getElement().getClientWidth();
}
代码示例来源:origin: kiegroup/appformer
public Integer scrollbarWidth() {
return getScrollPanel().getElement().getOffsetWidth() - getScrollPanel().getElement().getClientWidth();
}
代码示例来源:origin: com.extjs/gxt
/**
* Returns true if table cells in a fixed table layout are border boxes.
*
* @return true if border box
*/
public static boolean isBorderBoxTableFixed() {
if (borderBoxTableFixed == null) {
Element testElement = XDOM.create("<table style='table-layout:fixed; width: 100px'><tr><td></td></tr></table>");
Element td = (Element) testElement.getFirstChildElement().getFirstChildElement().getFirstChildElement();
td.getStyle().setPropertyPx("padding", 1);
td.getStyle().setPropertyPx("width", 100);
testElement.getStyle().setProperty("visibility", "hidden");
testElement.getStyle().setProperty("position", "absolute");
XDOM.getBody().appendChild(testElement);
borderBoxTableFixed = td.getOffsetWidth() == 100;
XDOM.getBody().removeChild(testElement);
}
return borderBoxTableFixed;
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
private void open() {
if (getElement().getOffsetWidth() > 0 && getElement().getOffsetHeight() > 0) {
terminal.open(terminalPanel.getElement());
if (focusOnOpen) {
terminal.focus();
}
isOpen = true;
}
}
代码示例来源:origin: com.extjs/gxt
private void updateGroupWidths() {
if (!enableGrouping || ds.getCount() < 1) {
return;
}
String tw = Math.max(cm.getTotalWidth(), el.dom.getOffsetWidth() - getScrollAdjust()) + "px";
NodeList<Element> gs = getGroups();
for (int i = 0, len = gs.getLength(); i < len; i++) {
Element e = gs.getItem(i).getFirstChild().cast();
e.getStyle().setProperty("width", tw);
}
}
代码示例来源:origin: com.extjs/gxt
protected void moveFocus(Element selectedElem) {
if (selectedElem == null) return;
int containerLeft = getAbsoluteLeft();
int containerTop = getAbsoluteTop();
int left = selectedElem.getAbsoluteLeft() - containerLeft;
int top = selectedElem.getAbsoluteTop() - containerTop;
int width = selectedElem.getOffsetWidth();
int height = selectedElem.getOffsetHeight();
if (width == 0 || height == 0) {
focusEl.setLeftTop(0, 0);
return;
}
focusEl.setLeftTop(left, top);
}
代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt
/** See class docs */
@Override
public void onResize(ResizeEvent resizeEvent) {
if (!isShowing()) {
return;
}
int delta = getElement().getOffsetWidth() - getElement().getClientWidth();
getScrollPanel().setWidth((getComboBox().getOffsetWidth() - delta) + "px");
adjustSize();
}
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui
@Override
public void execute() {
focusConstrainScheduled = false;
int scrollLeft = getElement().getScrollLeft();
int scrollTop = getElement().getScrollTop();
int left = getElement().getOffsetWidth() / 2 + scrollLeft;
int top = getElement().getOffsetHeight() / 2 + scrollTop;
focusEl.getStyle().setTop(top, Style.Unit.PX);
focusEl.getStyle().setLeft(left, Style.Unit.PX);
}
});
内容来源于网络,如有侵权,请联系作者删除!