From 093e406859be8e3a49e48cfc14f0a5276bc70d5d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 04 Jun 2007 19:51:10 +0000
Subject: [PATCH] Fix for issue 1601.
---
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java | 3 +++
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
index 13d8c4b..72e35eb 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
+++ b/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");
diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
index 0425421..2e0df16 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
+++ b/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;
--
Gitblit v1.10.0