From 7164c02689bf2fba4a7b1ec9229d6775d3332adc Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 09:03:15 +0000
Subject: [PATCH] GUI L&F enhancements, including accessibility and 508 compliances.
---
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java | 4
opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java | 2
opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java | 9
opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/AccessibleTableHeaderRenderer.java | 63 ++++
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java | 2
opends/src/guitools/org/opends/guitools/controlpanel/ui/components/SelectableLabelWithHelpIcon.java | 206 +++++++++++++++
opends/src/guitools/org/opends/guitools/controlpanel/browser/IconPool.java | 1
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java | 132 ++++++---
opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java | 10
opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java | 37 ++
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java | 121 ++++----
opends/src/messages/messages/admin_tool.properties | 5
opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java | 29 +
opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java | 27 +
opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java | 116 ++++++++
opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java | 14 +
16 files changed, 646 insertions(+), 132 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java
index 045b026..bea1928 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanel.java
@@ -207,7 +207,7 @@
private static void initLookAndFeel() throws Throwable
{
- UIFactory.initialize();
+ UIFactory.initializeLookAndFeel();
}
private void updateLocalOrRemotePanel(RootPaneContainer localOrRemote)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
index 1b8bcf1..d4b80d0 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ControlPanelLauncher.java
@@ -37,7 +37,6 @@
import javax.swing.SwingUtilities;
-import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.util.ControlPanelLog;
import org.opends.messages.AdminToolMessages;
import org.opends.messages.Message;
@@ -215,8 +214,7 @@
AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get(
DynamicConstants.PRODUCT_NAME), Message.class);
Utils.setMacOSXMenuBar(title);
- ColorAndFontConstants.initialize();
- UIFactory.initialize();
+ UIFactory.initializeLookAndFeel();
}
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/browser/IconPool.java b/opends/src/guitools/org/opends/guitools/controlpanel/browser/IconPool.java
index 25eb040..bf3ae5a 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/browser/IconPool.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/browser/IconPool.java
@@ -158,6 +158,7 @@
if (description != null)
{
icon.setDescription(description);
+ icon.getAccessibleContext().setAccessibleDescription(description);
}
return icon;
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
index f56e526..e5e3525 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
@@ -198,7 +198,7 @@
*/
public static final Font expanderFont = defaultFont.deriveFont(Font.BOLD);
/**
- * The inline help font.
+ * The in-line help font.
*/
public static final Font inlineHelpFont = defaultFont.deriveFont(
(float)(defaultFont.getSize() - 2));
@@ -262,12 +262,4 @@
* Specifies the font for the command-line output in the detail panel.
*/
public static final Font outputFont = Font.decode("Monospaced-PLAIN-12");
-
- /**
- * This method initialize the constants used by this class. It must be called
- * before other classes modify the UIManager constants.
- */
- public static void initialize()
- {
- }
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
index 3413a3c..639d1df 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -181,6 +181,8 @@
add(lNoBackendsFound, gbc);
lNoBackendsFound.setVisible(false);
gbc.insets.top = 10;
+ lBackend.setLabelFor(backends);
+ lNoBackendsFound.setLabelFor(lBackend);
gbc.gridx = 0;
gbc.gridy ++;
@@ -193,6 +195,7 @@
gbc.gridx = 1;
gbc.insets.left = 10;
file = Utilities.createTextField();
+ lFile.setLabelFor(file);
documentListener = new DocumentListener()
{
/**
@@ -242,6 +245,7 @@
gbc.insets.left = 10;
gbc.gridy ++;
add(lRemoteFileHelp, gbc);
+ lRemoteFileHelp.setLabelFor(file);
gbc.gridx = 1;
gbc.gridy ++;
@@ -265,6 +269,7 @@
overwrite = Utilities.createRadioButton(
INFO_CTRL_PANEL_IMPORT_OVERWRITE_LABEL.get());
overwrite.setSelected(true);
+ lImportType.setLabelFor(overwrite);
append =
Utilities.createRadioButton(INFO_CTRL_PANEL_IMPORT_APPEND_LABEL.get());
@@ -314,6 +319,7 @@
rejectNotSchemaCompliant.setSelected(true);
gbc.insets.left = 10;
add(rejectNotSchemaCompliant, gbc);
+ lSchemaValidation.setLabelFor(rejectNotSchemaCompliant);
gbc.gridx = 0;
gbc.gridy ++;
@@ -328,6 +334,7 @@
doDNValidationAfter.setSelected(false);
gbc.insets.left = 10;
add(doDNValidationAfter, gbc);
+ lDNValidation.setLabelFor(doDNValidationAfter);
gbc.gridx = 0;
gbc.gridy ++;
@@ -344,6 +351,7 @@
INFO_CTRL_PANEL_IMPORT_THREADS_TOOLTIP.get().toString());
gbc.insets.left = 10;
add(threads, gbc);
+ lThreads.setLabelFor(threads);
gbc.insets.top = 3;
gbc.gridy ++;
@@ -365,6 +373,7 @@
writeRejects.setSelected(false);
gbc.insets.left = 10;
add(writeRejects, gbc);
+ lRejectsFile.setLabelFor(writeRejects);
gbc.gridx = 1;
gbc.gridy++;
@@ -403,6 +412,7 @@
INFO_CTRL_PANEL_OVERWRITE_REJECTS_FILE_LABEL.get());
overwriteRejectsFile.setOpaque(false);
add(overwriteRejectsFile, gbc);
+ lRemoteRejectsHelp.setLabelFor(overwriteRejectsFile);
ChangeListener changeListener = new ChangeListener()
{
@@ -435,6 +445,7 @@
writeSkips.setSelected(false);
gbc.insets.left = 10;
add(writeSkips, gbc);
+ lSkipsFile.setLabelFor(writeSkips);
gbc.gridx = 1;
gbc.gridy++;
@@ -473,6 +484,7 @@
INFO_CTRL_PANEL_OVERWRITE_SKIPS_FILE_LABEL.get());
overwriteSkipsFile.setOpaque(false);
add(overwriteSkipsFile, gbc);
+ lRemoteSkipsHelp.setLabelFor(overwriteSkipsFile);
changeListener = new ChangeListener()
{
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
index 7cf9ebf..821af61 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
@@ -169,6 +169,7 @@
dnsToInclude = Utilities.createTextArea(Message.EMPTY, 5, 25);
final JScrollPane scrollDns = Utilities.createScrollPane(dnsToInclude);
panel.add(scrollDns, gbc);
+ lDnsToInclude.setLabelFor(dnsToInclude);
gbc.insets.top = 2;
gbc.gridy ++;
@@ -193,6 +194,7 @@
gbc.weightx = 1.0;
attributesToInclude = Utilities.createMediumTextField();
panel.add(attributesToInclude, gbc);
+ lAttributesToInclude.setLabelFor(attributesToInclude);
gbc.insets.top = 2;
gbc.gridy ++;
@@ -216,6 +218,7 @@
gbc.insets.left = 10;
inclusionFilter = Utilities.createMediumTextField();
panel.add(inclusionFilter, gbc);
+ lInclusionFilter.setLabelFor(inclusionFilter);
addExtraComponents(panel, extraComponentLabels, extraComponents, gbc,
labelInsetLeft);
@@ -284,6 +287,7 @@
gbc.insets.left = 10;
dnsToExclude = Utilities.createTextArea(Message.EMPTY, 5, 0);
final JScrollPane scrollDns = Utilities.createScrollPane(dnsToExclude);
+ lDnsToExclude.setLabelFor(dnsToExclude);
panel.add(scrollDns, gbc);
gbc.insets.top = 2;
@@ -309,12 +313,14 @@
gbc.weightx = 1.0;
attributesToExclude = Utilities.createTextField();
panel.add(attributesToExclude, gbc);
+ lAttributesToExclude.setLabelFor(dnsToExclude);
gbc.insets.top = 2;
gbc.gridy ++;
final JLabel lAttributesExplanation = Utilities.createInlineHelpLabel(
INFO_CTRL_PANEL_SEPARATE_ATTRIBUTES_COMMA.get());
panel.add(lAttributesExplanation, gbc);
+ lAttributesExplanation.setLabelFor(dnsToExclude);
gbc.gridy ++;
gbc.gridx = 0;
@@ -332,6 +338,7 @@
gbc.insets.left = 10;
exclusionFilter = Utilities.createTextField();
panel.add(exclusionFilter, gbc);
+ lExclusionFilter.setLabelFor(exclusionFilter);
addExtraComponents(panel, extraComponentLabels, extraComponents, gbc,
labelInsetLeft);
@@ -392,6 +399,8 @@
gbc.weightx = 1.0;
gbc.insets.left = 10;
panel.add(extraComponents[i], gbc);
+
+ extraComponentLabels[i].setLabelFor(extraComponents[i]);
}
}
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
index a3d07fe..033770c 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -53,6 +53,7 @@
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
+import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
@@ -102,7 +103,7 @@
private AttributeCellEditor editor;
- private JLabel lInitContents;
+ private JEditorPane lInitContents;
private JCheckBox showAll;
@@ -225,6 +226,10 @@
INFO_CTRL_PANEL_JAVA_HOME_LABEL.get());
useOpenDSJavaHome = Utilities.createRadioButton(Message.EMPTY);
useOpenDSJavaHome.setOpaque(false);
+ useOpenDSJavaHome.getAccessibleContext().setAccessibleName(
+ INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME.get().toString()+" "+
+ INFO_CTRL_PANEL_USE_OPENDS_JAVA_HOME_HELP.get());
+ lJavaHome.setLabelFor(useOpenDSJavaHome);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0.0;
@@ -250,6 +255,10 @@
gbc.gridwidth = 1;
useSpecifiedJavaHome = Utilities.createRadioButton(Message.EMPTY);
useSpecifiedJavaHome.setOpaque(false);
+ useSpecifiedJavaHome.getAccessibleContext().setAccessibleName(
+ INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME.get().toString() +
+ " "+INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME_HELP.get());
+ useOpenDSJavaHomeLabel.setLabelFor(useSpecifiedJavaHome);
LabelWithHelpIcon useSpecifiedJavaHomeLabel = new LabelWithHelpIcon(
INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME.get(),
INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_HOME_HELP.get());
@@ -260,6 +269,7 @@
add(useSpecifiedJavaHomeLabel, gbc);
gbc.gridx ++;
javaHome = Utilities.createTextField();
+ useSpecifiedJavaHomeLabel.setLabelFor(javaHome);
gbc.weightx = 1.0;
gbc.insets.left = 5;
add(javaHome, gbc);
@@ -300,9 +310,13 @@
lJavaArgs = Utilities.createPrimaryLabel(
INFO_CTRL_PANEL_JAVA_ARGUMENTS_LABEL.get());
useSpecifiedJavaArgs = Utilities.createRadioButton(Message.EMPTY);
+ useSpecifiedJavaArgs.getAccessibleContext().setAccessibleName(
+ INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS.get().toString() +
+ " "+INFO_CTRL_PANEL_USE_OPENDS_JAVA_ARGS_HELP.get());
useSpecifiedJavaArgs.setOpaque(false);
useOpenDSJavaArgs = Utilities.createRadioButton(Message.EMPTY);
useOpenDSJavaArgs.setOpaque(false);
+ lJavaArgs.setLabelFor(useOpenDSJavaArgs);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
@@ -321,12 +335,16 @@
gbc.insets.left = 0;
p.add(useOpenDSJavaArgsLabel, gbc);
-
gbc.gridx = 1;
gbc.gridy ++;
gbc.insets.top = 10;
gbc.insets.left = 10;
p.add(useSpecifiedJavaArgs, gbc);
+ useOpenDSJavaArgsLabel.setLabelFor(useSpecifiedJavaArgs);
+ useSpecifiedJavaArgs.getAccessibleContext().setAccessibleName(
+ INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS.get().toString() +
+ " "+INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS_HELP.get());
+
gbc.gridx ++;
LabelWithHelpIcon useSpecifiedJavaArgsLabel = new LabelWithHelpIcon(
INFO_CTRL_PANEL_USE_SPECIFIED_OPENDS_JAVA_ARGS.get(),
@@ -337,6 +355,7 @@
group = new ButtonGroup();
group.add(useSpecifiedJavaArgs);
group.add(useOpenDSJavaArgs);
+ useSpecifiedJavaArgsLabel.setLabelFor(useOpenDSJavaArgs);
argumentsTableModel = new JavaArgumentsTableModel();
LDAPEntryTableCellRenderer renderer = new LDAPEntryTableCellRenderer();
@@ -359,7 +378,9 @@
gbc.gridwidth = 2;
argumentsScroll = Utilities.createScrollPane(argumentsTable);
p.add(argumentsScroll, gbc);
- lInitContents = Utilities.createDefaultLabel(READING_JAVA_SETTINGS);
+ lInitContents = Utilities.makePlainTextPane(
+ READING_JAVA_SETTINGS.toString(),
+ ColorAndFontConstants.defaultFont);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
p.add(lInitContents, gbc);
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
index 8757afc..7f90e52 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -49,8 +49,10 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
+import javax.swing.Box;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
@@ -96,7 +98,7 @@
private JLabel dnLabel;
private String usedUrl;
private JLabel localInstallLabel;
- private JLabel localInstall;
+ private JEditorPane localInstall;
private JLabel localNotRunning;
@@ -287,12 +289,14 @@
INFO_CTRL_PANEL_REMOTE_SERVER.get()}));
combo.setSelectedIndex(0);
gbc.gridwidth = 2;
- add(Utilities.createDefaultLabel(INFO_CTRL_PANEL_LOCAL_OR_REMOTE.get()),
- gbc);
+ JLabel l = Utilities.createDefaultLabel(
+ INFO_CTRL_PANEL_LOCAL_OR_REMOTE.get());
+ add(l, gbc);
gbc.gridwidth = 1;
gbc.insets.top = 10;
gbc.gridy ++;
add(combo, gbc);
+ l.setLabelFor(combo);
gbc.gridx = 1;
localNotRunning = Utilities.createDefaultLabel();
@@ -300,8 +304,11 @@
INFO_CTRL_PANEL_LOCAL_SERVER_NOT_RUNNING.get());
gbc.insets.left = 10;
add(localNotRunning, gbc);
+ localNotRunning.setFocusable(true);
hostName = Utilities.createMediumTextField();
hostName.setText(UserData.getDefaultHostName());
+ hostName.setToolTipText(
+ INFO_CTRL_PANEL_REMOTE_SERVER_TOOLTIP.get().toString());
add(hostName, gbc);
gbc.insets.top = 10;
gbc.gridy ++;
@@ -329,11 +336,16 @@
add(localInstallLabel, gbc);
gbc.gridx = 1;
gbc.insets.left = 10;
- gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
- localInstall = Utilities.createDefaultLabel();
- localInstall.setText(localServerInstallPath);
+ gbc.weightx = 0.1;
+ localInstall = Utilities.makeHtmlPane(localServerInstallPath,
+ ColorAndFontConstants.defaultFont);
add(localInstall, gbc);
+ localInstallLabel.setLabelFor(localInstall);
+ gbc.gridx ++;
+ gbc.weightx = 1.0;
+ gbc.insets.left = 0;
+ add(Box.createHorizontalGlue(), gbc);
gbc.gridy ++;
gbc.insets.top = 10;
@@ -351,6 +363,7 @@
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
add(port, gbc);
+ portLabel.setLabelFor(port);
gbc.gridy ++;
gbc.gridx = 0;
@@ -367,6 +380,7 @@
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets.left = 10;
add(dn, gbc);
+ dnLabel.setLabelFor(dn);
gbc.insets.top = 10;
gbc.insets.left = 0;
@@ -384,6 +398,7 @@
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
add(pwd, gbc);
+ pwdLabel.setLabelFor(pwd);
addBottomGlue(gbc);
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
index e88b922..0255778 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
@@ -1157,6 +1157,7 @@
message.setText(Utilities.applyFont(msg.toString(),
ColorAndFontConstants.defaultFont));
cardLayout.show(cardPanel, MESSAGE_PANEL);
+ message.requestFocusInWindow();
}
/**
@@ -1169,6 +1170,7 @@
updateErrorPane(message, title, ColorAndFontConstants.errorTitleFont,
msg, ColorAndFontConstants.defaultFont);
cardLayout.show(cardPanel, MESSAGE_PANEL);
+ message.requestFocusInWindow();
}
/**
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
index 6ea99e9..a45bd50 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -45,11 +45,11 @@
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
@@ -60,7 +60,8 @@
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
-import org.opends.guitools.controlpanel.ui.components.LabelWithHelpIcon;
+import org.opends.guitools.controlpanel.ui.components.
+ SelectableLabelWithHelpIcon;
import org.opends.guitools.controlpanel.ui.renderer.BaseDNCellRenderer;
import org.opends.guitools.controlpanel.ui.renderer.CustomCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
@@ -79,18 +80,18 @@
class StatusPanel extends StatusGenericPanel
{
private static final long serialVersionUID = -6493442314639004717L;
- // The placeholder where we display errors.
- private JLabel serverStatus;
- private LabelWithHelpIcon currentConnections;
- private JLabel hostName;
- private JLabel administrativeUsers;
- private JLabel installPath;
- private JLabel instancePath;
- private JLabel opendsVersion;
- private LabelWithHelpIcon javaVersion;
- private JLabel adminConnector;
- private JLabel dbTableEmpty;
- private JLabel connectionHandlerTableEmpty;
+ // The place holder where we display errors.
+ private JEditorPane serverStatus;
+ private SelectableLabelWithHelpIcon currentConnections;
+ private JEditorPane hostName;
+ private JEditorPane administrativeUsers;
+ private JEditorPane installPath;
+ private JEditorPane instancePath;
+ private JEditorPane opendsVersion;
+ private SelectableLabelWithHelpIcon javaVersion;
+ private JEditorPane adminConnector;
+ private JEditorPane dbTableEmpty;
+ private JEditorPane connectionHandlerTableEmpty;
private JLabel lInstancePath;
private JButton stopButton;
private JButton startButton;
@@ -328,7 +329,7 @@
}
}
- serverStatus.setText(getStatusLabel(desc));
+ setText(serverStatus, getStatusLabel(desc));
boolean isRunning = desc.getStatus() ==
ServerDescriptor.ServerStatus.STARTED;
@@ -371,7 +372,7 @@
}
}
- hostName.setText(desc.getHostname());
+ setText(hostName, desc.getHostname());
Set<DN> rootUsers = desc.getAdministrativeUsers();
@@ -390,35 +391,33 @@
if (rootUsers.size() > 0)
{
- String htmlString = "<html>"+Utilities.applyFont(
- Utilities.getStringFromCollection(sortedRootUsers, "<br>"),
- administrativeUsers.getFont());
- administrativeUsers.setText(htmlString);
+ setText(administrativeUsers,
+ Utilities.getStringFromCollection(sortedRootUsers, "<br>"));
}
else
{
- administrativeUsers.setText(
+ setText(administrativeUsers,
INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
}
String install = desc.getInstallPath();
if (install != null)
{
- installPath.setText(install);
+ setText(installPath, install);
}
else
{
- installPath.setText(INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
+ setText(installPath, INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
}
String instance = desc.getInstancePath();
if (instance != null)
{
- instancePath.setText(instance);
+ setText(instancePath, instance);
}
else
{
- instancePath.setText(INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
+ setText(instancePath, INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
}
instancePath.setVisible(!desc.sameInstallAndInstance());
@@ -426,11 +425,11 @@
if (desc.getOpenDSVersion() != null)
{
- opendsVersion.setText(desc.getOpenDSVersion());
+ setText(opendsVersion, desc.getOpenDSVersion());
}
else
{
- opendsVersion.setText(INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
+ setText(opendsVersion, INFO_NOT_AVAILABLE_SHORT_LABEL.get().toString());
}
if (!isRunning)
@@ -462,7 +461,7 @@
}
}
- adminConnector.setText(
+ setText(adminConnector,
getAdminConnectorStringValue(desc.getAdminConnector()));
Set<BaseDNDescriptor> baseDNs = new HashSet<BaseDNDescriptor>();
@@ -514,6 +513,12 @@
Utilities.updateViewPositions(pos);
}
+ private void setText(JEditorPane pane, String htmlText)
+ {
+ pane.setText(Utilities.applyFont(htmlText,
+ ColorAndFontConstants.defaultFont));
+ }
+
/**
* Creates the server status subsection panel.
* @return the server status subsection panel.
@@ -527,8 +532,7 @@
gbc.weightx = 1.0;
gbc.insets = new Insets(0, 0, 0, 0);
- p.setBorder(Utilities.makeTitledBorder(
- INFO_CTRL_PANEL_SERVER_STATUS_TITLE_BORDER.get()));
+ setTitleBorder(p, INFO_CTRL_PANEL_SERVER_STATUS_TITLE_BORDER.get());
JPanel auxPanel = new JPanel(new GridBagLayout());
auxPanel.setOpaque(false);
gbc.anchor = GridBagConstraints.WEST;
@@ -541,8 +545,11 @@
statusPanel.setOpaque(false);
gbc.gridwidth = 6;
gbc.weightx = 0.0;
- serverStatus = Utilities.createDefaultLabel();
+ serverStatus = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
statusPanel.add(serverStatus, gbc);
+ //l.setFocusable(true);
+ l.setLabelFor(serverStatus);
gbc.gridwidth--;
stopButton = Utilities.createButton(INFO_STOP_BUTTON_LABEL.get());
@@ -620,12 +627,15 @@
l = Utilities.createPrimaryLabel(
INFO_CTRL_PANEL_OPEN_CONNECTIONS_LABEL.get());
auxPanel.add(l, gbc);
- currentConnections = new LabelWithHelpIcon(Message.EMPTY, null);
+ currentConnections = new SelectableLabelWithHelpIcon(Message.EMPTY, null);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets.left = 5;
auxPanel.add(currentConnections, gbc);
+ l.setFocusable(true);
+ l.setLabelFor(currentConnections);
+
gbc.insets.top = 2;
gbc.insets.right = 5;
gbc.insets.left = 5;
@@ -653,8 +663,7 @@
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
- p.setBorder(Utilities.makeTitledBorder(
- INFO_CTRL_PANEL_SERVER_DETAILS_TITLE_BORDER.get()));
+ setTitleBorder(p, INFO_CTRL_PANEL_SERVER_DETAILS_TITLE_BORDER.get());
JPanel auxPanel = new JPanel(new GridBagLayout());
auxPanel.setOpaque(false);
gbc.anchor = GridBagConstraints.NORTHWEST;
@@ -678,13 +687,19 @@
};
lInstancePath = leftLabels[3];
- hostName = Utilities.createDefaultLabel();
- administrativeUsers = Utilities.createDefaultLabel();
- installPath = Utilities.createDefaultLabel();
- instancePath = Utilities.createDefaultLabel();
- opendsVersion = Utilities.createDefaultLabel();
- javaVersion = new LabelWithHelpIcon(Message.EMPTY, null);
- adminConnector = Utilities.createDefaultLabel();
+ hostName = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ administrativeUsers = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ installPath = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ instancePath = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ opendsVersion = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ javaVersion = new SelectableLabelWithHelpIcon(Message.EMPTY, null);
+ adminConnector = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
JComponent[] rightLabels =
{
@@ -706,6 +721,8 @@
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets.left = 5;
auxPanel.add(rightLabels[i], gbc);
+
+ leftLabels[i].setLabelFor(rightLabels[i]);
}
gbc.insets.top = 2;
@@ -750,13 +767,17 @@
p.add(connectionHandlersTable, gbc);
connectionHandlerTableEmpty =
- Utilities.createPrimaryLabel(
- INFO_CTRL_PANEL_NO_CONNECTION_HANDLER_FOUND.get());
- connectionHandlerTableEmpty.setHorizontalAlignment(SwingConstants.CENTER);
+ Utilities.makeHtmlPane(
+ INFO_CTRL_PANEL_NO_CONNECTION_HANDLER_FOUND.get().toString(),
+ ColorAndFontConstants.primaryFont);
gbc.insets.top = 5;
+ gbc.anchor = GridBagConstraints.CENTER;
+ gbc.fill = GridBagConstraints.NONE;
p.add(connectionHandlerTableEmpty, gbc);
connectionHandlerTableEmpty.setVisible(false);
+ l.setLabelFor(connectionHandlersTable);
+
return p;
}
@@ -786,6 +807,7 @@
renderer);
noReplicatedBaseDNsTable.setVisible(false);
noReplicatedBaseDNsTable.getTableHeader().setVisible(false);
+
replicationBaseDNsTable =
Utilities.createSortableTable(dbTableModelWithReplication,
renderer);
@@ -794,6 +816,13 @@
Utilities.addClickTooltipListener(noReplicatedBaseDNsTable);
Utilities.addClickTooltipListener(replicationBaseDNsTable);
+ l.setLabelFor(replicationBaseDNsTable);
+
+ noReplicatedBaseDNsTable.getAccessibleContext().setAccessibleName(
+ l.getText());
+ replicationBaseDNsTable.getAccessibleContext().setAccessibleName(
+ l.getText());
+
gbc.insets.top = 5;
p.add(noReplicatedBaseDNsTable.getTableHeader(), gbc);
gbc.insets.top = 0;
@@ -807,9 +836,10 @@
replicationBaseDNsTable.getTableHeader().setVisible(true);
gbc.insets.top = 5;
- dbTableEmpty = Utilities.createPrimaryLabel(
- INFO_CTRL_PANEL_NO_DATA_SOURCES_FOUND.get());
- dbTableEmpty.setHorizontalAlignment(SwingConstants.CENTER);
+ dbTableEmpty = Utilities.makeHtmlPane(
+ INFO_CTRL_PANEL_NO_DATA_SOURCES_FOUND.get().toString(),
+ ColorAndFontConstants.primaryFont);
+ gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
p.add(dbTableEmpty, gbc);
dbTableEmpty.setVisible(false);
@@ -869,4 +899,10 @@
}
return status.toString();
}
+
+ private void setTitleBorder(JPanel p, Message title)
+ {
+ p.setBorder(Utilities.makeTitledBorder(title));
+ p.getAccessibleContext().setAccessibleName(title.toString());
+ }
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
index fb885be..4446980 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
@@ -22,12 +22,13 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui.components;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -97,6 +98,18 @@
add(Box.createHorizontalGlue(), gbc);
Utilities.addClickTooltipListener(iconLabel);
+
+ updateAccessibleContext();
+ }
+
+ /**
+ * Set the component this is labeling. Can be {@code null} if this does not
+ * label a {@code Component}.
+ * @param comp the {@code Component} to be labeled.
+ */
+ public void setLabelFor(Component comp)
+ {
+ label.setLabelFor(comp);
}
/**
@@ -106,6 +119,7 @@
public void setText(String text)
{
label.setText(text);
+ updateAccessibleContext();
}
/**
@@ -137,6 +151,7 @@
public void setHelpTooltip(String tooltip)
{
iconLabel.setToolTipText(tooltip);
+ updateAccessibleContext();
}
/**
@@ -198,4 +213,24 @@
return null;
}
}
+
+ private void updateAccessibleContext()
+ {
+ StringBuilder sb = new StringBuilder();
+ String s = label.getText();
+ if (s != null)
+ {
+ sb.append(s);
+ }
+ if (iconLabel.getIcon() != null)
+ {
+ String toolTip = iconLabel.getToolTipText();
+ toolTip = Utilities.stripHtmlToSingleLine(toolTip);
+ if (toolTip != null)
+ {
+ sb.append(" - "+toolTip);
+ }
+ }
+ getAccessibleContext().setAccessibleName(sb.toString());
+ }
}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/SelectableLabelWithHelpIcon.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/SelectableLabelWithHelpIcon.java
new file mode 100644
index 0000000..a36b2f6
--- /dev/null
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/SelectableLabelWithHelpIcon.java
@@ -0,0 +1,206 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2010 Sun Microsystems, Inc.
+ */
+
+package org.opends.guitools.controlpanel.ui.components;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.MouseEvent;
+
+import javax.swing.Box;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.text.JTextComponent;
+
+import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
+import org.opends.guitools.controlpanel.util.Utilities;
+import org.opends.messages.Message;
+
+/**
+ * A panel containing a label an a help icon. A customized tool tip is used,
+ * the tool tip is also displayed when the user clicks on the help icon.
+ * The main difference with {@code LabelWithHelpIcon} is that this uses
+ * a {@code JEditorPane} as label.
+ *
+ */
+public class SelectableLabelWithHelpIcon extends JPanel
+{
+ private static final long serialVersionUID = 4502977901098910797L;
+ /**
+ * The label with the text.
+ */
+ private JTextComponent label = Utilities.makeHtmlPane("",
+ ColorAndFontConstants.defaultFont);
+ /**
+ * The label with the icon.
+ */
+ private JLabel iconLabel = new JLabel(icon);
+ private static final ImageIcon icon =
+ Utilities.createImageIcon("org/opends/quicksetup/images/help_small.gif");
+
+ /**
+ * The left inset of the help icon.
+ */
+ private final int INSET_WITH_ICON= 3;
+
+ /**
+ * The constructor of this panel.
+ * @param text the text of the panel.
+ * @param tooltipIcon the tool tip of the help icon.
+ */
+ public SelectableLabelWithHelpIcon(Message text, Message tooltipIcon)
+ {
+ super(new GridBagLayout());
+ setOpaque(false);
+ label.setText(Utilities.applyFont(text.toString(),
+ label.getFont()));
+ if (tooltipIcon != null)
+ {
+ iconLabel.setToolTipText(tooltipIcon.toString());
+ }
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.gridwidth = 1;
+ add(label, gbc);
+ gbc.gridx ++;
+ gbc.insets.left = INSET_WITH_ICON;
+ add(iconLabel, gbc);
+ gbc.insets.left = 0;
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.gridx ++;
+ add(Box.createHorizontalGlue(), gbc);
+
+ Utilities.addClickTooltipListener(iconLabel);
+ }
+
+ /**
+ * Sets the text on the label. The text is assumed to be in HTML format
+ * but the font will be imposed by the font specified using {@link #setFont}.
+ * @param text the text to be displayed.
+ */
+ public void setText(String text)
+ {
+ label.setText(Utilities.applyFont(text.toString(),
+ label.getFont()));
+ }
+
+ /**
+ * Returns the text displayed on the panel.
+ * @return the text displayed on the panel.
+ */
+ public String getText()
+ {
+ return label.getText();
+ }
+
+ /**
+ * Sets the font to be used in this panel.
+ * @param font the font.
+ */
+ public void setFont(Font font)
+ {
+ // This is called by the constructor of JPanel.
+ if (label != null)
+ {
+ label.setFont(font);
+ }
+ }
+
+ /**
+ * Sets the tool tip to be used in the help icon.
+ * @param tooltip the tool tip text.
+ */
+ public void setHelpTooltip(String tooltip)
+ {
+ iconLabel.setToolTipText(tooltip);
+ }
+
+ /**
+ * Returns the tool tip to be used in the help icon.
+ * @return the tool tip to be used in the help icon.
+ */
+ public String getHelpTooltip()
+ {
+ return iconLabel.getToolTipText();
+ }
+
+ /**
+ * Sets whether the help icon is visible or not.
+ * @param visible whether the help icon is visible or not.
+ */
+ public void setHelpIconVisible(boolean visible)
+ {
+ if (visible)
+ {
+ if (iconLabel.getIcon() != icon)
+ {
+ iconLabel.setIcon(icon);
+ }
+ }
+ else if (iconLabel.getIcon() != null)
+ {
+ iconLabel.setIcon(null);
+ }
+ }
+
+ /**
+ * Sets the foreground color for the text in this panel.
+ * @param color the foreground color for the text in this panel.
+ */
+ public void setForeground(Color color)
+ {
+ super.setForeground(color);
+ if (label != null)
+ {
+ // This is called in the constructor of the object.
+ label.setForeground(color);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getToolTipText(MouseEvent ev)
+ {
+ int x = ev.getPoint().x;
+ boolean display = x > label.getPreferredSize().width - 10;
+
+ if (display)
+ {
+ return getHelpTooltip();
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/AccessibleTableHeaderRenderer.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/AccessibleTableHeaderRenderer.java
new file mode 100644
index 0000000..963a150
--- /dev/null
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/AccessibleTableHeaderRenderer.java
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2010 Sun Microsystems, Inc.
+ */
+package org.opends.guitools.controlpanel.ui.renderer;
+
+import java.awt.Component;
+
+import javax.swing.JTable;
+import javax.swing.table.TableCellRenderer;
+
+import org.opends.guitools.controlpanel.util.Utilities;
+
+/**
+ * Class used to have components that provide a valid accessible name.
+ */
+public class AccessibleTableHeaderRenderer implements TableCellRenderer
+{
+ private TableCellRenderer renderer;
+ /**
+ * Constructor of the renderer.
+ * @param renderer the renderer to be used as base.
+ */
+ public AccessibleTableHeaderRenderer(TableCellRenderer renderer)
+ {
+ this.renderer = renderer;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column)
+ {
+ Component comp = renderer.getTableCellRendererComponent(table, value,
+ isSelected, hasFocus, row, column);
+ comp.getAccessibleContext().setAccessibleName(
+ Utilities.stripHtmlToSingleLine(String.valueOf(value)));
+ return comp;
+ }
+
+}
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index 5273bf6..7654c1c 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -101,6 +101,10 @@
import org.opends.guitools.controlpanel.event.TextComponentFocusListener;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.ui.components.LabelWithHelpIcon;
+import org.opends.guitools.controlpanel.ui.components.
+ SelectableLabelWithHelpIcon;
+import org.opends.guitools.controlpanel.ui.renderer.
+ AccessibleTableHeaderRenderer;
import org.opends.messages.Message;
import org.opends.quicksetup.ui.UIFactory;
import org.opends.quicksetup.util.Utils;
@@ -338,6 +342,7 @@
{
JEditorPane pane = new JEditorPane();
pane.setContentType("text/html");
+ pane.setFont(font);
if (text != null)
{
pane.setText(applyFont(text, font));
@@ -350,6 +355,28 @@
}
/**
+ * Creates a JEditorPane that displays a message.
+ * @param text the message of the editor pane in plain text format.
+ * @param font the font to be used in the message.
+ * @return a JEditorPane that displays a message.
+ */
+ public static JEditorPane makePlainTextPane(String text, Font font)
+ {
+ JEditorPane pane = new JEditorPane();
+ pane.setContentType("text/plain");
+ if (text != null)
+ {
+ pane.setText(text);
+ }
+ pane.setFont(font);
+ pane.setEditable(false);
+ pane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ pane.setOpaque(false);
+ pane.setFocusCycleRoot(false);
+ return pane;
+ }
+
+ /**
* Returns the HTML style representation for the given font.
* @param font the font for which we want to get an HTML style representation.
* @return the HTML style representation for the given font.
@@ -434,6 +461,7 @@
JButton button = new JButton(text.toString());
button.setOpaque(false);
button.setForeground(ColorAndFontConstants.buttonForeground);
+ button.getAccessibleContext().setAccessibleName(text.toString());
return button;
}
@@ -447,6 +475,7 @@
JRadioButton button = new JRadioButton(text.toString());
button.setOpaque(false);
button.setForeground(ColorAndFontConstants.buttonForeground);
+ button.getAccessibleContext().setAccessibleName(text.toString());
return button;
}
@@ -460,6 +489,7 @@
JCheckBox cb = new JCheckBox(text.toString());
cb.setOpaque(false);
cb.setForeground(ColorAndFontConstants.buttonForeground);
+ cb.getAccessibleContext().setAccessibleName(text.toString());
return cb;
}
@@ -585,6 +615,9 @@
BorderFactory.createMatteBorder(1, 1, 0, 1,
ColorAndFontConstants.gridColor));
}
+ table.getTableHeader().setDefaultRenderer(
+ new AccessibleTableHeaderRenderer(
+ table.getTableHeader().getDefaultRenderer()));
for (int i=0; i<tableModel.getColumnCount(); i++)
{
@@ -1018,6 +1051,28 @@
}
}
+ /**
+ * Strips any potential HTML markup from a given string.
+ * @param s string to strip
+ * @return resulting string
+ */
+ static public String stripHtmlToSingleLine(String s) {
+ String o = null;
+ if (s != null) {
+ s = s.replaceAll("<br>", " ");
+ // This is not a comprehensive solution but addresses
+ // the few tags that we have in Resources.properties
+ // at the moment. Note that the following might strip
+ // out more than is intended for non-tags like
+ // '<your name here>' or for funky tags like
+ // '<tag attr="1 > 0">'. See test class for cases that
+ // might cause problems.
+ o = s.replaceAll("\\<.*?\\>","");
+
+ }
+ return o;
+ }
+
private final static String HTML_SPACE = " ";
/**
* Wraps the contents of the provided message using the specified number of
@@ -1715,6 +1770,36 @@
}
/**
+ * Sets the not available text to a label and associates a help icon and
+ * a tooltip explaining that the data is not available because the server is
+ * down.
+ * @param l the label.
+ */
+ public static void setNotAvailableBecauseServerIsDown(
+ SelectableLabelWithHelpIcon l)
+ {
+ l.setText(INFO_CTRL_PANEL_NOT_AVAILABLE_LONG_LABEL.get().toString());
+ l.setHelpIconVisible(true);
+ l.setHelpTooltip(INFO_NOT_AVAILABLE_SERVER_DOWN_TOOLTIP.get().toString());
+ }
+
+ /**
+ * Sets the not available text to a label and associates a help icon and
+ * a tooltip explaining that the data is not available because authentication
+ * is required.
+ * @param l the label.
+ */
+ public static void setNotAvailableBecauseAuthenticationIsRequired(
+ SelectableLabelWithHelpIcon l)
+ {
+ l.setText(INFO_CTRL_PANEL_NOT_AVAILABLE_LONG_LABEL.get().toString());
+ l.setHelpIconVisible(true);
+ l.setHelpTooltip(
+ INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_TOOLTIP.get()
+ .toString());
+ }
+
+ /**
* Updates a label by setting a warning icon and a text.
* @param l the label to be updated.
* @param text the text to be set on the label.
@@ -1726,6 +1811,10 @@
{
warningIcon =
createImageIcon("org/opends/quicksetup/images/warning_medium.gif");
+ warningIcon.setDescription(
+ INFO_WARNING_ICON_ACCESSIBLE_DESCRIPTION.get().toString());
+ warningIcon.getAccessibleContext().setAccessibleName(
+ INFO_WARNING_ICON_ACCESSIBLE_DESCRIPTION.get().toString());
}
l.setIcon(warningIcon);
l.setToolTipText(text.toString());
@@ -1756,6 +1845,29 @@
}
/**
+ * Sets the not available text to a label with no icon nor tooltip.
+ * @param l the label.
+ */
+ public static void setNotAvailable(SelectableLabelWithHelpIcon l)
+ {
+ l.setText(INFO_CTRL_PANEL_NOT_AVAILABLE_LONG_LABEL.get().toString());
+ l.setHelpIconVisible(false);
+ l.setHelpTooltip(null);
+ }
+
+ /**
+ * Sets the a text to a label with no icon nor tooltip.
+ * @param l the label.
+ * @param text the text.
+ */
+ public static void setTextValue(SelectableLabelWithHelpIcon l, String text)
+ {
+ l.setText(text);
+ l.setHelpIconVisible(false);
+ l.setHelpTooltip(null);
+ }
+
+ /**
* Returns the server root directory (the path where the server is installed).
* @return the server root directory (the path where the server is installed).
*/
@@ -2396,6 +2508,10 @@
{
requiredIcon =
createImageIcon(IconPool.IMAGE_PATH+"/required.gif");
+ requiredIcon.setDescription(
+ INFO_REQUIRED_ICON_ACCESSIBLE_DESCRIPTION.get().toString());
+ requiredIcon.getAccessibleContext().setAccessibleName(
+ INFO_REQUIRED_ICON_ACCESSIBLE_DESCRIPTION.get().toString());
}
label.setIcon(requiredIcon);
label.setHorizontalTextPosition(SwingConstants.LEADING);
diff --git a/opends/src/messages/messages/admin_tool.properties b/opends/src/messages/messages/admin_tool.properties
index e8b98b0..7431022 100644
--- a/opends/src/messages/messages/admin_tool.properties
+++ b/opends/src/messages/messages/admin_tool.properties
@@ -2056,6 +2056,8 @@
INFO_CTRL_PANEL_LOCAL_OR_REMOTE_LABEL=Choose the server to be administered:
INFO_CTRL_PANEL_REMOTE_SERVER=Remote Server:
+INFO_CTRL_PANEL_REMOTE_SERVER_TOOLTIP=Fully qualified host name of the remote \
+ server.
INFO_CTRL_PANEL_LOCAL_SERVER=Local Server
INFO_CTRL_PANEL_ADMINISTRATION_PORT=Administration Port:
INFO_CTRL_PANEL_LOCAL_SERVER_NOT_RUNNING=Not Running
@@ -2970,3 +2972,6 @@
INFO_CTRL_PANEL_ENTRY_TO_DUPLICATE_HAS_PASSWORD_WARNING=The duplicated entry \
will contain a password with value '%s'
INFO_CTRL_PANEL_DS_SYNC_HIST_BINARY_VALUE=<Binary Value>
+INFO_REQUIRED_ICON_ACCESSIBLE_DESCRIPTION=Required Icon.
+INFO_WARNING_ICON_ACCESSIBLE_DESCRIPTION=Warning Icon.
+INFO_ACCESSIBLE_TABLE_CELL_NAME=%s - Column %s
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
index 6139948..ae3a88a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -28,7 +28,6 @@
package org.opends.quicksetup.ui;
import org.opends.messages.Message;
-import org.opends.quicksetup.util.Utils;
import static org.opends.messages.QuickSetupMessages.*;
@@ -554,26 +553,6 @@
private static final HashMap<IconType, ImageIcon> hmIcons =
new HashMap<IconType, ImageIcon>();
- static {
- if (!Utils.isCli())
- {
- try
- {
- UIManager.put("OptionPane.background",
- getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get()));
- UIManager.put("Panel.background",
- getColor(INFO_PANEL_BACKGROUND_COLOR.get()));
- UIManager.put("ComboBox.background",
- getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get()));
- }
- catch (Throwable t)
- {
- // This might occur when we do not get the display
- LOG.log(Level.WARNING, "Error updating UIManager: "+t, t);
- }
- }
- }
-
/**
* The following enumeration contains the different icons that we can have.
*
@@ -731,54 +710,78 @@
}
/**
- * This method initialize the look and feel and UI settings.
+ * This method initialize the look and feel.
+ * @throws Throwable if there is a problem initializing the look and feel.
+ */
+ public static void initializeLookAndFeel() throws Throwable
+ {
+ final Throwable[] ts = {null};
+ Runnable r = new Runnable()
+ {
+ public void run()
+ {
+ System.setProperty("swing.aatext", "true");
+ try
+ {
+ String lf = UIManager.getSystemLookAndFeelClassName();
+ if (lf.equalsIgnoreCase(
+ "com.sun.java.swing.plaf.motif.MotifLookAndFeel"))
+ {
+ lf = UIManager.getCrossPlatformLookAndFeelClassName();
+ }
+ UIManager.setLookAndFeel(lf);
+ } catch (Throwable t)
+ {
+ ts[0] = t;
+ }
+ JFrame.setDefaultLookAndFeelDecorated(false);
+ }
+ };
+ if (SwingUtilities.isEventDispatchThread())
+ {
+ r.run();
+ }
+ else
+ {
+ try
+ {
+ SwingUtilities.invokeAndWait(r);
+ }
+ catch (Throwable t)
+ {
+ ts[0] = t;
+ }
+ }
+ if (ts[0] != null)
+ {
+ throw ts[0];
+ }
+ }
+
+ /**
+ * This method initialize the look and feel and UI settings specific to
+ * quick setup.
* @throws Throwable if there is a problem initializing the look and feel.
*/
public static void initialize() throws Throwable
{
if (!initialized)
{
- final Throwable[] ts = {null};
- Runnable r = new Runnable()
+ try
{
- public void run()
- {
- System.setProperty("swing.aatext", "true");
- try
- {
- String lf = UIManager.getSystemLookAndFeelClassName();
- if (lf.equalsIgnoreCase(
- "com.sun.java.swing.plaf.motif.MotifLookAndFeel"))
- {
- lf = UIManager.getCrossPlatformLookAndFeelClassName();
- }
- UIManager.setLookAndFeel(lf);
- } catch (Throwable t)
- {
- ts[0] = t;
- }
- JFrame.setDefaultLookAndFeelDecorated(false);
- }
- };
- if (SwingUtilities.isEventDispatchThread())
- {
- r.run();
+ UIManager.put("OptionPane.background",
+ getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get()));
+ UIManager.put("Panel.background",
+ getColor(INFO_PANEL_BACKGROUND_COLOR.get()));
+ UIManager.put("ComboBox.background",
+ getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get()));
}
- else
+ catch (Throwable t)
{
- try
- {
- SwingUtilities.invokeAndWait(r);
- }
- catch (Throwable t)
- {
- ts[0] = t;
- }
+ // This might occur when we do not get the display
+ LOG.log(Level.WARNING, "Error updating UIManager: "+t, t);
}
- if (ts[0] != null)
- {
- throw ts[0];
- }
+ initializeLookAndFeel();
initialized = true;
}
}
--
Gitblit v1.10.0