Hi, I am trying to set the theme in my app using a JNDI parameter, so I can’t use the @Theme annotation.
I have tried to use the setTheme method the first thing in the init method of the UI but that’s already too late, since first you can see for a second the page without a theme, and after that second it loads the theme.
I have thought then to override the getTheme method in a custom CDIUIProvider, but it is ignoring it. This is my UI:
[code] @Title(“My web”) @CDIUI(“hello”) @Push(transport= Transport.LONG_POLLING) @PreserveOnRefresh
public final class MyUI extends UI
{ @WebServlet(value = “/hello”, asyncSupported = true, initParams =
{ @WebInitParam(name = Constants.SERVLET_PARAMETER_UI_PROVIDER, value = “com.whatever.CustomCDIUIProvider”) }) @VaadinServletConfiguration(productionMode = false, ui = MyUI.class)
public static class Servlet extends VaadinCDIServlet
{
}
..
[/code]This is CustomCDIUIProvider:
public class CustomCDIUIProvider extends CDIUIProvider
{
@Override public String getTheme (UICreateEvent event) { return "mytheme"; }
}
How do I configure it properly so it uses my overitten method? Is this the correct approach?
[/code]But why can’t I set it in a class apart? I don’t like all this code in my UI class. Can somebody tell me why what I was doing before didn’t work?