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.

NavigationStateManager.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.navigator;
  17. import java.io.Serializable;
  18. /**
  19. * An interface for handling interaction between {@link Navigator} and the
  20. * browser location URI or other similar view identification and bookmarking
  21. * system. The state is limited to a single string because in the usual cases it
  22. * forms a part of a URI.
  23. * <p>
  24. * Different implementations can be created for hashbang URIs, HTML5 pushState,
  25. * portlet URL navigation and other similar systems.
  26. * <p>
  27. * This interface is mostly for internal use by Navigator.
  28. *
  29. * @author Vaadin Ltd
  30. * @since 7.0
  31. */
  32. public interface NavigationStateManager extends Serializable {
  33. /**
  34. * Returns the current navigation state including view name and any optional
  35. * parameters.
  36. *
  37. * @return current view and parameter string, not null
  38. */
  39. public String getState();
  40. /**
  41. * Sets the current navigation state in the location URI or similar
  42. * location, including view name and any optional parameters.
  43. * <p>
  44. * This method should be only called by a Navigator.
  45. *
  46. * @param state
  47. * new view and parameter string, not null
  48. */
  49. public void setState(String state);
  50. /**
  51. * Sets the Navigator used with this state manager. The state manager should
  52. * notify the provided navigator of user-triggered navigation state changes
  53. * by invoking <code>navigator.navigateTo(getState())</code>.
  54. * {@code navigator} parameter value could be null if previously set
  55. * navigator is destroyed.
  56. * <p>
  57. * This method should only be called by a Navigator.
  58. */
  59. public void setNavigator(Navigator navigator);
  60. }