You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anton Bessonov <ex...@googlemail.com> on 2010/12/31 03:19:05 UTC

TreeTabel and file download

Hello list,

I'm trying to implement small file browser and I use TreeTable. 
PropertyTreeColumn shows file names and I can get (newCell -> 
getTreeTable().getTreeState().isNodeSelected(node)) java.io.File. Now, 
I'm need force to download file after click on the file name. Any 
suggestions?

Thanks,

Anton

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


Re: TreeTabel and file download

Posted by Anton Bessonov <ex...@googlemail.com>.
I solved it.

                 new PropertyTreeColumn(new 
ColumnLocation(Alignment.MIDDLE, 8, Unit.PROPORTIONAL),
                         "", "userObject.name") {
                     @Override
                     public IRenderable newCell(TreeNode node, int level)
                     {
                         if 
(getTreeTable().getTreeState().isNodeSelected(node)) {
                             File f = new PropertyModel<File>(node, 
"userObject.file").getObject();
                             ResourceStreamRequestTarget res = new 
ResourceStreamRequestTarget(
                                 new FileResourceStream(f), f.getName());
                             getRequestCycle().setRequestTarget(res);
                             return null;
                         } else {
                             return super.newCell(node, level);
                         }
                     }
                 }

and

TreeTable tree = new TreeTable("treeTable", createTreeModel(), columns);
tree.setLinkType(TreeTable.LinkType.REGULAR);

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


Re: TreeTabel and file download

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Feb 23, 2011 at 8:01 PM, Anton Bessonov <ex...@googlemail.com>wrote:

> Hello Martin,
>
> thanks for your reply! You mean override newLink method in
> DefaultAbstractTree?
>
> No, Probably you'll have to create custom TreeColumn that uses DownloadLink
instead of Label (as PropertyTreeColumn does).


>  See DownloadLink.
>>
>> On Fri, Dec 31, 2010 at 3:19 AM, Anton Bessonov<exelib@googlemail.com
>> >wrote:
>>
>>  Hello list,
>>>
>>> I'm trying to implement small file browser and I use TreeTable.
>>> PropertyTreeColumn shows file names and I can get (newCell ->
>>> getTreeTable().getTreeState().isNodeSelected(node)) java.io.File. Now,
>>> I'm
>>> need force to download file after click on the file name. Any
>>> suggestions?
>>>
>>> Thanks,
>>>
>>> Anton
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: TreeTabel and file download

Posted by Anton Bessonov <ex...@googlemail.com>.
Hello Martin,

thanks for your reply! You mean override newLink method in 
DefaultAbstractTree?

> See DownloadLink.
>
> On Fri, Dec 31, 2010 at 3:19 AM, Anton Bessonov<ex...@googlemail.com>wrote:
>
>> Hello list,
>>
>> I'm trying to implement small file browser and I use TreeTable.
>> PropertyTreeColumn shows file names and I can get (newCell ->
>> getTreeTable().getTreeState().isNodeSelected(node)) java.io.File. Now, I'm
>> need force to download file after click on the file name. Any suggestions?
>>
>> Thanks,
>>
>> Anton
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


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


Re: TreeTabel and file download

Posted by Martin Grigorov <mg...@apache.org>.
See DownloadLink.

On Fri, Dec 31, 2010 at 3:19 AM, Anton Bessonov <ex...@googlemail.com>wrote:

> Hello list,
>
> I'm trying to implement small file browser and I use TreeTable.
> PropertyTreeColumn shows file names and I can get (newCell ->
> getTreeTable().getTreeState().isNodeSelected(node)) java.io.File. Now, I'm
> need force to download file after click on the file name. Any suggestions?
>
> Thanks,
>
> Anton
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>