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

MailDetail

public class MailDetail extends com.google.gwt.user.client.ui.Composite
A composite for displaying the details of an email message.

Fields Summary
private com.google.gwt.user.client.ui.VerticalPanel
panel
private com.google.gwt.user.client.ui.VerticalPanel
headerPanel
private com.google.gwt.user.client.ui.HTML
subject
private com.google.gwt.user.client.ui.HTML
sender
private com.google.gwt.user.client.ui.HTML
recipient
private com.google.gwt.user.client.ui.HTML
body
private com.google.gwt.user.client.ui.ScrollPanel
scroller
Constructors Summary
public MailDetail()


    
    body.setWordWrap(true);

    headerPanel.add(subject);
    headerPanel.add(sender);
    headerPanel.add(recipient);
    headerPanel.setWidth("100%");

    DockPanel innerPanel = new DockPanel();
    innerPanel.add(headerPanel, DockPanel.NORTH);
    innerPanel.add(scroller, DockPanel.CENTER);

    innerPanel.setCellHeight(scroller, "100%");
    panel.add(innerPanel);
    innerPanel.setSize("100%", "100%");
    scroller.setSize("100%", "100%");
    initWidget(panel);

    setStyleName("mail-Detail");
    headerPanel.setStyleName("mail-DetailHeader");
    innerPanel.setStyleName("mail-DetailInner");
    subject.setStyleName("mail-DetailSubject");
    sender.setStyleName("mail-DetailSender");
    recipient.setStyleName("mail-DetailRecipient");
    body.setStyleName("mail-DetailBody");
  
Methods Summary
public voidadjustSize(int windowWidth, int windowHeight)
Adjusts the widget's size such that it fits within the window's client area.

    int scrollWidth = windowWidth - scroller.getAbsoluteLeft() - 9;
    if (scrollWidth < 1) {
      scrollWidth = 1;
    }

    int scrollHeight = windowHeight - scroller.getAbsoluteTop() - 9;
    if (scrollHeight < 1) {
      scrollHeight = 1;
    }

    scroller.setSize("" + scrollWidth, "" + scrollHeight);
  
public voidsetItem(MailItem item)

    subject.setHTML(item.subject);
    sender.setHTML("<b>From:</b> " + item.sender);
    recipient.setHTML("<b>To:</b> foo@example.com");
    body.setHTML(item.body);