From c40f084a6d3e897785f2fbff3ddb97545644cddc Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 11 Dec 2006 15:34:39 +0000
Subject: [PATCH] The following modifications include the comments from Neil and Brian (thanks to both for your help):

---
 opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
index 517c871..f31edcc 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -28,6 +28,7 @@
 package org.opends.quicksetup.ui;
 
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Font;
 import java.awt.Image;
 import java.awt.Insets;
@@ -43,11 +44,13 @@
 import javax.swing.JEditorPane;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
+import javax.swing.JList;
 import javax.swing.JPasswordField;
 import javax.swing.JRadioButton;
 import javax.swing.JScrollBar;
 import javax.swing.JScrollPane;
 import javax.swing.JTextField;
+import javax.swing.ListCellRenderer;
 import javax.swing.UIManager;
 import javax.swing.border.Border;
 import javax.swing.border.EmptyBorder;
@@ -275,6 +278,11 @@
   public static final Color PROGRESS_COLOR = Color.BLACK;
 
   /**
+   * Specifies the instructions text color.
+   */
+  public static final Color INSTRUCTIONS_COLOR = Color.BLACK;
+
+  /**
    * Specifies the text field text color.
    */
   public static final Color TEXTFIELD_COLOR = Color.BLACK;
@@ -329,6 +337,12 @@
     Font.decode("Arial-PLAIN-14");
 
   /**
+   * Specifies the font for the instructions of the current panel.
+   */
+  public static final Font INSTRUCTIONS_MONOSPACE_FONT =
+    Font.decode("Monospaced-PLAIN-14");
+
+  /**
    * Specifies the font for the primary valid field.
    */
   public static final Font PRIMARY_FIELD_VALID_FONT =
@@ -559,6 +573,10 @@
      */
     PROGRESS,
     /**
+     * Text style for the instructions.
+     */
+    INSTRUCTIONS,
+    /**
      * No text style.
      */
     NO_STYLE
@@ -733,6 +751,19 @@
   }
 
   /**
+   * Creates a JList.
+   *
+   * @param textStyle the style to be used for the renderer.
+   * @return a JList.
+   */
+  public static JList makeJList(TextStyle textStyle)
+  {
+    JList list = new JList();
+    list.setCellRenderer(makeCellRenderer(textStyle));
+    return list;
+  }
+
+  /**
    * Sets the specified text style to the component passed as parameter.
    * @param l the component to update.
    * @param style the text style to use.
@@ -791,6 +822,11 @@
       l.setForeground(PROGRESS_COLOR);
       break;
 
+    case INSTRUCTIONS:
+      l.setFont(INSTRUCTIONS_FONT);
+      l.setForeground(INSTRUCTIONS_COLOR);
+      break;
+
     case TEXTFIELD:
       l.setFont(UIFactory.TEXTFIELD_FONT);
       l.setForeground(TEXTFIELD_COLOR);
@@ -1279,6 +1315,24 @@
     }
     return tooltip;
   }
+
+  private static ListCellRenderer makeCellRenderer(final TextStyle textStyle)
+  {
+    ListCellRenderer renderer = new ListCellRenderer()
+    {
+      public Component getListCellRendererComponent(JList list,
+          Object value,
+          int index,
+          boolean isSelected,
+          boolean cellHasFocus)
+      {
+        JLabel l = makeJLabel(IconType.NO_ICON, (String)value, textStyle);
+        l.setBorder(new EmptyBorder(TOP_INSET_SECONDARY_FIELD, 0, 0, 0));
+        return l;
+      }
+    };
+    return renderer;
+  }
 }
 
 /**

--
Gitblit v1.10.0