com.google.gwt.event.dom.client.KeyEvent Java Examples

The following examples show how to use com.google.gwt.event.dom.client.KeyEvent. 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 5 votes vote down vote up
private void dispatch(KeyEvent<?> event) {
     if (checkStatDialogCondition(event)) {
       StatDialog.show();
     } else {
Timer timer = null;
       if (Timing.isEnabled()) {
         Timing.enterScope();
         Timing.setScopeValue(ExecutionTree.class, new ExecutionTree());
         timer = Timing.start("Key event dispatch");
       }
       try {
         // Only respond to key events on the body element. Otherwise, the key
         // event was probably targeted to some editable input element, and that
         // should own the events.
         NativeEvent realEvent = event.getNativeEvent();
         Element target = realEvent.getEventTarget().cast();
         if (!"body".equals(target.getTagName().toLowerCase())) {
           return;
         }
         // Test that the event is meaningful (and stop bubbling if it is not).
         SignalEvent signal = SignalEventImpl.create(realEvent.<Event>cast(), true);
         if (signal != null) {
           KeyCombo key = EventWrapper.getKeyCombo(signal);
           if (globalHandler.onKeySignal(key)) {
             event.preventDefault();
           }
         }
       } finally {
         Timing.stop(timer);
         Timing.exitScope();
       }
     }
   }
 
Example #2
Source File: FocusManager.java    From swellrt with Apache License 2.0 5 votes vote down vote up
private boolean checkStatDialogCondition(KeyEvent<?> event) {
  boolean down = event instanceof KeyDownEvent;
  if (checkStatDialogCondition(statDialogCondition, event.getNativeEvent().getKeyCode(), down)) {
    if (statDialogCondition/2 == statDialogKeyCodeSequence.length-1) {
      statDialogCondition = 0;
      return true;
    }
    statDialogCondition++;
  } else if (statDialogCondition != 0) {
    statDialogCondition = checkStatDialogCondition(0, event.getNativeEvent().getKeyCode(), down) ? 1 : 0;
  }
  return false;
}
 
Example #3
Source File: FocusManager.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private void dispatch(KeyEvent<?> event) {
     if (checkStatDialogCondition(event)) {
       StatDialog.show();
     } else {
Timer timer = null;
       if (Timing.isEnabled()) {
         Timing.enterScope();
         Timing.setScopeValue(ExecutionTree.class, new ExecutionTree());
         timer = Timing.start("Key event dispatch");
       }
       try {
         // Only respond to key events on the body element. Otherwise, the key
         // event was probably targeted to some editable input element, and that
         // should own the events.
         NativeEvent realEvent = event.getNativeEvent();
         Element target = realEvent.getEventTarget().cast();
         if (!"body".equals(target.getTagName().toLowerCase())) {
           return;
         }
         // Test that the event is meaningful (and stop bubbling if it is not).
         SignalEvent signal = SignalEventImpl.create(realEvent.<Event>cast(), true);
         if (signal != null) {
           KeyCombo key = EventWrapper.getKeyCombo(signal);
           if (globalHandler.onKeySignal(key)) {
             event.preventDefault();
           }
         }
       } finally {
         Timing.stop(timer);
         Timing.exitScope();
       }
     }
   }
 
Example #4
Source File: FocusManager.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private boolean checkStatDialogCondition(KeyEvent<?> event) {
  boolean down = event instanceof KeyDownEvent;
  if (checkStatDialogCondition(statDialogCondition, event.getNativeEvent().getKeyCode(), down)) {
    if (statDialogCondition/2 == statDialogKeyCodeSequence.length-1) {
      statDialogCondition = 0;
      return true;
    }
    statDialogCondition++;
  } else if (statDialogCondition != 0) {
    statDialogCondition = checkStatDialogCondition(0, event.getNativeEvent().getKeyCode(), down) ? 1 : 0;
  }
  return false;
}