FileDocCategorySizeDatePackage
Mailboxes.javaAPI DocExample2976Mon Aug 27 20:12:46 BST 2007com.google.gwt.sample.mail.client

Mailboxes

public class Mailboxes extends com.google.gwt.user.client.ui.Composite
A tree displaying a set of email folders.

Fields Summary
private com.google.gwt.user.client.ui.Tree
tree
Constructors Summary
public Mailboxes(Images images)
Constructs a new mailboxes widget with a bundle of images.

param
images a bundle that provides the images for this widget

    tree = new Tree(images);
    TreeItem root = new TreeItem(
        imageItemHTML(images.home(), "foo@example.com"));
    tree.addItem(root);

    addImageItem(root, "Inbox", images.inbox());
    addImageItem(root, "Drafts", images.drafts());
    addImageItem(root, "Templates", images.templates());
    addImageItem(root, "Sent", images.sent());
    addImageItem(root, "Trash", images.trash());

    root.setState(true);
    initWidget(tree);
  
Methods Summary
private com.google.gwt.user.client.ui.TreeItemaddImageItem(com.google.gwt.user.client.ui.TreeItem root, java.lang.String title, com.google.gwt.user.client.ui.AbstractImagePrototype imageProto)
A helper method to simplify adding tree items that have attached images. {@link #addImageItem(TreeItem, String) code}

param
root the tree item to which the new item will be added.
param
title the text associated with this item.

    TreeItem item = new TreeItem(imageItemHTML(imageProto, title));
    root.addItem(item);
    return item;
  
private java.lang.StringimageItemHTML(com.google.gwt.user.client.ui.AbstractImagePrototype imageProto, java.lang.String title)
Generates HTML for a tree item with an attached icon.

param
imageUrl the url of the icon image
param
title the title of the item
return
the resultant HTML

    return "<span>" + imageProto.getHTML() + title + "</span>";