Use DataView or take a look at how PropertyListView creates a
CompoundPropertyModel for each listitem.

Martijn

On Mon, Aug 3, 2009 at 6:25 PM, fachhoch<fachh...@gmail.com> wrote:
>
> That I get  it from the database but my question is when user clicks on a
> particular Item ie  AuditProgramDocument I want to reload this as its
> auditProgramDocument.getDocumentBytes() is lazy  , In refreshing view I can
> reload each item but why not in listview ?
>
> igor.vaynberg wrote:
>>
>> where does List<AuditProgramDocument> documents come from?
>>
>> -igor
>>
>> On Mon, Aug 3, 2009 at 7:49 AM, tubin gen<fachh...@gmail.com> wrote:
>>> Please help me use detachablemodel inside a list view
>>>
>>> here is my code
>>>
>>> private class DocumentsPanel  extends  Panel {
>>>
>>> public DocumentsPanel( final List<AuditProgramDocument> documents ,final
>>> String name) {
>>> super("documentsPanel");
>>> List<IModel<AuditProgramDocument>>   models= new
>>> ArrayList<IModel<AuditProgramDocument>>();
>>> for(final AuditProgramDocument  auditProgramDocument :documents){
>>> models.add(new
>>> LoadableDetachableModel<AuditProgramDocument>(auditProgramDocument){
>>> Long sysDocumentId;
>>> {
>>> sysDocumentId=auditProgramDocument.getSysDocumentId();
>>> }
>>> @Override
>>> protected AuditProgramDocument load() {
>>>
>>> return auditProgramDocumentService.getById(sysDocumentId);
>>> }
>>> });
>>> }
>>> add(new ListView<IModel<AuditProgramDocument>>("documentsList",models){
>>>
>>> @Override
>>> protected void populateItem(ListItem<IModel<AuditProgramDocument>> item)
>>> {
>>> AuditProgramDocument
>>>  auditProgramDocument=item.getModelObject().getObject();
>>> item.add(new Link<Void>("view"){
>>> @Override
>>> public void onClick() {
>>> System.out.println(getParent().getDefaultModelObject());
>>> *AuditProgramDocument auditProgramDocument=
>>> (AuditProgramDocument)getParent().getDefaultModelObject();*
>>> download(name+".pdf", auditProgramDocument.getDocumentBytes());
>>> }
>>> });
>>> }
>>> });
>>> }
>>> }
>>>
>>> the highlited line I get class cast exception, Please tell me  what is
>>> wrong
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/detachable-model-in-a-listview-tp24792175p24793501.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to