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

The following examples show how to use com.google.gwt.user.client.ui.RootPanel#detachOnWindowClose() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FocusManager.java    From swellrt with Apache License 2.0 6 votes vote down vote up
/**
 * 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
Source File: FocusManager.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * 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 3
Source File: EventDispatcherPanel.java    From swellrt with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: EventDispatcherPanel.java    From incubator-retired-wave with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}