I'm doing a web aplication where I have to monitorize the value of different variables. I have 3 main elements on the xhtml file:
1) A tree with different checkboxes to select which variables I want to monitorize. Every time I check and uncheck a variable the datagrid is updated.
Code: Select all
<p:tree value="#{monitorBean.root}" var="node" expanded="true"
selectionMode="checkbox" selection="#{monitorBean.selectedNodes}"
propagateSelectionUp="true" nodeSelectListener="#{monitorBean.displayVariables}"
propagateSelectionDown="true" update="data:table"
expandAnim="FADE_IN" collapseAnim="FADE_OUT">
<p:treeNode>
<h:outputText value="#{node.nombre}" />
</p:treeNode>
</p:tree>
Code: Select all
<p:dataGrid var="variable" value="#{monitorBean.selectedVariables}" columns="5"
rows="20" paginator="true" effect="true" paginatorPosition="top"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {ColumnsPerPageDropdown}"
rowsPerPageTemplate="15,20,25" id="table" rendered="#{monitorBean.viewType}" paginatorAlwaysVisible="false">
<p:column style="min-width: 20%">
<p:panel id="panel" header="#{variable.nombre}" toggleable="true" styleClass="dataGridPanel" >
<h:panelGrid columns="1" style="width:100%">
<h:outputText id="gridValue" title="#{mon.valor}" value="#{variable.binario? (monitorBean.binaryHex?variable.bytesLines8:variable.hex):variable.valorUnidad}" escape="false"/>
<p:commandLink title="#{mon.masinfo}" update="dialogPanel" oncomplete="varDialog.show()" value="#{mon.info}">
<f:setPropertyActionListener value="#{variable}"
target="#{monitorBean.selectedVariable}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:column>
</p:dataGrid>
Code: Select all
<p:poll id="updatePoll" actionListener="#{monitorBean.updateValues}" interval="1"
update="#{monitorBean.updateTabla}"/>
Is there any problem on doing this? Should I use one form for the whole page or one form per element(menu, data/poll)? Am I doing something wrong?
Thanks for your help. I started some months ago using primefaces to build my Final Year Project application but I still I have a lot of things to learn about it.
PD: I'm using Mojarra 2.1.0+Primefaces 2.2.1+glassfish 3