Can someone help me?
When the constructor DocEditPage is called, the variables file, file name and 
content type are null. These variables set to be later. But the panel is not 
refreshed. 

-----Ursprüngliche Nachricht-----
Von: Kaplankiran, Mehmet 
Gesendet: Mittwoch, 10. November 2010 13:09
An: users@wicket.apache.org
Betreff: panel can not be refreshed

Hello,

I have implemented iframe and can view documents. Unfortunately, only in the 
class MyPdfResource hard-coded filename (example: private string filename = 
"test.pdf";) can be displayed.
The files can not be refreshed. I hope someone can help me.

greetings, Mehmet

HTML:
<div wicket:id="mypdf" border="1" width="900px" height="400px"></div>

++++++++++++++++++++++++++++++ class DocEditPage 
++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++ ++++++++++++
public class DocEditPage extends MainTemplate {

        private byte[] file;
        private String fileName;
        private String contentType;

...
        public DocEditPage(PageParameters params)
        {
                ...
                add(renderFileContent("mypdf"));
        }
...

        private MyPdfPanel renderFileContent(String id)
        {
                return new MyPdfPanel(id, getRenderFileContentModel(), 
getContentTypeModel(), getFileNameModel);
        }
...
        private IModel getRenderFileContentModel()
        {

                return new AbstractReadOnlyModel()
                {
                        @Override
                        public Object getObject()
                        {
                                return file;
                        }
                };
        }

        private IModel getContentTypeModel()
        {
                return new AbstractReadOnlyModel()
                {
                        @Override
                        public Object getObject()
                        {
                                return contentType;
                        }
                };
        }

        private IModel getFileNameModel()
        {
                return new AbstractReadOnlyModel()
                {
                        @Override
                        public Object getObject()
                        {
                                return fileName;
                        }
                };
        }

...

        private DISTree disTree(String id)
        {
                return new DISTree(id)
                {
                        @Override
                        public void selectNode(AjaxRequestTarget target, 
DISTreeNode node)
                        {
                                //set file and contentType;
                                ...
                                DocEditPage.this.contentType = 
content.getContentType();
                                DocEditPage.this.file = content.getOrbLk();
                        }
                }
        }

}

++++++++++++++++++++++++++++++ class MyPdfPanel 
++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++ ++++++++++++
public class MyPdfPanel extends Panel
{

        public MyPdfPanel(String id, IModel fileContentModel, IModel 
fileNameModel, IModel contentTypeModel)
        {
                //super(id, fileContentModel);
                super(id);

                file = (byte[]) fileContentModel.getObject();
                String fileName =  (String) fileNameModel.getObject();
                String contentType = (String) contentTypeModel.getObject();
                setRenderBodyOnly(true);
                add(new DocumentInlineFrame("mypdf", new MyPdfResource(file, 
contentType, fileName)));
        }

}

++++++++++++++++++++++++++++++ class MyPdfResource 
++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++ ++++++++++++
public class MyPdfResource extends DynamicWebResource {
        private static final long serialVersionUID = 1L; ...
        private byte[] file;
        private String contentType = "application/pdf";
        private String fileName = "test.pdf"; ...
        public MyPdfResource(byte[] file, String contenttype, String filename)
        {
                if (file != null)
                        this.file = file;
                if (contenttype != null && !"".equalsIgnoreCase(contenttype))
                        contentType = contenttype;
                if (filename != null && !"".equalsIgnoreCase(filename))
                        fileName = filename;
        }
...
}



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

Reply via email to