Skip to content

Instantly share code, notes, and snippets.

@gusthavosouza
Created January 9, 2014 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusthavosouza/8337782 to your computer and use it in GitHub Desktop.
Save gusthavosouza/8337782 to your computer and use it in GitHub Desktop.
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Noticias</title>
</h:head>
<h:body>
<h:form id="form">
<p:growl id="growl" showDetail="true"/>
<p:dataTable id="noticias" var="bus" value="#{beanSession.noticiaDataModel}" rowKey="#{bus}"
selection="#{beanSession.notice}" selectionMode="single" rows="15"
paginator="true" paginatorPosition="bottom" >
<p:ajax event="rowSelect" listener="#{beanSession.selectNotice}"
update=":form:display :form:growl" oncomplete="notdialog.show()"/>
<p:ajax event="rowUnselect" listener="#{beanSession.unselectNotice}" update=":form:growl"/>
<f:facet name="header">
Noticias
</f:facet>
<f:facet name="footer">
<p:commandButton value="Cadastrar nova noticia" onclick="cadastro.show()"
actionListener="#{beanSession.clear}" />
</f:facet>
<p:column headerText="Selecione um titulo para mais detalhes sobre a noticia">
#{bus.titulo}
</p:column>
</p:dataTable>
<p:dialog id="dialog" widgetVar="notdialog" resizable="false"
showEffect="fade" hideEffect="explode" width="600">
<h:panelGrid id="display" >
<h:outputText value="#{beanSession.notice.textNoticia}" />
<p:commandButton value="Excluir" actionListener="#{beanSession.excluir}" ajax="false" />
</h:panelGrid>
</p:dialog>
</h:form>
<p:dialog id="cadastrodialog" modal="true" header="Nova noticia" widgetVar="cadastro">
<h:form>
<h:panelGrid columns="2" cellpadding="2" cellspacing="2" >
<h:outputText value="Titulo :" />
<h:inputText value="#{beanSession.notice.titulo}" required="true" requiredMessage="Campo Titulo é Obrigatorio"/>
<h:outputText value="Noticia :"/>
<h:inputTextarea rows="10" cols="80" value="#{beanSession.notice.textNoticia}" required="true" requiredMessage="Campo Noticia é Obrigatorio"/>
</h:panelGrid>
<h:panelGroup style="display: block; text-align: center ">
<p:commandButton value="Salvar" actionListener="#{beanSession.salvar}" ajax="false"
icon="ui-icon-disk" />
</h:panelGroup>
</h:form>
</p:dialog>
</h:body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment