Adding Link to Tree , How ?

Hi , i wanted to add some Links to Tree but it seems it can only add String.
I want to use Tree as a navigation.

Here is my code that extends Tree but when i add this Tree to my app , i see this:

Whats wrong?
How can i add custom objects?

package com.test;

import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Link;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Tree;
import com.vaadin.ui.VerticalLayout;

public class ToCTree extends Tree implements ItemClickListener {

public ToCTree() {
	final Object[][]

planets = new Object
new Object{“Mercury”},
new Object{“Venus”},
new Object{“Earth”, “The Moon”},
new Object{“Mars”, “Phobos”, “Deimos”},
new Object{“Jupiter”, “Io”, “Europa”, “Ganymedes”,
new Object{“Saturn”, “Titan”, “Tethys”, “Dione”,
“Rhea”, “Iapetus”},
new Object{“Uranus”, “Miranda”, “Ariel”, “Umbriel”,
“Titania”, “Oberon”},
new Object{“Neptune”, “Triton”, “Proteus”, “Nereid”,

	/* Add planets as root items in the tree. */
	for (int i=0; i<planets.length; i++) {
	    Link planet = new Link((String) (planets[i]

),new ExternalResource(“”) );
planet.getDescription( );

	    if (planets[i]

.length == 1) {
// The planet has no moons so make it a leaf.
setChildrenAllowed(planet, false);
} else {
// Add children (moons) under the planets.
for (int j=1; j<planets[i]
.length; j++) {
String moon = (String) planets[i]

	            // Add the item as a regular item.
	            // Set it to be a child.
	            setParent(moon, planet);
	            // Make the moons look like leaves.
	            setChildrenAllowed(moon, false);
	        // Expand the subtree.
	addListener(  (ItemClickListener)this);

public void itemClick(ItemClickEvent event) {
	// TODO Auto-generated method stub
	Object src = event.getSource();


You can only add text to a tree. Can’t you do the navigation that you need inside the itemClick method, or alternatively inside a ValueChangeListener? the method works pretty much the same way.

If you really need the tree and components inside it, then check out
ComponentTree in the Directory

Nice addon , but is it good for SEO?

When google bot enters my page , bot must dedect my ajax links.
Its giving directly links to bots?

Okay, maybe you need the Links in there then, if you want to have some kind of support for search engines. The Links
be enough for that. Search the forum around for posts regaring search engines, for example
this one
has some info regarding those.

Here’s a few other threads as well:

how to make vaadin app components searchable by search engines?

Rich web apps and search engines like a Google - indexing problems and tri

Okay that means ,
Inside ComponentTree i will add Link object for each item.
And my ajax page must start with “#!”

So my code will be SEO friendly.
Hope so :slight_smile: