4 Replies Latest reply on Aug 16, 2010 9:36 AM by Ilya Shaikovsky

    modalPanel no headerfrom bean

    Flavio Palumbo Newbie

      Hi all,

      i have a strange behavior tryng to set a modalPanel header.

      The modal panel is used to edit and insert records and i'd like to put a specific header.

      To switch beetwen the two cases i use a flag in a bean.

      The strange thing is that when i try to set the header of the modalPanel the flag does not work while few lines below the same flag in the same bean works perfectly.

      Any hint would be appreciated.

      Flavio

       

      Here is the code :

       

      <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:h="http://java.sun.com/jsf/html"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:a4j="http://richfaces.org/a4j"

            xmlns:rich="http://richfaces.org/rich">

       

          <rich:modalPanel id="ESBankEditPanel" autosized="false" keepVisualState="false" width="840" height="560" headerClass="panel-header-class">

              <f:facet name="header">

                  <h:outputText value="#{mess.titleEditBank}" rendered="#{!eSBank.insert}"/>         <----- here doesn't work

                  <h:outputText value="#{mess.titleInsertBank}" rendered="#{eSBank.insert}"/>        <----- here doesn't work

              </f:facet>

              <f:facet name="controls">

                  <span style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('ESBankEditPanel')">X</span>

              </f:facet>

              <h:form id="ESBankEditPanelForm">

                  <h:panelGroup layout="block" styleClass="scrolls">

                      <a4j:outputPanel id="ESBankTableMod" >

                          <h:panelGrid columns="2">

                              <h:outputText value="#{mess.labelBankId}"/>

                              <h:outputText value="#{eSBank.ESBank.a1id}" rendered="#{!eSBank.insert}"/>         <----- here works

                              <h:inputText id="a1id" value="#{eSBank.ESBank.a1id}" size="7" required="true"

                                           maxlength="7" requiredMessage="#{mess.errBankId}" rendered="#{eSBank.insert}" /> <----- here works

                              <h:outputText value="#{mess.labelUser}"/>

                              <h:outputText value="#{eSBank.ESBank.a1user}"  />

                              <h:outputText value="#{mess.labelBankCod}"/>

                              <h:inputText id="a1cdba" value="#{eSBank.ESBank.a1cdba}" size="25" required="true"

                                           maxlength="25" requiredMessage="#{mess.errBankCode}" />

                              <h:outputText value="#{mess.labelBankSoc}"/>

                              <h:inputText id="a1cdso" value="#{eSBank.ESBank.a1cdso}" size="25" required="true"

                                           maxlength="25" requiredMessage="#{mess.errBankSoc}" />

                              <h:outputText value="#{mess.labelBankDes}"/>

                              <h:inputText id="a1deba" value="#{eSBank.ESBank.a1deba}" size="100"

                                           required="true" requiredMessage="#{mess.errBankDesc}" />

                              <h:outputText value="#{mess.labelBankImpFiCC}"/>

                              <h:inputText id="a1pcmo" value="#{eSBank.ESBank.a1pcmo}" size="100" />

                              <h:outputText value="#{mess.labelBankSpoFiCC}"/>

                              <h:inputText id="a1pcim" value="#{eSBank.ESBank.a1pcim}" size="100" />

                              <h:outputText value="#{mess.labelBankClImpFiCC}"/>

                              <h:inputText id="a1clci" value="#{eSBank.ESBank.a1clci}" size="100" />

                              <h:outputText value="#{mess.labelBankClCalCC}"/>

                              <h:inputText id="a1clcr" value="#{eSBank.ESBank.a1clcr}" size="100" />

                              <h:outputText value="#{mess.labelBankClCanStoCC}"/>

                              <h:inputText id="a1clcc" value="#{eSBank.ESBank.a1clcc}" size="100" />

                              <h:outputText value="#{mess.labelBankImpFiTT}"/>

                              <h:inputText id="a1ptmo" value="#{eSBank.ESBank.a1ptmo}" size="100" />

                              <h:outputText value="#{mess.labelBankSpoFiTT}"/>

                              <h:inputText id="a1ptim" value="#{eSBank.ESBank.a1ptim}" size="100" />

                              <h:outputText value="#{mess.labelBankClImpFiTT}"/>

                              <h:inputText id="a1clti" value="#{eSBank.ESBank.a1clti}" size="100" />

                              <h:outputText value="#{mess.labelBankClCalTT}"/>

                              <h:inputText id="a1cltr" value="#{eSBank.ESBank.a1cltr}" size="100" />

                              <h:outputText value="#{mess.labelBankClCanStoTT}"/>

                              <h:inputText id="a1cltc" value="#{eSBank.ESBank.a1cltc}" size="100" />

                              <rich:spacer height="20" width="100" style="display: block"/>

                              <rich:spacer height="20" width="100" style="display: block"/>

                              <h:outputText value="#{mess.labelUserIns}"/>

                              <h:outputText value="#{eSBank.ESBank.a1usin}" />

                              <h:outputText value="#{mess.labelDataIns}"/>

                              <h:outputText value="#{eSBank.ESBank.a1dtin}" >

                                  <f:convertDateTime pattern="dd-MM-yyyy HH:mm:ss" />

                              </h:outputText>

                              <h:outputText value="#{mess.labelUserVar}"/>

                              <h:outputText value="#{eSBank.ESBank.a1usva}" />

                              <h:outputText value="#{mess.labelDataVar}"/>

                              <h:outputText value="#{eSBank.ESBank.a1dtva}"  >

                                  <f:convertDateTime pattern="dd-MM-yyyy HH:mm:ss" />

                              </h:outputText>

                          </h:panelGrid>

                          <rich:spacer height="20" width="100" style="display: block"/>

                          <rich:spacer height="20" width="100" style="display: block"/>

                          <a4j:commandLink action="#{eSBank.confirmData}"

                                           reRender="ESBankTable"

                                           oncomplete="if (!ajaxRequestContainsErrors()) #{rich:component('ESBankEditPanel')}.hide();" >

                              <h:graphicImage url="/resources/images/check.png" title="#{mess.tipConferma}"/>

                          </a4j:commandLink>

                      </a4j:outputPanel>

                  </h:panelGroup>

                  <rich:spacer height="10" width="100" style="display: block"/>

                  <rich:messages id="ESBankEditPanelErr" style="color:red;" layout="list"></rich:messages>

              </h:form>

          </rich:modalPanel>

      </html>

        • 1. Re: modalPanel no headerfrom bean
          Rob Acraman Newbie

          Are the non-working elements being reRendered?

           

          In the previous issue, you had :

          <a4j:commandLink reRender="ESBankEditOutPanel" ajaxSingle="true"
                                               action="#{eSBank.editSetup}"
                                               oncomplete="javascript:Richfaces.showModalPanel('ESBankEditPanel');" >

           

          So you were only rerendering the panel inside the modalPanel, leaving the header containing whatever it was last set to.

          • 2. Re: modalPanel no headerfrom bean
            Flavio Palumbo Newbie

            Hi,

            you make me understand what i mistake in another part of my code ;-))

            For this your right, i rerender the outputpanel inside the modal panel, but if i try to rerender the whole modalpanel nothing changes.

            Can you give another hint ?

            Thanks a lot.

            Flavio

             

            Here is the enclosing page of the previous.

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:h="http://java.sun.com/jsf/html"
                  xmlns:f="http://java.sun.com/jsf/core"
                  xmlns:a4j="http://richfaces.org/a4j"
                  xmlns:rich="http://richfaces.org/rich">

             

                <ui:composition>
                    <h:form id="ESBankform">
                        <rich:panel header="#{mess.bankTitleList}" headerClass="panel-header-class">
                            <rich:extendedDataTable
                                value="#{eSBank.dataModel}" var="item" id="ESBankTable"
                                width="850px" height="400px"
                                sortMode="#{eSBank.sortMode}"
                                selectionMode="#{eSBank.selectionMode}"
                                tableState="#{eSBank.tableState}"
                                selection="#{eSBank.selection}">

             

                                <rich:column sortable="true" sortBy="#{item.a1id}" label="a1id"
                                             id="a1id_col" width="40px">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelBankId}" id="a1id_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1id}" id="a1id_fld" style="text-align: right"/>
                                </rich:column>
                                <rich:column sortable="true" sortBy="#{item.a1cdba}" id="a1cdba_col"
                                             filterBy="#{item.a1cdba}" filterEvent="onkeyup" width="120px"
                                             label="a1cdba">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelBankCod}" id="a1cdba_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1cdba}" id="a1cdba_fld"/>
                                </rich:column>
                                <rich:column sortable="true" sortBy="#{item.a1deba}" id="a1deba_col"
                                             filterBy="#{item.a1deba}" filterEvent="onkeyup" width="250px"
                                             label="a1deba">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelBankDes}" id="a1deba_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1deba}" id="a1deba_fld"/>
                                </rich:column>
                                <rich:column sortable="false" label="a1cdso" id="a1cdso_col" width="100px">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelBankSoc}" id="a1cdso_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1cdso}" id="a1cdso_fld"/>
                                </rich:column>
                                <rich:column sortable="false" label="a1user" id="a1user_col" width="100px">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelUser}" id="a1user_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1user}" id="a1user_fld"/>
                                </rich:column>
                                <rich:column sortable="false" label="a1usva" id="a1usva_col" width="100px">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelUserVar}" id="a1usva_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1usva}" id="a1usva_fld"/>
                                </rich:column>
                                <rich:column sortable="false" label="a1dtva" id="a1dtva_col" width="140px">
                                    <f:facet name="header">
                                        <h:outputText value="#{mess.labelDataVar}" id="a1dtva_hea"/>
                                    </f:facet>
                                    <h:outputText value="#{item.a1dtva}" id="a1dtva_fld">
                                        <f:convertDateTime pattern="dd-MM-yyyy HH:mm:ss" />
                                    </h:outputText>
                                </rich:column>

             

                                <a4j:support reRender="selectiontable" id="extended_table_bean_take_selection"
                                             action="#{eSBank.takeSelection}"
                                             event="onselectionchange" />
                            </rich:extendedDataTable>
                            <rich:panel>
                                <a4j:commandLink reRender="ESBankEditPanel"  ajaxSingle="true"
                                                 action="#{eSBank.editSetup}"
                                                 oncomplete="javascript:Richfaces.showModalPanel('ESBankEditPanel');" >
                                    <h:graphicImage url="/resources/images/nuovo.png" title="#{mess.tipEdit}"/>
                                    <f:setPropertyActionListener value="I" target="#{eSBank.curFunc}" />
                                </a4j:commandLink>
                                <a4j:commandLink reRender="ESBankEditPanel"  ajaxSingle="true"
                                                 action="#{eSBank.editSetup}"
                                                 oncomplete="javascript:Richfaces.showModalPanel('ESBankEditPanel');" >
                                    <h:graphicImage url="/resources/images/edit.png" title="#{mess.tipEdit}"/>
                                    <f:setPropertyActionListener value="M" target="#{eSBank.curFunc}" />
                                </a4j:commandLink>
                                <a4j:commandLink reRender="ESBankTableDel"  ajaxSingle="true"
                                                 action="#{eSBank.editSetup}"
                                                 oncomplete="javascript:Richfaces.showModalPanel('ESBankDeletePanel');" >
                                    <h:graphicImage url="/resources/images/delete.png" title="#{mess.tipDelete}"/>
                                    <f:setPropertyActionListener value="D" target="#{eSBank.curFunc}" />
                                </a4j:commandLink>
                            </rich:panel>
                            <rich:spacer height="10" width="100" style="display: block"/>
                            <rich:messages id="ESBankTableErr" infoClass="msg-info-class" errorClass="msg-err-class" layout="list"></rich:messages>
                        </rich:panel>
                    </h:form>
                    <ui:include src="/tables/eSBank/ESBankDelete.xhtml"/>
                    <ui:include src="/tables/eSBank/ESBankEdit.xhtml"/>
                </ui:composition>
            </html>

            • 3. Re: modalPanel no headerfrom bean
              Flavio Palumbo Newbie

              Hi,

              your suggestions was enough, i solved.

              I was not right saying that nothing changes ; testing better i found that only the last outputText in the header of the modalpanel was displayed.

              It seems that modalPanel cannot manage more than one outputText for header.

              Anyway, understood the mechanism i solved with a bean method.

              Thanks a lot.

              Flavio

              • 4. Re: modalPanel no headerfrom bean
                Ilya Shaikovsky Master

                not MP limitation. Just facets in JSF has limtation that accepts only oine child.