Added new UI to upload bayesian network.
authorMichele Silva <michele.silva@gmail.com>
Wed, 18 Jan 2012 00:33:30 +0000 (22:33 -0200)
committerMichele Silva <michele.silva@gmail.com>
Wed, 18 Jan 2012 00:33:30 +0000 (22:33 -0200)
12 files changed:
lib/commons-fileupload-1.2.2.jar [new file with mode: 0644]
lib/commons-io-2.1.jar [new file with mode: 0644]
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
src/java/org/ufcspa/simdecs/bn/ui/NodeController.java
src/java/org/ufcspa/simdecs/bn/ui/NodeTypeController.java [new file with mode: 0644]
web/WEB-INF/web.xml
web/bn.xhtml
web/img/bn/browse.png [new file with mode: 0644]
web/img/bn/remove.png [new file with mode: 0644]

diff --git a/lib/commons-fileupload-1.2.2.jar b/lib/commons-fileupload-1.2.2.jar
new file mode 100644 (file)
index 0000000..131f192
Binary files /dev/null and b/lib/commons-fileupload-1.2.2.jar differ
diff --git a/lib/commons-io-2.1.jar b/lib/commons-io-2.1.jar
new file mode 100644 (file)
index 0000000..b5c7d69
Binary files /dev/null and b/lib/commons-io-2.1.jar differ
index 0decccd..6f913dd 100644 (file)
@@ -693,6 +693,8 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.xalan-2.7.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.xml-apis-1.0.b2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.commons-lang3-3.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.commons-fileupload-1.2.2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.commons-io-2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <mkdir dir="${build.web.dir}/META-INF"/>
         <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
@@ -717,6 +719,8 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.xalan-2.7.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.xml-apis-1.0.b2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.commons-lang3-3.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.commons-fileupload-1.2.2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.commons-io-2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
     </target>
     <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
         <delete dir="${build.web.dir}/WEB-INF/lib"/>
index f140bcb..59b9ae8 100644 (file)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=1f90bca6
+build.xml.data.CRC32=ea275e7b
 build.xml.script.CRC32=5a865f64
 build.xml.stylesheet.CRC32=651128d4@1.36.1.1
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=1f90bca6
-nbproject/build-impl.xml.script.CRC32=05db1bc7
+nbproject/build-impl.xml.data.CRC32=ea275e7b
+nbproject/build-impl.xml.script.CRC32=bd134794
 nbproject/build-impl.xml.stylesheet.CRC32=b7883b1f@1.36.1.1
index d1c5ee5..e1512a8 100644 (file)
@@ -28,6 +28,8 @@ dist.war=${dist.dir}/${war.name}
 endorsed.classpath=
 excludes=
 file.reference.avalon-framework-4.1.3.jar=lib/avalon-framework-4.1.3.jar
+file.reference.commons-fileupload-1.2.2.jar=lib/commons-fileupload-1.2.2.jar
+file.reference.commons-io-2.1.jar=lib/commons-io-2.1.jar
 file.reference.commons-lang3-3.1.jar=lib/commons-lang3-3.1.jar
 file.reference.commons-logging-1.1.jar=lib/commons-logging-1.1.jar
 file.reference.icu4j-3.8.jar=lib/icu4j-3.8.jar
@@ -77,7 +79,9 @@ javac.classpath=\
     ${file.reference.unbbayes-4.10.4-1s.jar}:\
     ${file.reference.xalan-2.7.0.jar}:\
     ${file.reference.xml-apis-1.0.b2.jar}:\
-    ${file.reference.commons-lang3-3.1.jar}
+    ${file.reference.commons-lang3-3.1.jar}:\
+    ${file.reference.commons-fileupload-1.2.2.jar}:\
+    ${file.reference.commons-io-2.1.jar}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.debug=true
index 5dee40a..8a6aa3f 100644 (file)
                     <file>${file.reference.commons-lang3-3.1.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${file.reference.commons-fileupload-1.2.2.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
+                <library dirs="200">
+                    <file>${file.reference.commons-io-2.1.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
             </web-module-libraries>
             <web-module-additional-libraries/>
             <source-roots>
index bd24dd9..11604a3 100644 (file)
@@ -20,6 +20,7 @@ import javax.faces.model.SelectItem;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.PersistenceUnit;
 import javax.transaction.UserTransaction;
+import org.primefaces.event.RowEditEvent;
 
 @ManagedBean(name = "nodeController")
 @SessionScoped
@@ -37,6 +38,11 @@ public class NodeController implements Serializable {
 
     public NodeController() {
     }
+    
+    public void rowEditListener(RowEditEvent event) throws Exception {
+        Node node = (Node) event.getObject();
+        getJpaController().edit(node);
+    }
 
     public Node getSelected() {
         if (current == null) {
diff --git a/src/java/org/ufcspa/simdecs/bn/ui/NodeTypeController.java b/src/java/org/ufcspa/simdecs/bn/ui/NodeTypeController.java
new file mode 100644 (file)
index 0000000..81154fa
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.ufcspa.simdecs.bn.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+import javax.faces.model.SelectItem;
+import org.ufcspa.simdecs.bn.entity.NodeType;
+
+/**
+ *
+ * @author mchelem
+ */
+@ManagedBean(name = "nodeTypeController")
+@ApplicationScoped
+public class NodeTypeController {
+    private NodeType nodeType;
+
+    public void setNodeType(NodeType nodeType) { this.nodeType=nodeType; }
+
+    public NodeType getNodeType() { return this.nodeType; }
+        
+    public List<SelectItem> getNodeTypes() {
+        List<SelectItem> items = new ArrayList<SelectItem>();
+            for (NodeType type: NodeType.values()) {
+                items.add(new SelectItem(type, type.toString()));
+            }
+        return items;
+    } 
+}
index 0c3e8eb..8187691 100644 (file)
     <welcome-file-list>
         <welcome-file>editDiagram.jsf</welcome-file>
     </welcome-file-list>
+    <filter>   
+        <filter-name>PrimeFaces FileUpload Filter</filter-name>        
+        <filter-class> 
+            org.primefaces.webapp.filter.FileUploadFilter
+        </filter-class>
+    </filter>  
+    <filter-mapping>   
+        <filter-name>PrimeFaces FileUpload Filter</filter-name>        
+        <servlet-name>Faces Servlet</servlet-name>
+    </filter-mapping>
 </web-app>
index c677556..d42bc8c 100644 (file)
     </h:head>
     <h:body>
         <h:outputLabel> <h1>SimDeCS - Cadastro de Redes Bayesianas</h1> </h:outputLabel>
-        <h:panelGrid>
-           <h:form enctype="multipart/form-data">
-
-    <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
-            mode="advanced"
-            update="messages" 
-            multiple="true"
-            allowTypes="/(\.|\/)(xml)$/"/>
-
-    <p:growl id="messages" showDetail="true"/>
-
-</h:form>        
-        </h:panelGrid>
+            <h:panelGrid>
+                <h:form>
+                    <p:fileUpload widgetVar="uploader" height="48" width="48"  
+                                  fileUploadListener="#{fileUploadController.handleFileUpload}"   
+                                  image="/img/bn/browse.png" customUI="true"
+                                  multiple="true" label="Selecione..." allowTypes="*.xml;" description="Images"
+                                  update="bayesianNetworkList, nodeList"/> 
+                    <h:outputLink value="#" title="Upload" onclick="uploader.upload();" 
+                                  style="font-weight:bold;color:#616D7E">Enviar Redes Bayesianas
+                    </h:outputLink>
+                </h:form>            
+            </h:panelGrid>    
         <h:panelGroup id="messagePanel" layout="block">
             <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
         </h:panelGroup>   
-            <p:panel header="Redes Bayesianas" toggleable="true" toggleListener="#{bayesianNetworkController.prepareList}">
-                <h:form>    
-                    <br></br>
-                    <h:commandLink action="#{bayesianNetworkController.prepareList}" value="Atualizar tabela"/>
-                </h:form>
-                <h:panelGrid columns="2" cellpadding="10">                                        
-                    <h:outputText escape="false" value="#{bundle.ListBayesianNetworkEmpty}" rendered="#{bayesianNetworkController.items.rowCount == 0}"/>
-                    <h:panelGroup rendered="#{bayesianNetworkController.items.rowCount > 0}">   
-
-                        <h:form id="fBayesianNetworkList">
-
-                            <p:dataTable var="bayesianNetwork" value="#{bayesianNetworkController.items}" id="bayesianNetworkList" 
-                                         paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
-                                         rowEditListener="#{bayesianNetworkController.rowEditListener}">  
-                                <p:column headerText="id">  
-                                    <h:outputText value="#{bayesianNetwork.id}"/>  
-                                </p:column>  
+        <p:panel header="Redes Bayesianas" toggleable="true" toggleListener="#{bayesianNetworkController.prepareList}">
+            <h:form>    
+                <br></br>
+                <h:commandLink action="#{bayesianNetworkController.prepareList}" value="Atualizar tabela"/>
+            </h:form>
+            <h:panelGrid columns="2" cellpadding="10">                                        
+                <h:outputText escape="false" value="#{bundle.ListBayesianNetworkEmpty}" rendered="#{bayesianNetworkController.items.rowCount == 0}"/>
+                <h:panelGroup rendered="#{bayesianNetworkController.items.rowCount > 0}">   
 
-                                <p:column headerText="Nome">  
-                                    <p:cellEditor>  
-                                        <f:facet name="output">  
-                                            <h:outputText value="#{bayesianNetwork.name}"/>  
-                                        </f:facet>  
-                                        <f:facet name="input">  
-                                            <p:inputText value="#{bayesianNetwork.name}"/>  
-                                        </f:facet>  
-                                    </p:cellEditor>  
-                                </p:column>   
-                                <p:column headerText="Opções">  
-                                    <p:rowEditor />  
-                                    <h:commandLink action="#{bayesianNetworkController.destroy}" >
-                                        <h:graphicImage value="/img/bayesianNetwork/remove.png" />
-                                    </h:commandLink>
-                                </p:column>  
-                            </p:dataTable>  
-                        </h:form>         
+                    <h:form id="fBayesianNetworkList">
 
-                    </h:panelGroup>
-                </h:panelGrid>
-            </p:panel>     
-            <p:panel header="Nodos" toggleable="true">
-                <h:form>
-                    <br></br>
-                    <h:commandLink action="#{nodeController.prepareList}" value="Atualizar tabela"/>
-                </h:form>                            
-                <h:outputText escape="false" value="#{bundle.ListNodeEmpty}" rendered="#{nodeController.items.rowCount == 0}"/>
-                <h:panelGroup rendered="#{nodeController.items.rowCount > 0}">  
-                    <h:form>      
-                        <p:dataTable var="node" value="#{nodeController.items}" id="nodeList" 
+                        <p:dataTable var="bayesianNetwork" value="#{bayesianNetworkController.items}" id="bayesianNetworkList" 
                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
-                                     rowEditListener="#{nodeController.rowEditListener}">  
-
-                            <p:column headerText="id">                                 
-                                <h:outputText value="#{node.id}" />                                
+                                     rowEditListener="#{bayesianNetworkController.rowEditListener}">  
+                            <p:column headerText="id">  
+                                <h:outputText value="#{bayesianNetwork.id}"/>  
                             </p:column>  
 
                             <p:column headerText="Nome">  
                                 <p:cellEditor>  
                                     <f:facet name="output">  
-                                        <h:outputText value="#{node.name}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <p:inputText value="#{node.name}" style="width:100%"/>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>  
-                            <p:column headerText="Tempo">  
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{node.time}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <p:inputText value="#{node.time}" style="width:100%"/>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>  
-                            <p:column headerText="Custo">  
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{node.cost}" />  
+                                        <h:outputText value="#{bayesianNetwork.name}"/>  
                                     </f:facet>  
                                     <f:facet name="input">  
-                                        <p:inputText value="#{node.cost}" style="width:100%"/>  
+                                        <p:inputText value="#{bayesianNetwork.name}"/>  
                                     </f:facet>  
                                 </p:cellEditor>  
-                            </p:column>  
-                            <p:column headerText="Tipo">
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{node.nodeType}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <h:selectOneMenu value="#{node.nodeType}" >  
-                                            <f:selectItems value="#{nodeTypeController.nodeTypes}"  
-                                                           var="nodeType"   
-                                                           itemLabel="#{nodeType}"  
-                                                           itemValue="#{nodeType}" />  
-                                        </h:selectOneMenu>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>  
-                            <p:column headerText="Rede Bayesiana"> 
-                                <h:outputText value="#{node.bayesianNetwork.name}"/>
-                            </p:column>  
-
-
+                            </p:column>   
                             <p:column headerText="Opções">  
                                 <p:rowEditor />  
+                                <h:commandLink action="#{bayesianNetworkController.destroy}" >
+                                    <h:graphicImage value="/img/bn/remove.png" />
+                                </h:commandLink>
                             </p:column>  
-
                         </p:dataTable>  
-                    </h:form>   
-                </h:panelGroup>
+                    </h:form>         
 
-            </p:panel>
-            <p:panel header="Perguntas" toggleable="true">
-                <h:form>
-                    <br></br>
-                    <h:commandLink action="#{questionController.prepareList}" value="Atualizar tabela"/>
-                </h:form>       
-                <h:form>
-                    <h:outputText escape="false" value="#{bundle.ListQuestionEmpty}" rendered="#{questionController.items.rowCount == 0}"/>
-                    <h:panelGroup rendered="#{questionController.items.rowCount > 0}">                       
-                        <p:dataTable var="question" value="#{questionController.items}" id="questionList" 
-                                     paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
-                                     rowEditListener="#{questionController.rowEditListener}">  
+                </h:panelGroup>
+            </h:panelGrid>
+        </p:panel>     
+        <p:panel header="Nodos" toggleable="true">
+            <h:form>
+                <br></br>
+                <h:commandLink action="#{nodeController.prepareList}" value="Atualizar tabela"/>
+            </h:form>                            
+            <h:outputText escape="false" value="#{bundle.ListNodeEmpty}" rendered="#{nodeController.items.rowCount == 0}"/>
+            <h:panelGroup rendered="#{nodeController.items.rowCount > 0}">  
+                <h:form>      
+                    <p:dataTable var="node" value="#{nodeController.items}" id="nodeList" 
+                                 paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
+                                 rowEditListener="#{nodeController.rowEditListener}">  
 
-                            <p:column headerText="id">                                 
-                                <h:outputText value="#{question.id}" />                                
-                            </p:column>  
+                        <p:column headerText="id">                                 
+                            <h:outputText value="#{node.id}" />                                
+                        </p:column>  
 
-                            <p:column headerText="Texto">  
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{question.text}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <p:inputText value="#{question.text}" style="width:100%"/>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>                     
-                            <p:column headerText="Nodo"> 
-                                <h:outputText value="#{question.node.name}"/>
-                            </p:column> 
-                            <p:column headerText="Rede Bayesiana"> 
-                                <h:outputText value="#{question.node.bayesianNetwork.name}"/>
-                            </p:column>  
+                        <p:column headerText="Nome">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{node.name}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{node.name}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>  
+                        <p:column headerText="Tempo">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{node.time}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{node.time}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>  
+                        <p:column headerText="Custo">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{node.cost}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{node.cost}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>  
+                        <p:column headerText="Tipo">
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{node.nodeType}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <h:selectOneMenu value="#{node.nodeType}" >  
+                                        <f:selectItems value="#{nodeTypeController.nodeTypes}"  
+                                                       var="nodeType"   
+                                                       itemLabel="#{nodeType}"  
+                                                       itemValue="#{nodeType}" />  
+                                    </h:selectOneMenu>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>  
+                        <p:column headerText="Rede Bayesiana"> 
+                            <h:outputText value="#{node.bayesianNetwork.name}"/>
+                        </p:column>  
 
 
-                            <p:column headerText="Opções">  
-                                <p:rowEditor />  
-                                <h:commandLink action="#{bayesianNetworkController.destroy}" >
-                                    <h:graphicImage value="/img/bayesianNetwork/remove.png" />
-                                </h:commandLink>
-                            </p:column>  
+                        <p:column headerText="Opções">  
+                            <p:rowEditor />  
+                        </p:column>  
 
-                        </p:dataTable>                                                 
-                    </h:panelGroup>                    
+                    </p:dataTable>  
                 </h:form>   
+            </h:panelGroup>
 
-                <h:form>
-                    <br></br>
-                    <h:commandLink action="/net/question/Create.xhtml" value="Criar nova pergunta"/>
-                </h:form>
-            </p:panel>
-            <p:panel header="Respostas" toggleable="true">
-                <h:form>
-                    <br></br>
-                    <h:commandLink action="#{answerController.prepareList}" value="Atualizar tabela"/>
-                </h:form>       
-                <h:form>
-                    <h:outputText escape="false" value="#{bundle.ListAnswerEmpty}" rendered="#{answerController.items.rowCount == 0}"/>
-                    <h:panelGroup rendered="#{answerController.items.rowCount > 0}">                       
-                        <p:dataTable var="answer" value="#{answerController.items}" id="answerList" 
-                                     paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
-                                     rowEditListener="#{answerController.rowEditListener}">  
+        </p:panel>
+        <p:panel header="Perguntas" toggleable="true">
+            <h:form>
+                <br></br>
+                <h:commandLink action="#{questionController.prepareList}" value="Atualizar tabela"/>
+            </h:form>       
+            <h:form>
+                <h:outputText escape="false" value="#{bundle.ListQuestionEmpty}" rendered="#{questionController.items.rowCount == 0}"/>
+                <h:panelGroup rendered="#{questionController.items.rowCount > 0}">                       
+                    <p:dataTable var="question" value="#{questionController.items}" id="questionList" 
+                                 paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
+                                 rowEditListener="#{questionController.rowEditListener}">  
 
-                            <p:column headerText="id">                                 
-                                <h:outputText value="#{answer.id}" />                                
-                            </p:column>  
+                        <p:column headerText="id">                                 
+                            <h:outputText value="#{question.id}" />                                
+                        </p:column>  
 
-                            <p:column headerText="Texto">  
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{answer.text}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <p:inputText value="#{answer.text}" style="width:100%"/>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>      
-                            <p:column headerText="Probabilidade">  
-                                <p:cellEditor>  
-                                    <f:facet name="output">  
-                                        <h:outputText value="#{answer.likelihood}" />  
-                                    </f:facet>  
-                                    <f:facet name="input">  
-                                        <p:inputText value="#{answer.likelihood}" style="width:100%"/>  
-                                    </f:facet>  
-                                </p:cellEditor>  
-                            </p:column>   
-                            <p:column headerText="Pergunta"> 
-                                <h:outputText value="#{answer.question.text}"/>
-                            </p:column>
-                            <p:column headerText="Nodo"> 
-                                <h:outputText value="#{answer.question.node.name}"/>
-                            </p:column> 
-                            <p:column headerText="Rede Bayesiana"> 
-                                <h:outputText value="#{answer.question.node.bayesianNetwork.name}"/>
-                            </p:column>  
+                        <p:column headerText="Texto">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{question.text}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{question.text}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>                     
+                        <p:column headerText="Nodo"> 
+                            <h:outputText value="#{question.node.name}"/>
+                        </p:column> 
+                        <p:column headerText="Rede Bayesiana"> 
+                            <h:outputText value="#{question.node.bayesianNetwork.name}"/>
+                        </p:column>  
 
 
-                            <p:column headerText="Opções">  
-                                <p:rowEditor />  
-                            </p:column>  
-                        </p:dataTable>  
-                    </h:panelGroup>   
-                </h:form>   
-                <h:form>
-                    <br></br>
-                    <h:commandLink action="/net/answer/Create.xhtml" value="Criar nova resposta"/>
-                </h:form>
-            </p:panel>
+                        <p:column headerText="Opções">  
+                            <p:rowEditor />  
+                            <h:commandLink action="#{bayesianNetworkController.destroy}" >
+                                <h:graphicImage value="/img/bn/remove.png" />
+                            </h:commandLink>
+                        </p:column>  
+
+                    </p:dataTable>                                                 
+                </h:panelGroup>                    
+            </h:form>   
+
+            <h:form>
+                <br></br>
+                <h:commandLink action="/net/question/Create.xhtml" value="Criar nova pergunta"/>
+            </h:form>
+        </p:panel>
+        <p:panel header="Respostas" toggleable="true">
+            <h:form>
+                <br></br>
+                <h:commandLink action="#{answerController.prepareList}" value="Atualizar tabela"/>
+            </h:form>       
+            <h:form>
+                <h:outputText escape="false" value="#{bundle.ListAnswerEmpty}" rendered="#{answerController.items.rowCount == 0}"/>
+                <h:panelGroup rendered="#{answerController.items.rowCount > 0}">                       
+                    <p:dataTable var="answer" value="#{answerController.items}" id="answerList" 
+                                 paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
+                                 rowEditListener="#{answerController.rowEditListener}">  
+
+                        <p:column headerText="id">                                 
+                            <h:outputText value="#{answer.id}" />                                
+                        </p:column>  
+
+                        <p:column headerText="Texto">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{answer.text}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{answer.text}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>      
+                        <p:column headerText="Probabilidade">  
+                            <p:cellEditor>  
+                                <f:facet name="output">  
+                                    <h:outputText value="#{answer.likelihood}" />  
+                                </f:facet>  
+                                <f:facet name="input">  
+                                    <p:inputText value="#{answer.likelihood}" style="width:100%"/>  
+                                </f:facet>  
+                            </p:cellEditor>  
+                        </p:column>   
+                        <p:column headerText="Pergunta"> 
+                            <h:outputText value="#{answer.question.text}"/>
+                        </p:column>
+                        <p:column headerText="Nodo"> 
+                            <h:outputText value="#{answer.question.node.name}"/>
+                        </p:column> 
+                        <p:column headerText="Rede Bayesiana"> 
+                            <h:outputText value="#{answer.question.node.bayesianNetwork.name}"/>
+                        </p:column>  
+
+
+                        <p:column headerText="Opções">  
+                            <p:rowEditor />  
+                        </p:column>  
+                    </p:dataTable>  
+                </h:panelGroup>   
+            </h:form>   
+            <h:form>
+                <br></br>
+                <h:commandLink action="/net/answer/Create.xhtml" value="Criar nova resposta"/>
+            </h:form>
+        </p:panel>
     </h:body>
 
 
diff --git a/web/img/bn/browse.png b/web/img/bn/browse.png
new file mode 100644 (file)
index 0000000..1dc40d2
Binary files /dev/null and b/web/img/bn/browse.png differ
diff --git a/web/img/bn/remove.png b/web/img/bn/remove.png
new file mode 100644 (file)
index 0000000..03e3170
Binary files /dev/null and b/web/img/bn/remove.png differ