mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
25.25.2007 3ee5e422a933df5d4a2be439c73b659277caa4bc
corrected some upgrader presentation problems and consolidated some UIFactory imposed settings
9 files modified
228 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java 1 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java 3 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java 1 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/SecurityOptionsDialog.java 7 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java 9 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java 5 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java 131 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java 70 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java 1 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -325,7 +325,6 @@
      checkBox =
          UIFactory.makeJCheckBox(getMsg("start-server-label"),
              getMsg("start-server-tooltip"), UIFactory.TextStyle.CHECKBOX);
      checkBox.setOpaque(false);
      checkBox.setSelected(getApplication().getUserData().getStartServer());
    }
    return checkBox;
opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java
@@ -150,7 +150,6 @@
    {
      JCheckBox cb = UIFactory.makeJCheckBox(labels[i], tooltips[i],
          UIFactory.TextStyle.INSTRUCTIONS);
      cb.setOpaque(false);
      cb.setSelected(true);
      hmCbs.put(fieldNames[i], cb);
    }
@@ -245,7 +244,6 @@
    JCheckBox cbOutsideDbs = UIFactory.makeJCheckBox(
        getMsg("delete-outside-dbs-label"),
        getMsg("delete-outside-dbs-tooltip"), UIFactory.TextStyle.INSTRUCTIONS);
    cbOutsideDbs.setOpaque(false);
    cbOutsideDbs.setSelected(true);
    hmCbs.put(FieldName.EXTERNAL_DB_DIRECTORIES, cbOutsideDbs);
@@ -265,7 +263,6 @@
        getMsg("delete-outside-logs-label"),
        getMsg("delete-outside-logs-tooltip"),
        UIFactory.TextStyle.INSTRUCTIONS);
    cbOutsideLogs.setOpaque(false);
    cbOutsideLogs.setSelected(true);
    hmCbs.put(FieldName.EXTERNAL_LOG_FILES, cbOutsideLogs);
opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java
@@ -468,7 +468,6 @@
    for (DataOptions.Type type : hmRadioButtons.keySet())
    {
      rb = hmRadioButtons.get(type);
      rb.setOpaque(false);
      rb.setSelected(type == defaultType);
      buttonGroup.add(rb);
    }
opends/src/quicksetup/org/opends/quicksetup/ui/SecurityOptionsDialog.java
@@ -354,7 +354,6 @@
    cbEnableSSL = UIFactory.makeJCheckBox(getMsg("enable-ssl-label"),
        getMsg("enable-ssl-tooltip"), UIFactory.TextStyle.PRIMARY_FIELD_VALID);
    cbEnableSSL.addActionListener(l);
    cbEnableSSL.setOpaque(false);
    String sPort = "";
    int port = securityOptions.getSslPort();
    if (port > 0)
@@ -368,12 +367,10 @@
        getMsg("enable-starttls-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    cbEnableStartTLS.addActionListener(l);
    cbEnableStartTLS.setOpaque(false);
    rbUseSelfSignedCertificate = UIFactory.makeJRadioButton(
        getMsg("use-self-signed-label"),
        getMsg("use-self-signed-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    rbUseSelfSignedCertificate.setOpaque(false);
    rbUseSelfSignedCertificate.addActionListener(l);
    lSelfSignedName = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON,
        getMsg("self-signed-certificate-name-label"),
@@ -388,7 +385,6 @@
        getMsg("use-existing-certificate-label"),
        getMsg("use-existing-certificate-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    rbUseExistingCertificate.setOpaque(false);
    rbUseExistingCertificate.addActionListener(l);
    ButtonGroup group1 = new ButtonGroup();
    group1.add(rbUseSelfSignedCertificate);
@@ -402,19 +398,16 @@
        getMsg("jks-certificate-label"),
        getMsg("jks-certificate-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    rbJKS.setOpaque(false);
    rbJKS.addActionListener(l);
    rbPKCS11 = UIFactory.makeJRadioButton(
        getMsg("pkcs11-certificate-label"),
        getMsg("pkcs11-certificate-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    rbPKCS11.setOpaque(false);
    rbPKCS11.addActionListener(l);
    rbPKCS12 = UIFactory.makeJRadioButton(
        getMsg("pkcs12-certificate-label"),
        getMsg("pkcs12-certificate-tooltip"),
        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
    rbPKCS12.setOpaque(false);
    rbPKCS12.addActionListener(l);
    ButtonGroup group2 = new ButtonGroup();
    group2.add(rbJKS);
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -493,6 +493,11 @@
  private static final HashMap<IconType, ImageIcon> hmIcons =
      new HashMap<IconType, ImageIcon>();
  static {
    UIManager.put("OptionPane.background",Color.WHITE);
    UIManager.put("Panel.background",Color.WHITE);
  }
  /**
   * The following enumeration contains the different icons that we can have.
   *
@@ -839,7 +844,7 @@
      TextStyle style)
  {
    JRadioButton rb = new JRadioButton();
    rb.setOpaque(false);
    if (text != null)
    {
      rb.setText(text);
@@ -867,7 +872,7 @@
      TextStyle style)
  {
    JCheckBox cb = new JCheckBox();
    cb.setOpaque(false);
    if (text != null)
    {
      cb.setText(text);
opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
@@ -305,7 +305,10 @@
    gbc.gridy = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets.top = 0;
    p.add(chkRequiresAuth = new JCheckBox("Required by proxy"), gbc);
    p.add(chkRequiresAuth =
            UIFactory.makeJCheckBox("Required by proxy","",
                    UIFactory.TextStyle.SECONDARY_FIELD_VALID
            ), gbc);
    chkRequiresAuth.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        tfUserName.setEnabled(chkRequiresAuth.isSelected());
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
@@ -30,14 +30,17 @@
import org.opends.quicksetup.upgrader.RemoteBuildManager;
import org.opends.quicksetup.ui.CustomHTMLEditorKit;
import org.opends.quicksetup.ui.UIFactory;
import org.opends.quicksetup.ui.WebProxyDialog;
import org.opends.quicksetup.i18n.ResourceProvider;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.Proxy;
import java.net.SocketAddress;
import java.net.URL;
import java.net.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.lang.reflect.InvocationTargetException;
/**
   * This panel represents the big error message the pops up when the
@@ -45,22 +48,22 @@
 */
class BuildListDownloadErrorPanel extends JPanel {
  static private final Logger LOG =
          Logger.getLogger(BuildListDownloadErrorPanel.class.getName());
  private RemoteBuildManager rbm = null;
  private Throwable reason = null;
  private ChooseVersionPanel chooseVersionPanel;
  private static final long serialVersionUID = 4614415561629811272L;
  /**
   * Creates an instance.
   *
   * @param rbm RemoteBuildManager that is having trouble.
   * @param reason Throwable indicating the error when downloading
   * @param chooseVersionPanel ChooseVersionPanel where the error occurred
   */
  public BuildListDownloadErrorPanel(ChooseVersionPanel chooseVersionPanel,
                                     RemoteBuildManager rbm,
  public BuildListDownloadErrorPanel(RemoteBuildManager rbm,
                                     Throwable reason) {
    this.chooseVersionPanel = chooseVersionPanel;
    this.rbm = rbm;
    this.reason = reason;
    layoutPanel();
@@ -83,7 +86,7 @@
    }
    String html =
            chooseVersionPanel.getMsg("upgrade-choose-version-build-list-error",
            getMsg("upgrade-choose-version-build-list-error",
            new String[]{
                    baseContext,
                    reason.getLocalizedMessage(),
@@ -107,7 +110,7 @@
    CustomHTMLEditorKit ek = new CustomHTMLEditorKit();
    ek.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ev) {
        chooseVersionPanel.specifyProxy(getParent());
        specifyProxy(getParent());
        // Since the proxy info may change we need
        // to regenerate the text
@@ -120,4 +123,112 @@
    add(UIFactory.makeHtmlPane(html, ek, UIFactory.INSTRUCTIONS_FONT));
  }
  /**
   * Returns a localized message for a key value.  In  the properties file we
   * have something of type:
   * key=value
   * <p/>
   * For instance if we pass as key "mykey" and as arguments {"value1"} and
   * in the properties file we have:
   * mykey=value with argument {0}.
   * <p/>
   * This method will return "value with argument value1".
   *
   * @param key  the key in the properties file.
   * @param args the arguments to be passed to generate the resulting value.
   * @return the value associated to the key in the properties file.
   * @see org.opends.quicksetup.i18n.ResourceProvider#getMsg(String,String[])
   */
  public String getMsg(String key, String[] args) {
    return getI18n().getMsg(key, args);
  }
  /**
   * Returns a ResourceProvider instance.
   *
   * @return a ResourceProvider instance.
   */
  public ResourceProvider getI18n() {
    return ResourceProvider.getInstance();
  }
  /**
   * Displays a dialog prompting the user for proxy information
   * after which applys the new proxy information to the available
   * RemoteBuildManager.
   *
   * @param parent Component that will server as parent to the dialog
   */
  void specifyProxy(final Component parent) {
    Runnable proxySpecifier = new Runnable() {
      public void run() {
        String host = null;
        Integer port = null;
        Proxy proxy = rbm.getProxy();
        if (proxy != null) {
          SocketAddress address = proxy.address();
          if (address instanceof InetSocketAddress) {
            host = ((InetSocketAddress) address).getHostName();
            port = ((InetSocketAddress) address).getPort();
          }
        }
        String user = rbm.getProxyUserName();
        char[] pw = rbm.getProxyPassword();
        WebProxyDialog dlg;
        if (parent instanceof Dialog) {
          dlg = new WebProxyDialog((Dialog) parent, host, port, user, pw);
        } else if (parent instanceof Frame) {
          dlg = new WebProxyDialog((Frame) parent, host, port, user, pw);
        } else {
          dlg = new WebProxyDialog((Frame) null, host, port, user, pw);
        }
        dlg.setVisible(true);
        SocketAddress address = dlg.getSocketAddress();
        if (address != null) {
          proxy = new Proxy(Proxy.Type.HTTP, address);
          rbm.setProxy(proxy);
          rbm.setProxyUserName(dlg.getUserName());
          rbm.setProxyPassword(dlg.getPassword());
        }
      }
    };
    if (SwingUtilities.isEventDispatchThread()) {
      proxySpecifier.run();
    } else {
      try {
        SwingUtilities.invokeAndWait(proxySpecifier);
      } catch (InterruptedException e) {
        LOG.log(Level.INFO, "error", e);
      } catch (InvocationTargetException e) {
        LOG.log(Level.INFO, "error", e);
      } catch (Throwable t) {
        LOG.log(Level.INFO, "error", t);
      }
    }
  }
//  public static void main(String[] args) {
//    String[] options = {"Retry", "Close"};
//    try {
//      JOptionPane op = new JOptionPane(
//      //JOptionPane.showOptionDialog(null,
//              new BuildListDownloadErrorPanel(
//                      new RemoteBuildManager(null,
//                              new URL("http://builds.opends.org")),
//                      new IllegalArgumentException("abc")),
//              JOptionPane.ERROR_MESSAGE,
//              JOptionPane.YES_NO_OPTION,
//              null,
//              options,
//              null);
//      op.setBackground(Color.WHITE);
//      //op.getRootPane().setBackground(Color.WHITE);
//      JDialog dlg = op.createDialog(null, "Network Error");
//      dlg.getContentPane().setBackground(Color.WHITE);
//      dlg.setVisible(true);
//    } catch (MalformedURLException e) {
//      e.printStackTrace();
//    }
//  }
}
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
@@ -28,12 +28,7 @@
package org.opends.quicksetup.upgrader.ui;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.ui.FieldName;
import org.opends.quicksetup.ui.GuiApplication;
import org.opends.quicksetup.ui.QuickSetupStepPanel;
import org.opends.quicksetup.ui.UIFactory;
import org.opends.quicksetup.ui.Utilities;
import org.opends.quicksetup.ui.WebProxyDialog;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.upgrader.Build;
import org.opends.quicksetup.upgrader.RemoteBuildManager;
import org.opends.quicksetup.upgrader.Upgrader;
@@ -42,11 +37,6 @@
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -218,62 +208,6 @@
  }
  /**
   * Displays a dialog prompting the user for proxy information
   * after which applys the new proxy information to the available
   * RemoteBuildManager.
   * @param parent Component that will server as parent to the dialog
   */
  void specifyProxy(final Component parent) {
    Runnable proxySpecifier = new Runnable() {
      public void run() {
        String host = null;
        Integer port = null;
        RemoteBuildManager rbm =
                ((Upgrader) getApplication()).getRemoteBuildManager();
        Proxy proxy = rbm.getProxy();
        if (proxy != null) {
          SocketAddress address = proxy.address();
          if (address instanceof InetSocketAddress) {
            host = ((InetSocketAddress) address).getHostName();
            port = ((InetSocketAddress) address).getPort();
          }
        }
        String user = rbm.getProxyUserName();
        char[] pw = rbm.getProxyPassword();
        WebProxyDialog dlg;
        if (parent instanceof Dialog) {
          dlg = new WebProxyDialog((Dialog) parent, host, port, user, pw);
        } else if (parent instanceof Frame) {
          dlg = new WebProxyDialog((Frame) parent, host, port, user, pw);
        } else {
          dlg = new WebProxyDialog((Frame) null, host, port, user, pw);
        }
        dlg.setVisible(true);
        SocketAddress address = dlg.getSocketAddress();
        if (address != null) {
          proxy = new Proxy(Proxy.Type.HTTP, address);
          rbm.setProxy(proxy);
          rbm.setProxyUserName(dlg.getUserName());
          rbm.setProxyPassword(dlg.getPassword());
        }
      }
    };
    if (SwingUtilities.isEventDispatchThread()) {
      proxySpecifier.run();
    } else {
      try {
        SwingUtilities.invokeAndWait(proxySpecifier);
      } catch (InterruptedException e) {
        LOG.log(Level.INFO, "error", e);
      } catch (InvocationTargetException e) {
        LOG.log(Level.INFO, "error", e);
      } catch (Throwable t) {
        LOG.log(Level.INFO, "error", t);
      }
    }
  }
  /**
   * Renders the combo box when there has been an error downloading
   * the build information.
   */
@@ -343,7 +277,7 @@
        try {
        String[] options = { "Retry", "Close" };
        int i = JOptionPane.showOptionDialog(getMainWindow(),
                new BuildListDownloadErrorPanel(ChooseVersionPanel.this, rbm,
                new BuildListDownloadErrorPanel(rbm,
                        throwable),
                "Network Error",
                JOptionPane.YES_NO_OPTION,
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
@@ -204,7 +204,6 @@
      checkBox =
          UIFactory.makeJCheckBox(getMsg("upgrade-review-panel-start-server"),
              getMsg("start-server-tooltip"), UIFactory.TextStyle.CHECKBOX);
      checkBox.setOpaque(false);
      checkBox.setSelected(getApplication().getUserData().getStartServer());
    }
    return checkBox;