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.

AddingASplashScreen.asciidoc 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. title: Adding A Splash Screen
  3. order: 85
  4. layout: page
  5. ---
  6. [[adding-a-splash-sreen]]
  7. = Adding a splash screen
  8. When a Vaadin application is loading a loading indicator is
  9. automatically shown so the user knows something is happening. But what
  10. if we want to show something else, like a custom splash screen for our
  11. product? Or just customize the loading indicator? Let's have a look.
  12. During the Vaadin bootstrap there are a couple of div elements added to
  13. the page which we can use for our custom splash screen. The DOM for a
  14. servlet application looks the like the following when starting up:
  15. [source,html]
  16. ....
  17. <body scroll="auto" class="v-generated-body">
  18. <div id="splash-895866265" class="v-app splash">
  19. <div class="v-app-loading"></div>
  20. <noscript>
  21. You have to enable javascript in your browser to use an application built with Vaadin.
  22. </noscript>
  23. </div>
  24. ....
  25. In this example _splash_ is the name of our theme. The _v-app-loading_
  26. div is meant for styling the loading screen. It will only exist in the
  27. DOM until the widget set has been loaded and the application starts. At
  28. that point the _v-app-loading_ div is removed and replaced by the actual
  29. components for the application.
  30. Styling the loading screen is then as simple as adding some rules for
  31. _v-app-loading_, for example:
  32. [source,scss]
  33. ....
  34. .v-generated-body &.v-app .v-app-loading {
  35. height: 100%;
  36. width: 100%;
  37. background-image: url(http://archive.eclipse.org/eclipse/downloads/drops/R-3.3-200706251500/whatsnew/images/splash.png);
  38. background-repeat: no-repeat;
  39. background-position: 50%;
  40. }
  41. ....
  42. This will use an Eclipse logo as your splash screen - change the
  43. background image to your own splash screen or redesign the css
  44. completely to your liking.
  45. *Note that Vaadin 7.0 incorrectly does not add the theme name during
  46. bootstrap. You must therefore use a rule without the theme name, e.g.
  47. `.v-generated-body .v-app .v-app-loading` and move it out of the
  48. @mixin. You also need to ensure the v-app div has a height using
  49. `.v-app {height:100%;}`*