0 Replies Latest reply on Oct 4, 2010 5:17 AM by Andrea Vanz

    rendered problem jbpm

    Andrea Vanz Newbie

      Hi,
      I have a problem with the rendered.
      I have a creaDoc.xhtml where the user chooses a template using a combox. The template contains the information on which kind of process should begin.


      documentoHome.java checks the value and return a true or false value through a method.


      documentoList.xhtml is the page that manages the process choosen by the user. It checks the value given back by the method and then displays or hiddens the buttons of the process using the rendered.


      The problem comes up when I try to click on the displayed button (or buttons): an error comes up.


      Is there something that I'm missing about the use of the rendered (since, if I don't use it, everything works)?


      creaDoc.xhtml



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">
      
           <ui:define name="body">
                <h:form id="description">
                     <rich:panel>
                          <f:facet name="header">Crezione processi</f:facet>
                          <h:panelGrid columns="2" cellpadding="2" >
                          
                                Scegli il template:
                               <h:selectOneMenu value="#{documentoHome.t}" style=" width : 200px;">
                                    <s:selectItems value="#{templateList.resultList}" var="_template"
                                         label="#{_template.name}" itemValue="#{_template}"/>
                                         <s:convertEntity />
                               </h:selectOneMenu>
      
                          </h:panelGrid>
                     </rich:panel>
                     
                     <h:commandButton action="#{documentoHome.persist}" value="Imposta" rendered="#{!documentoHome.managed}"/>
                          
                     <s:button propagation="end" id="cancel" value="Lista Documenti" view="/documentoList.xhtml"/>
                </h:form>
           </ui:define>
      </ui:composition>



      documentoHome.java



      @Name("documentoHome")
      public class DocumentoHome extends EntityHome<Documento>
      {
          @RequestParameter Long documentoId;
      
         
          private Template t=new Template();
          private Documento d=new Documento();
          private ArrayList<Documento> documenti=new ArrayList<Documento>();
           private TodoDoc td=new TodoDoc();
          
          @Override 
          public String persist() {
               this.instance.setIdTemplate(t);
               System.out.println("Template Scelto: "+t.getName());
               System.out.println("CDV Scelto: "+     t.getIdCicliDiVita().getName() );
               super.persist();
               return "persisted";
          }
      
          public Boolean isTwoTask(){
               System.out.println("Ciclo 2? "+t.getIdCicliDiVita().getName());
                    if("ciclo2".equals(t.getIdCicliDiVita().getName()))
                         return true;
                    else
                    return false;     
          }
          
          public Boolean isThreeTask(){
               System.out.println("Ciclo 3? "+t.getIdCicliDiVita().getName());     
               if("ciclo1".equals(t.getIdCicliDiVita().getName()))
                         return true;
                    else
                         return false;
          }
      [...]
      }



      docuementoList.xhtml



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">
      
      
           <ui:define name="body">
      
           
                      <rich:panel rendered="#{authenticator.isRedattore()}">
                     <f:facet name="header" >Crezione processi</f:facet>
                     <h:form id="description">
                     <h:outputText value="Inserire il nome del documento."/>
                     
                          <div>Description:<h:inputText id="description" value="#{todoDoc.description}" style="width: 400"/> 
                     
                               <h:commandButton value="Ciclo 2 step (RA)" action="#{todoDoc.createTodo2}" rendered="#{documentoHome.isTwoTask()}"/>
                               <h:commandButton value="Ciclo 3 step (RVA)" action="#{todoDoc.createTodo}" rendered="#{documentoHome.isThreeTask()}"/>
                     
                          </div>
                     </h:form>
      
                </rich:panel>
                
      
                <br />
                <br />
      
                <rich:panel>
      
                     <f:facet name="header">Task propri</f:facet>
                     <div id="list"><h:form id="list">
                          <div><h:outputText value="Nessun task presente."
                               rendered="#{empty taskInstancePriorityList}" /> <h:dataTable
                               value="#{taskInstancePriorityList}" var="task"
                               rendered="#{not empty taskInstancePriorityList}">
                               
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Description task" />
                                    </f:facet>
                                    
                                    <h:inputText value="#{task.description}" style="width: 400" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Id processo" />
                                    </f:facet>
                                    <h:outputLabel value="#{task.taskMgmtInstance.processInstance.id}"/>
                                    
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Fase" />
                                    </f:facet>
                                    <h:outputLabel value="#{task.name}"/>
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Created" />
                                    </f:facet>
                                    <h:outputText
                                         value="#{task.taskMgmtInstance.processInstance.start}">
                                         <s:convertDateTime type="date" />
                                    </h:outputText>
                               </h:column>
                               
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Due Date" />
                                    </f:facet>
                                    <h:inputText value="#{task.dueDate}" style="width: 100">
                                         <s:convertDateTime type="date" dateStyle="short" />
                                    </h:inputText>
                               </h:column>
                          
                               <h:column>
                                    <s:button action="#{todoDoc.conferma}" taskInstance="#{task}"
                                         value="Accetta Documento" />
                               </h:column>
                               <h:column>
                                    <s:button action="#{todoDoc.rifiuta}" taskInstance="#{task}"
                                         value="Rifiuta Documento"/>
                               </h:column>
                
                     
                          </h:dataTable></div>
      
                          <div><h:commandButton value="Update Items"
                               rendered="#{not empty taskInstanceList}" /></div>
                     </h:form></div>
                </rich:panel>
      
                <br />
                <br />
      
                <rich:panel>
                     <f:facet name="header">Task del gruppo</f:facet>
                     <div id="list"><h:form id="list2">
                          <div><h:outputText value="Nessun task presente."
                               rendered="#{empty pooledTaskInstanceList}" />
                               <p>
                               <h:outputText value="Scegliere il task da prendere in carico."
                               rendered="#{not empty pooledTaskInstanceList}" />
                               </p>
                               
                               <h:dataTable
                                    value="#{pooledTaskInstanceList}" var="task"
                                    rendered="#{not empty pooledTaskInstanceList}">
                                    
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Description task" />
                                    </f:facet>
                                    <h:outputLabel value="#{task.description}"/>
                               
                               </h:column>
      
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Id processo" />
                                    </f:facet>
                                    
                                    <h:outputLabel value="#{task.taskMgmtInstance.processInstance.id}"/>
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Fase" />
                                    </f:facet>
                               <h:outputLabel value="#{task.name}" style="width: 100"/>
                               </h:column>
                               <h:column>
                                    <s:button action="#{pooledTask.assignToCurrentActor}" value="Assegna" taskInstance="#{task}" />
                               </h:column>
                          </h:dataTable></div>
                     </h:form></div>
                </rich:panel>
      
           </ui:define>
      </ui:composition>