Java Code Examples for com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose()

The following are Jave code examples for showing how to use detachOnWindowClose() of the com.google.gwt.user.client.ui.RootPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Wiab.pro   File: FocusManager.java   Source Code and License Vote up 6 votes
/**
 * 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();
}
 
Example 2
Project: Wiab.pro   File: EventDispatcherPanel.java   Source Code and License Vote up 3 votes
/**
 * 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;
}