You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Push.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2000-2018 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.annotations;
  17. import java.lang.annotation.ElementType;
  18. import java.lang.annotation.Inherited;
  19. import java.lang.annotation.Retention;
  20. import java.lang.annotation.RetentionPolicy;
  21. import java.lang.annotation.Target;
  22. import com.vaadin.shared.communication.PushMode;
  23. import com.vaadin.shared.ui.ui.Transport;
  24. import com.vaadin.ui.UI;
  25. /**
  26. * Configures server push for a {@link UI}. Adding <code>@Push</code> to a UI
  27. * class configures the UI for automatic push. If some other push mode is
  28. * desired, it can be passed as a parameter, e.g.
  29. * <code>@Push(PushMode.MANUAL)</code>.
  30. *
  31. * @see PushMode
  32. *
  33. * @author Vaadin Ltd.
  34. * @since 7.1
  35. */
  36. @Retention(RetentionPolicy.RUNTIME)
  37. @Target(ElementType.TYPE)
  38. @Inherited
  39. public @interface Push {
  40. /**
  41. * Returns the {@link PushMode} to use for the annotated UI. The default
  42. * push mode when this annotation is present is {@link PushMode#AUTOMATIC}.
  43. *
  44. * @return the push mode to use
  45. */
  46. public PushMode value() default PushMode.AUTOMATIC;
  47. /**
  48. * Returns the transport type used for the push for the annotated UI. The
  49. * default transport type when this annotation is present is
  50. * {@link Transport#WEBSOCKET}.
  51. *
  52. * @return the transport type to use
  53. */
  54. public Transport transport() default Transport.WEBSOCKET;
  55. }