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.

MigratingFromVaadin7.0ToVaadin7.1.asciidoc 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ---
  2. title: Migrating from Vaadin 7.0 to Vaadin 7.1
  3. order: 35
  4. layout: page
  5. ---
  6. [[migrating-from-vaadin-7.0-to-vaadin-7.1]]
  7. = Migrating from Vaadin 7.0 to Vaadin 7.1
  8. This guide describes how to migrate from earlier versions to Vaadin 7.1.
  9. [[migrating-from-vaadin-6]]
  10. Migrating from Vaadin 6
  11. ~~~~~~~~~~~~~~~~~~~~~~~
  12. When migrating from Vaadin 6, first review
  13. <<MigratingFromVaadin6ToVaadin7#migrating-from-vaadin-6-to-vaadin-7,Migrating
  14. from Vaadin 6 to Vaadin 7>>, then continue with the rest of this guide.
  15. [[migrating-from-vaadin-7.0]]
  16. Migrating from Vaadin 7.0
  17. ~~~~~~~~~~~~~~~~~~~~~~~~~
  18. As always with minor releases, we have tried hard to minimize the number
  19. and extent of changes that could affect existing applications you want
  20. to upgrade. However, there are a few points that must be considered, and
  21. some other changes and improvements that might be beneficial to know.
  22. [[property-legacypropertytostring]]
  23. Property legacyPropertyToString
  24. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  25. The old convention where `Property` `toString()` was used to get the value
  26. of the `Property` continues to cause problems. Changing this behaviour
  27. could potentially cause severe bugs that are hard to find, so instead we
  28. continue our quest to phase out this behaviour.
  29. The behaviour can now be configured via the `legacyPropertyToString`
  30. (either as an init-parameter or using `@VaadinServletConfiguration`). The
  31. settings are:
  32. * “warning” = as 7.0, `toString()` logs warning, default when using
  33. web.xml
  34. * “disabled” = `toString()` is just `toString()`, does not log, default when
  35. using `@VaadinServletConfiguration`
  36. * “enabled” = legacy `toString()` behaviour, does not log, compatible with
  37. Vaadin 6
  38. By default, if you are not using `@VaadinServletConfiguration` to
  39. configure your servlet, the functionality is the same as in 7.0, and
  40. compatible with 6; a warning is logged.
  41. If you are using the new `@VaadinServletConfiguration` to configure your
  42. servlet, it is assumed that you’re creating a new project, and using
  43. `getValue()` instead of `toString()`, and no warning of `toString()` usage is
  44. logged.
  45. This change will not break your application, but you should consider the
  46. options.
  47. 1. Consider switching `legacyPropertyToString` mode to
  48. 1. “enabled” if you are using `toString()` improperly, and do not want
  49. warnings
  50. 2. “disabled” if you are absolutely sure you are not using `toString()`
  51. improperly, and do not want warnings
  52. [[converter-targettype]]
  53. Converter targetType
  54. ^^^^^^^^^^^^^^^^^^^^
  55. The conversion methods in `Converter` now have an additional `targetType`
  56. parameter, used by the caller to indicate what return type is expected.
  57. This enables `Converter`{empty}s to support multiple types, which can be handy in
  58. some cases.
  59. This change will cause compile errors if you implement or call
  60. `Converter.convertToModel()` and/or `Converter.convertToPresentation()`.
  61. 1. Add the `targetType` parameter if needed
  62. [[ui-access-outside-its-requestresponse]]
  63. UI access() outside it’s request/response
  64. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  65. If you have background threads/processes that update the ui (e.g long
  66. running process updating a `ProgressBar`), or if you otherwise update a ui
  67. from outside its request/response (e.g updating one UI from another),
  68. you should use the new `UI.access()` method. This ensures proper locking
  69. is done, and failing to do so might result in hard to debug concurrency
  70. problems.
  71. To debug possible concurrency problems, it is recommended to enable
  72. assertions with the "-ea" parameter to the JVM.
  73. This change will not break your application, but your application might
  74. already be broken; you should ensure that all ui access dome outside the
  75. request handling thread uses this new API.
  76. [[calendar-included]]
  77. Calendar included
  78. ^^^^^^^^^^^^^^^^^
  79. The `Calendar` component, which was previously an add-on, is now included
  80. in the core framework. However, the package is new, and there are minor
  81. API changes.
  82. This change will not break your application, but you might want to
  83. switch to the core framework version of the component.
  84. 1. Remove the Calendar add-on
  85. 2. Update imports to the new package
  86. 3. Adjust for API changes
  87. [[progressbar-is-the-new-progressindicator]]
  88. ProgressBar is the new ProgressIndicator
  89. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  90. The `ProgressIndicator` component had integrated support for polling - a
  91. feature that was a bit strange, especially now with built-in polling and
  92. push support. `ProgressBar` is a pure visual component that is intended to
  93. replace `ProgressIndicator`. If you have been relying on the polling
  94. capability of `ProgressIndicator`, you should look at `UI.setPollInterval()`
  95. or enable server push.
  96. This change does not break your application, but is deprecated, and
  97. should particularly not be used if push or `UI.setPollInterval()` is used.
  98. 1. Replace `ProgressIndicator` with `ProgressBar`
  99. 2. If you are using the polling feature use `UI.setPollInterval()` or enable push
  100. [[isattached-replaces-sessionnull]]
  101. isAttached() replaces session!=null
  102. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  103. Previously you had to do an awkward `getSession() != null` to figure out
  104. whether or not the component (or `ClientConnector` to be precise) actually
  105. was attached to the UI hierarchy (attached to a session, to be precise).
  106. There is now a `isAttached()` method that does that. Note that the old way
  107. still works, the new way is just more explicit, clean and findable.
  108. This change will not break your application, but if you want to clean up
  109. your code, you can look for `getSession()` null-checking and replace as
  110. appropriate with `isAttached()`.
  111. [[vconsole-is-now-java.util.logging]]
  112. VConsole is now java.util.logging
  113. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  114. For client-side logging and debug messages, the proprietary `VConsole` has
  115. been deprecated and replaced with the standard `java.util.logging`
  116. framework, and the messages are (by default) displayed in the completely
  117. renewed debug window.
  118. This change will not break your application, but the old API is
  119. deprecated, and the new one has additional features (e.g log levels). To
  120. update, look for references to `VConsole` and replace with standard
  121. `java.util.logging` calls, e.g
  122. `Logger.getLogger(getClass().getName()).log(“A message”)`.
  123. [[call-init-for-custom-vaadinservice-instances]]
  124. Call init() for custom VaadinService instances
  125. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  126. If overriding `VaadinServlet.createServletService()` or
  127. `VaadinPortlet.createPortletService()`, the new `init` method must be
  128. invoked for the newly-created `VaadinService` instance.
  129. [[new-features]]
  130. New features
  131. ~~~~~~~~~~~~
  132. In addition to the changes, there are a number of new features that you
  133. probably want to familiarize yourself with, such as `Push` and the
  134. redesigned `DebugWindow`.