Changed ui controllers to let primefaces handle the pagination.
[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
82                             <p:column headerText="Nome">  
83                                 <p:cellEditor>  
84                                     <f:facet name="output">  
85                                         <h:outputText value="#{node.name}" />  
86                                     </f:facet>  
87                                     <f:facet name="input">  
88                                         <p:inputText value="#{node.name}" style="width:100%"/>  
89                                     </f:facet>  
90                                 </p:cellEditor>  
91                             </p:column>  
92                             <p:column headerText="Tempo">  
93                                 <p:cellEditor>  
94                                     <f:facet name="output">  
95                                         <h:outputText value="#{node.time}" />  
96                                     </f:facet>  
97                                     <f:facet name="input">  
98                                         <p:inputText value="#{node.time}" style="width:100%"/>  
99                                     </f:facet>  
100                                 </p:cellEditor>  
101                             </p:column>  
102                             <p:column headerText="Custo">  
103                                 <p:cellEditor>  
104                                     <f:facet name="output">  
105                                         <h:outputText value="#{node.cost}" />  
106                                     </f:facet>  
107                                     <f:facet name="input">  
108                                         <p:inputText value="#{node.cost}" style="width:100%"/>  
109                                     </f:facet>  
110                                 </p:cellEditor>  
111                             </p:column>  
112                             <p:column headerText="Classificação">
113                                 <p:cellEditor>  
114                                     <f:facet name="output">  
115                                         <h:outputText value="#{node.nodeType}" />  
116                                     </f:facet>  
117                                     <f:facet name="input">  
118                                         <h:selectOneMenu value="#{node.nodeType}" >  
119                                             <f:selectItems value="#{nodeTypeController.nodeTypes}"  
120                                                            var="nodeType"   
121                                                            itemLabel="#{nodeType}"  
122                                                            itemValue="#{nodeType}" />  
123                                         </h:selectOneMenu>  
124                                     </f:facet>  
125                                 </p:cellEditor>  
126                             </p:column>  
127                             <p:column headerText="Tipo">
128                                 <p:cellEditor>  
129                                     <f:facet name="output">  
130                                         <h:outputText value="#{node.nodeRole}" />  
131                                     </f:facet>  
132                                     <f:facet name="input">  
133                                         <h:selectOneMenu value="#{node.nodeRole}" >  
134                                             <f:selectItems value="#{nodeRoleController.nodeRoles}"  
135                                                            var="nodeType"   
136                                                            itemLabel="#{nodeRole}"  
137                                                            itemValue="#{nodeRole}" />  
138                                         </h:selectOneMenu>  
139                                     </f:facet>  
140                                 </p:cellEditor>  
141                             </p:column>  
142                             <p:column headerText="Rede Bayesiana"> 
143                                 <h:outputText value="#{node.bayesianNetwork.name}"/>
144                             </p:column>  
145
146
147                             <p:column headerText="Opções">  
148                                 <p:rowEditor />  
149                                 <h:commandLink action="#{nodeController.destroy}" >
150                                     <h:graphicImage value="/img/bn/remove.png" />
151                                 </h:commandLink>
152                             </p:column>  
153                         </p:dataTable>  
154                     </h:form>   
155                 </h:panelGroup>
156                 <h:form>
157                     <br></br>
158                     <h:commandLink action="/bn/node/Create.xhtml" value="Criar novo nodo"/>
159                 </h:form>
160             </p:tab>
161             
162             <p:tab id="tab3" title="Perguntas">
163                 <h:form>
164                     <br></br>
165                     <h:commandLink action="#{questionController.recreateModel}" value="Atualizar tabela"/>
166                 </h:form>       
167                 <h:form>
168                     <h:outputText escape="false" value="#{bundle.ListQuestionEmpty}" rendered="#{questionController.items.rowCount == 0}"/>
169                     <h:panelGroup rendered="#{questionController.items.rowCount > 0}">                       
170                         <p:dataTable var="question" value="#{questionController.items}" id="questionList" 
171                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
172                                      rowEditListener="#{questionController.rowEditListener}">  
173
174                             <p:column headerText="id">                                 
175                                 <h:outputText value="#{question.id}" />                                
176                             </p:column>  
177
178                             <p:column headerText="Texto">  
179                                 <p:cellEditor>  
180                                     <f:facet name="output">  
181                                         <h:outputText value="#{question.text}" />  
182                                     </f:facet>  
183                                     <f:facet name="input">  
184                                         <p:inputText value="#{question.text}" style="width:100%"/>  
185                                     </f:facet>  
186                                 </p:cellEditor>  
187                             </p:column>                     
188                             <p:column headerText="Nodo"> 
189                                 <h:outputText value="#{question.node.name}"/>
190                             </p:column> 
191                             <p:column headerText="Rede Bayesiana"> 
192                                 <h:outputText value="#{question.node.bayesianNetwork.name}"/>
193                             </p:column>  
194                             <p:column headerText="Opções">  
195                                 <p:rowEditor />  
196                                 <h:commandLink action="#{questionController.destroy}" >
197                                     <h:graphicImage value="/img/bn/remove.png" />
198                                 </h:commandLink>
199                             </p:column>  
200
201                         </p:dataTable>                                                 
202                     </h:panelGroup>                    
203                 </h:form>   
204                 <h:form>
205                     <br></br>
206                     <h:commandLink action="/bn/question/Create.xhtml" value="Criar nova pergunta"/>
207                 </h:form>
208             </p:tab>
209             
210             <p:tab id="tab4" title="Respostas">
211                 <h:form>
212                     <br></br>
213                     <h:commandLink action="#{answerController.recreateModel}" value="Atualizar tabela"/>
214                 </h:form>       
215                 <h:form>
216                     <h:outputText escape="false" value="#{bundle.ListAnswerEmpty}" rendered="#{answerController.items.rowCount == 0}"/>
217                     <h:panelGroup rendered="#{answerController.items.rowCount > 0}">                       
218                         <p:dataTable var="answer" value="#{answerController.items}" id="answerList" 
219                                      paginator="true" rows="10" style="width:100%" paginatorPosition="bottom"
220                                      rowEditListener="#{answerController.rowEditListener}">  
221
222                             <p:column headerText="id">                                 
223                                 <h:outputText value="#{answer.id}" />                                
224                             </p:column>  
225
226                             <p:column headerText="Texto">  
227                                 <p:cellEditor>  
228                                     <f:facet name="output">  
229                                         <h:outputText value="#{answer.text}" />  
230                                     </f:facet>  
231                                     <f:facet name="input">  
232                                         <p:inputText value="#{answer.text}" style="width:100%"/>  
233                                     </f:facet>  
234                                 </p:cellEditor>  
235                             </p:column>      
236                             <p:column headerText="Probabilidade">  
237                                 <p:cellEditor>  
238                                     <f:facet name="output">  
239                                         <h:outputText value="#{answer.likelihood}" />  
240                                     </f:facet>  
241                                     <f:facet name="input">  
242                                         <p:inputText value="#{answer.likelihood}" style="width:100%"/>  
243                                     </f:facet>  
244                                 </p:cellEditor>  
245                             </p:column>   
246                             <p:column headerText="Pergunta"> 
247                                 <h:outputText value="#{answer.question.text}"/>
248                             </p:column>
249                             <p:column headerText="Nodo"> 
250                                 <h:outputText value="#{answer.question.node.name}"/>
251                             </p:column> 
252                             <p:column headerText="Rede Bayesiana"> 
253                                 <h:outputText value="#{answer.question.node.bayesianNetwork.name}"/>
254                             </p:column> 
255                             <p:column headerText="Opções">  
256                                 <p:rowEditor /> 
257                                 <h:commandLink action="#{answerController.destroy}" >
258                                     <h:graphicImage value="/img/bn/remove.png" />
259                                 </h:commandLink>
260                             </p:column>  
261                         </p:dataTable>  
262                     </h:panelGroup>   
263                 </h:form>   
264                 <h:form>
265                     <br></br>
266                     <h:commandLink action="/bn/answer/Create.xhtml" value="Criar nova resposta"/>
267                 </h:form>
268             </p:tab>
269         </p:tabView>
270     </h:body>
271
272
273
274
275 </html>
276