From 80c58327faaa4873369f6bb949e62792c2f708e0 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 15 Aug 2007 21:34:53 +0000
Subject: [PATCH] This commit is a step toward getting OpenDS internationalized. There are still issues to be resolved before we can declare that we are internationalized but this commit covers the bulk of changes needed at this time.

---
 opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java |   58 ++++++++++++++++++++--------------------------------------
 1 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java b/opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java
index ce20326..f44d3d8 100644
--- a/opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java
+++ b/opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java
@@ -35,10 +35,12 @@
 
 import javax.swing.table.AbstractTableModel;
 
-import org.opends.guitools.i18n.ResourceProvider;
 import org.opends.guitools.statuspanel.BaseDNDescriptor;
 import org.opends.quicksetup.ui.SortableTableModel;
 
+import org.opends.messages.Message;
+import static org.opends.messages.AdminToolMessages.*;
+
 /**
  * This class is just a table model used to display the information about
  * databases in a table.
@@ -51,13 +53,13 @@
   private HashSet<BaseDNDescriptor> data = new HashSet<BaseDNDescriptor>();
   private ArrayList<BaseDNDescriptor> dataArray =
     new ArrayList<BaseDNDescriptor>();
-  private final String[] COLUMN_NAMES = {
-    getMsg("basedn-column"),
-    getMsg("backendid-column"),
-    getMsg("number-entries-column"),
-    getMsg("replicated-column"),
-    getMsg("missing-changes-column"),
-    getMsg("age-of-oldest-missing-change-column")
+  private final Message[] COLUMN_NAMES = {
+    INFO_BASEDN_COLUMN.get(),
+    INFO_BACKENDID_COLUMN.get(),
+    INFO_NUMBER_ENTRIES_COLUMN.get(),
+    INFO_REPLICATED_COLUMN.get(),
+    INFO_MISSING_CHANGES_COLUMN.get(),
+    INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN.get()
   };
   private int sortColumn = 0;
   private boolean sortAscending = true;
@@ -360,7 +362,7 @@
    * {@inheritDoc}
    */
   public String getColumnName(int col) {
-    return COLUMN_NAMES[col];
+    return COLUMN_NAMES[col].toString();
   }
 
   /**
@@ -468,11 +470,9 @@
     if ((rep.getDatabase().getBaseDns().size() > 1) &&
       (nEntries >= 0))
     {
-      String[] args = {
-        String.valueOf(nEntries),
-        rep.getDatabase().getBackendID()
-      };
-      v = getMsg("number-entries-multiple-suffixes-in-db", args);
+      v = INFO_NUMBER_ENTRIES_MULTIPLE_SUFFIXES_IN_DB.get(
+              String.valueOf(nEntries),
+              rep.getDatabase().getBackendID());
     }
     else
     {
@@ -499,7 +499,7 @@
     }
     else
     {
-      v = getMsg("not-applicable-label");
+      v = INFO_NOT_APPLICABLE_LABEL.get();
     }
     return v;
   }
@@ -543,7 +543,7 @@
     }
     else
     {
-      v = getMsg("not-applicable-label");
+      v = INFO_NOT_APPLICABLE_LABEL.get();
     }
     return v;
   }
@@ -555,36 +555,18 @@
    * @return the localized String describing the replication state of
    * a given Base DN.
    */
-  private String getStringForReplState(BaseDNDescriptor rep)
+  private Message getStringForReplState(BaseDNDescriptor rep)
   {
-    String s;
+    Message s;
     if (rep.getType() == BaseDNDescriptor.Type.REPLICATED)
     {
-      s = getMsg("suffix-replicated-label");
+      s = INFO_SUFFIX_REPLICATED_LABEL.get();
     }
     else
     {
-      s = getMsg("suffix-not-replicated-label");
+      s = INFO_SUFFIX_NOT_REPLICATED_LABEL.get();
     }
     return s;
   }
 
-  /**
-   * The following three methods are just commodity methods to get localized
-   * messages.
-   */
-  private String getMsg(String key)
-  {
-    return getI18n().getMsg(key);
-  }
-
-  private String getMsg(String key, String[] args)
-  {
-    return getI18n().getMsg(key, args);
-  }
-
-  private ResourceProvider getI18n()
-  {
-    return ResourceProvider.getInstance();
-  }
 }

--
Gitblit v1.10.0