10 Replies Latest reply on Nov 11, 2008 7:10 AM by savge

    Strnage Skin behaviour

    shandor

      HI

      I am using skin selection in a menu as bellow:

      <rich:menuItem submitMode="ajax" ajaxSingle="true" reRender="_mbr,_tbr,tabbed_pane_list" value="Classic" action="#{skinBean.classicSkin}" id="_skin1"/>
      


      The reRender property points to 3 parent components on the page ( I dont know how to specify full page reRendering ).
      The behaviour is as follows: First time I choose a skin it works fine and colors change accordingly. If I try to select a skin a second time ( i.e I start from classic then choose blueSky then go to classic again ) the page will not change the color correctly and old colors remain ( if I refresh the page with the browser refresh button it corrects itself )



        • 1. Re: Strnage Skin behaviour
          ilya_shaikovsky

          I think you just could use h:command* component in order to refresh the page with new skin.

          • 2. Re: Strnage Skin behaviour
            shandor

            True.
            But I need it in a RichMenu and I dont want to submit all my components values ( which will go through validation etc. ) when changing skin.

            The problem remains though that skins do not refresh properly scond time they are selcted

            • 3. Re: Strnage Skin behaviour
              ilya_shaikovsky

              if you have your menu in separate form - nothing will be applied.

              • 4. Re: Strnage Skin behaviour
                shandor

                I have one form only on the page which include the menu bar, tool bar and all the other components ( as I said first time when I choose a skin it is applied correctly)

                I noticed something else: The only thing that will change color when choosing a skin ( in the second time ) is the item seperators on my toolbar:


                <rich:toolBar height="26" itemSeparator="line" id="_tbr">
                



                Maybe it is a caching problem ?

                • 5. Re: Strnage Skin behaviour
                  guarf

                  I have the same problem when I try to change the background, only work the first time :(

                  • 6. Re: Strnage Skin behaviour
                    lgweb

                    Use this page to change the skin and language tbm and works very well, including qdo have required fields and forms, this page is imported by tds the other of my system using <c:import>

                    
                    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                    <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                    <html>
                    <head>
                    <title></title>
                    
                    </head>
                    <body>
                    
                     <center>
                     <rich:panel style=" width : 989px;">
                     <rich:toolBar itemSeparator="disc" style=" width : 975px;">
                     <rich:toolBarGroup itemSeparator="line">
                     <h:commandLink immediate="true" action="#{local.MudaLocale}">
                     <f:param value="pt" name="languageCode"/>
                     <h:graphicImage value="/images/BR.png" width="20" styleClass="imagem"></h:graphicImage>
                     </h:commandLink>
                    
                     <h:commandLink immediate="true" action="#{local.MudaLocale}">
                     <f:param value="en" name="languageCode"/>
                     <h:graphicImage value="/images/english.gif"styleClass="imagem"></h:graphicImage>
                     </h:commandLink>
                    
                     <h:commandLink immediate="true" action="#{local.MudaLocale}">
                     <f:param value="es" name="languageCode"/>
                     <h:graphicImage value="/images/SP.png" width="20" height="21"
                     styleClass="imagem"></h:graphicImage>
                     </h:commandLink>
                     </rich:toolBarGroup>
                     <rich:toolBar itemSeparator="disc">
                    
                     <h:commandLink value="BlueSky" styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="blueSky" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                     <h:commandLink value="EmeraldTow"styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="emeraldTown" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                     <h:commandLink value="Wine" styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="wine" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                     <h:commandLink value="JapanCherry"styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="japanCherry" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                    
                     <h:commandLink value="Ruby"styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="ruby" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                     <h:commandLink value="DeepMarine"styleClass="menuBranco" immediate="true">
                    
                     <a4j:actionparam name="skin" value="deepMarine" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                    
                    
                    
                     <h:commandLink value="Classic"styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="classic" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                    
                     <h:commandLink value="Plain"styleClass="menuBranco" immediate="true">
                     <a4j:actionparam name="skin" value="plain" assignTo="#{skinBean.skin}" />
                     </h:commandLink>
                    
                    
                     <h:commandLink immediate="true" value="Inicio" action="Menu"styleClass="menuBranco">
                     </h:commandLink>
                    
                    
                     </rich:toolBar>
                    
                    
                     <rich:toolBarGroup itemSeparator="line" location="right">
                    
                     </rich:toolBarGroup>
                     </rich:toolBar>
                     </rich:panel>
                     </center>
                    
                    </body>
                    </html>
                    
                    


                    My skinBean this way:
                    
                    package com.Lgweb.Tcc.Util;
                    
                    import java.io.Serializable;
                    import javax.faces.context.FacesContext;
                    import javax.servlet.http.HttpSession;
                    
                     public class SkinBean implements Serializable {
                     private static final long serialVersionUID = -2399884208294434812L;
                     private String skin="ruby";
                    
                     public String getSkin() {
                     String param = getSkinParam();
                     if (param!=null) {
                     setSkin(param);
                     }
                     return skin;
                     }
                     public void setSkin(String skin) {
                     this.skin = skin;
                     }
                    
                     private String getSkinParam(){
                     FacesContext fc = FacesContext.getCurrentInstance();
                     String param = (String) fc.getExternalContext().getRequestParameterMap().get("s");
                     if (param!=null && param.trim().length()>0) {
                     return param;
                     } else {
                     return null;
                     }
                     }
                    }
                    


                    I hope this helps, hugging.

                    • 7. Re: Strnage Skin behaviour
                      shandor

                      Thanks LGWEB,

                      I will check it out

                      • 8. Re: Strnage Skin behaviour

                        I have the same problem too... Only works with a non ajax submit mode... in other case the menu crashs... Some times works 1, 2 ...3 times...but when u try to go back to an already selected skin nothing happens... i think thats maybe a richfaces bug. Sorry for my poor english :(

                        • 9. Re: Strnage Skin behaviour
                          ilya_shaikovsky

                          guys... I repeat if you make controls for skin change - just use h:command* controls or rich controls with server mode and with immediate="true" or wrapped in its own form. New stylesheets should be loaded and apllied to the whole page - so all the page should be refreshed.

                          • 10. Re: Strnage Skin behaviour

                            Humm...My mistake... Now i understand that this cant be done using ajax mode. thanks