本文整理了Java中com.google.gwt.user.client.Element.getClientWidth()
方法的一些代码示例,展示了Element.getClientWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getClientWidth()
方法的具体详情如下:
包路径:com.google.gwt.user.client.Element
类名称:Element
方法名:getClientWidth
暂无
代码示例来源: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.google.gwt/gwt-servlet
protected double getCenterWidth() {
return getElement().getClientWidth() / layout.getUnitSize(unit, false) -
filledWidth;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Adjust the size of the scroll lock element based on the new position of the
* scroll bar.
*/
private void adjustScrollLock() {
int scrollLeft = Math.abs(getElement().getScrollLeft());
if (scrollLeft > 0) {
int clientWidth = getElement().getClientWidth();
scrollLock.getStyle().setWidth(scrollLeft + clientWidth, Unit.PX);
} else {
scrollLock.getStyle().setWidth(1.0, Unit.PX);
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-gwt-api
/**
* @return width in pixels of the GWT component in the Sonar page
*/
public static int getPageWidth() {
return DOM.getElementById("gwtpage").getClientWidth();
}
代码示例来源:origin: com.extjs/gxt
/**
* Returns whether the element is scrollable on the x-axis.
*
* @return true if scrollable on the x-axis
*/
public boolean isScrollableX() {
return dom.getScrollWidth() > dom.getClientWidth();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
代码示例来源:origin: net.wetheinter/gwt-user 代码示例来源:origin: kiegroup/appformer 代码示例来源:origin: org.uberfire/uberfire-wires-core-grids 代码示例来源:origin: org.uberfire/uberfire-wires-core-grids 代码示例来源:origin: org.kie.uberfire/kie-uberfire-perspective-editor-client 代码示例来源:origin: oVirt/ovirt-engine 代码示例来源:origin: net.wetheinter/gwt-user 代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui 代码示例来源:origin: kiegroup/appformer 代码示例来源:origin: org.uberfire/uberfire-wires-core-grids 代码示例来源:origin: org.uberfire/uberfire-wires-core-grids 代码示例来源:origin: kiegroup/appformer 代码示例来源:origin: net.sf.advanced-gwt/advanced-gwtint realScrollbarWidth = 0;
if (hScrollbar != null
&& (alwaysShowScrollbars || getElement().getClientWidth() protected double getCenterWidth() {
return getElement().getClientWidth() / layout.getUnitSize(unit, false) -
filledWidth;
}private Panel scrollPanel() {
final Panel panel = mock(AbsolutePanel.class);
final Element element = mock(Element.class);
doReturn(SCROLL_LEFT).when(element).getScrollLeft();
doReturn(SCROLL_TOP).when(element).getScrollTop();
doReturn(SCROLL_WIDTH).when(element).getScrollWidth();
doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();
doReturn(CLIENT_WIDTH).when(element).getClientWidth();
doReturn(CLIENT_HEIGHT).when(element).getClientHeight();
doReturn(element).when(panel).getElement();
return panel;
}private Panel scrollPanel() {
final Panel panel = mock(AbsolutePanel.class);
final Element element = mock(Element.class);
doReturn(SCROLL_LEFT).when(element).getScrollLeft();
doReturn(SCROLL_TOP).when(element).getScrollTop();
doReturn(SCROLL_WIDTH).when(element).getScrollWidth();
doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();
doReturn(CLIENT_WIDTH).when(element).getClientWidth();
doReturn(CLIENT_HEIGHT).when(element).getClientHeight();
doReturn(element).when(panel).getElement();
return panel;
}private Panel emptyPanel() {
final Panel panel = mock(AbsolutePanel.class);
final Element element = mock(Element.class);
doReturn(0).when(element).getScrollLeft();
doReturn(0).when(element).getScrollTop();
doReturn(0).when(element).getScrollWidth();
doReturn(0).when(element).getScrollHeight();
doReturn(0).when(element).getClientWidth();
doReturn(0).when(element).getClientHeight();
doReturn(element).when(panel).getElement();
return panel;
}
}@Override
public void onOpen() {
for ( String key : screensToLoad.keySet() ) {
final Target target = screensToLoad.get( key );
final Column column = target.getColumn();
final FlowPanel panel = target.getPanel();
final int height = 400;
panel.setPixelSize( column.getElement().getClientWidth(), height );
placeManager.goTo( new DefaultPlaceRequest( key, target.getParameters() ), target.getPanel() );
}
}/**
* Redraw the progress bar when something changes the layout.
*/
public void redraw() {
if (isAttached()) {
int width = getElement().getClientWidth();
int height = getElement().getClientHeight();
onResize(width, height);
}
}/**
* Adjust the size of the scroll lock element based on the new position of the
* scroll bar.
*/
private void adjustScrollLock() {
int scrollLeft = Math.abs(getElement().getScrollLeft());
if (scrollLeft > 0) {
int clientWidth = getElement().getClientWidth();
scrollLock.getStyle().setWidth(scrollLeft + clientWidth, Unit.PX);
} else {
scrollLock.getStyle().setWidth(1.0, Unit.PX);
}
}void toggleMenuVisibility() {
if (isShowing()) {
hide();
} else {
if (widthsSynced) {
setWidth(dropdownList.getElement().getClientWidth() + "px");
}
showRelativeTo(dropdownList);
}
}void setHorizontalScrollPosition(final Double percentage) {
final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
final Integer clientWidth = scrollPanel().getElement().getClientWidth();
final Integer max = scrollWidth - clientWidth;
setScrollLeft((int) ((max * percentage) / 100));
}void setHorizontalScrollPosition(final Double percentage) {
final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
final Integer clientWidth = scrollPanel().getElement().getClientWidth();
final Integer max = scrollWidth - clientWidth;
setScrollLeft((int) ((max * percentage) / 100));
}Double getHorizontalScrollPosition() {
final Integer scrollLeft = scrollPanel().getElement().getScrollLeft();
final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
final Integer clientWidth = scrollPanel().getElement().getClientWidth();
final Integer level = scrollWidth - clientWidth;
return level == 0 ? 0d : 100d * scrollLeft / level;
}Double getHorizontalScrollPosition() {
final Integer scrollLeft = scrollPanel().getElement().getScrollLeft();
final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
final Integer clientWidth = scrollPanel().getElement().getClientWidth();
final Integer level = scrollWidth - clientWidth;
return level == 0 ? 0d : 100d * scrollLeft / level;
}/** 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();
}
}