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

jvergara
04.51.2007 093e406859be8e3a49e48cfc14f0a5276bc70d5d
Fix for issue 1601.

Basically the fix consists of making the progress panel JEditorPane not to be the root of the focus cycle. Appart from that some focus listeners have been added to be sure that the first component that gets the focus is the details text area in the progress panel.

Concerning the status panel, the panel could be used using just the keyboard, but when the tables get the focus CTRL+TAB must be used. As the tables are read-only there is no much value on making them focusable so I set them to be non focusable so that the use of CTRL+TAB is no longer required to use the status panel.
2 files modified
55 ■■■■■ changed files
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java 52 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java 3 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
@@ -32,6 +32,8 @@
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
@@ -60,6 +62,8 @@
  private String lastText;
  private Component lastFocusComponent;
  /**
   * ProgressPanel constructor.
   * @param application Application this panel represents
@@ -89,6 +93,8 @@
        getMsg("progressbar-initial-label"), UIFactory.PROGRESS_FONT);
    progressBarLabel.setOpaque(false);
    progressBarLabel.setEditable(false);
    progressBarLabel.setFocusable(false);
    progressBarLabel.setFocusCycleRoot(false);
    CustomHTMLEditorKit htmlEditor = new CustomHTMLEditorKit();
    htmlEditor.addActionListener(new ActionListener()
    {
@@ -145,6 +151,8 @@
    gbc.weighty = 1.0;
    panel.add(scroll, gbc);
    addFocusListeners();
    return panel;
  }
@@ -167,6 +175,17 @@
  /**
   * {@inheritDoc}
   */
  public void endDisplay()
  {
    if (lastFocusComponent != null)
    {
      lastFocusComponent.requestFocusInWindow();
    }
  }
  /**
   * {@inheritDoc}
   */
  public void displayProgress(ProgressDescriptor descriptor)
  {
    ProgressStep status = descriptor.getProgressStep();
@@ -175,6 +194,7 @@
    if (status.isLast()) {
      progressBar.setVisible(false);
      progressBarLabel.setFocusable(true);
      btnCancel.setVisible(false);
      if (!status.isError()) {
        summaryText = "<form>"+summaryText+"</form>";
@@ -252,6 +272,38 @@
    return panel;
  }
  /**
   * Adds the required focus listeners to the fields.
   */
  private void addFocusListeners()
  {
    final FocusListener l = new FocusListener()
    {
      public void focusGained(FocusEvent e)
      {
        lastFocusComponent = e.getComponent();
      }
      public void focusLost(FocusEvent e)
      {
      }
    };
    JComponent[] comps =
    {
        progressBarLabel,
        progressBar,
        btnCancel,
        detailsTextArea
    };
    for (int i = 0; i < comps.length; i++)
    {
      comps[i].addFocusListener(l);
    }
    lastFocusComponent = detailsTextArea;
  }
//  public static void main(String[] args) {
//    final UserData ud = new UpgradeUserData();
//    ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX");
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
@@ -722,6 +722,7 @@
    listenersTable = UIFactory.makeSortableTable(listenersTableModel,
        new ListenersCellRenderer(),
        UIFactory.makeHeaderRenderer());
    listenersTable.setFocusable(false);
    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
    p.add(listenersTable.getTableHeader(), gbc);
@@ -762,11 +763,13 @@
      UIFactory.makeSortableTable(dbTableModelWithReplication,
        new DatabasesCellRenderer(),
        UIFactory.makeHeaderRenderer());
    dbTableWithReplication.setFocusable(false);
    toolTipManager.registerComponent(dbTableWithReplication);
    dbTableWithoutReplication =
      UIFactory.makeSortableTable(dbTableModelWithoutReplication,
        new DatabasesCellRenderer(),
        UIFactory.makeHeaderRenderer());
    dbTableWithoutReplication.setFocusable(false);
    toolTipManager.registerComponent(dbTableWithoutReplication);
    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;