From 9fad2a52a884da67ebda5f4d2c5538bef14d21ba Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 29 Jun 2004 22:44:13 +0000 Subject: [PATCH] ICU-3501 Fix compiler warnings, and some GUI updating issues. X-SVN-Rev: 15953 --- tools/unicodetools/com/ibm/rbm/Bundle.java | 22 ++++++--- .../unicodetools/com/ibm/rbm/Preferences.java | 15 ++---- .../unicodetools/com/ibm/rbm/RBExporter.java | 6 --- .../com/ibm/rbm/RBICUExporter.java | 4 +- .../unicodetools/com/ibm/rbm/RBImporter.java | 49 ++++++++++--------- .../com/ibm/rbm/RBJavaExporter.java | 2 +- tools/unicodetools/com/ibm/rbm/RBManager.java | 40 +++++---------- .../unicodetools/com/ibm/rbm/RBReporter.java | 9 ++-- .../com/ibm/rbm/RBReporterScanner.java | 11 ++--- .../com/ibm/rbm/RBTMXExporter.java | 7 +-- .../com/ibm/rbm/RBTMXImporter.java | 2 +- tools/unicodetools/com/ibm/rbm/Resources.java | 3 +- .../com/ibm/rbm/gui/AboutDialog.java | 8 +-- .../rbm/gui/BundleGroupCreationDialog.java | 2 +- .../ibm/rbm/gui/BundleItemCreationDialog.java | 2 +- .../com/ibm/rbm/gui/BundleItemDialog.java | 2 +- .../com/ibm/rbm/gui/PreferencesDialog.java | 2 +- .../com/ibm/rbm/gui/RBGroupPanel.java | 16 +++--- .../com/ibm/rbm/gui/RBManagerGUI.java | 12 +++-- .../com/ibm/rbm/gui/RBProjectItemPanel.java | 7 +-- .../com/ibm/rbm/gui/RBStatisticsPanel.java | 9 ++-- .../ibm/rbm/gui/ResourceCreationDialog.java | 4 -- 22 files changed, 102 insertions(+), 132 deletions(-) diff --git a/tools/unicodetools/com/ibm/rbm/Bundle.java b/tools/unicodetools/com/ibm/rbm/Bundle.java index 79ffd78e510..7c5491b5a53 100644 --- a/tools/unicodetools/com/ibm/rbm/Bundle.java +++ b/tools/unicodetools/com/ibm/rbm/Bundle.java @@ -22,8 +22,10 @@ import com.ibm.rbm.gui.RBManagerGUI; */ public class Bundle { - // The following public class variables reflect the various properties that can be included as - // meta-data in a resource bundle formatted by RBManager + /** + * The following public class variables reflect the various properties that can be included as + * meta-data in a resource bundle formatted by RBManager + */ public String name; /** * The encoding of the bundle (e.g. 'en', 'en_US', 'de', etc.) @@ -111,9 +113,11 @@ public class Bundle { */ public String getLanguageEncoding() { - if (encoding == null) return null; - if (encoding.indexOf("_") >= 0) return encoding.substring(0,encoding.indexOf("_")); - else return encoding.trim(); + if (encoding == null) + return null; + if (encoding.indexOf("_") >= 0) + return encoding.substring(0,encoding.indexOf("_")); + return encoding.trim(); } /** @@ -122,11 +126,13 @@ public class Bundle { */ public String getCountryEncoding() { - if (encoding == null || encoding.indexOf("_") < 0) return null; + if (encoding == null || encoding.indexOf("_") < 0) + return null; // Strip off the language String workStr = encoding.substring(encoding.indexOf("_")+1,encoding.length()); - if (workStr.indexOf("_") >= 0) return workStr.substring(0,encoding.indexOf("_")); - else return workStr.trim(); + if (workStr.indexOf("_") >= 0) + return workStr.substring(0,encoding.indexOf("_")); + return workStr.trim(); } /** diff --git a/tools/unicodetools/com/ibm/rbm/Preferences.java b/tools/unicodetools/com/ibm/rbm/Preferences.java index 91666ebb326..3d94b8abb2c 100644 --- a/tools/unicodetools/com/ibm/rbm/Preferences.java +++ b/tools/unicodetools/com/ibm/rbm/Preferences.java @@ -1,14 +1,8 @@ /* ***************************************************************************** - * Copyright (C) 2000-2002, International Business Machines Corporation and * + * Copyright (C) 2000-2004, International Business Machines Corporation and * * others. All Rights Reserved. * ***************************************************************************** - * - * $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/rbm/Preferences.java,v $ - * $Date: 2002/05/20 18:53:10 $ - * $Revision: 1.1 $ - * - ***************************************************************************** */ package com.ibm.rbm; @@ -20,15 +14,12 @@ import java.io.*; * individual user preferences for the application. All of the public methods defined * in this class are static, and so the class need not be instantiated. * - * @author Jared Jackson - Email: jjared@almaden.ibm.com + * @author Jared Jackson * @see com.ibm.rbm.RBManager */ public class Preferences { // Default values private static final int NUM_RECENT_FILES = 4; - private static final int _Y = 2002; - private static final int _M = 6; - private static final int _D = 15; private static final String EMPTY_STRING = ""; private static Properties prop; @@ -187,4 +178,4 @@ public class Preferences { init(); } */ -} \ No newline at end of file +} diff --git a/tools/unicodetools/com/ibm/rbm/RBExporter.java b/tools/unicodetools/com/ibm/rbm/RBExporter.java index d7b1182fbe5..7da58040d36 100644 --- a/tools/unicodetools/com/ibm/rbm/RBExporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBExporter.java @@ -20,11 +20,5 @@ import javax.swing.*; public abstract class RBExporter { protected static JFileChooser chooser; - /** - * Basic empty constructor. - */ - public RBExporter() { - } - public abstract void export(RBManager rbm) throws IOException; } \ No newline at end of file diff --git a/tools/unicodetools/com/ibm/rbm/RBICUExporter.java b/tools/unicodetools/com/ibm/rbm/RBICUExporter.java index ca22d8a2001..babc11e6a97 100644 --- a/tools/unicodetools/com/ibm/rbm/RBICUExporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBICUExporter.java @@ -145,7 +145,7 @@ public class RBICUExporter extends RBExporter { int len = str.length(); boolean quoteRequired = !isKey; for (int idx = 0; idx < len; idx++) { - char ch = str.charAt(idx); + int ch = str.charAt(idx); if (ch <= ' ' || '~' < ch) { if (isKey && ch != ' ') { IOException e = new IOException(str + " needs to use invariant characters for the key."); @@ -157,7 +157,7 @@ public class RBICUExporter extends RBExporter { if ((ch & 0xf800) == 0xd800) { // We assume that we found a valid UTF-16 string with a surrogate int ch2 = str.charAt(idx++); - int chSurrogate = ((((int)ch)<<10)+(ch2)-((0xd800<<10)+0xdc00-0x10000)); + int chSurrogate = (((ch)<<10)+(ch2)-((0xd800<<10)+0xdc00-0x10000)); zeros = "00000000"; hexNum = Integer.toHexString(chSurrogate); diff --git a/tools/unicodetools/com/ibm/rbm/RBImporter.java b/tools/unicodetools/com/ibm/rbm/RBImporter.java index ebe81d6f1e0..f72ea21da21 100644 --- a/tools/unicodetools/com/ibm/rbm/RBImporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBImporter.java @@ -96,7 +96,8 @@ public class RBImporter extends JDialog { protected void beginImport() throws IOException { // To be overwritten - if (!pathSet) return; + if (!pathSet) + throw new IOException("Path not set yet"); } protected void chooseFile() { @@ -216,30 +217,30 @@ public class RBImporter extends JDialog { protected void resolveEncodings(Vector v) { for (int i=0; i < v.size(); i++) { String encoding = (String)v.elementAt(i); - if (encoding == null || encoding.equals("")) continue; - if (rbm.hasResource(encoding)) continue; - else { - // We need to resolve this conflict - if (this.getFileConflictOption() == FILE_OPTION_IGNORE) continue; - else if (this.getFileConflictOption() == FILE_OPTION_POPULATE) { + if (encoding == null || encoding.equals("") || rbm.hasResource(encoding)) { + continue; + } + + // We need to resolve this conflict + if (this.getFileConflictOption() == FILE_OPTION_IGNORE) continue; + else if (this.getFileConflictOption() == FILE_OPTION_POPULATE) { + rbm.createResource(null, null, null, encoding, null, null, null, true); + } else if (this.getFileConflictOption() == FILE_OPTION_EMPTY) { + rbm.createResource(null, null, null, encoding, null, null, null, true); + } else if (this.getFileConflictOption() == FILE_OPTION_PROMPT) { + String options[] = { Resources.getTranslation("import_file_conflict_generate_populate"), + Resources.getTranslation("import_file_conflict_generate_empty"), + Resources.getTranslation("import_file_conflict_ignore")}; + + String result = (String)JOptionPane.showInputDialog(this, Resources.getTranslation("import_file_conflict_choose", encoding), + Resources.getTranslation("import_file_conflicts"), JOptionPane.QUESTION_MESSAGE, + null, options, options[0]); + if (result == null) continue; + if (result.equals(Resources.getTranslation("import_file_conflict_ignore"))) continue; + else if (result.equals(Resources.getTranslation("import_file_conflict_generate_populate"))) { rbm.createResource(null, null, null, encoding, null, null, null, true); - } else if (this.getFileConflictOption() == FILE_OPTION_EMPTY) { - rbm.createResource(null, null, null, encoding, null, null, null, true); - } else if (this.getFileConflictOption() == FILE_OPTION_PROMPT) { - String options[] = { Resources.getTranslation("import_file_conflict_generate_populate"), - Resources.getTranslation("import_file_conflict_generate_empty"), - Resources.getTranslation("import_file_conflict_ignore")}; - - String result = (String)JOptionPane.showInputDialog(this, Resources.getTranslation("import_file_conflict_choose", encoding), - Resources.getTranslation("import_file_conflicts"), JOptionPane.QUESTION_MESSAGE, - null, options, options[0]); - if (result == null) continue; - if (result.equals(Resources.getTranslation("import_file_conflict_ignore"))) continue; - else if (result.equals(Resources.getTranslation("import_file_conflict_generate_populate"))) { - rbm.createResource(null, null, null, encoding, null, null, null, true); - } else if (result.equals(Resources.getTranslation("import_file_conflict_generate_empty"))) { - rbm.createResource(null, null, null, encoding, null, null, null, false); - } + } else if (result.equals(Resources.getTranslation("import_file_conflict_generate_empty"))) { + rbm.createResource(null, null, null, encoding, null, null, null, false); } } } diff --git a/tools/unicodetools/com/ibm/rbm/RBJavaExporter.java b/tools/unicodetools/com/ibm/rbm/RBJavaExporter.java index 075b00c8cbb..c1648fc9d7d 100644 --- a/tools/unicodetools/com/ibm/rbm/RBJavaExporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBJavaExporter.java @@ -44,7 +44,7 @@ public class RBJavaExporter extends RBExporter { return false; } }); - } // end if + } } public void export(RBManager rbm) throws IOException { diff --git a/tools/unicodetools/com/ibm/rbm/RBManager.java b/tools/unicodetools/com/ibm/rbm/RBManager.java index e3d8d2d1e55..0fd2dbc537f 100644 --- a/tools/unicodetools/com/ibm/rbm/RBManager.java +++ b/tools/unicodetools/com/ibm/rbm/RBManager.java @@ -113,9 +113,6 @@ public class RBManager { // Count the number of language files and set up the encoding and dictionary data int numLanguages = 1; String NLSbaseClass = null; - String NLSlanguage = null; - String NLScountry = null; - String NLSvariant = null; String NLSpostfix = null; if (mainFile.getName().indexOf(".") >= 0) { @@ -168,7 +165,6 @@ public class RBManager { // Read in the entries from the main file String line; - int index = 0; // Set the dictionary for the main file Bundle dict = new Bundle(encodings[0]); bundles.addElement(dict); @@ -231,7 +227,7 @@ public class RBManager { if (tag.startsWith("{")) { if (tag.indexOf("}") < 0) continue; String lookup = tag.substring(1,tag.indexOf("}")); - item.getLookups().put(lookup,(String) descriptors.get(tag)); + item.getLookups().put(lookup, descriptors.get(tag)); } } } @@ -265,7 +261,7 @@ public class RBManager { allBundleKeys = new Vector(); Enumeration enum = ((Bundle)bundles.elementAt(0)).allItems.keys(); while (enum.hasMoreElements()) { - allBundleKeys.addElement((String)enum.nextElement()); + allBundleKeys.addElement(enum.nextElement()); } // Now go through all of the other languages @@ -280,7 +276,6 @@ public class RBManager { p = new Properties(); p.load(new FileInputStream(tempFile)); - index = 0; // Set the dictionary for the main file dict = new Bundle(encodings[i]); bundles.addElement(dict); @@ -334,7 +329,7 @@ public class RBManager { if (tag.startsWith("{")) { if (tag.indexOf("}") < 0) continue; String lookup = tag.substring(1,tag.indexOf("}")); - item.getLookups().put(lookup,(String) descriptors.get(tag)); + item.getLookups().put(lookup, descriptors.get(tag)); } } } @@ -474,7 +469,7 @@ public class RBManager { String oldName = item.getKey(); String oldComment = item.getComment(); String oldValue = item.getTranslation(); - String oldGroupName = item.getParentGroup().getName(); + //String oldGroupName = item.getParentGroup().getName(); // Loop through the bundles for (int i = 0; i < bundles.size(); i++) { Bundle bundle = (Bundle)bundles.elementAt(i); @@ -847,6 +842,9 @@ public class RBManager { return baseClass; } + /** + * A Vector of NLSbundles, one for each language + */ public Vector getBundles() { return bundles; } @@ -907,36 +905,22 @@ public class RBManager { } // Checks an array of strings to see if it contains a particular string - private static boolean arrayContains(String[] array, String match) { +/* private static boolean arrayContains(String[] array, String match) { for (int i = 0; i < array.length; i++) { if (array[i].equals(match)) return true; } return false; - } + }*/ // Prints the usage of the program when called from main - private static void printUsage() { +/* private static void printUsage() { String usage = new String(); usage += "Usage:\n\njava com.ibm.almaden.TempusFugit.Tools.RBManager fileName ((-r | -d) encoding?)?"; usage += "\n\n fileName -> The file (and path?) representing the main NLS resource\n\t\t(i.e. TempusFugit.resources)\n"; usage += " encoding -> Returns results for only the language encoding specified\n"; usage += " flag -r -> Gives only a status report on the state of the translations\n"; System.out.println(usage); - } + }*/ - // Given a language encoding, returns the name of the language if known, otherwise returns the given parameter - // Example: decodeLanguageName("de"); returns "German" - - private static String decodeLanguageName(String encoding) { - // This should probably be done with a hash table - if (encoding.equalsIgnoreCase("de")) return "German"; - else if (encoding.equalsIgnoreCase("en_us")) return "U.S. English"; - else if (encoding.equalsIgnoreCase("en_ca")) return "Canadian English"; - else if (encoding.equalsIgnoreCase("fi")) return "Finnish"; - else if (encoding.equalsIgnoreCase("fr")) return "French"; - else if (encoding.equalsIgnoreCase("sv")) return "Swedish"; - else if (encoding.equalsIgnoreCase("kr")) return "Korean"; - return encoding; - } -} // ListAllInstances +} diff --git a/tools/unicodetools/com/ibm/rbm/RBReporter.java b/tools/unicodetools/com/ibm/rbm/RBReporter.java index cd5731c6832..b67f9071f21 100644 --- a/tools/unicodetools/com/ibm/rbm/RBReporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBReporter.java @@ -1157,11 +1157,12 @@ public class RBReporter extends JFrame { } public static void main(String args[]) { + RBReporter reporter; if (args.length == 1) { if (args[0].equals("-gui")) { - RBReporter reporter = new RBReporter(true); + reporter = new RBReporter(true); } else if (args[0].equals("-now")) { - RBReporter reporter = new RBReporter(false); + reporter = new RBReporter(false); try { reporter.generateReports(); System.out.println("RBReporter: Generation of reports successful. " + new Date()); @@ -1170,14 +1171,14 @@ public class RBReporter extends JFrame { } reporter.thisWindowClosing(null); } else if (args[0].equals("-line")) { - RBReporter reporter = new RBReporter(false); + reporter = new RBReporter(false); if (!reporter.running) reporter.toggleStatus(); System.out.println("RBReporter: Next Report at " + reporter.nextReport.toString()); } else { System.out.println(getUsage()); } } else if (args.length == 0) { - RBReporter reporter = new RBReporter(true); + reporter = new RBReporter(true); } else { System.out.println(getUsage()); } diff --git a/tools/unicodetools/com/ibm/rbm/RBReporterScanner.java b/tools/unicodetools/com/ibm/rbm/RBReporterScanner.java index ccba62bc4fd..41e848a0306 100644 --- a/tools/unicodetools/com/ibm/rbm/RBReporterScanner.java +++ b/tools/unicodetools/com/ibm/rbm/RBReporterScanner.java @@ -140,8 +140,7 @@ public class RBReporterScanner { if (recurse) { File children[] = directory.listFiles(new java.io.FileFilter(){ public boolean accept(File f) { - if (f.isDirectory()) return true; - else return false; + return f.isDirectory(); } public String getDescription() { @@ -272,11 +271,11 @@ class ParseRule { //before_index = source.indexOf(before, before_index); after_index = -1; after_index = source.indexOf(after, before_index + before.length()+1); - if (after_index < 0 || before_index < 0 || before.length() < 0) break; - else { - v.addElement(source.substring(before_index + before.length(), after_index)); - before_index = after_index; + if (after_index < 0 || before_index < 0 || before.length() < 0) { + break; } + v.addElement(source.substring(before_index + before.length(), after_index)); + before_index = after_index; } } else { // Before non-empty, after empty diff --git a/tools/unicodetools/com/ibm/rbm/RBTMXExporter.java b/tools/unicodetools/com/ibm/rbm/RBTMXExporter.java index 034a5fcf5a5..4783438702d 100644 --- a/tools/unicodetools/com/ibm/rbm/RBTMXExporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBTMXExporter.java @@ -85,8 +85,10 @@ public class RBTMXExporter extends RBExporter { if (variant != null && !variant.equals("")) { //variant = variant.toUpperCase(); return language + "-" + country + "-" + variant; - } else return language + "-" + country; - } else return language; + } + return language + "-" + country; + } + return language; } } return ""; @@ -143,7 +145,6 @@ public class RBTMXExporter extends RBExporter { if (base_name.endsWith(".tmx")) base_name = base_name.substring(0,base_name.length()-4); String file_name = base_name + ".tmx"; - StringBuffer buffer = new StringBuffer(); Vector bundle_v = rbm.getBundles(); Bundle main_bundle = (Bundle)bundle_v.elementAt(0); diff --git a/tools/unicodetools/com/ibm/rbm/RBTMXImporter.java b/tools/unicodetools/com/ibm/rbm/RBTMXImporter.java index 6ce8a2fb8a5..bac0645ace0 100644 --- a/tools/unicodetools/com/ibm/rbm/RBTMXImporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBTMXImporter.java @@ -78,7 +78,7 @@ public class RBTMXImporter extends RBImporter { while (node != null && (node.getNodeType() != Node.ELEMENT_NODE || !(node.getNodeName().equalsIgnoreCase("header")))) { node = node.getNextSibling(); } - ElementImpl header = (ElementImpl)node; + //ElementImpl header = (ElementImpl)node; node = root.getFirstChild(); while (node != null && (node.getNodeType() != Node.ELEMENT_NODE || !(node.getNodeName().equalsIgnoreCase("body")))) { node = node.getNextSibling(); diff --git a/tools/unicodetools/com/ibm/rbm/Resources.java b/tools/unicodetools/com/ibm/rbm/Resources.java index 62e1409ae7d..245e4e972d3 100644 --- a/tools/unicodetools/com/ibm/rbm/Resources.java +++ b/tools/unicodetools/com/ibm/rbm/Resources.java @@ -76,10 +76,9 @@ public class Resources { */ public static String[] getAvailableLocales() { - Locale loc[] = null; + //Locale loc[] = null; String list[] = null; Vector locVect = new Vector(); -// try { try { URL resURL = ClassLoader.getSystemResource("com/ibm/rbm/resources/RBManager.properties"); JarURLConnection resConnection = (JarURLConnection)resURL.openConnection(); diff --git a/tools/unicodetools/com/ibm/rbm/gui/AboutDialog.java b/tools/unicodetools/com/ibm/rbm/gui/AboutDialog.java index 145958fd4d6..e9142b13a18 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/AboutDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/AboutDialog.java @@ -14,7 +14,7 @@ import javax.swing.*; /** A dialog displaying information about this application */ class AboutDialog { - public static JDialog dialog = null; + private static JDialog dialog = null; public static void showDialog(Frame parent) { if (dialog == null) { @@ -53,14 +53,10 @@ class AboutDialog { dialog.getContentPane().add(logoLabel, BorderLayout.WEST); dialog.getContentPane().add(panel, BorderLayout.CENTER); - dialog.addMouseListener(new MouseListener() { - public void mousePressed(MouseEvent ev) { } + dialog.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent ev) { hideDialog(); } - public void mouseEntered(MouseEvent ev) { } - public void mouseExited(MouseEvent ev) { } - public void mouseClicked(MouseEvent ev) { } }); //dialog.validate(); diff --git a/tools/unicodetools/com/ibm/rbm/gui/BundleGroupCreationDialog.java b/tools/unicodetools/com/ibm/rbm/gui/BundleGroupCreationDialog.java index 3fe49014920..2b4e3e23ef2 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/BundleGroupCreationDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/BundleGroupCreationDialog.java @@ -69,7 +69,7 @@ class BundleGroupCreationDialog extends JDialog { } } - public void initComponents(){ + private void initComponents(){ // Error check if (rbm == null) { String alert = Resources.getTranslation("error_no_bundle_for_group"); diff --git a/tools/unicodetools/com/ibm/rbm/gui/BundleItemCreationDialog.java b/tools/unicodetools/com/ibm/rbm/gui/BundleItemCreationDialog.java index 2608c0448fc..2ede566baa7 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/BundleItemCreationDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/BundleItemCreationDialog.java @@ -160,7 +160,7 @@ class BundleItemCreationDialog extends JDialog { } } - public void initComponents(){ + private void initComponents(){ enableEvents(AWTEvent.KEY_EVENT_MASK); // Error check if (rbm == null || rbm.getBundles() == null) { diff --git a/tools/unicodetools/com/ibm/rbm/gui/BundleItemDialog.java b/tools/unicodetools/com/ibm/rbm/gui/BundleItemDialog.java index a2852cfca7c..785d9e67f6b 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/BundleItemDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/BundleItemDialog.java @@ -84,7 +84,7 @@ class BundleItemDialog extends JDialog implements ActionListener { } } - public void initComponents(){ + private void initComponents(){ // Error check if (item == null) closeWindow(); if (!firstInit) closeWindow(); diff --git a/tools/unicodetools/com/ibm/rbm/gui/PreferencesDialog.java b/tools/unicodetools/com/ibm/rbm/gui/PreferencesDialog.java index 42c45ec2cba..efe22faec16 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/PreferencesDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/PreferencesDialog.java @@ -207,7 +207,7 @@ class PreferencesDialog extends JDialog { setVisible(true); } - public void thisWindowClosing() { + private void thisWindowClosing() { setVisible(false); dispose(); } diff --git a/tools/unicodetools/com/ibm/rbm/gui/RBGroupPanel.java b/tools/unicodetools/com/ibm/rbm/gui/RBGroupPanel.java index 8e3be4c686e..a27cfeb98d7 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/RBGroupPanel.java +++ b/tools/unicodetools/com/ibm/rbm/gui/RBGroupPanel.java @@ -106,14 +106,14 @@ class RBGroupPanel extends JPanel { GroupItemsTableModel model = (GroupItemsTableModel)jTableGroupTable.getModel(); BundleItem item = model.getBundleItem(row); if (item.getParentGroup() != null && item.getParentGroup().getParentBundle() != null) { - Bundle bundle = item.getParentGroup().getParentBundle(); - bundle.removeItem(item.getKey()); + Bundle parentBundle = item.getParentGroup().getParentBundle(); + parentBundle.removeItem(item.getKey()); } model.update(); } } - public void initComponents() { + private void initComponents() { // Initialize components if (bundle != null) { jLabelGroupTitle = new JLabel(bundle.name); @@ -252,8 +252,7 @@ class RBGroupPanel extends JPanel { jLabelGroupTitle.setFont(new Font("SansSerif",Font.PLAIN,18)); // Add the listeners - jListGroup.addMouseListener(new MouseListener() { - public void mousePressed(MouseEvent ev) { } + jListGroup.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent ev) { if(ev.getClickCount() == 2 && ev.getSource() instanceof JList) { // A double click means they want to edit a bundle item @@ -265,9 +264,6 @@ class RBGroupPanel extends JPanel { panel.listener.rbm, panel.listener, Resources.getTranslation("dialog_title_edit_item"), true); } } - public void mouseReleased(MouseEvent ev) { } - public void mouseEntered(MouseEvent ev) { } - public void mouseExited(MouseEvent ev) { } }); createItemButton.addActionListener(new ActionListener(){ @@ -481,7 +477,9 @@ class GroupComboActionListener implements ActionListener { ((GroupItemsTableModel)table.getModel()).setGroup((BundleGroup)cbox.getSelectedItem()); //table.validate(); Container c = table.getParent(); - while (!(c instanceof RBGroupPanel)) { c = c.getParent(); } + while (!(c instanceof RBGroupPanel)) { + c = c.getParent(); + } ((RBGroupPanel)c).updateComponents(); } else if (list != null) { list.setListData(((BundleGroup)cbox.getSelectedItem()).getItemsAsVector()); diff --git a/tools/unicodetools/com/ibm/rbm/gui/RBManagerGUI.java b/tools/unicodetools/com/ibm/rbm/gui/RBManagerGUI.java index 3858cb5a820..82f5e485502 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/RBManagerGUI.java +++ b/tools/unicodetools/com/ibm/rbm/gui/RBManagerGUI.java @@ -797,13 +797,13 @@ public class RBManagerGUI extends JFrame implements ActionListener, MouseListene // Add the base class root.add(new DefaultMutableTreeNode(mainBundle)); - DefaultMutableTreeNode currNode = root; + //DefaultMutableTreeNode currNode = root; for (int i = 1; i < rbm.getBundles().size(); i++) { Bundle currBundle = (Bundle)rbm.getBundles().elementAt(i); String variant = currBundle.getVariantEncoding(); String country = currBundle.getCountryEncoding(); String language = currBundle.getLanguageEncoding(); - DefaultMutableTreeNode languageNode = null; + //DefaultMutableTreeNode languageNode = null; // Look for a node representing this language if (language == null || language.equals("")) continue; boolean languageNodeFound = false; @@ -1463,8 +1463,9 @@ class GroupItemsTableModel extends AbstractTableModel { } public BundleItem getBundleItem(int row) { - if (row >= group.getItemCount()) return null; - return (BundleItem)group.getBundleItem(row); + if (row >= group.getItemCount()) + return null; + return group.getBundleItem(row); } public void update() { @@ -1483,6 +1484,7 @@ class UntranslatedItemsTableModel extends AbstractTableModel { public void setBundle(Bundle bundle) { this.bundle = bundle; + update(); } public int getColumnCount() { return 3; } @@ -1725,7 +1727,7 @@ class RBManagerMenuBar extends JMenuBar { boolean xmlAvailable; try { - Class cl = Class.forName("org.apache.xerces.parsers.DOMParser"); + Class.forName("org.apache.xerces.parsers.DOMParser"); xmlAvailable = true; } catch (ClassNotFoundException e) { xmlAvailable = false; diff --git a/tools/unicodetools/com/ibm/rbm/gui/RBProjectItemPanel.java b/tools/unicodetools/com/ibm/rbm/gui/RBProjectItemPanel.java index 13d2800e9a9..b575e89175e 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/RBProjectItemPanel.java +++ b/tools/unicodetools/com/ibm/rbm/gui/RBProjectItemPanel.java @@ -76,12 +76,13 @@ class RBProjectItemPanel extends JPanel implements ActionListener { BundleItem item = rbundle.getBundleItem(key); if (item != null) { item.setTranslation(translation); - System.out.println("Set translation to : " + translation); + RBManagerGUI.debugMsg("Set translation to : " + translation); } else - System.out.println("Item was null"); + RBManagerGUI.debugMsg("Item was null"); break; - } else System.out.println("Compared " + rbundle.encoding + " with " + encoding); + } + RBManagerGUI.debugMsg("Compared " + rbundle.encoding + " with " + encoding); } gui.saveResources(bundle, encoding); } diff --git a/tools/unicodetools/com/ibm/rbm/gui/RBStatisticsPanel.java b/tools/unicodetools/com/ibm/rbm/gui/RBStatisticsPanel.java index fe25e2f6ff5..f756252b8f7 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/RBStatisticsPanel.java +++ b/tools/unicodetools/com/ibm/rbm/gui/RBStatisticsPanel.java @@ -333,10 +333,11 @@ class RBStatisticsPanel extends JPanel { jTextFieldStatsLanguage.setText(bundle.language == null ? "" : bundle.language); jTextFieldStatsCountry.setText(bundle.country == null ? "" : bundle.country); jTextFieldStatsVariant.setText(bundle.variant == null ? "" : bundle.variant); - - } else if (rbm != null) { - - } else { + jLabelStatsNumTrans.setText(Resources.getTranslation("languagestats_item_count") + " " + + String.valueOf(bundle.allItems.size())); + jLabelStatsNumUntrans.setText(Resources.getTranslation("languagestats_translation_count") + + String.valueOf(untranslated)); + } else if (rbm == null) { removeAll(); } diff --git a/tools/unicodetools/com/ibm/rbm/gui/ResourceCreationDialog.java b/tools/unicodetools/com/ibm/rbm/gui/ResourceCreationDialog.java index 0f2d811457b..ceef59ad7df 100644 --- a/tools/unicodetools/com/ibm/rbm/gui/ResourceCreationDialog.java +++ b/tools/unicodetools/com/ibm/rbm/gui/ResourceCreationDialog.java @@ -125,10 +125,6 @@ class ResourceCreationDialog extends JDialog { variPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Resources.getTranslation("dialog_variant"))); - Dimension encDim = new Dimension(50,20); - Dimension namDim = new Dimension(350,20); - Dimension othDim = new Dimension(400,20); - titleField.setColumns(30); commentField.setColumns(30); managerField.setColumns(30);