1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-03-05 11:49:46 -05:00

UI: small fixes on ui code from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2243 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-03-10 20:45:13 +00:00
parent a8a0ac3923
commit bc9ae770e7
7 changed files with 34 additions and 26 deletions

View File

@ -55,11 +55,7 @@ public class AcceptCertificateDialog extends JDialog {
*/ */
protected void addFieldValue(JPanel panel, String label, String value) { protected void addFieldValue(JPanel panel, String label, String value) {
JPanel fieldPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel fieldPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
StringBuilder buffer = new StringBuilder(); fieldPanel.add(new JLabel("<html><b>" + label + ":</b></html>"));
buffer.append("<html><b>");
buffer.append(label);
buffer.append(":</b></html>");
fieldPanel.add(new JLabel(buffer.toString()));
fieldPanel.add(new JLabel(value)); fieldPanel.add(new JLabel(value));
panel.add(fieldPanel); panel.add(fieldPanel);
} }

View File

@ -30,6 +30,11 @@ public class CredentialPromptDialog extends JDialog {
} }
} }
/**
* Get user principal.
*
* @return user principal
*/
public String getPrincipal() { public String getPrincipal() {
return principal; return principal;
} }
@ -68,7 +73,7 @@ public class CredentialPromptDialog extends JDialog {
}); });
JPanel credentialPanel = new JPanel(new GridLayout(2, 2)); JPanel credentialPanel = new JPanel(new GridLayout(2, 2));
JLabel promptLabel = new JLabel(" "+prompt.trim()); JLabel promptLabel = new JLabel(' ' +prompt.trim());
promptLabel.setHorizontalAlignment(SwingConstants.RIGHT); promptLabel.setHorizontalAlignment(SwingConstants.RIGHT);
promptLabel.setVerticalAlignment(SwingConstants.CENTER); promptLabel.setVerticalAlignment(SwingConstants.CENTER);

View File

@ -62,6 +62,7 @@ public class NotificationDialog extends JDialog {
* @param to main recipients * @param to main recipients
* @param cc copy recipients * @param cc copy recipients
* @param subject notification subject * @param subject notification subject
* @param description notification description
*/ */
public NotificationDialog(String to, String cc, String subject, String description) { public NotificationDialog(String to, String cc, String subject, String description) {
setModal(true); setModal(true);

View File

@ -33,6 +33,9 @@ public class OSXInfoPlist {
protected static final Logger LOGGER = Logger.getLogger(OSXInfoPlist.class); protected static final Logger LOGGER = Logger.getLogger(OSXInfoPlist.class);
protected static final String INFO_PLIST_PATH = "Contents/Info.plist"; protected static final String INFO_PLIST_PATH = "Contents/Info.plist";
private OSXInfoPlist() {
}
protected static boolean isOSX() { protected static boolean isOSX() {
return System.getProperty("os.name").toLowerCase().startsWith("mac os x"); return System.getProperty("os.name").toLowerCase().startsWith("mac os x");
} }
@ -61,7 +64,7 @@ public class OSXInfoPlist {
public static boolean isHideFromDock() { public static boolean isHideFromDock() {
boolean result = false; boolean result = false;
try { try {
result = isOSX() && getInfoPlistContent().indexOf("<key>LSUIElement</key><string>1</string>") >= 0; result = isOSX() && getInfoPlistContent().contains("<key>LSUIElement</key><string>1</string>");
} catch (IOException e) { } catch (IOException e) {
LOGGER.warn("Unable to update Info.plist", e); LOGGER.warn("Unable to update Info.plist", e);
} }

View File

@ -30,7 +30,7 @@ import java.awt.event.ActionListener;
* Let user select a client certificate * Let user select a client certificate
*/ */
public class SelectCertificateDialog extends JDialog { public class SelectCertificateDialog extends JDialog {
protected final JList aliasListBox; protected final JList<String> aliasListBox;
protected String selectedAlias; protected String selectedAlias;
/** /**
@ -64,7 +64,7 @@ public class SelectCertificateDialog extends JDialog {
imageLabel.setText(BundleMessage.format("UI_CERTIFICATE_ALIAS_PROMPT")); imageLabel.setText(BundleMessage.format("UI_CERTIFICATE_ALIAS_PROMPT"));
questionPanel.add(imageLabel); questionPanel.add(imageLabel);
aliasListBox = new JList(aliases); aliasListBox = new JList<String>(aliases);
aliasListBox.setMaximumSize(aliasListBox.getPreferredSize()); aliasListBox.setMaximumSize(aliasListBox.getPreferredSize());
JPanel aliasPanel = new JPanel(); JPanel aliasPanel = new JPanel();
@ -82,8 +82,8 @@ public class SelectCertificateDialog extends JDialog {
getSize().width / 2, getSize().width / 2,
getToolkit().getScreenSize().height / 2 - getToolkit().getScreenSize().height / 2 -
getSize().height / 2); getSize().height / 2);
setAlwaysOnTop(true); setAlwaysOnTop(true);
setVisible(true); setVisible(true);
} }
protected JPanel getButtonPanel() { protected JPanel getButtonPanel() {
@ -92,7 +92,7 @@ public class SelectCertificateDialog extends JDialog {
JButton cancelButton = new JButton(BundleMessage.format("UI_BUTTON_CANCEL")); JButton cancelButton = new JButton(BundleMessage.format("UI_BUTTON_CANCEL"));
okButton.addActionListener(new ActionListener() { okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectedAlias = aliasListBox.getSelectedValue().toString(); selectedAlias = aliasListBox.getSelectedValue();
setVisible(false); setVisible(false);
} }
}); });

View File

@ -75,21 +75,21 @@ public class SettingsFrame extends JFrame {
protected JTextField certHashField; protected JTextField certHashField;
protected JCheckBox disableUpdateCheck; protected JCheckBox disableUpdateCheck;
protected JComboBox keystoreTypeCombo; protected JComboBox<String> keystoreTypeCombo;
protected JTextField keystoreFileField; protected JTextField keystoreFileField;
protected JPasswordField keystorePassField; protected JPasswordField keystorePassField;
protected JPasswordField keyPassField; protected JPasswordField keyPassField;
protected JComboBox clientKeystoreTypeCombo; protected JComboBox<String> clientKeystoreTypeCombo;
protected JTextField clientKeystoreFileField; protected JTextField clientKeystoreFileField;
protected JPasswordField clientKeystorePassField; protected JPasswordField clientKeystorePassField;
protected JTextField pkcs11LibraryField; protected JTextField pkcs11LibraryField;
protected JTextArea pkcs11ConfigField; protected JTextArea pkcs11ConfigField;
protected JComboBox rootLoggingLevelField; protected JComboBox<Level> rootLoggingLevelField;
protected JComboBox davmailLoggingLevelField; protected JComboBox<Level> davmailLoggingLevelField;
protected JComboBox httpclientLoggingLevelField; protected JComboBox<Level> httpclientLoggingLevelField;
protected JComboBox wireLoggingLevelField; protected JComboBox<Level> wireLoggingLevelField;
protected JTextField logFilePathField; protected JTextField logFilePathField;
protected JTextField logFileSizeField; protected JTextField logFileSizeField;
@ -102,7 +102,7 @@ public class SettingsFrame extends JFrame {
protected JCheckBox imapAutoExpungeCheckBox; protected JCheckBox imapAutoExpungeCheckBox;
protected JCheckBox enableKeepAliveCheckBox; protected JCheckBox enableKeepAliveCheckBox;
protected JCheckBox popMarkReadOnRetrCheckBox; protected JCheckBox popMarkReadOnRetrCheckBox;
protected JComboBox enableEwsComboBox; protected JComboBox<String> enableEwsComboBox;
protected JCheckBox enableKerberosCheckBox; protected JCheckBox enableKerberosCheckBox;
protected JTextField folderSizeLimitField; protected JTextField folderSizeLimitField;
protected JCheckBox smtpSaveInSentCheckBox; protected JCheckBox smtpSaveInSentCheckBox;
@ -151,7 +151,7 @@ public class SettingsFrame extends JFrame {
JPanel settingsPanel = new JPanel(new GridLayout(7, 2)); JPanel settingsPanel = new JPanel(new GridLayout(7, 2));
settingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_GATEWAY"))); settingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_GATEWAY")));
enableEwsComboBox = new JComboBox(new String[]{WEBDAV, EWS, AUTO}); enableEwsComboBox = new JComboBox<String>(new String[]{WEBDAV, EWS, AUTO});
setEwsModeSelectedItem(Settings.getProperty("davmail.enableEws", "auto")); setEwsModeSelectedItem(Settings.getProperty("davmail.enableEws", "auto"));
urlField = new JTextField(Settings.getProperty("davmail.url"), 20); urlField = new JTextField(Settings.getProperty("davmail.url"), 20);
popPortField = new JTextField(Settings.getProperty("davmail.popPort"), 4); popPortField = new JTextField(Settings.getProperty("davmail.popPort"), 4);
@ -316,7 +316,7 @@ public class SettingsFrame extends JFrame {
JPanel keyStorePanel = new JPanel(new GridLayout(4, 2)); JPanel keyStorePanel = new JPanel(new GridLayout(4, 2));
keyStorePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_DAVMAIL_SERVER_CERTIFICATE"))); keyStorePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_DAVMAIL_SERVER_CERTIFICATE")));
keystoreTypeCombo = new JComboBox(new String[]{"JKS", "PKCS12"}); keystoreTypeCombo = new JComboBox<String>(new String[]{"JKS", "PKCS12"});
keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType")); keystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.keystoreType"));
keystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.keystoreFile"), 17); keystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.keystoreFile"), 17);
keystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.keystorePass"), 15); keystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.keystorePass"), 15);
@ -339,7 +339,7 @@ public class SettingsFrame extends JFrame {
clientKeystorePanel.setLayout(new BoxLayout(clientKeystorePanel, BoxLayout.Y_AXIS)); clientKeystorePanel.setLayout(new BoxLayout(clientKeystorePanel, BoxLayout.Y_AXIS));
clientKeystorePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_CLIENT_CERTIFICATE"))); clientKeystorePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_CLIENT_CERTIFICATE")));
clientKeystoreTypeCombo = new JComboBox(new String[]{"PKCS11", "JKS", "PKCS12"}); clientKeystoreTypeCombo = new JComboBox<String>(new String[]{"PKCS11", "JKS", "PKCS12"});
clientKeystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.clientKeystoreType")); clientKeystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.clientKeystoreType"));
clientKeystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.clientKeystoreFile"), 17); clientKeystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.clientKeystoreFile"), 17);
clientKeystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.clientKeystorePass"), 15); clientKeystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.clientKeystorePass"), 15);
@ -506,10 +506,10 @@ public class SettingsFrame extends JFrame {
loggingLevelPanel.add(leftLoggingPanel); loggingLevelPanel.add(leftLoggingPanel);
loggingLevelPanel.add(rightLoggingPanel); loggingLevelPanel.add(rightLoggingPanel);
rootLoggingLevelField = new JComboBox(LOG_LEVELS); rootLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
davmailLoggingLevelField = new JComboBox(LOG_LEVELS); davmailLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
httpclientLoggingLevelField = new JComboBox(LOG_LEVELS); httpclientLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
wireLoggingLevelField = new JComboBox(LOG_LEVELS); wireLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
logFilePathField = new JTextField(Settings.getProperty("davmail.logFilePath"), 15); logFilePathField = new JTextField(Settings.getProperty("davmail.logFilePath"), 15);
logFileSizeField = new JTextField(Settings.getProperty("davmail.logFileSize"), 15); logFileSizeField = new JTextField(Settings.getProperty("davmail.logFileSize"), 15);

View File

@ -290,6 +290,9 @@ public final class DavGatewayTray {
return result; return result;
} }
/**
* Dispose application tray icon
*/
public static void dispose() { public static void dispose() {
if (davGatewayTray != null) { if (davGatewayTray != null) {
davGatewayTray.dispose(); davGatewayTray.dispose();