本文整理汇总了Java中com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose方法的典型用法代码示例。如果您正苦于以下问题:Java RootPanel.detachOnWindowClose方法的具体用法?Java RootPanel.detachOnWindowClose怎么用?Java RootPanel.detachOnWindowClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.RootPanel
的用法示例。
在下文中一共展示了RootPanel.detachOnWindowClose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: install
import com.google.gwt.user.client.ui.RootPanel; //导入方法依赖的package包/类
/**
* Installs a key handler for key events on this window.
*
* @param handler handler to receive key events.
*/
static void install(KeySignalHandler handler) {
//
// NOTE: There are three potential candidate elements for sinking keyboard
// events: the window, the document, and the document body. IE7 does not
// fire events on the window element, and GWT's RootPanel is already a
// listener on the body, leaving the document as the only cross-browser
// whole-window event-sinking 'element'.
//
DocumentPanel panel = new DocumentPanel(handler);
panel.setElement(Document.get().<Element>cast());
panel.addDomHandler(panel, KeyDownEvent.getType());
panel.addDomHandler(panel, KeyPressEvent.getType());
panel.addDomHandler(panel, KeyUpEvent.getType());
RootPanel.detachOnWindowClose(panel);
panel.onAttach();
}
示例2: of
import com.google.gwt.user.client.ui.RootPanel; //导入方法依赖的package包/类
/**
* Creates an EventDispatcherPanel on an existing element. If the element is
* part of a larger GWT widget structure, consider see
* {@link #inGwtContext(Element, LogicalPanel)}.
*
* @param element element to become the panel
*/
public static EventDispatcherPanel of(Element element) {
EventDispatcherPanel panel = new EventDispatcherPanel(element);
RootPanel.detachOnWindowClose(panel);
panel.onAttach();
return panel;
}