Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

PointerEventSupportImplModernIE.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client.event;
  17. import com.google.gwt.core.client.JavaScriptObject;
  18. import com.google.gwt.user.client.impl.DOMImplStandard;
  19. import com.vaadin.client.event.PointerEvent.EventType;
  20. /**
  21. * Pointer event support class for IE 11+ (unprefixed pointer events).
  22. *
  23. * @since 7.2
  24. * @author Vaadin Ltd
  25. */
  26. public class PointerEventSupportImplModernIE extends PointerEventSupportImpl {
  27. protected static boolean inited = false;
  28. @Override
  29. protected boolean isSupported() {
  30. return true;
  31. }
  32. @Override
  33. protected void init() {
  34. if (!inited) {
  35. JavaScriptObject eventDispatcherMapExtensions = JavaScriptObject
  36. .createObject();
  37. JavaScriptObject captureEventDispatcherMapExtensions = JavaScriptObject
  38. .createObject();
  39. for (EventType e : EventType.values()) {
  40. addEventDispatcher(e.getNativeEventName(),
  41. eventDispatcherMapExtensions);
  42. getPointerEventCaptureDispatchers(e.getNativeEventName(),
  43. captureEventDispatcherMapExtensions);
  44. }
  45. DOMImplStandard
  46. .addBitlessEventDispatchers(eventDispatcherMapExtensions);
  47. DOMImplStandard.addCaptureEventDispatchers(
  48. captureEventDispatcherMapExtensions);
  49. inited = true;
  50. }
  51. }
  52. private static native void addEventDispatcher(String eventName,
  53. JavaScriptObject jso)
  54. /*-{
  55. jso[eventName] = @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent(*);
  56. }-*/;
  57. private static native void getPointerEventCaptureDispatchers(
  58. String eventName, JavaScriptObject jso)
  59. /*-{
  60. jso[eventName] = @com.google.gwt.user.client.impl.DOMImplStandard::dispatchCapturedMouseEvent(*);
  61. }-*/;
  62. }