semanticLayout + modalPanel
guimoz Jul 21, 2009 2:48 PM
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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">
<head>
<script src="#{facesContext.externalContext.request.contextPath}/js/utils.js" type="text/javascript"></script>
</head>
<f:view>
<body>
<!--Verfifica se há mensagens de validação no inputHiddden
Se houver não deixar fechar o modal nos Cadastros -->
<a4j:outputPanel ajaxRendered="true">
<h:form style="display:none" prependId="false">
<h:inputHidden id="maximumSeverity" value="#{facesContext.maximumSeverity.ordinal}"/>
</h:form>
</a4j:outputPanel>
<rich:panel>
<f:facet name="header">
Orgão Lista
</f:facet>
<h:form>
<center>
<h:panelGrid columns="2">
<a4j:commandButton action="#{orgaoCadastro.novo}"
value="Novo"
reRender="orgaoCadastro"
oncomplete="#{rich:component('modalOrgao')}.show();"/>
</h:panelGrid>
<rich:dataTable value="#{orgaoCadastro.pesquisar}"
var="orgao" id="orgaoLista"
>
<f:facet name="header">
<rich:columnGroup>
<rich:column>
<h:outputText value="Código" />
</rich:column>
<rich:column>
<h:outputText value="Descrição" />
</rich:column>
<rich:column>
<h:outputText value="Sigla" />
</rich:column>
<rich:column>
</rich:column>
<rich:column>
</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column>
<h:outputText value="#{orgao.codigo}" />
</rich:column>
<rich:column>
<h:outputText value="#{orgao.descricao}" />
</rich:column>
<rich:column>
<h:outputText value="#{orgao.sigla}" />
</rich:column>
<rich:column>
<a4j:commandLink action="#{orgaoCadastro.remover}"
reRender="orgaoLista" id="excluirlink">
<h:graphicImage value="/img/excluir.png" style="border:0px"/>
<rich:toolTip for="excluirlink" value="Excluir"/>
<a4j:actionparam name="codigo" value="#{orgao.codigo}" assignTo="#{orgaoCadastro.parametro}"/>
</a4j:commandLink>
</rich:column>
<rich:column>
<a4j:commandLink action="#{orgaoCadastro.editar}"
reRender="orgaoCadastro" id="editarlink"
oncomplete="#{rich:component('modalOrgao')}.show();">
<h:graphicImage value="/img/editar.png" style="border:0px"/>
<rich:toolTip for="editarlink" value="Editar"/>
<a4j:actionparam name="codigo" value="#{orgao.codigo}" assignTo="#{orgaoCadastro.parametro}"/>
</a4j:commandLink>
</rich:column>
</rich:dataTable>
</center>
</h:form>
</rich:panel>
<rich:modalPanel id="modalOrgao" autosized="true">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Cadastro de Orgão "></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:form>
<h:graphicImage value="/img/fechar.png"
id="fechar" />
<rich:componentControl for="modalOrgao" attachTo="fechar"
operation="hide" event="onclick" />
</h:form>
</h:panelGroup>
</f:facet>
<ui:include src="/paginas/orgaoCadastro.xhtml" />
</rich:modalPanel>
</body>
</f:view>
</html><?xml version="1.0" encoding="ISO-8859-1" ?>
<rich:page 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:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j" markupType="xhtml"
contentType="text/html" theme="#{layoutBean.theme}"
width="#{layoutBean.width}" sidebarWidth="#{layoutBean.sidebarWidth}"
sidebarPosition="#{layoutBean.position}">
<f:facet name="sidebar">
<a4j:include viewId="/paginas/menu.xhtml"/>
</f:facet>
<f:facet name="header">
<h:panelGroup>
<table width="100%"><tbody><tr>
<td><h2>Protocolo</h2></td>
<td align="right" >
<h:outputText value="Links" style="color:#FFFFFF;" />
</td>
</tr></tbody></table>
</h:panelGroup>
</f:facet>
<f:facet name="footer">
<h:outputText
value="Copyright (c) 2009 XXX. All rights reserved. Protocolo 0.1" />
</f:facet>
<h:form>
<rich:layout>
<rich:layoutPanel position="center" width="50%">
<a4j:outputPanel ajaxRendered="true">
<a4j:include viewId="#{conteudo.url}"/>
</a4j:outputPanel>
</rich:layoutPanel>
</rich:layout>
</h:form>
</rich:page>ass u can see, im using semanticLayout, when i try to open up a modalPanel that have its body included from other xhtml, it does not open. When i put some static data on my modalpanel, and click on my commandlink, it does not open too. The only way i can show my modal, is putting some static data on it, and open calling the onclick event of my commandlink!
Whats wrong ?