I am doing a project in Vaadin 7. In that I need to change the theme of a page.
In Vaadin 6, there is a function called 'setTheme()'. so that I can change the theme using that function wherever I want in my code.
But, In Vaadin 7, I couldn't find any like that.
I know there will be a way to do it.
And also how to apply changes on the UI when I change a theme?
Will it be changed automatically? (or)
ICEPush gonna help me?
setTheme functionality has been introduced in Vaadin 7.3.0: https://vaadin.com/wiki/-/wiki/Main/Changing+theme+on+the+fly
you can try this for Vaadin 7:
DynamicThemeUIProvider.java
DemoUI.java
Then on a component which switches the theme:
Since I used custom themes, I have made it pretty simple. I used a toggle button and executed the required piece of code every time.
My css file will be like this.
Believe me; the theme switch is very very fast since the browser itself do the trick to switch the theme rather than asking the Vaadin server to do the switch.
In Vaadin 7 the method 'setTheme()' has been replaced with the new Annotation @Theme. The "on the fly theme change" is not possible in Vaadin 7.
There is a disucssion in this Vaadin Forum Thread about the on fly theme change in Vaadin 7. You should have a look on it.
Since Vaadin 7.3 you can use UI#setTheme()
In Vaadin 7 and higher Versions we have an Annotation called @Theme(yourThemeName) based on the Theme name which you give here it will redirect to that specific .scss Style.This annotation is called before the Init method is called.