I answered my own question, after a bit of research. In case you run
into the same issue, here's some code to get you over the hump. It
relies on using the non-default constructor for Tree. If you set
spacer.png to a 1x1 transparent PNG it will remove the + signs. Here
is the full code I used.
public interface MyResources extends ClientBundle {
public static final MyResources INSTANCE =
GWT.create(MyResources.class);
@Source("spacer.png")
public ImageResource leaf();
}
public class TreeImagesExample implements Tree.Resources
{
@Override
public ImageResource treeClosed() {
// TODO Auto-generated method stub
return MyResources.INSTANCE.leaf();
}
@Override
public ImageResource treeLeaf() {
// TODO Auto-generated method stub
return MyResources.INSTANCE.leaf();
}
@Override
public ImageResource treeOpen() {
// TODO Auto-generated method stub
return MyResources.INSTANCE.leaf();
}
}
Main Function:
TreeImagesExample tx= new TreeImagesExample();
Tree t = new Tree(tx);
t.addItem(root);
On Aug 22, 5:23 pm, Travis G <[email protected]> wrote:
> I wondered if anyone knew whether it was possible to remove the '+'
> Sign that appears next to the root item in a GWT Tree? I didn't see a
> CSS rule to handle it. Can one replace the + sign with say, a GIF?
>
> (Adapted code from GWT manual below, for illustrative purposes)
>
> TreeItem root = new TreeItem("root"); // Wish to remove + sign from
> next to this item
> root.addItem("item0");
> root.addItem("item1");
> root.addItem("item2");
> root.setState(true, true);
> // Add a CheckBox to the tree
> TreeItem item = new TreeItem(new CheckBox("item3"));
> root.addItem(item);
>
> Tree t = new Tree();
> t.addItem(root);
>
> // Add it to the root panel.
> RootPanel.get().add(t);
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.