[RESOLVIDO]rich:modalPanel para visualizar as mesnsagens

8 respostas
robson_vs

Gostaria de fazer um modalPanel para visualizar as mensagens da inha aplicação

criei um form assim

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition 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:c="http://java.sun.com/jstl/core"
      xmlns:rich="http://richfaces.org/rich">

	<rich:modalPanel id="modalInfo" width="350" height="250">
		<f:facet name="header">
			<h:panelGroup>
				<h:graphicImage value="" />
				<h:outputText value="MENSAGEM" />
			</h:panelGroup>
		</f:facet>
		
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="modalInfo_X" />
				<rich:componentControl for="modalInfo" attachTo="modalInfo_X" operation="hide" event="onclick"/>
			</h:panelGroup>
		</f:facet>
		
		<ul>
			<li>
				<h:graphicImage value="" />
				<h:messages />
			</li>
			<li>
				<a jsfc="h:commandLink"
						id="btnFechar" 
						href="javascript:void(null);"
						class="button"
						onclick="this.blur();" 
						onkeypress="this.blur();">
					<strong>
						<h:outputText value="#{msgs.buttonIncluir}"/>
					</strong>
					<rich:componentControl for="modalInfo" 
											attachTo="btnFechar" 
											operation="hide" 
											event="onclick"/>
				</a>
			</li>
		</ul>
	</rich:modalPanel>

	<h:commandLink id="modalInfo_btnFechar"
					value="#{msgs.buttonIncluir}"
					action="#{suggestionboxBean.teste}">
		<rich:componentControl for="modalInfo" 
								attachTo="modalInfo_btnFechar" 
								operation="show" 
								event="onclick"/>
	</h:commandLink>

</ui:composition>

Mais ñ esta funcionando gostaria de saber se alguem já fez algo do genero e pode me dar alguma idéia

Grato a atodos.

Robson

8 Respostas

L

O que vc gostaria de exibir?Seria as mensagens de erro em um modalPanel,é isto?

robson_vs

lgweb:
O que vc gostaria de exibir?Seria as mensagens de erro em um modalPanel,é isto?
sim

robson_vs

e se possivel de uma forma generica

L

Funciona assim:

&lt;rich:modalPanel id="error" autosized="true" showWhenRendered="#{facesContext.maximumSeverity !=null}"&gt;
                 &lt;f:facet name="header"&gt;
                 &lt;h:outputText value="#{msg.erros}"&gt;&lt;/h:outputText&gt;
                 &lt;/f:facet&gt;
                 &lt;f:facet name="controls"&gt;
                 &lt;h:graphicImage value="/images/BOTOES/cancel.png" width="20" height="20"styleClass="imagem"
                 style="cursor:pointer"   onclick="Richfaces.hideModalPanel('error')" /&gt;
                 &lt;/f:facet&gt;
               &lt;table class="blank" style="font-size: 10pt; white-space: nowrap"&gt;
                &lt;nobr&gt;
               &lt;rich:messages&gt;
               &lt;f:facet name="errorMarker"&gt;
               &lt;h:graphicImage value="/images/BOTOES/cancel.png"
                width="20" height="20"styleClass="imagem"/&gt;   
               &lt;/f:facet&gt;
               &lt;f:facet name="warnMarker"&gt;
               &lt;h:graphicImage value="/images/info.png"
               width="20" height="20"styleClass="imagem" /&gt;   
               &lt;/f:facet&gt;
              &lt;f:facet name="infoMarker"&gt;
              &lt;h:graphicImage value="/images/accept.png" 
              width="20" height="20"styleClass="imagem" /&gt;   
              &lt;/f:facet&gt;
              &lt;/rich:messages&gt;
              &lt;/nobr&gt;
              &lt;/table&gt;
              &lt;/rich:modalPanel&gt;

Testa aew depois me diga se funfou.
falow

robson_vs

lgweb:
Funciona assim:

&lt;rich:modalPanel id="error" autosized="true" showWhenRendered="#{facesContext.maximumSeverity !=null}"&gt;
                 &lt;f:facet name="header"&gt;
                 &lt;h:outputText value="#{msg.erros}"&gt;&lt;/h:outputText&gt;
                 &lt;/f:facet&gt;
                 &lt;f:facet name="controls"&gt;
                 &lt;h:graphicImage value="/images/BOTOES/cancel.png" width="20" height="20"styleClass="imagem"
                 style="cursor:pointer"   onclick="Richfaces.hideModalPanel('error')" /&gt;
                 &lt;/f:facet&gt;
               &lt;table class="blank" style="font-size: 10pt; white-space: nowrap"&gt;
                &lt;nobr&gt;
               &lt;rich:messages&gt;
               &lt;f:facet name="errorMarker"&gt;
               &lt;h:graphicImage value="/images/BOTOES/cancel.png"
                width="20" height="20"styleClass="imagem"/&gt;   
               &lt;/f:facet&gt;
               &lt;f:facet name="warnMarker"&gt;
               &lt;h:graphicImage value="/images/info.png"
               width="20" height="20"styleClass="imagem" /&gt;   
               &lt;/f:facet&gt;
              &lt;f:facet name="infoMarker"&gt;
              &lt;h:graphicImage value="/images/accept.png" 
              width="20" height="20"styleClass="imagem" /&gt;   
              &lt;/f:facet&gt;
              &lt;/rich:messages&gt;
              &lt;/nobr&gt;
              &lt;/table&gt;
              &lt;/rich:modalPanel&gt;

Testa aew depois me diga se funfou.
falow

ok valeu vou fazer um teste e te aviso.

Muito obrigado por enquanto

robson_vs

Então lgweb

Ainda ñ deu certo

fiz a seguinte página para testar mais nada sabe oque pode ser?

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition 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:c="http://java.sun.com/jstl/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:acegijsf="http://sourceforge.net/projects/jsf-comp/acegijsf"
      template="/templates/template-pages.xhtml">

		<ui:define name="pageTitle">titulo</ui:define>
		<ui:define name="pageHeader">header</ui:define>
		<ui:define name="body">
			<h:form>
				<h:inputText value="" required="true">
					<f:validateLength minimum="1" maximum="3"/>
					<f:validateLongRange minimum="0" maximum="1000"/>
				</h:inputText>
				<h:commandButton value="teste"/>
			</h:form>
		</ui:define>
</ui:composition>

os erros são jogados no console mais ñ no modalpanel

robson_vs

Cara desculpe tinha comido bola consegui resolver agora

é q como tinha feito em uma página a parte tinha esquecido de importar o conteúdo
com <ui:include src="/pages/modalPanelMessages.xhtml" />

meu código ficou assim para se mais alguem quizer fazer
messages.xhtml

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition 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:c="http://java.sun.com/jstl/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:acegijsf="http://sourceforge.net/projects/jsf-comp/acegijsf">
  
	<rich:modalPanel id="msgsErros" autosized="true" showWhenRendered="#{facesContext.maximumSeverity !=null}">  
		<f:facet name="header">  
			<h:outputText value="#{msgs.}" />  
		</f:facet>  
		<f:facet name="controls">  
			<h:graphicImage value="/images/bt_fechar.png" 
							width="20" 
							height="20"
							styleClass="imagem"  
							style="cursor:pointer"   
							onclick="Richfaces.hideModalPanel('msgsErros')" />  
		</f:facet>  
		<table class="blank" style="font-size: 10pt; white-space: nowrap">  
			<nobr>  
				<rich:messages>  
					<f:facet name="errorMarker">  
						<h:graphicImage value="/images/cancel.png"  
										width="20" 
										height="20"
										styleClass="imagem"/>     
					</f:facet>  
					<f:facet name="warnMarker">  
						<h:graphicImage value="/images/info.png"  
										width="20" 
										height="20"
										styleClass="imagem" />     
					</f:facet>  
					<f:facet name="infoMarker">  
						<h:graphicImage value="/images/accept.png"   
										width="20" 
										height="20"
										styleClass="imagem" />     
					</f:facet>  
				</rich:messages>  
			</nobr>  
		</table>  
	</rich:modalPanel>	
</ui:composition>

página_qualquer.xhtml

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition 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:c="http://java.sun.com/jstl/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:acegijsf="http://sourceforge.net/projects/jsf-comp/acegijsf"
      template="/templates/template-pages.xhtml">

		<ui:define name="pageTitle">titulo</ui:define>
		<ui:define name="pageHeader">header</ui:define>
		<ui:define name="body">
		
		<ui:include src="/pages/messages.xhtml" />
		
			<h:form>
				<h:inputText value="" required="true">
					<f:validateLength minimum="1" maximum="3"/>
					<f:validateLongRange minimum="0" maximum="1000"/>
				</h:inputText>
				<h:commandButton value="submit"/>
				<h:commandButton action="#{testeMBean.teste}" value="teste" immediate="true"/>
			</h:form>
		</ui:define>
</ui:composition>

ficou muito bom valeu a ajuda lgweb obrigadão

flaviojmendes

Cara, salvou a minha vida tb…

Brigadão!

Criado 26 de maio de 2008
Ultima resposta 28 de set. de 2009
Respostas 8
Participantes 3