Thanks for any suggestions on how I should proceed.
JSF 2.0, PrimeFaces 2.2.1 , Facelets, Eclipse Helios, Tomcat 7
MainPage
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><ui:insert name="titulo">Sistema - Gestão de Obras</ui:insert></title>
<h:outputStylesheet library="css" name="estilo.css"/>
<style type="text/css"><!--
#logotipo {
text-align: center;
} -->
</style>
</h:head>
<h:body>
<div id="logotipo">
<h:graphicImage library="imagens" name="books2.jpg" title="Getão de obras" />
<h:outputLabel>Gestão de obras</h:outputLabel>
</div>
<div id="corpo">
<ui:insert name="corpo"/>
</div>
<div id="barramenu">
<ui:insert name="barra_menu">
<ui:include src="/restrito/barramenu.xhtml"/>
</ui:insert>
</div>
<div id="rodape">
<ui:insert name="rodape">
<ui:include src="/restrito/rodape.xhtml"/>
</ui:insert>
</div>
</h:body>
</html>
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets" >
<h:form>
<ui:composition>
<h:outputText value="Selecione a opção desejada" style="width:15%; font-family: Verdana; font-size: 10px; font-weight: bold; color: red;"/>
<h:form>
<p:tree id="arvore" value="#{menuBean.opcoesMenuTree}" var="node"
style="width:20%; font-family: Verdana; font-size: 8px; font-weight: bold; color: green; border-top: thin solid #CCCCCC; border-bottom: thin solid #CCCCCC; border-left: medium solid #CCCCCC; border-right: medium solid #CCCCCC; padding-right:2px; "
dynamic="false"
selectionMode="single"
selection="#{menuBean.selectedNode}"
nodeSelectListener="#{menuBean.opMenuSelecionada}">
<p:treeNode>
<h:outputText value="#{node.titleFormulario}" />
</p:treeNode>
</p:tree>
</h:form>
</ui:composition>
</h:form>
</html>
Code: Select all
@ManagedBean(name="menuBean")
@SessionScoped
public class MenuBean {
private TreeNode root;
private TreeNode opcoesMenuTree;
private TreeNode selectedNode;
public TreeNode getOpcoesMenuTree() {
if (this.opcoesMenuTree == null) {
OpcoesMenuRN opMenuRN = new OpcoesMenuRN();
List<OpcoesMenu> opMenu = (List<OpcoesMenu>) opMenuRN.localizaOpMenu(1);
this.opcoesMenuTree = new DefaultTreeNode( null , null);
TreeNode pai = null;
TreeNode filho = null;
for (OpcoesMenu opM : opMenu) {
if ( opM.getNivelPai() != null ){
pai = new DefaultTreeNode(opM , this.opcoesMenuTree);
}
else {
filho = new DefaultTreeNode(opM, pai);
}
}
}
return opcoesMenuTree;
}
public String opMenuSelecionada(NodeSelectEvent event ) {
OpcoesMenu opsel = (OpcoesMenu) event.getTreeNode().getData();
Integer nid = opsel.getIdFormulario();
System.out.println("SELECIOANDA" + nid + opsel.getTitleFormulario() + " form : " + opsel.getNameFormulario() );
[color=#FF0040]// Redicted implict to page [/color]
return "teste";
}
public TreeNode getSelectedNode() {
return this.selectedNode;
}
public void setSelectedNode(TreeNode selectedNode) {
this.selectedNode = selectedNode;
}