Changed controllers to handle table row edit.
[simdecs.git] / web / bn.xhtml
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"
4       xmlns:p="http://primefaces.prime.com.tr/ui"
5       xmlns:h="http://java.sun.com/jsf/html"
6       xmlns:f="http://java.sun.com/jsf/core">
7     <h:head>
8         <title>SimDeCS</title>
9         <h:outputStylesheet name="css/jsfcrud.css"/>
10     </h:head>
11     <h:body>
12         <h:outputLabel> <h1>SimDeCS - Cadastro de Redes Bayesianas</h1> </h:outputLabel>           
13         <h:panelGroup id="messagePanel" layout="block">
14             <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
15         </h:panelGroup>   
16         <p:tabView id="tabView"> 
17             <p:tab id="tab1" title="Redes Bayesianas">
18                 <h:form>
19                     <p:fileUpload widgetVar="uploader" height="48" width="48"  
20                                   fileUploadListener="#{fileUploadController.handleFileUpload}"   
21                                   image="/img/bn/browse.png" customUI="true"
22                                   multiple="true" label="Selecione..." allowTypes="*.xml;" description="Images"
23                                   update="tabView"/> 
24                     <h:outputLink value="#" title="Upload" onclick="uploader.upload();" 
25                                   style="font-weight:bold;color:#616D7E">Enviar Redes Bayesianas
26                     </h:outputLink>
27                 </h:form>            
28                 <h:form>    
29                     <br></br>
30                     <h:commandLink action="#{bayesianNetworkController.recreateModel}" value="Atualizar tabela"/>
31                 </h:form>
32                 <h:panelGrid columns="2" cellpadding="10">                                        
33                     <h:outputText escape="false" value="#{bundle.ListBayesianNetworkEmpty}" rendered="#{bayesianNetworkController.items.rowCount == 0}"/>
34                     <h:panelGroup rendered="#{bayesianNetworkController.items.rowCount > 0}">   
35
36                         <h:form id="fBayesianNetworkList">
37                             <p:dataTable var="bayesianNetwork" value="#{bayesianNetworkController.items}" id="bayesianNetworkList" 
38                                          paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
39                                          rowEditListener="#{bayesianNetworkController.rowEditListener}">  
40                                 <p:column headerText="id">  
41                                     <h:outputText value="#{bayesianNetwork.id}"/>  
42                                 </p:column>  
43
44                                 <p:column headerText="Nome">  
45                                     <p:cellEditor>  
46                                         <f:facet name="output">  
47                                             <h:outputText value="#{bayesianNetwork.name}"/>  
48                                         </f:facet>  
49                                         <f:facet name="input">  
50                                             <p:inputText value="#{bayesianNetwork.name}"/>  
51                                         </f:facet>  
52                                     </p:cellEditor>  
53                                 </p:column>   
54                                 <p:column headerText="Opções">  
55                                     <p:rowEditor />  
56                                     <h:commandLink action="#{bayesianNetworkController.destroy}" >
57                                         <h:graphicImage value="/img/bn/remove.png" />
58                                     </h:commandLink>
59                                 </p:column>  
60                             </p:dataTable>  
61                         </h:form>         
62                     </h:panelGroup>
63                 </h:panelGrid>
64             </p:tab>     
65
66             <p:tab id="tab2" title="Nodos">
67                 <h:form>
68                     <br></br>
69                     <h:commandLink action="#{nodeController.recreateModel}" value="Atualizar tabela"/>
70                 </h:form>                            
71                 <h:outputText escape="false" value="#{bundle.ListNodeEmpty}" rendered="#{nodeController.items.rowCount == 0}"/>
72                 <h:panelGroup rendered="#{nodeController.items.rowCount > 0}">  
73                     <h:form>      
74                         <p:dataTable var="node" value="#{nodeController.items}" id="nodeList" 
75                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
76                                      rowEditListener="#{nodeController.rowEditListener}">  
77
78                             <p:column headerText="id">                                 
79                                 <h:outputText value="#{node.id}" />                                
80                             </p:column>  
81                             <p:column headerText="Nome">  
82                                 <p:cellEditor>  
83                                     <f:facet name="output">  
84                                         <h:outputText value="#{node.name}" />  
85                                     </f:facet>  
86                                     <f:facet name="input">  
87                                         <p:inputText value="#{node.name}" style="width:100%"/>  
88                                     </f:facet>  
89                                 </p:cellEditor>  
90                             </p:column>  
91                             <p:column headerText="Tempo">  
92                                 <p:cellEditor>  
93                                     <f:facet name="output">  
94                                         <h:outputText value="#{node.time}" />  
95                                     </f:facet>  
96                                     <f:facet name="input">  
97                                         <p:inputText value="#{node.time}" style="width:100%"/>  
98                                     </f:facet>  
99                                 </p:cellEditor>  
100                             </p:column>  
101                             <p:column headerText="Custo">  
102                                 <p:cellEditor>  
103                                     <f:facet name="output">  
104                                         <h:outputText value="#{node.cost}" />  
105                                     </f:facet>  
106                                     <f:facet name="input">  
107                                         <p:inputText value="#{node.cost}" style="width:100%"/>  
108                                     </f:facet>  
109                                 </p:cellEditor>  
110                             </p:column>  
111                             <p:column headerText="Classificação">
112                                 <p:cellEditor>  
113                                     <f:facet name="output">  
114                                         <h:outputText value="#{node.nodeType}" />  
115                                     </f:facet>  
116                                     <f:facet name="input">  
117                                         <h:selectOneMenu value="#{node.nodeType}" >  
118                                             <f:selectItems value="#{nodeTypeController.nodeTypes}"  
119                                                            var="nodeType"   
120                                                            itemLabel="#{nodeType}"  
121                                                            itemValue="#{nodeType}" />  
122                                         </h:selectOneMenu>  
123                                     </f:facet>  
124                                 </p:cellEditor>  
125                             </p:column>  
126                             <p:column headerText="Tipo">
127                                 <p:cellEditor>  
128                                     <f:facet name="output">  
129                                         <h:outputText value="#{node.nodeRole}" />  
130                                     </f:facet>  
131                                     <f:facet name="input">  
132                                         <h:selectOneMenu value="#{node.nodeRole}" >  
133                                             <f:selectItems value="#{nodeRoleController.nodeRoles}"  
134                                                            var="nodeRole"   
135                                                            itemLabel="#{nodeRole}"  
136                                                            itemValue="#{nodeRole}" />  
137                                         </h:selectOneMenu>  
138                                     </f:facet>  
139                                 </p:cellEditor>  
140                             </p:column>  
141                             <p:column headerText="Rede Bayesiana"> 
142                                 <h:outputText value="#{node.bayesianNetwork.name}"/>
143                             </p:column>  
144
145
146                             <p:column headerText="Opções">  
147                                 <p:rowEditor />  
148                                 <h:commandLink action="#{nodeController.destroy}" >
149                                     <h:graphicImage value="/img/bn/remove.png" />
150                                 </h:commandLink>
151                             </p:column>  
152                         </p:dataTable>  
153                     </h:form>   
154                 </h:panelGroup>
155                 <h:form>
156                     <br></br>
157                     <h:commandLink action="/bn/node/Create.xhtml" value="Criar novo nodo"/>
158                 </h:form>
159             </p:tab>
160
161             <p:tab id="tab3" title="Perguntas">
162                 <h:form>
163                     <br></br>
164                     <h:commandLink action="#{questionController.recreateModel}" value="Atualizar tabela"/>
165                 </h:form>       
166                 <h:form>
167                     <h:outputText escape="false" value="#{bundle.ListQuestionEmpty}" rendered="#{questionController.items.rowCount == 0}"/>
168                     <h:panelGroup rendered="#{questionController.items.rowCount > 0}">                       
169                         <p:dataTable var="question" value="#{questionController.items}" id="questionList" 
170                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
171                                      rowEditListener="#{questionController.rowEditListener}">  
172
173                             <p:column headerText="id">                                 
174                                 <h:outputText value="#{question.id}" />                                
175                             </p:column>  
176
177                             <p:column headerText="Texto">  
178                                 <p:cellEditor>  
179                                     <f:facet name="output">  
180                                         <h:outputText value="#{question.text}" />  
181                                     </f:facet>  
182                                     <f:facet name="input">  
183                                         <p:inputText value="#{question.text}" style="width:100%"/>  
184                                     </f:facet>  
185                                 </p:cellEditor>  
186                             </p:column>                     
187                             <p:column headerText="Nodo"> 
188                                 <h:outputText value="#{question.node.name}"/>
189                             </p:column> 
190                             <p:column headerText="Rede Bayesiana"> 
191                                 <h:outputText value="#{question.node.bayesianNetwork.name}"/>
192                             </p:column>  
193                             <p:column headerText="Opções">  
194                                 <p:rowEditor />  
195                                 <h:commandLink action="#{questionController.destroy}" >
196                                     <h:graphicImage value="/img/bn/remove.png" />
197                                 </h:commandLink>
198                             </p:column>  
199
200                         </p:dataTable>                                                 
201                     </h:panelGroup>                    
202                 </h:form>   
203                 <h:form>
204                     <br></br>
205                     <h:commandLink action="/bn/question/Create.xhtml" value="Criar nova pergunta"/>
206                 </h:form>
207             </p:tab>
208
209             <p:tab id="tab4" title="Respostas">
210                 <h:form>
211                     <br></br>
212                     <h:commandLink action="#{answerController.recreateModel}" value="Atualizar tabela"/>
213                 </h:form>       
214                 <h:form>
215                     <h:outputText escape="false" value="#{bundle.ListAnswerEmpty}" rendered="#{answerController.items.rowCount == 0}"/>
216                     <h:panelGroup rendered="#{answerController.items.rowCount > 0}">                       
217                         <p:dataTable var="answer" value="#{answerController.items}" id="answerList" 
218                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
219                                      rowEditListener="#{answerController.rowEditListener}">  
220
221                             <p:column headerText="id">                                 
222                                 <h:outputText value="#{answer.id}" />                                
223                             </p:column>  
224
225                             <p:column headerText="Texto">  
226                                 <p:cellEditor>  
227                                     <f:facet name="output">  
228                                         <h:outputText value="#{answer.text}" />  
229                                     </f:facet>  
230                                     <f:facet name="input">  
231                                         <p:inputText value="#{answer.text}" style="width:100%"/>  
232                                     </f:facet>  
233                                 </p:cellEditor>  
234                             </p:column>      
235                             <p:column headerText="Probabilidade">  
236                                 <p:cellEditor>  
237                                     <f:facet name="output">  
238                                         <h:outputText value="#{answer.likelihood}" />  
239                                     </f:facet>  
240                                     <f:facet name="input">  
241                                         <p:inputText value="#{answer.likelihood}" style="width:100%"/>  
242                                     </f:facet>  
243                                 </p:cellEditor>  
244                             </p:column>   
245                             <p:column headerText="Pergunta"> 
246                                 <h:outputText value="#{answer.question.text}"/>
247                             </p:column>
248                             <p:column headerText="Nodo"> 
249                                 <h:outputText value="#{answer.question.node.name}"/>
250                             </p:column> 
251                             <p:column headerText="Rede Bayesiana"> 
252                                 <h:outputText value="#{answer.question.node.bayesianNetwork.name}"/>
253                             </p:column> 
254                             <p:column headerText="Opções">  
255                                 <p:rowEditor /> 
256                                 <h:commandLink action="#{answerController.destroy}" >
257                                     <h:graphicImage value="/img/bn/remove.png" />
258                                 </h:commandLink>
259                             </p:column>  
260                         </p:dataTable>  
261                     </h:panelGroup>   
262                 </h:form>   
263                 <h:form>
264                     <br></br>
265                     <h:commandLink action="/bn/answer/Create.xhtml" value="Criar nova resposta"/>
266                 </h:form>
267             </p:tab>
268         </p:tabView>
269     </h:body>
270
271
272
273
274 </html>
275