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

Reply via email to