Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ContextClickEvent.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright 2000-2014 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.event;
  17. import java.io.Serializable;
  18. import java.lang.reflect.Method;
  19. import com.vaadin.event.MouseEvents.ClickEvent;
  20. import com.vaadin.shared.MouseEventDetails;
  21. import com.vaadin.ui.Component;
  22. import com.vaadin.util.ReflectTools;
  23. /**
  24. * Context click event fired by a {@link Component}. ContextClickEvent happens
  25. * when context click happens on the client-side inside the Component.
  26. *
  27. * @since 7.6
  28. * @author Vaadin Ltd
  29. */
  30. public class ContextClickEvent extends ClickEvent {
  31. public static final Method CONTEXT_CLICK_METHOD = ReflectTools
  32. .findMethod(ContextClickListener.class, "contextClick",
  33. ContextClickEvent.class);
  34. public ContextClickEvent(Component source,
  35. MouseEventDetails mouseEventDetails) {
  36. super(source, mouseEventDetails);
  37. }
  38. /**
  39. * Listener for {@link ContextClickEvent ContextClickEvents}.
  40. */
  41. public interface ContextClickListener extends Serializable {
  42. /**
  43. * Called when the context click happens.
  44. *
  45. * @param event
  46. * the context click event
  47. */
  48. public void contextClick(ContextClickEvent event);
  49. }
  50. /**
  51. * The interface for adding and removing listeners for
  52. * {@link ContextClickEvent ContextClickEvents}.
  53. */
  54. public interface ContextClickNotifier extends Serializable {
  55. /**
  56. * Adds a context click listener that gets notified when a context click
  57. * happens.
  58. *
  59. * @param listener
  60. * the context click listener to add
  61. */
  62. public void addContextClickListener(ContextClickListener listener);
  63. /**
  64. * Removes a context click listener that was previously added with
  65. * {@link #addContextClickListener(ContextClickListener)}.
  66. *
  67. * @param listener
  68. * the context click listener to remove
  69. */
  70. public void removeContextClickListener(ContextClickListener listener);
  71. }
  72. }