*
* @param replyMessage the message being replied to, or null if composing
* a new message.
*/
public ComposeWindow(Message replyMessage) {
super(Messages.getString("ComposeWindow.Title"), new Extent(600), new Extent(480));
setResizable(false);
setDefaultCloseOperation(WindowPane.DO_NOTHING_ON_CLOSE);
setStyleName("Default");
addWindowPaneListener(new WindowPaneListener() {
public void windowPaneClosing(WindowPaneEvent e) {
processDiscard();
}
});
SplitPane mainPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL, new Extent(32));
add(mainPane);
Row controlPane = new Row();
controlPane.setStyleName("ControlPane");
mainPane.add(controlPane);
Button sendButton = new Button(Messages.getString("ComposeWindow.SendButton"),
Styles.ICON_24_YES);
sendButton.setStyleName("ControlPane.Button");
sendButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (sendMessage()) {
((EmailApp) getApplicationInstance()).getDefaultWindow().getContent().remove(ComposeWindow.this);
}
}
});
controlPane.add(sendButton);
Button cancelButton = new Button(Messages.getString("ComposeWindow.DiscardButton"),
Styles.ICON_24_NO);
cancelButton.setStyleName("ControlPane.Button");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
processDiscard();
}
});
controlPane.add(cancelButton);
Column layoutColumn = new Column();
layoutColumn.setCellSpacing(new Extent(10));
layoutColumn.setInsets(new Insets(10));
mainPane.add(layoutColumn);
Grid headerGrid = new Grid();
headerGrid.setInsets(new Insets(0, 2));
layoutColumn.add(headerGrid);
Label label;
label = new Label(Messages.getString("Message.PromptLabel.To"));
headerGrid.add(label);
toField = new TextField();
toField.setStyleName("Default");
toField.setWidth(new Extent(450));
headerGrid.add(toField);
label = new Label(Messages.getString("Message.PromptLabel.Cc"));
headerGrid.add(label);
ccField = new TextField();
ccField.setStyleName("Default");
ccField.setWidth(new Extent(450));
headerGrid.add(ccField);
label = new Label(Messages.getString("Message.PromptLabel.Bcc"));
headerGrid.add(label);
bccField = new TextField();
bccField.setStyleName("Default");
bccField.setWidth(new Extent(450));
headerGrid.add(bccField);
label = new Label(Messages.getString("Message.PromptLabel.Subject"));
headerGrid.add(label);
subjectField = new TextField();
subjectField.setStyleName("Default");
subjectField.setWidth(new Extent(450));
headerGrid.add(subjectField);
messageField = new TextArea();
messageField.setStyleName("Default");
messageField.setWidth(new Extent(520));
messageField.setHeight(new Extent(18, Extent.EM));
layoutColumn.add(messageField);
if (replyMessage == null) {
EmailApp.getActive().setFocusedComponent(toField);
} else {