本文整理汇总了Java中com.google.gwt.user.client.Window.addWindowResizeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Window.addWindowResizeListener方法的具体用法?Java Window.addWindowResizeListener怎么用?Java Window.addWindowResizeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Window
的用法示例。
在下文中一共展示了Window.addWindowResizeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ErrorPopup
import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
/**
* Initializes the ErrorPopup.
*/
ErrorPopup() {
super(true); //constructor for PopupPanel class. "True" initializes the "auto-hide" variable
// I'm leaving this setSTyleName line here as a comment, to show the typical way to define
// the style.
// I would have preferred to use this method rather than constructing the HTML by hand,
// but it seems that GWT doesn't let the StyleName to be switched dynamically.
// setStyleName("ode-ErrorMessage");
messageLabel = new HTML();
setWidget(messageLabel);
// Recenter the message when the window is resized.
// TODO(halabelson): replace the deprecated methods
Window.addWindowResizeListener(new WindowResizeListener() {
@Override
public void onWindowResized(int width, int height) {
centerTopPopup();
}
});
// Reposition the message to the top of the screen when the
// window is scrolled
// TODO(halabelson): get rid of the flashing on vertical scrolling
Window.addWindowScrollListener(new WindowScrollListener() {
@Override
public void onWindowScrolled(int scrollLeft, int scrollTop) {
centerTopPopup();
}
});
}
示例2: RpcStatusPopup
import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
/**
* Initializes the LoadingPopup.
*/
public RpcStatusPopup() {
super(/* autoHide = */ false);
setStyleName("ode-RpcStatusMessage");
setWidget(label);
// Re-center the loading message when the window is resized.
// TODO(halabelson): Replace the deprecated methods
Window.addWindowResizeListener(new WindowResizeListener() {
@Override
public void onWindowResized(int width, int height) {
positionPopup(getOffsetWidth());
}
});
// Reposition the message to the top of the screen when the
// window is scrolled
// TODO(halabelson): get rid of the flashing on vertical scrolling
Window.addWindowScrollListener(new WindowScrollListener() {
@Override
public void onWindowScrolled(int scrollLeft, int scrollTop) {
positionPopup(getOffsetWidth());
}
});
// Position the popup before showing it to prevent flashing.
setPopupPositionAndShow(new PopupPanel.PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
positionPopup(offsetWidth);
}
});
}