* Creates the panel in which the addressing will be done, such as
* the To: field, Subject: field, etc.
*/
public Container createHeaderInputPanel(MessageProxy pProxy, Hashtable proptDict) {
Box inputPanel = new Box(BoxLayout.Y_AXIS);
Box inputRow = new Box(BoxLayout.X_AXIS);
// Create UserProfile DropDown
JLabel userProfileLabel = new JLabel(Pooka.getProperty("UserProfile.label","User:"), SwingConstants.RIGHT);
userProfileLabel.setPreferredSize(new Dimension(75,userProfileLabel.getPreferredSize().height));
JComboBox profileCombo = new JComboBox(new Vector(Pooka.getPookaManager().getUserProfileManager().getUserProfileList()));
IconManager iconManager = Pooka.getUIFactory().getIconManager();
ImageIcon headerIcon = iconManager.getIcon(Pooka.getProperty("NewMessage.customHeader.button", "Hammer"));
if (headerIcon != null) {
java.awt.Image headerImage = headerIcon.getImage();
headerImage = headerImage.getScaledInstance(15, 15, java.awt.Image.SCALE_SMOOTH);
headerIcon.setImage(headerImage);
customHeaderButton = new JToggleButton(headerIcon);
customHeaderButton.setMargin(new java.awt.Insets(1,1,1,1));
customHeaderButton.setSize(15,15);
} else {
customHeaderButton = new JToggleButton();
}
customHeaderButton.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (customHeaderButton.isSelected()) {
selectCustomHeaderPane();
} else {
removeCustomHeaderPane();
}
}
});
customHeaderButton.setToolTipText(Pooka.getProperty("NewMessage.customHeaders.button.Tooltip", "Edit Headers"));
inputRow.add(userProfileLabel);
inputRow.add(profileCombo);
inputRow.add(customHeaderButton);
UserProfile selectedProfile = null;
selectedProfile = pProxy.getDefaultProfile();
if (selectedProfile == null)
if (Pooka.getMainPanel() != null)
selectedProfile = Pooka.getMainPanel().getCurrentUser();
if (selectedProfile == null)
selectedProfile = Pooka.getPookaManager().getUserProfileManager().getDefaultProfile();
if (selectedProfile != null)
profileCombo.setSelectedItem(selectedProfile);
profileCombo.addItemListener(this);
proptDict.put("UserProfile", profileCombo);
inputPanel.add(inputRow);
// Create Address panel
StringTokenizer tokens = new StringTokenizer(Pooka.getProperty("MessageWindow.Input.DefaultFields", "To:CC:BCC:Subject"), ":");
String currentHeader = null;
JLabel hdrLabel = null;
EntryTextArea inputField = null;
while (tokens.hasMoreTokens()) {
inputRow = new Box(BoxLayout.X_AXIS);
currentHeader=tokens.nextToken();
hdrLabel = new JLabel(Pooka.getProperty("MessageWindow.Input.." + currentHeader + ".label", currentHeader) + ":", SwingConstants.RIGHT);
hdrLabel.setPreferredSize(new Dimension(75,hdrLabel.getPreferredSize().height));
inputRow.add(hdrLabel);
if (currentHeader.equalsIgnoreCase("To") || currentHeader.equalsIgnoreCase("CC") || currentHeader.equalsIgnoreCase("BCC") ) {
try {
inputField = new AddressEntryTextArea(getNewMessageUI(), getNewMessageProxy().getNewMessageInfo().getHeader(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".MIMEHeader", "") , ","), 1, 30);
} catch (MessagingException me) {
inputField = new net.suberic.util.swing.EntryTextArea(1, 30);
}
} else {
try {
inputField = new net.suberic.util.swing.EntryTextArea(getNewMessageProxy().getNewMessageInfo().getHeader(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".MIMEHeader", "") , ","), 1, 30);
} catch (MessagingException me) {
inputField = new net.suberic.util.swing.EntryTextArea(1, 30);
}
}
inputField.setLineWrap(true);
inputField.setWrapStyleWord(true);
inputField.setBorder(BorderFactory.createEtchedBorder());
inputField.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
setModified(true);
}
});
inputRow.add(inputField);
if (inputField instanceof AddressEntryTextArea) {
//int height = inputField.getPreferredSize().height;
JButton addressButton = ((AddressEntryTextArea)inputField).createAddressButton(10, 10);
inputRow.add(Box.createHorizontalGlue());
inputRow.add(addressButton);
}
inputPanel.add(inputRow);
proptDict.put(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".value", currentHeader), inputField);
}