maia/.svn/pristine/f3/f3ef4fa6343f37e73e6d5cd55c2...

59 lines
5.4 KiB
Plaintext
Executable File

<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:comp="http://java.sun.com/jsf/composite">
<comp:interface shortDescription="Componente que incluye los botones de consultar, previo y siguiente pagina. Adicionalmente los botones de crear y grabar">
<comp:attribute name="controller" shortDescription="Controlador de la tabla a dar mantenimiento" />
<comp:attribute name="childController" shortDescription="Controlador para crear un nuevo registro, esta opcion es mas usado en los tabs donde existe un controlador padre y varios hijos" />
<comp:attribute name="queryProcess" shortDescription="Widgets a procesar" />
<comp:attribute name="queryUpdate" shortDescription="Widgets a actualizar" />
<comp:attribute name="createProcess" shortDescription="Widgets a procesar" />
<comp:attribute name="createUpdate" shortDescription="Widgets a actualizar" />
<comp:attribute name="saveProcess" shortDescription="Widgets a procesar" />
<comp:attribute name="saveUpdate" shortDescription="Widgets a actualizar" />
<comp:attribute name="showQueryBtn" shortDescription="Mostrar boton consultar, el valor por defecto es 'true'" default="true" />
<comp:attribute name="showNextBtn" shortDescription="Mostrar boton pagina siguiente, el valor por defecto es 'true'" default="true" />
<comp:attribute name="showPreviousBtn" shortDescription="Mostrar boton pagina previa, el valor por defecto es 'true'" default="true" />
<comp:attribute name="showCreateBtn" shortDescription="Mostrar boton crear, el valor por defecto es 'true'" default="true" />
<comp:attribute name="showSaveBtn" shortDescription="Mostrar boton guardar, el valor por defecto es 'true'" default="true" />
<comp:attribute name="disableQueryBtn" shortDescription="Deshabilita boton consultar, el valor por defecto es 'false'" default="false" />
<comp:attribute name="disableNextBtn" shortDescription="Deshabilita boton pagina siguiente, el valor por defecto es 'false'" default="false" />
<comp:attribute name="disablePreviousBtn" shortDescription="Deshabilita boton pagina previa, el valor por defecto es 'false'" default="false" />
<comp:attribute name="disableCreateBtn" shortDescription="Deshabilita boton crear, el valor por defecto es 'false'" default="false" />
<comp:attribute name="disableSaveBtn" shortDescription="Deshabilita boton guardar, el valor por defecto es 'false'" default="false" />
<comp:attribute name="dialogWidgetVar" shortDescription="Widgetvar del dialogo" />
</comp:interface>
<comp:implementation>
<div id="#{cc.clientId}">
<h:panelGrid columns="5">
<p:commandButton id="queryControl" value="#{msg_general.btn_query}" icon="ui-icon-search" action="#{cc.attrs.controller.query()}" update="#{cc.attrs.queryUpdate}" process="@this, #{cc.attrs.queryProcess}" rendered="#{cc.attrs.showQueryBtn}" disabled="#{cc.attrs.disableQueryBtn}"/>
<p:commandButton value="#{msg_general.btn_previous}" icon="ui-icon-seek-prev" action="#{cc.attrs.controller.previous()}" update="#{cc.attrs.queryUpdate}" process="@this, #{cc.attrs.queryProcess}" rendered="#{cc.attrs.showPreviousBtn}" disabled="#{cc.attrs.disablePreviousBtn}"/>
<p:commandButton value="#{msg_general.btn_next}" icon="ui-icon-seek-next" action="#{cc.attrs.controller.next()}" update="#{cc.attrs.queryUpdate}" process="@this, #{cc.attrs.queryProcess}" rendered="#{cc.attrs.showNextBtn}" disabled="#{cc.attrs.disableNextBtn}"/>
<c:choose>
<c:when test="#{!empty cc.attrs.childController}">
<p:commandButton id="createControl" value="#{msg_general.btn_create}" update="#{cc.attrs.createUpdate}" process="@this, #{cc.attrs.createProcess}" icon="ui-icon-plus" action="#{cc.attrs.childController.create()}" oncomplete="if(args.validationFailed){return false;} PF('#{cc.attrs.dialogWidgetVar}').show()" rendered="#{cc.attrs.showCreateBtn}" disabled="#{cc.attrs.disableCreateBtn}">
<f:setPropertyActionListener target="#{cc.attrs.childController.newRow}" value="#{true}" />
<f:setPropertyActionListener target="#{cc.attrs.childController.showRow}" value="#{false}" />
</p:commandButton>
</c:when>
<c:otherwise>
<p:commandButton id="createControl" value="#{msg_general.btn_create}" update="#{cc.attrs.createUpdate}" process="@this, #{cc.attrs.createProcess}" icon="ui-icon-plus" action="#{cc.attrs.controller.create()}" oncomplete="if(args.validationFailed){return false;} PF('#{cc.attrs.dialogWidgetVar}').show()" rendered="#{cc.attrs.showCreateBtn}" disabled="#{cc.attrs.disableCreateBtn}">
<f:setPropertyActionListener target="#{cc.attrs.controller.newRow}" value="#{true}" />
<f:setPropertyActionListener target="#{cc.attrs.controller.showRow}" value="#{false}" />
</p:commandButton>
</c:otherwise>
</c:choose>
<p:commandButton id="saveControl" value="#{msg_general.btn_save}" icon="ui-icon-disk" update="#{cc.attrs.saveUpdate}" process="@this, #{cc.attrs.saveProcess}" action="#{cc.attrs.controller.save()}" rendered="#{cc.attrs.showSaveBtn}" disabled="#{cc.attrs.disableSaveBtn}"/>
</h:panelGrid>
</div>
</comp:implementation>
</ui:component>