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

Contacts

public class Contacts extends com.google.gwt.user.client.ui.Composite
A component that displays a list of contacts.

Fields Summary
private Contact[]
contacts
private com.google.gwt.user.client.ui.VerticalPanel
panel
private final Images
images
Constructors Summary
public Contacts(Images images)


     
    SimplePanel outer = new SimplePanel();
    outer.setWidget(panel);

    this.images = images;
    // Add all the contacts to the list.
    for (int i = 0; i < contacts.length; ++i) {
      addContact(contacts[i]);
    }

    initWidget(outer);
    setStyleName("mail-Contacts");
  
Methods Summary
private voidaddContact(com.google.gwt.sample.mail.client.Contacts$Contact contact)

    final HTML link = new HTML("<a href='javascript:;'>" + contact.name
        + "</a>");
    panel.add(link);

    // Add a click listener that displays a ContactPopup when it is clicked.
    link.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        ContactPopup popup = new ContactPopup(contact);
        int left = link.getAbsoluteLeft() + 14;
        int top = link.getAbsoluteTop() + 14;
        popup.setPopupPosition(left, top);
        popup.show();
      }
    });