Skinnability issues
jseanjensen Jan 18, 2011 4:32 PMI've been building an app from the seamgen standard build using jboss-5.1.0.GA, jboss-seam-2.2.0.GA and the RichFaces version that came with the download. I was modifying the Seam Web Project that I created so that I could change the skins using a drop down menu. All was well at first. I was happy with my work and went on to the next task. However I noticed that occasionally I was not getting the css styling when I would access the application in my browser. I undid the changes I had made to the system and still was not getting the styling to show up unless I changed the style using my new menu and even then the content would by styled but my menu would not. I also got inconsistent styling of components in the menu when it was styled; for example the menu would be styled but the drop down list would not be. I even switched to another app I created and attempted to reproduce my issues after modifying 3 files I started to get the results I was getting before. Could someone enlighten me as to the proper way of changing skins at runtime? These are the changes I made:
I added:
<component name="skinBean"> <property name="skin">deepMarine</property> </component>
to my components.xml.
I added a context param in my web.xml:
<context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>#{skinBean.skin}</param-value> </context-param>
I also modified my pages.xml to require login for all pages:
<page view-id="*" login-required="true"> <navigation> <rule if-outcome="home"> <redirect view-id="/home.xhtml"/> </rule> </navigation> </page>
I created the SkinBean and interface and modified my menu to call the setSkin(xxx) method which seems to be functioning:
<rich:menuItem> <s:link id="theme8" includePageParams="false" propagation="none" value="deepMarine" action="#{skinBean.setSkin('deepMarine')}"/> </rich:menuItem>
If I could just get the styling to come up properly initially and not lose it's parts then my modifications to make the changes should be ok.