aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
diff options
context:
space:
mode:
authorDeepak Bhole <[email protected]>2010-12-06 15:34:01 -0500
committerDeepak Bhole <[email protected]>2010-12-06 15:34:01 -0500
commit6ca1a9a369b10703da9af8f8a1ced0f3b02ae5c2 (patch)
tree568f8e454db94fa8abc896b46ce8cac7a9f3b74d /netx/net/sourceforge/jnlp/security/AccessWarningPane.java
parent0d66adf24179c33bbdccaacc10d4c8a5f5e2cd54 (diff)
Fixed indentation and spacing for all .java files.
Added a new .settings directory which contains Eclipse preferences for code style.
Diffstat (limited to 'netx/net/sourceforge/jnlp/security/AccessWarningPane.java')
-rw-r--r--netx/net/sourceforge/jnlp/security/AccessWarningPane.java253
1 files changed, 126 insertions, 127 deletions
diff --git a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
index 68b1ef4..d83e45c 100644
--- a/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
+++ b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java
@@ -71,142 +71,141 @@ import net.sourceforge.jnlp.util.FileUtils;
*/
public class AccessWarningPane extends SecurityDialogPanel {
- JCheckBox alwaysAllow;
- Object[] extras;
-
- public AccessWarningPane(SecurityWarningDialog x, CertVerifier certVerifier) {
- super(x, certVerifier);
- addComponents();
+ JCheckBox alwaysAllow;
+ Object[] extras;
+
+ public AccessWarningPane(SecurityWarningDialog x, CertVerifier certVerifier) {
+ super(x, certVerifier);
+ addComponents();
+ }
+
+ public AccessWarningPane(SecurityWarningDialog x, Object[] extras, CertVerifier certVerifier) {
+ super(x, certVerifier);
+ this.extras = extras;
+ addComponents();
+ }
+
+ /**
+ * Creates the actual GUI components, and adds it to this panel
+ */
+ private void addComponents() {
+ AccessType type = parent.getAccessType();
+ JNLPFile file = parent.getFile();
+
+ String name = "";
+ String publisher = "";
+ String from = "";
+
+ //We don't worry about exceptions when trying to fill in
+ //these strings -- we just want to fill in as many as possible.
+ try {
+ name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : R("SNoAssociatedCertificate");
+ } catch (Exception e) {
}
- public AccessWarningPane(SecurityWarningDialog x, Object[] extras, CertVerifier certVerifier) {
- super(x, certVerifier);
- this.extras = extras;
- addComponents();
+ try {
+ publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : R("SNoAssociatedCertificate");
+ } catch (Exception e) {
}
- /**
- * Creates the actual GUI components, and adds it to this panel
- */
- private void addComponents() {
- AccessType type = parent.getAccessType();
- JNLPFile file = parent.getFile();
-
- String name = "";
- String publisher = "";
- String from = "";
-
- //We don't worry about exceptions when trying to fill in
- //these strings -- we just want to fill in as many as possible.
- try {
- name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : R("SNoAssociatedCertificate");
- } catch (Exception e) {
- }
-
- try {
- publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : R("SNoAssociatedCertificate");
- } catch (Exception e) {
- }
+ try {
+ from = !file.getInformation().getHomepage().toString().equals("") ? file.getInformation().getHomepage().toString() : file.getSourceLocation().getAuthority();
+ } catch (Exception e) {
+ from = file.getSourceLocation().getAuthority();
+ }
- try {
- from = !file.getInformation().getHomepage().toString().equals("") ? file.getInformation().getHomepage().toString() : file.getSourceLocation().getAuthority();
- } catch (Exception e) {
- from = file.getSourceLocation().getAuthority();
+ //Top label
+ String topLabelText = "";
+ switch (type) {
+ case READ_FILE:
+ if (extras != null && extras.length > 0 && extras[0] instanceof String) {
+ topLabelText = R("SFileReadAccess", FileUtils.displayablePath((String) extras[0]));
+ } else {
+ topLabelText = R("SFileReadAccess", R("AFileOnTheMachine"));
}
-
- //Top label
- String topLabelText = "";
- switch (type) {
- case READ_FILE:
- if (extras != null && extras.length > 0 && extras[0] instanceof String) {
- topLabelText = R("SFileReadAccess", FileUtils.displayablePath((String)extras[0]));
- } else {
- topLabelText = R("SFileReadAccess", R("AFileOnTheMachine"));
- }
- break;
- case WRITE_FILE:
- if (extras != null && extras.length > 0 && extras[0] instanceof String) {
- topLabelText = R("SFileWriteAccess", FileUtils.displayablePath((String)extras[0]));
- } else {
- topLabelText = R("SFileWriteAccess", R("AFileOnTheMachine"));
- }
- break;
- case CREATE_DESTKOP_SHORTCUT:
- topLabelText = R("SDesktopShortcut");
- break;
- case CLIPBOARD_READ:
- topLabelText = R("SClipboardReadAccess");
- break;
- case CLIPBOARD_WRITE:
- topLabelText = R("SClipboardWriteAccess");
- break;
- case PRINTER:
- topLabelText = R("SPrinterAccess");
- break;
- case NETWORK:
- if (extras != null && extras.length >= 0)
- topLabelText = R("SNetworkAccess", extras[0]);
- else
- topLabelText = R("SNetworkAccess", "(address here)");
+ break;
+ case WRITE_FILE:
+ if (extras != null && extras.length > 0 && extras[0] instanceof String) {
+ topLabelText = R("SFileWriteAccess", FileUtils.displayablePath((String) extras[0]));
+ } else {
+ topLabelText = R("SFileWriteAccess", R("AFileOnTheMachine"));
}
-
- ImageIcon icon = new ImageIcon((new sun.misc.Launcher()).getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
- JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
- topLabel.setFont(new Font(topLabel.getFont().toString(),
- Font.BOLD, 12));
- JPanel topPanel = new JPanel(new BorderLayout());
- topPanel.setBackground(Color.WHITE);
- topPanel.add(topLabel, BorderLayout.CENTER);
- topPanel.setPreferredSize(new Dimension(450,100));
- topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
- //application info
- JLabel nameLabel = new JLabel(R("Name") + ": " + name);
- nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
- JLabel publisherLabel = new JLabel(R("Publisher") + ": " + publisher);
- publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
- JLabel fromLabel = new JLabel(R("From") + ": " + from);
- fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-
- alwaysAllow = new JCheckBox(R("AlwaysAllowAction"));
- alwaysAllow.setEnabled(false);
-
- JPanel infoPanel = new JPanel(new GridLayout(4,1));
- infoPanel.add(nameLabel);
- infoPanel.add(publisherLabel);
- infoPanel.add(fromLabel);
- infoPanel.add(alwaysAllow);
- infoPanel.setBorder(BorderFactory.createEmptyBorder(25,25,25,25));
-
- //run and cancel buttons
- JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-
- JButton run = new JButton(R("ButAllow"));
- JButton cancel = new JButton(R("ButCancel"));
- run.addActionListener(createSetValueListener(parent,0));
- run.addActionListener(new CheckBoxListener());
- cancel.addActionListener(createSetValueListener(parent, 1));
- initialFocusComponent = cancel;
- buttonPanel.add(run);
- buttonPanel.add(cancel);
- buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
- //all of the above
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
- add(topPanel);
- add(infoPanel);
- add(buttonPanel);
-
+ break;
+ case CREATE_DESTKOP_SHORTCUT:
+ topLabelText = R("SDesktopShortcut");
+ break;
+ case CLIPBOARD_READ:
+ topLabelText = R("SClipboardReadAccess");
+ break;
+ case CLIPBOARD_WRITE:
+ topLabelText = R("SClipboardWriteAccess");
+ break;
+ case PRINTER:
+ topLabelText = R("SPrinterAccess");
+ break;
+ case NETWORK:
+ if (extras != null && extras.length >= 0)
+ topLabelText = R("SNetworkAccess", extras[0]);
+ else
+ topLabelText = R("SNetworkAccess", "(address here)");
}
-
- private class CheckBoxListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- if (alwaysAllow != null && alwaysAllow.isSelected()) {
- // TODO: somehow tell the ApplicationInstance
- // to stop asking for permission
- }
- }
+ ImageIcon icon = new ImageIcon((new sun.misc.Launcher()).getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
+ JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
+ topLabel.setFont(new Font(topLabel.getFont().toString(),
+ Font.BOLD, 12));
+ JPanel topPanel = new JPanel(new BorderLayout());
+ topPanel.setBackground(Color.WHITE);
+ topPanel.add(topLabel, BorderLayout.CENTER);
+ topPanel.setPreferredSize(new Dimension(450, 100));
+ topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+
+ //application info
+ JLabel nameLabel = new JLabel(R("Name") + ": " + name);
+ nameLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ JLabel publisherLabel = new JLabel(R("Publisher") + ": " + publisher);
+ publisherLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ JLabel fromLabel = new JLabel(R("From") + ": " + from);
+ fromLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ alwaysAllow = new JCheckBox(R("AlwaysAllowAction"));
+ alwaysAllow.setEnabled(false);
+
+ JPanel infoPanel = new JPanel(new GridLayout(4, 1));
+ infoPanel.add(nameLabel);
+ infoPanel.add(publisherLabel);
+ infoPanel.add(fromLabel);
+ infoPanel.add(alwaysAllow);
+ infoPanel.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));
+
+ //run and cancel buttons
+ JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+
+ JButton run = new JButton(R("ButAllow"));
+ JButton cancel = new JButton(R("ButCancel"));
+ run.addActionListener(createSetValueListener(parent, 0));
+ run.addActionListener(new CheckBoxListener());
+ cancel.addActionListener(createSetValueListener(parent, 1));
+ initialFocusComponent = cancel;
+ buttonPanel.add(run);
+ buttonPanel.add(cancel);
+ buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+
+ //all of the above
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ add(topPanel);
+ add(infoPanel);
+ add(buttonPanel);
+
+ }
+
+ private class CheckBoxListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (alwaysAllow != null && alwaysAllow.isSelected()) {
+ // TODO: somehow tell the ApplicationInstance
+ // to stop asking for permission
+ }
}
+ }
}