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.

PreserveOnRefresh.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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.annotations;
  17. import java.lang.annotation.ElementType;
  18. import java.lang.annotation.Retention;
  19. import java.lang.annotation.RetentionPolicy;
  20. import java.lang.annotation.Target;
  21. import com.vaadin.server.UIProvider;
  22. import com.vaadin.ui.UI;
  23. /**
  24. * Marks a UI that should be retained when the user refreshed the browser
  25. * window. By default, a new UI instance is created when refreshing, causing any
  26. * UI state not captured in the URL or the URI fragment to get discarded. By
  27. * adding this annotation to a UI class, the framework will instead reuse the
  28. * current UI instance when a reload is detected.
  29. * <p>
  30. * Whenever a request is received that reloads a preserved UI, the UI's
  31. * {@link UI#refresh(com.vaadin.server.VaadinRequest) refresh} method is invoked
  32. * by the framework.
  33. * <p>
  34. * By using
  35. * {@link UIProvider#isPreservedOnRefresh(com.vaadin.server.UICreateEvent)}, the
  36. * decision can also be made dynamically based on other parameters than only
  37. * whether this annotation is present on the UI class.
  38. *
  39. * @author Vaadin Ltd
  40. * @since 7.0.0
  41. */
  42. @Target(ElementType.TYPE)
  43. @Retention(RetentionPolicy.RUNTIME)
  44. public @interface PreserveOnRefresh {
  45. // Empty marker annotation
  46. }