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
master
mguessan 9 years ago
parent a8a0ac3923
commit bc9ae770e7

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

@ -30,6 +30,11 @@ public class CredentialPromptDialog extends JDialog {
}
}
/**
* Get user principal.
*
* @return user principal
*/
public String getPrincipal() {
return principal;
}
@ -68,7 +73,7 @@ public class CredentialPromptDialog extends JDialog {
});
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.setVerticalAlignment(SwingConstants.CENTER);

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

@ -33,6 +33,9 @@ public class OSXInfoPlist {
protected static final Logger LOGGER = Logger.getLogger(OSXInfoPlist.class);
protected static final String INFO_PLIST_PATH = "Contents/Info.plist";
private OSXInfoPlist() {
}
protected static boolean isOSX() {
return System.getProperty("os.name").toLowerCase().startsWith("mac os x");
}
@ -61,7 +64,7 @@ public class OSXInfoPlist {
public static boolean isHideFromDock() {
boolean result = false;
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) {
LOGGER.warn("Unable to update Info.plist", e);
}

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

@ -75,21 +75,21 @@ public class SettingsFrame extends JFrame {
protected JTextField certHashField;
protected JCheckBox disableUpdateCheck;
protected JComboBox keystoreTypeCombo;
protected JComboBox<String> keystoreTypeCombo;
protected JTextField keystoreFileField;
protected JPasswordField keystorePassField;
protected JPasswordField keyPassField;
protected JComboBox clientKeystoreTypeCombo;
protected JComboBox<String> clientKeystoreTypeCombo;
protected JTextField clientKeystoreFileField;
protected JPasswordField clientKeystorePassField;
protected JTextField pkcs11LibraryField;
protected JTextArea pkcs11ConfigField;
protected JComboBox rootLoggingLevelField;
protected JComboBox davmailLoggingLevelField;
protected JComboBox httpclientLoggingLevelField;
protected JComboBox wireLoggingLevelField;
protected JComboBox<Level> rootLoggingLevelField;
protected JComboBox<Level> davmailLoggingLevelField;
protected JComboBox<Level> httpclientLoggingLevelField;
protected JComboBox<Level> wireLoggingLevelField;
protected JTextField logFilePathField;
protected JTextField logFileSizeField;
@ -102,7 +102,7 @@ public class SettingsFrame extends JFrame {
protected JCheckBox imapAutoExpungeCheckBox;
protected JCheckBox enableKeepAliveCheckBox;
protected JCheckBox popMarkReadOnRetrCheckBox;
protected JComboBox enableEwsComboBox;
protected JComboBox<String> enableEwsComboBox;
protected JCheckBox enableKerberosCheckBox;
protected JTextField folderSizeLimitField;
protected JCheckBox smtpSaveInSentCheckBox;
@ -151,7 +151,7 @@ public class SettingsFrame extends JFrame {
JPanel settingsPanel = new JPanel(new GridLayout(7, 2));
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"));
urlField = new JTextField(Settings.getProperty("davmail.url"), 20);
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));
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"));
keystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.keystoreFile"), 17);
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.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"));
clientKeystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.clientKeystoreFile"), 17);
clientKeystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.clientKeystorePass"), 15);
@ -506,10 +506,10 @@ public class SettingsFrame extends JFrame {
loggingLevelPanel.add(leftLoggingPanel);
loggingLevelPanel.add(rightLoggingPanel);
rootLoggingLevelField = new JComboBox(LOG_LEVELS);
davmailLoggingLevelField = new JComboBox(LOG_LEVELS);
httpclientLoggingLevelField = new JComboBox(LOG_LEVELS);
wireLoggingLevelField = new JComboBox(LOG_LEVELS);
rootLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
davmailLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
httpclientLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
wireLoggingLevelField = new JComboBox<Level>(LOG_LEVELS);
logFilePathField = new JTextField(Settings.getProperty("davmail.logFilePath"), 15);
logFileSizeField = new JTextField(Settings.getProperty("davmail.logFileSize"), 15);

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

Loading…
Cancel
Save