本文整理汇总了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);
}
示例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));
}
示例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;
}
示例4: getViewport
import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
Rectangle getViewport() {
return new Rectangle(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight());
}
示例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();
}
示例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);
}