如何在弹出窗口中选择重置选项卡?

时间:2012-09-21 12:02:21

标签: java-ee jsf-2 primefaces

当我打开弹出窗口并更改所选标签时,如果我关闭此弹出窗口并再次打开所选标签页。

此弹出窗口打开时如何重置?

哪个避免双电梯的最佳解决方案在第二个截图中?

查看代码:

        <p:dialog id="dialog" rendered="true"
            header="#{gestSoftware.action} Configuration des produits"
            widgetVar="confProd" resizable="false" showEffect="clip"
            hideEffect="fold">

            <h:panelGrid id="display" columns="2" cellpadding="4">



                <p:layout style="min-width:900px;min-height:600px;" id="layout">

                    <p:layoutUnit position="north" style="text-align:center;">

                        <p:panelGrid>
                            <p:row>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Reference"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Indice Majeur"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Indice Mineur"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center" colspan="2"><h:outputText value="Modele"/></p:column>
                            </p:row>
                            <p:row>

                                <p:column>
                                    <p:inputText
                                        value="#{gestConfigurationProductBean.referenceConfProduct}" />
                                </p:column>

                                <p:column>
                                    <p:inputText
                                        value="#{gestConfigurationProductBean.majorIndexConfProduct}" />
                                </p:column>
                                <p:column>
                                    <p:inputText
                                        value="#{gestConfigurationProductBean.minorIndexConfProduct}" />
                                </p:column>
                                <p:column colspan="2">
                                    <p:selectOneMenu
                                        value="#{gestConfigurationProductBean.selectedProductConfModel}">

                                        <f:selectItems
                                            value="#{gestConfigurationProductBean.productConfModelList}"
                                            var="productConf" itemLabel="#{productConf.reference}"
                                            itemValue="#{productConf}" />
                                        <f:converter converterId="productConfModelConverter" />
                                    </p:selectOneMenu>
                                </p:column>

                            </p:row>

                            <p:row>

                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Identifiable"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Etat"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Famille"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Alimentation"/></p:column>
                                <p:column styleClass="ui-widget-header"
                                    style="text-align:center"><h:outputText value="Fiche Suiveuse"/></p:column>
                            </p:row>

                            <p:row>


                                <p:column>
                                    <p:selectBooleanCheckbox
                                        value="#{gestConfigurationProductBean.identifiableConfProduct}" />
                                </p:column>

                                <p:column>
                                    <p:selectOneMenu
                                        value="#{gestConfigurationProductBean.stateConfProduct}">
                                        <f:selectItem itemLabel="actif" itemValue="1" />
                                        <f:selectItem itemLabel="inactif" itemValue="0" />

                                    </p:selectOneMenu>
                                </p:column>
                                <p:column>
                                    <p:selectOneMenu
                                        value="#{gestConfigurationProductBean.selectedProductFamily}">

                                        <f:selectItems
                                            value="#{gestConfigurationProductBean.productFamilyList}"
                                            var="productFam" itemLabel="#{productFam.name}"
                                            itemValue="#{productFam}" />
                                        <f:converter
                                            converterId="configurationProductFamilyConverter" />
                                    </p:selectOneMenu>
                                </p:column>
                                <p:column>
                                    <p:selectOneMenu
                                        value="#{gestConfigurationProductBean.selectedProductSupply}">
                                        <f:selectItem itemLabel="" itemValue="" />
                                        <f:selectItems
                                            value="#{gestConfigurationProductBean.productSupplyList}"
                                            var="productSupply" itemLabel="#{productSupply.name}"
                                            itemValue="#{productSupply}" />
                                        <f:converter converterId="productSupplyConverter" />
                                    </p:selectOneMenu>
                                </p:column>

                                <p:column>
                                    <p:selectOneMenu
                                        value="#{gestConfigurationProductBean.selectedFollowingFormModel}">
                                        <f:selectItem itemLabel="" itemValue="" />
                                        <f:selectItems
                                            value="#{gestConfigurationProductBean.followingFormModelList}"
                                            var="follFormModel" itemLabel="#{follFormModel.name}"
                                            itemValue="#{follFormModel}" />
                                        <f:converter converterId="followingFormModelConverter" />
                                    </p:selectOneMenu>
                                </p:column>

                            </p:row>
                        </p:panelGrid>

                    </p:layoutUnit>

                    <p:layoutUnit position="center" size="200px">
                        <p:tabView id="tabViewElement" dynamic="true" activeIndex="0">
                            <p:ajax event="tabChange"
                                Listener="#{gestConfigurationProductBean.onTabChange}"
                                update="tabViewElement" />

                            <p:tab id="idTabElementView" title="Elements Sectionnes">

                                <p:scrollPanel style="width:100%;height:100%">
                                    <p:dataTable id="productConfs" var="productConf"
                                        value="#{gestConfigurationProductBean.productConfsList}"
                                        rowKey="#{productConf.idProductConf}">

                                        <f:facet name="header">
                                            <h:outputText value="ELEMENTS" />
                                        </f:facet>

                                        <p:column headerText="Reference">
                                            <h:outputText value="#{productConf.reference}" />
                                        </p:column>

                                        <p:column headerText="Indice majeur">
                                            <h:outputText value="#{productConf.majorIndex}" />
                                        </p:column>

                                        <p:column headerText="Indice majeur">
                                            <h:outputText value="#{productConf.minorIndex}" />
                                        </p:column>

                                        <p:column headerText="Designation">
                                            <h:outputText
                                                value="#{productConf.productConfModel.reference}" />
                                        </p:column>


                                        <p:column headerText="Identifiable">
                                            <p:selectBooleanCheckbox disabled="true"
                                                value="#{productConf.identifiable}" />
                                        </p:column>


                                    </p:dataTable>
                                </p:scrollPanel>
                            </p:tab>

                            <p:tab id="tabSelectedElement" style="padding:none"
                                title="Choisir Elements">
                                <p:scrollPanel style="width:100%;height:100%">
                                    <p:dataTable id="cardsElements" var="cardElement"
                                        value="#{gestConfigurationProductBean.cardElementList}"
                                        rowKey="#{cardElement.idProductConf}"
                                        selection="#{gestConfigurationProductBean.selectedElement}"
                                        selectionMode="single">

                                        <f:facet name="header">
                                            <h:outputText value="ELEMENTS" />
                                        </f:facet>

                                        <p:column headerText="Selection">
                                            <p:selectBooleanCheckbox
                                                value="#{cardElement.selectedElement}">
                                                <p:ajax
                                                    listener="#{gestConfigurationProductBean.checkBoxElement}" />
                                            </p:selectBooleanCheckbox>
                                        </p:column>

                                        <p:column headerText="Reference">
                                            <h:outputText value="#{cardElement.reference}" />
                                        </p:column>

                                        <p:column headerText="Indice majeur">
                                            <h:outputText value="#{cardElement.majorIndex}" />
                                        </p:column>

                                        <p:column headerText="Indice majeur">
                                            <h:outputText value="#{cardElement.minorIndex}" />
                                        </p:column>

                                        <p:column headerText="Designation">
                                            <h:outputText
                                                value="#{cardElement.productConfModel.reference}" />
                                        </p:column>


                                        <p:column headerText="Identifiable">
                                            <p:selectBooleanCheckbox disabled="true"
                                                value="#{cardElement.identifiable}" />
                                        </p:column>
                                    </p:dataTable>
                                </p:scrollPanel>
                            </p:tab>
                        </p:tabView>
                    </p:layoutUnit>

                    <p:layoutUnit position="south" style="margin-top:10px;">
                        <p:tabView id="softwareTabView">
                            <p:ajax event="tabChange"
                                Listener="#{gestConfigurationProductBean.onTabChange}"
                                update="softwareTabView" />
                            <p:tab id="idSoftwareView" title="Logiciels selectionnes">
                                <p:scrollPanel style="width:100%;height:100%">
                                    <p:dataTable id="softwares" var="software"
                                        value="#{gestConfigurationProductBean.softwareList}"
                                        rowKey="#{software.idSoftware}">

                                        <f:facet name="header">
                                            <h:outputText value="LOGICIELS" />
                                        </f:facet>

                                        <p:column headerText="Nom">
                                            <h:outputText value="#{software.name}" />
                                        </p:column>

                                        <p:column headerText="Version">
                                            <h:outputText value="#{software.version}" />
                                        </p:column>

                                    </p:dataTable>
                                </p:scrollPanel>
                            </p:tab>

                            <p:tab id="idSelectedSoftwareView" title="Choisir Logiciels"
                                height="100%">
                                <p:scrollPanel style="width:100%;height:100%">
                                    <p:dataTable id="softwaresSelected" var="softwareSelected"
                                        value="#{gestConfigurationProductBean.softwareElementList}"
                                        rowKey="#{softwareSelected.idSoftware}">

                                        <f:facet name="header">
                                            <h:outputText value="LOGICIELS" />
                                        </f:facet>

                                        <p:column headerText="Selection">
                                            <p:selectBooleanCheckbox
                                                value="#{softwareSelected.selectedSoftware}">
                                                <p:ajax
                                                    listener="#{gestConfigurationProductBean.checkBoxSoftware}" />
                                            </p:selectBooleanCheckbox>
                                        </p:column>
                                        <p:column headerText="Nom">
                                            <h:outputText value="#{softwareSelected.name}" />
                                        </p:column>

                                        <p:column headerText="Version">
                                            <h:outputText value="#{softwareSelected.version}" />
                                        </p:column>
                                    </p:dataTable>
                                </p:scrollPanel>
                            </p:tab>
                        </p:tabView>
                    </p:layoutUnit>
                </p:layout>
            </h:panelGrid>
            <h:panelGrid columns="2">
                <p:commandButton value="Editer"
                    actionListener="#{gestConfigurationProductBean.buttonForm}"
                    update="message,productConfModels" />

                <p:commandButton value="Annuler"
                    actionListener="#{gestConfigurationProductBean.quit}" />
            </h:panelGrid>
        </p:dialog>

enter image description here enter image description here

谢谢!

1 个答案:

答案 0 :(得分:2)

要确保在打开对话框时选中了标签,您可以使用对话框的onShow属性。

<p:dialog onShow="tabview.select(1)">
    <p:tabView widgetVar="tabview">
        <p:tab>
            This is tab 1
        </p:tab>
        <p:tab>
            This is tab 2
        </p:tab>
    </p:tabView>
</p:dialog>