You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Katie Macpherson <ka...@gmail.com> on 2005/02/09 23:49:36 UTC

contrib:TableForm error -- Help!!! -- REVISED

I failed to mention that this error only comes up when I click on one of 
the column headers to sort the column.
Also, when I click on the paging links, the form runs the formSubmit 
code, instead of going to the next page of data.

Any ideas?

Thanks,
Katie

Mind Bridge wrote:

>Hi,
>
>It appears that the 'source' binding of the component is null. This can only
>happen if setDocumentList() in pageBeginRender() is not invoked at all,
>however. Do you happen to have a return in the '...' part of the method? If
>not, could you try to place a trace of documentSelectionList just before the
>setDocumentList() invocation and see if it appears before the exception pops
>up?
>
>Otherwise the code does look okay to me...
>
>
>----- Original Message ----- 
>From: "Katie Macpherson" <ka...@gmail.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Wednesday, February 09, 2005 9:11 PM
>Subject: contrib:TableForm error -- Help!!!
>
>
>  
>
>>Hey everyone,
>>
>>I've been getting an error when using the contrib:TableForm component
>>that I have never gotten previously. I've tried to figure out what the
>>problem is, but I've had no luck. If anybody could help out, I'd
>>appreciate it. I've used this component successfully on several other
>>pages, but for some reason, I can't get it to work with this page &
>>objects. I've included the error message, and .html, .page and .java
>>code that is relevant to this problem.
>>
>>
>>ERROR MESSAGE : Either the tableModel parameter or both source and
>>columns parameters must be specified by component
>>DocumentSelection/tableView
>>
>>Stack Trace:
>>
>>    *
>>    
>>
>org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableVi
>ew.java:199)
>  
>
>>    *
>>    
>>
>org.apache.tapestry.contrib.table.components.inserted.SimpleTableColumnCompo
>nent.columnSelected(SimpleTableColumnComponent.java:150)
>  
>
>>    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>    *
>>    
>>
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>)
>  
>
>>    *
>>    
>>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>.java:25)
>  
>
>>    * java.lang.reflect.Method.invoke(Method.java:585) ...
>>
>>----------------------------------------------
>>DocumentSelection.html (relevant portion)
>>----------------------------------------------
>><form jwcid="@Form" listener="ognl:listeners.formSubmit">
>><div align="left">
>><table jwcid="tableView">
>>      <span jwcid="tableColumns"/>
>>      <span jwcid="tableRows">
>>            <span jwcid="tableValues"/>
>>      </span>
>>      <tr>
>>         <td colspan="2" class="tablepager">
>>            <span jwcid="tablePages"/>
>>         </td>
>>      </tr>
>></table>
>></div>
>></form>
>>----------------------------------------------
>>DocumentSelection.page
>>----------------------------------------------
>><page-specification class="com.dci.dids.webapp.DocumentSelection">
>>  <property-specification name="adminPage" type="boolean"
>>initial-value="true" />
>>  <property-specification name="documentList" type="java.util.List" />
>>  <context-asset name="documentSelection"
>>path="/images/title_document_holders.jpg"/>
>>
>>    <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
>>
>>       <component id="tableView" type="contrib:TableView">
>>         <binding name="source" expression="documentList"/>
>>         <static-binding name="columns" value="DocumentTitle, Version"/>
>>         <binding name="pageSize" expression="6"/>
>>         <static-binding  name="initialSortColumn" value="DocumentTitle"/>
>>         <static-binding name="class" value="reporting"/>
>>        </component>
>>
>>         <component id="tableColumns" type="contrib:TableColumns">
>>             <static-binding name="class" value="sortablecolumn"/>
>>        </component>
>>
>>           <component id="tableValues" type="contrib:TableValues">
>>            <static-binding name="class" value="nolines"/>
>>        </component>
>>
>>        <component id="tableRows" type="contrib:TableFormRows">
>>            <binding name="class" expression="beans.evenOdd.next"/>
>>        </component>
>>
>>       <component id="tablePages" type="TableFormPageImages"/>
>>
>> </page-specification>
>>
>>----------------------------------------
>>Java Bean (populates documentList)
>>----------------------------------------
>>
>>public class DocumentSelectionListItem implements Serializable {
>>
>>    private String documentTitle;
>>
>>    private String version;
>>
>>    public String getDocumentTitle() {
>>        return documentTitle;
>>    }
>>
>>    public void setDocumentTitle(String documentTitle) {
>>       this.documentTitle = documentTitle;
>>    }
>>
>>    public String getVersion() {
>>       return version;
>>    }
>>
>>    public void setVersion(String version) {
>>        this.version = version;
>>    }
>>
>>}
>>
>>----------------------------------------
>>DocumentSelection.java
>>----------------------------------------
>>
>>public abstract class DocumentSelection extends ProtectedPage
>>    implements PageRenderListener {
>>    private static Logger logger =
>>Logger.getLogger(DocumentSelection.class);
>>    private DocumentRoleDAO fDocumentRoleDAO;
>>    private DocumentAssignmentDAO fDocumentAssignmentDAO;
>>    private MediaTypeDAO fMediaTypeDAO;
>>    private DocumentDAO fDocumentDAO;
>>    private DocumentHolderDAO fDocumentHolderDAO;
>>    private IPropertySelectionModel mediaTypeModel;
>>
>>    public DocumentSelection() {
>>    }
>>
>>    /* Tapestry abstract methods */
>>
>>    public abstract void setDocumentList(List docList);
>>
>>    public abstract List getDocumentList();
>>
>>
>>   public void pageBeginRender(PageEvent event) {
>>        fDocumentRoleDAO = (DocumentRoleDAO)
>>getBean(DAOConstants.DOCUMENT_ROLE_DAO);
>>        if (fMediaTypeDAO==null) {
>>            fMediaTypeDAO = (MediaTypeDAO)
>>getBean(DAOConstants.MEDIATYPE_DAO);
>>        }
>>        Vector documentSelectionList = new Vector();
>>
>>
>>        List roleList = getRoleList();
>>        for(Iterator it=roleList.iterator(); it.hasNext();) {
>>            Role role = (Role) it.next();
>>            List documentRoles = fDocumentRoleDAO.findByRole(role);
>>            for (Iterator iter=documentRoles.iterator(); iter.hasNext();)
>>    
>>
>{
>  
>
>>                DocumentRole docRole = (DocumentRole) iter.next();
>>                Document doc = docRole.getDocument();
>>                DocumentSelectionListItem docSelectionItem = new
>>DocumentSelectionListItem();
>>                docSelectionItem.setDocumentTitle(doc.getTitle());
>>                docSelectionItem.setVersion(doc.getVersion());
>>                documentSelectionList.add(docSelectionItem);
>>                .....
>>            }
>>
>>        }
>>        setDocumentList(documentSelectionList);
>>
>>    }
>>
>>    public void formSubmit(IRequestCycle cycle) {
>>        if (fDocumentAssignmentDAO==null) {
>>            fDocumentAssignmentDAO = (DocumentAssignmentDAO)
>>getBean(DAOConstants.DOCUMENTASSIGNMENT_DAO);
>>        }
>>       .....
>>
>>
>>        List documentList = getDocumentList();
>>        for(Iterator it=documentList.iterator(); it.hasNext();) {
>>            DocumentSelectionListItem docListItem =
>>(DocumentSelectionListItem) it.next();
>>            .....
>>
>>        }
>>        //Send the user back to the Document Holder list page
>>        DocumentHolderList docHolderListPage = (DocumentHolderList)
>>cycle.getPage("DocumentHolderList");
>>        docHolderListPage.setMessage("Document Holder updated
>>successfully");
>>        cycle.activate(docHolderListPage);
>>    }
>>
>>}
>>
>>
>>
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib:TableForm error -- Help!!! -- REVISED

Posted by Katie Macpherson <ka...@gmail.com>.
Mind Bridge-

You were right, that fixed it. Thank you for your help!

(thank you to john & steven as well)

--Katie

Mind Bridge wrote:

>Yes, that makes sense. DirectLink invokes its listener before
>pageBeginRender() and hence the document list is null at that point and the
>exception is thrown.
>Here is a way to resolve this:
>
>In the .page file make the following modification (basically only change the
>source binding):
>
>       <component id="tableView" type="contrib:TableView">
>         <binding name="source" expression="cachedDocumentList"/>
>        ...
>
>And in the .java add the following function:
>
>public List getCachedDocumentList() {
>    List lst = getDocumentList();
>    if (lst == null) {
>        ... // same as currently in pageBeginRender()
>        setDocumentList(documentSelectionList);
>    }
>}
>
>
>Basically initialize the list lazily on demand.
>
>
>
>----- Original Message ----- 
>From: "Katie Macpherson" <ka...@gmail.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Thursday, February 10, 2005 12:49 AM
>Subject: contrib:TableForm error -- Help!!! -- REVISED
>
>
>  
>
>>I failed to mention that this error only comes up when I click on one of
>>the column headers to sort the column.
>>Also, when I click on the paging links, the form runs the formSubmit
>>code, instead of going to the next page of data.
>>
>>Any ideas?
>>
>>Thanks,
>>Katie
>>
>>Mind Bridge wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>It appears that the 'source' binding of the component is null. This can
>>>      
>>>
>only
>  
>
>>>happen if setDocumentList() in pageBeginRender() is not invoked at all,
>>>however. Do you happen to have a return in the '...' part of the method?
>>>      
>>>
>If
>  
>
>>>not, could you try to place a trace of documentSelectionList just before
>>>      
>>>
>the
>  
>
>>>setDocumentList() invocation and see if it appears before the exception
>>>      
>>>
>pops
>  
>
>>>up?
>>>
>>>Otherwise the code does look okay to me...
>>>
>>>
>>>----- Original Message ----- 
>>>From: "Katie Macpherson" <ka...@gmail.com>
>>>To: "Tapestry users" <ta...@jakarta.apache.org>
>>>Sent: Wednesday, February 09, 2005 9:11 PM
>>>Subject: contrib:TableForm error -- Help!!!
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>Hey everyone,
>>>>
>>>>I've been getting an error when using the contrib:TableForm component
>>>>that I have never gotten previously. I've tried to figure out what the
>>>>problem is, but I've had no luck. If anybody could help out, I'd
>>>>appreciate it. I've used this component successfully on several other
>>>>pages, but for some reason, I can't get it to work with this page &
>>>>objects. I've included the error message, and .html, .page and .java
>>>>code that is relevant to this problem.
>>>>
>>>>
>>>>ERROR MESSAGE : Either the tableModel parameter or both source and
>>>>columns parameters must be specified by component
>>>>DocumentSelection/tableView
>>>>
>>>>Stack Trace:
>>>>
>>>>   *
>>>>
>>>>
>>>>        
>>>>
>>org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableV
>>    
>>
>i
>  
>
>>>ew.java:199)
>>>
>>>
>>>      
>>>
>>>>   *
>>>>
>>>>
>>>>        
>>>>
>>org.apache.tapestry.contrib.table.components.inserted.SimpleTableColumnComp
>>    
>>
>o
>  
>
>>>nent.columnSelected(SimpleTableColumnComponent.java:150)
>>>
>>>
>>>      
>>>
>>>>   * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>   *
>>>>
>>>>
>>>>        
>>>>
>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>>    
>>
>9
>  
>
>>>)
>>>
>>>
>>>      
>>>
>>>>   *
>>>>
>>>>
>>>>        
>>>>
>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>>    
>>
>l
>  
>
>>>.java:25)
>>>
>>>
>>>      
>>>
>>>>   * java.lang.reflect.Method.invoke(Method.java:585) ...
>>>>
>>>>----------------------------------------------
>>>>DocumentSelection.html (relevant portion)
>>>>----------------------------------------------
>>>><form jwcid="@Form" listener="ognl:listeners.formSubmit">
>>>><div align="left">
>>>><table jwcid="tableView">
>>>>     <span jwcid="tableColumns"/>
>>>>     <span jwcid="tableRows">
>>>>           <span jwcid="tableValues"/>
>>>>     </span>
>>>>     <tr>
>>>>        <td colspan="2" class="tablepager">
>>>>           <span jwcid="tablePages"/>
>>>>        </td>
>>>>     </tr>
>>>></table>
>>>></div>
>>>></form>
>>>>----------------------------------------------
>>>>DocumentSelection.page
>>>>----------------------------------------------
>>>><page-specification class="com.dci.dids.webapp.DocumentSelection">
>>>> <property-specification name="adminPage" type="boolean"
>>>>initial-value="true" />
>>>> <property-specification name="documentList" type="java.util.List" />
>>>> <context-asset name="documentSelection"
>>>>path="/images/title_document_holders.jpg"/>
>>>>
>>>>   <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
>>>>
>>>>      <component id="tableView" type="contrib:TableView">
>>>>        <binding name="source" expression="documentList"/>
>>>>        <static-binding name="columns" value="DocumentTitle, Version"/>
>>>>        <binding name="pageSize" expression="6"/>
>>>>        <static-binding  name="initialSortColumn"
>>>>        
>>>>
>value="DocumentTitle"/>
>  
>
>>>>        <static-binding name="class" value="reporting"/>
>>>>       </component>
>>>>
>>>>        <component id="tableColumns" type="contrib:TableColumns">
>>>>            <static-binding name="class" value="sortablecolumn"/>
>>>>       </component>
>>>>
>>>>          <component id="tableValues" type="contrib:TableValues">
>>>>           <static-binding name="class" value="nolines"/>
>>>>       </component>
>>>>
>>>>       <component id="tableRows" type="contrib:TableFormRows">
>>>>           <binding name="class" expression="beans.evenOdd.next"/>
>>>>       </component>
>>>>
>>>>      <component id="tablePages" type="TableFormPageImages"/>
>>>>
>>>></page-specification>
>>>>
>>>>----------------------------------------
>>>>Java Bean (populates documentList)
>>>>----------------------------------------
>>>>
>>>>public class DocumentSelectionListItem implements Serializable {
>>>>
>>>>   private String documentTitle;
>>>>
>>>>   private String version;
>>>>
>>>>   public String getDocumentTitle() {
>>>>       return documentTitle;
>>>>   }
>>>>
>>>>   public void setDocumentTitle(String documentTitle) {
>>>>      this.documentTitle = documentTitle;
>>>>   }
>>>>
>>>>   public String getVersion() {
>>>>      return version;
>>>>   }
>>>>
>>>>   public void setVersion(String version) {
>>>>       this.version = version;
>>>>   }
>>>>
>>>>}
>>>>
>>>>----------------------------------------
>>>>DocumentSelection.java
>>>>----------------------------------------
>>>>
>>>>public abstract class DocumentSelection extends ProtectedPage
>>>>   implements PageRenderListener {
>>>>   private static Logger logger =
>>>>Logger.getLogger(DocumentSelection.class);
>>>>   private DocumentRoleDAO fDocumentRoleDAO;
>>>>   private DocumentAssignmentDAO fDocumentAssignmentDAO;
>>>>   private MediaTypeDAO fMediaTypeDAO;
>>>>   private DocumentDAO fDocumentDAO;
>>>>   private DocumentHolderDAO fDocumentHolderDAO;
>>>>   private IPropertySelectionModel mediaTypeModel;
>>>>
>>>>   public DocumentSelection() {
>>>>   }
>>>>
>>>>   /* Tapestry abstract methods */
>>>>
>>>>   public abstract void setDocumentList(List docList);
>>>>
>>>>   public abstract List getDocumentList();
>>>>
>>>>
>>>>  public void pageBeginRender(PageEvent event) {
>>>>       fDocumentRoleDAO = (DocumentRoleDAO)
>>>>getBean(DAOConstants.DOCUMENT_ROLE_DAO);
>>>>       if (fMediaTypeDAO==null) {
>>>>           fMediaTypeDAO = (MediaTypeDAO)
>>>>getBean(DAOConstants.MEDIATYPE_DAO);
>>>>       }
>>>>       Vector documentSelectionList = new Vector();
>>>>
>>>>
>>>>       List roleList = getRoleList();
>>>>       for(Iterator it=roleList.iterator(); it.hasNext();) {
>>>>           Role role = (Role) it.next();
>>>>           List documentRoles = fDocumentRoleDAO.findByRole(role);
>>>>           for (Iterator iter=documentRoles.iterator();
>>>>        
>>>>
>iter.hasNext();)
>  
>
>>>>        
>>>>
>>>{
>>>
>>>
>>>      
>>>
>>>>               DocumentRole docRole = (DocumentRole) iter.next();
>>>>               Document doc = docRole.getDocument();
>>>>               DocumentSelectionListItem docSelectionItem = new
>>>>DocumentSelectionListItem();
>>>>               docSelectionItem.setDocumentTitle(doc.getTitle());
>>>>               docSelectionItem.setVersion(doc.getVersion());
>>>>               documentSelectionList.add(docSelectionItem);
>>>>               .....
>>>>           }
>>>>
>>>>       }
>>>>       setDocumentList(documentSelectionList);
>>>>
>>>>   }
>>>>
>>>>   public void formSubmit(IRequestCycle cycle) {
>>>>       if (fDocumentAssignmentDAO==null) {
>>>>           fDocumentAssignmentDAO = (DocumentAssignmentDAO)
>>>>getBean(DAOConstants.DOCUMENTASSIGNMENT_DAO);
>>>>       }
>>>>      .....
>>>>
>>>>
>>>>       List documentList = getDocumentList();
>>>>       for(Iterator it=documentList.iterator(); it.hasNext();) {
>>>>           DocumentSelectionListItem docListItem =
>>>>(DocumentSelectionListItem) it.next();
>>>>           .....
>>>>
>>>>       }
>>>>       //Send the user back to the Document Holder list page
>>>>       DocumentHolderList docHolderListPage = (DocumentHolderList)
>>>>cycle.getPage("DocumentHolderList");
>>>>       docHolderListPage.setMessage("Document Holder updated
>>>>successfully");
>>>>       cycle.activate(docHolderListPage);
>>>>   }
>>>>
>>>>}
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib:TableForm error -- Help!!! -- REVISED

Posted by Mind Bridge <mi...@yahoo.com>.
Yes, that makes sense. DirectLink invokes its listener before
pageBeginRender() and hence the document list is null at that point and the
exception is thrown.
Here is a way to resolve this:

In the .page file make the following modification (basically only change the
source binding):

       <component id="tableView" type="contrib:TableView">
         <binding name="source" expression="cachedDocumentList"/>
        ...

And in the .java add the following function:

public List getCachedDocumentList() {
    List lst = getDocumentList();
    if (lst == null) {
        ... // same as currently in pageBeginRender()
        setDocumentList(documentSelectionList);
    }
}


Basically initialize the list lazily on demand.



----- Original Message ----- 
From: "Katie Macpherson" <ka...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, February 10, 2005 12:49 AM
Subject: contrib:TableForm error -- Help!!! -- REVISED


> I failed to mention that this error only comes up when I click on one of
> the column headers to sort the column.
> Also, when I click on the paging links, the form runs the formSubmit
> code, instead of going to the next page of data.
>
> Any ideas?
>
> Thanks,
> Katie
>
> Mind Bridge wrote:
>
> >Hi,
> >
> >It appears that the 'source' binding of the component is null. This can
only
> >happen if setDocumentList() in pageBeginRender() is not invoked at all,
> >however. Do you happen to have a return in the '...' part of the method?
If
> >not, could you try to place a trace of documentSelectionList just before
the
> >setDocumentList() invocation and see if it appears before the exception
pops
> >up?
> >
> >Otherwise the code does look okay to me...
> >
> >
> >----- Original Message ----- 
> >From: "Katie Macpherson" <ka...@gmail.com>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Wednesday, February 09, 2005 9:11 PM
> >Subject: contrib:TableForm error -- Help!!!
> >
> >
> >
> >
> >>Hey everyone,
> >>
> >>I've been getting an error when using the contrib:TableForm component
> >>that I have never gotten previously. I've tried to figure out what the
> >>problem is, but I've had no luck. If anybody could help out, I'd
> >>appreciate it. I've used this component successfully on several other
> >>pages, but for some reason, I can't get it to work with this page &
> >>objects. I've included the error message, and .html, .page and .java
> >>code that is relevant to this problem.
> >>
> >>
> >>ERROR MESSAGE : Either the tableModel parameter or both source and
> >>columns parameters must be specified by component
> >>DocumentSelection/tableView
> >>
> >>Stack Trace:
> >>
> >>    *
> >>
> >>
>
>org.apache.tapestry.contrib.table.components.TableView.getTableModel(TableV
i
> >ew.java:199)
> >
> >
> >>    *
> >>
> >>
>
>org.apache.tapestry.contrib.table.components.inserted.SimpleTableColumnComp
o
> >nent.columnSelected(SimpleTableColumnComponent.java:150)
> >
> >
> >>    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>    *
> >>
> >>
>
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
9
> >)
> >
> >
> >>    *
> >>
> >>
>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
l
> >.java:25)
> >
> >
> >>    * java.lang.reflect.Method.invoke(Method.java:585) ...
> >>
> >>----------------------------------------------
> >>DocumentSelection.html (relevant portion)
> >>----------------------------------------------
> >><form jwcid="@Form" listener="ognl:listeners.formSubmit">
> >><div align="left">
> >><table jwcid="tableView">
> >>      <span jwcid="tableColumns"/>
> >>      <span jwcid="tableRows">
> >>            <span jwcid="tableValues"/>
> >>      </span>
> >>      <tr>
> >>         <td colspan="2" class="tablepager">
> >>            <span jwcid="tablePages"/>
> >>         </td>
> >>      </tr>
> >></table>
> >></div>
> >></form>
> >>----------------------------------------------
> >>DocumentSelection.page
> >>----------------------------------------------
> >><page-specification class="com.dci.dids.webapp.DocumentSelection">
> >>  <property-specification name="adminPage" type="boolean"
> >>initial-value="true" />
> >>  <property-specification name="documentList" type="java.util.List" />
> >>  <context-asset name="documentSelection"
> >>path="/images/title_document_holders.jpg"/>
> >>
> >>    <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
> >>
> >>       <component id="tableView" type="contrib:TableView">
> >>         <binding name="source" expression="documentList"/>
> >>         <static-binding name="columns" value="DocumentTitle, Version"/>
> >>         <binding name="pageSize" expression="6"/>
> >>         <static-binding  name="initialSortColumn"
value="DocumentTitle"/>
> >>         <static-binding name="class" value="reporting"/>
> >>        </component>
> >>
> >>         <component id="tableColumns" type="contrib:TableColumns">
> >>             <static-binding name="class" value="sortablecolumn"/>
> >>        </component>
> >>
> >>           <component id="tableValues" type="contrib:TableValues">
> >>            <static-binding name="class" value="nolines"/>
> >>        </component>
> >>
> >>        <component id="tableRows" type="contrib:TableFormRows">
> >>            <binding name="class" expression="beans.evenOdd.next"/>
> >>        </component>
> >>
> >>       <component id="tablePages" type="TableFormPageImages"/>
> >>
> >> </page-specification>
> >>
> >>----------------------------------------
> >>Java Bean (populates documentList)
> >>----------------------------------------
> >>
> >>public class DocumentSelectionListItem implements Serializable {
> >>
> >>    private String documentTitle;
> >>
> >>    private String version;
> >>
> >>    public String getDocumentTitle() {
> >>        return documentTitle;
> >>    }
> >>
> >>    public void setDocumentTitle(String documentTitle) {
> >>       this.documentTitle = documentTitle;
> >>    }
> >>
> >>    public String getVersion() {
> >>       return version;
> >>    }
> >>
> >>    public void setVersion(String version) {
> >>        this.version = version;
> >>    }
> >>
> >>}
> >>
> >>----------------------------------------
> >>DocumentSelection.java
> >>----------------------------------------
> >>
> >>public abstract class DocumentSelection extends ProtectedPage
> >>    implements PageRenderListener {
> >>    private static Logger logger =
> >>Logger.getLogger(DocumentSelection.class);
> >>    private DocumentRoleDAO fDocumentRoleDAO;
> >>    private DocumentAssignmentDAO fDocumentAssignmentDAO;
> >>    private MediaTypeDAO fMediaTypeDAO;
> >>    private DocumentDAO fDocumentDAO;
> >>    private DocumentHolderDAO fDocumentHolderDAO;
> >>    private IPropertySelectionModel mediaTypeModel;
> >>
> >>    public DocumentSelection() {
> >>    }
> >>
> >>    /* Tapestry abstract methods */
> >>
> >>    public abstract void setDocumentList(List docList);
> >>
> >>    public abstract List getDocumentList();
> >>
> >>
> >>   public void pageBeginRender(PageEvent event) {
> >>        fDocumentRoleDAO = (DocumentRoleDAO)
> >>getBean(DAOConstants.DOCUMENT_ROLE_DAO);
> >>        if (fMediaTypeDAO==null) {
> >>            fMediaTypeDAO = (MediaTypeDAO)
> >>getBean(DAOConstants.MEDIATYPE_DAO);
> >>        }
> >>        Vector documentSelectionList = new Vector();
> >>
> >>
> >>        List roleList = getRoleList();
> >>        for(Iterator it=roleList.iterator(); it.hasNext();) {
> >>            Role role = (Role) it.next();
> >>            List documentRoles = fDocumentRoleDAO.findByRole(role);
> >>            for (Iterator iter=documentRoles.iterator();
iter.hasNext();)
> >>
> >>
> >{
> >
> >
> >>                DocumentRole docRole = (DocumentRole) iter.next();
> >>                Document doc = docRole.getDocument();
> >>                DocumentSelectionListItem docSelectionItem = new
> >>DocumentSelectionListItem();
> >>                docSelectionItem.setDocumentTitle(doc.getTitle());
> >>                docSelectionItem.setVersion(doc.getVersion());
> >>                documentSelectionList.add(docSelectionItem);
> >>                .....
> >>            }
> >>
> >>        }
> >>        setDocumentList(documentSelectionList);
> >>
> >>    }
> >>
> >>    public void formSubmit(IRequestCycle cycle) {
> >>        if (fDocumentAssignmentDAO==null) {
> >>            fDocumentAssignmentDAO = (DocumentAssignmentDAO)
> >>getBean(DAOConstants.DOCUMENTASSIGNMENT_DAO);
> >>        }
> >>       .....
> >>
> >>
> >>        List documentList = getDocumentList();
> >>        for(Iterator it=documentList.iterator(); it.hasNext();) {
> >>            DocumentSelectionListItem docListItem =
> >>(DocumentSelectionListItem) it.next();
> >>            .....
> >>
> >>        }
> >>        //Send the user back to the Document Holder list page
> >>        DocumentHolderList docHolderListPage = (DocumentHolderList)
> >>cycle.getPage("DocumentHolderList");
> >>        docHolderListPage.setMessage("Document Holder updated
> >>successfully");
> >>        cycle.activate(docHolderListPage);
> >>    }
> >>
> >>}
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org