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


Java Window.getClientHeight方法代码示例

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


在下文中一共展示了Window.getClientHeight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: position

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) {
	int textBoxOffsetWidth = relativeObject.getOffsetWidth();
	int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
	int left = relativeObject.getAbsoluteLeft();
	if (offsetWidthDiff > 0) {
		int windowRight = Window.getClientWidth() + Window.getScrollLeft();
		int windowLeft = Window.getScrollLeft();
		int distanceToWindowRight = windowRight - left;
		int distanceFromWindowLeft = left - windowLeft;
		if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) {
			left -= offsetWidthDiff;
		}
	}
	int top = relativeObject.getAbsoluteTop();
	int windowTop = Window.getScrollTop();
	int windowBottom = Window.getScrollTop() + Window.getClientHeight();
	int distanceFromWindowTop = top - windowTop;
	int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());
	if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
		top -= offsetHeight;
	} else {
		top += relativeObject.getOffsetHeight();
	}
	setPopupPosition(left, top);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:FilterBox.java

示例2: recenter

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
public void recenter() {
	GwtHint.getInstance().hide();
	
	iScrollRooms.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100)
		iScrollRooms.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	
	iScrollDates.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100) {
		iScrollDates.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	}

	int left = (Window.getClientWidth() - getOffsetWidth()) >> 1;
    int top = (Window.getClientHeight() - getOffsetHeight()) >> 1;
	setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0));
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:17,代码来源:AddMeetingsDialog.java

示例3: findNextMessageYPosition

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
public int findNextMessageYPosition() {
    int y = Window.getClientHeight();
    for (OperationMessage currMsg : messages) {
        if (currMsg.isAttached()) {
            if (currMsg.getAbsoluteTop() < y)
                y = currMsg.getAbsoluteTop();
        }
    }
    return y;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:11,代码来源:OperationMessageManager.java

示例4: getViewport

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
Rectangle getViewport() {
    return new Rectangle(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight());
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:4,代码来源:ViewportHelper.java

示例5: setVisible

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
@Override
public void setVisible(boolean visible) {
	super.setVisible(visible);
	if (visible && getElement().getClientHeight() > Window.getClientHeight() - 100)
		recenter();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:7,代码来源:AddMeetingsDialog.java

示例6: setPosition

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
/**
 * @param offsetWidth width of the ContextMenu being positioned on the parent element
 * @param offsetHeight height of the ContextMenu being positioned on the parent element
 * Sets the position of the ContextMenu on the screen given it's dimensions
 */
@Override
public void setPosition(int offsetWidth, int offsetHeight) {

  // getAbsoluteLeft/Right() gives the top coordinate of the parent element
  // getOffsetWidth/Height() gives the width/height of the parent element
  int left = Window.Navigator.getUserAgent().contains("Chrome") && isPinchZoomed()
          ? getTrueAbsoluteLeft() : getAbsoluteLeft();

  if (rightAlign) {
    left += getOffsetWidth() - offsetWidth;
  }

  int top = Window.Navigator.getUserAgent().contains("Chrome") && isPinchZoomed()
          ? getTrueAbsoluteTop() + getOffsetHeight()
          : getAbsoluteTop() + getOffsetHeight();

  // Values to determine how to display the ContextMenu - above or below

  int dropDownBottom = top + offsetHeight;
  int screenBottom  = Window.getScrollTop()+Window.getClientHeight();

  // if the bottom will go off the current browser screen, display
  // the dropdown as a 'dropup' where the ContextMenu appears
  // above instead

  if(dropDownBottom > screenBottom) {
      int newTop = Window.Navigator.getUserAgent().contains("Chrome") && isPinchZoomed()
        ? getTrueAbsoluteTop() -offsetHeight
        : getAbsoluteTop() - offsetHeight;

      // account for the extreeeemely unlikely case where newTop
      // also goes off the screen in this case, it makes more
      // sense to just go off the bottom of the screen (the screen
      // won't grow up, and so the menu would get completely cut
      // off at the top

      if(newTop >= 0) {
          top = newTop;
      }
  }

  menu.setPopupPosition(left, top);

}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:50,代码来源:DropDownButton.java


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