You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Struck <st...@stottlerhenke.com> on 2007/10/24 23:18:23 UTC

Configuring AJAX tree

I've been able to get an AJAX tree up and running and I'm very happy 
with how simple it was. My HTML is:

  <html>
  <body>
  <span wicket:id="myTree"></span>
  </body>
  </html>

and my Java is:

  ...
  public TreePage() {
    DefaultMutableTreeNode root = ...
    TreeModel treeModel = new DefaultTreeModel(root);
    Tree tree = new Tree("myTree", treeModel);
    tree.getTreeState().collapseAll();
    add(tree);
  }
  ...

Now I'd like to improve the layout and I'm not sure how to do it. First 
of all, the tree view seems to have a preset width that doesn't grow 
when one of the tree nodes goes outside the width. How can I modify the 
width of the tree view? Should I use CSS? And, if so, how do I hook my 
CSS settings in?

Second, can I move/remove the floating debugger link? And can anyone 
provide a link to a tutorial/guide that explains how to tweak pre-built 
components? Hopefully that will get me moving in the right direction.

Thanks,

David

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


Re: Configuring AJAX tree

Posted by Florian Sperber <fl...@sperber.info>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It's been some time, but i believe it's enough to use css like this:

<div style="width: 300px;height:400px;overflow: auto">
  <div wicket:id="tree">
    tree component goes here
  </div>
</div>

Sorry if i rember that incorrectly but at least it's worth a try :-)

Kind regards,
Florian Sperber

David Struck schrieb:
> I've been able to get an AJAX tree up and running and I'm very happy
> with how simple it was. My HTML is:
> 
>  <html>
>  <body>
>  <span wicket:id="myTree"></span>
>  </body>
>  </html>
> 
> and my Java is:
> 
>  ...
>  public TreePage() {
>    DefaultMutableTreeNode root = ...
>    TreeModel treeModel = new DefaultTreeModel(root);
>    Tree tree = new Tree("myTree", treeModel);
>    tree.getTreeState().collapseAll();
>    add(tree);
>  }
>  ...
> 
> Now I'd like to improve the layout and I'm not sure how to do it. First
> of all, the tree view seems to have a preset width that doesn't grow
> when one of the tree nodes goes outside the width. How can I modify the
> width of the tree view? Should I use CSS? And, if so, how do I hook my
> CSS settings in?
> 
> Second, can I move/remove the floating debugger link? And can anyone
> provide a link to a tutorial/guide that explains how to tweak pre-built
> components? Hopefully that will get me moving in the right direction.
> 
> Thanks,
> 
> David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHH8brTJfKjmvEjHwRAvN0AJ0bsBuu+v5py7ozEKKdjx5FHblBtwCgg09m
PevlYqcrzgaXlUzlhBUpfWk=
=o9ca
-----END PGP SIGNATURE-----

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


Re: Configuring AJAX tree

Posted by dstruck <st...@stottlerhenke.com>.
Thanks for the advice, Matej. I've upgraded to Wicket 1.3 and the LinkTree
lays out much nicer.

That said, I actually was able to adjust the width by using CSS:

1. Create a CSS file in the same package as the HTML file.
2. Use a span tag in the HTML for the tree (when the HTML is generated by
Wicket, the span tag will become a div tag and get a class of
"wicket-tree").
3. In the CSS file, make a setting for the width for the "wicket-tree"
class.
4. In the Java code, add this line:
    tree.add(HeaderContributor.forCss(TreePage.class, cssFilename));

This is obviously not ideal since I had to look in the generated HTML to see
the "wicket-tree" class. Also, if you use a div tag (instead of a span tag),
the class doesn't show up.

David


Matej Knopp-2 wrote:
> 
> Hi, unfortunately the Tree class is not able to grow horizontally,
> neither it is possible for it to have a horizontal scrollbar. If you
> need this features, you have to use the new LinkTree (or it's
> superclass BaseTree) from wicket 1.3.
> 
> -Matej
> 
> On 10/24/07, David Struck <st...@stottlerhenke.com> wrote:
>> I've been able to get an AJAX tree up and running and I'm very happy
>> with how simple it was. My HTML is:
>>
>>   <html>
>>   <body>
>>   
>>   </body>
>>   </html>
>>
>> and my Java is:
>>
>>   ...
>>   public TreePage() {
>>     DefaultMutableTreeNode root = ...
>>     TreeModel treeModel = new DefaultTreeModel(root);
>>     Tree tree = new Tree("myTree", treeModel);
>>     tree.getTreeState().collapseAll();
>>     add(tree);
>>   }
>>   ...
>>
>> Now I'd like to improve the layout and I'm not sure how to do it. First
>> of all, the tree view seems to have a preset width that doesn't grow
>> when one of the tree nodes goes outside the width. How can I modify the
>> width of the tree view? Should I use CSS? And, if so, how do I hook my
>> CSS settings in?
>>
>> Second, can I move/remove the floating debugger link? And can anyone
>> provide a link to a tutorial/guide that explains how to tweak pre-built
>> components? Hopefully that will get me moving in the right direction.
>>
>> Thanks,
>>
>> David
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Configuring-AJAX-tree-tf4687105.html#a13430342
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Configuring AJAX tree

Posted by Matej Knopp <ma...@gmail.com>.
Hi, unfortunately the Tree class is not able to grow horizontally,
neither it is possible for it to have a horizontal scrollbar. If you
need this features, you have to use the new LinkTree (or it's
superclass BaseTree) from wicket 1.3.

-Matej

On 10/24/07, David Struck <st...@stottlerhenke.com> wrote:
> I've been able to get an AJAX tree up and running and I'm very happy
> with how simple it was. My HTML is:
>
>   <html>
>   <body>
>   <span wicket:id="myTree"></span>
>   </body>
>   </html>
>
> and my Java is:
>
>   ...
>   public TreePage() {
>     DefaultMutableTreeNode root = ...
>     TreeModel treeModel = new DefaultTreeModel(root);
>     Tree tree = new Tree("myTree", treeModel);
>     tree.getTreeState().collapseAll();
>     add(tree);
>   }
>   ...
>
> Now I'd like to improve the layout and I'm not sure how to do it. First
> of all, the tree view seems to have a preset width that doesn't grow
> when one of the tree nodes goes outside the width. How can I modify the
> width of the tree view? Should I use CSS? And, if so, how do I hook my
> CSS settings in?
>
> Second, can I move/remove the floating debugger link? And can anyone
> provide a link to a tutorial/guide that explains how to tweak pre-built
> components? Hopefully that will get me moving in the right direction.
>
> Thanks,
>
> David
>
> ---------------------------------------------------------------------
> 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