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ů.

ConnectorActionManager.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.event;
  17. import com.vaadin.event.Action.Container;
  18. import com.vaadin.server.ClientConnector;
  19. import com.vaadin.server.VariableOwner;
  20. import com.vaadin.ui.Component;
  21. /**
  22. * An ActionManager connected to a connector. Takes care of verifying that the
  23. * connector can receive events before triggering an action.
  24. * <p>
  25. * This is mostly a workaround until shortcut actions are re-implemented in a
  26. * more sensible way.
  27. *
  28. * @since 7.1.8
  29. * @author Vaadin Ltd
  30. */
  31. public class ConnectorActionManager extends ActionManager {
  32. private ClientConnector connector;
  33. /**
  34. * Initialize an action manager for the given connector.
  35. *
  36. * @param connector
  37. * the owner of this action manager
  38. */
  39. public ConnectorActionManager(ClientConnector connector) {
  40. super();
  41. this.connector = connector;
  42. }
  43. /**
  44. * Initialize an action manager for the given connector using the given
  45. * viewer.
  46. *
  47. * @param connector
  48. * the owner of this action manager
  49. * @param viewer
  50. * the viewer connected
  51. */
  52. public <T extends Component & Container & VariableOwner> ConnectorActionManager(
  53. ClientConnector connector, T viewer) {
  54. super(viewer);
  55. this.connector = connector;
  56. }
  57. /*
  58. * (non-Javadoc)
  59. *
  60. * @see com.vaadin.event.ActionManager#handleAction(com.vaadin.event.Action,
  61. * java.lang.Object, java.lang.Object)
  62. */
  63. @Override
  64. public void handleAction(Action action, Object sender, Object target) {
  65. if (!connector.isConnectorEnabled()) {
  66. return;
  67. }
  68. super.handleAction(action, sender, target);
  69. }
  70. }