GWT: Dynamically Changing CSS Styles

Are you building a Google Web Toolkit application? Has someone asked you to personalize colors or images for their account? If so, you may have tried to look for things like dynamic CSS in GWT as well. While Googling these terms, I could not find what I needed. After some more Googling and reading some not so helpful posts, I found a project titled Advanced GWT Components.

This project has a set of widgets which support switching themes at runtime. That was exactly what I was looking for, but I had no need for the widgets. So I picked the project apart and adapted the way it changes CSS on runtime to fit our application. In this post I will take you through the pieces of code we used to complete this. Note: this is going to be quite a long and code heavy post ^_^

Continue reading