[jsword-svn] r1035 - in trunk/common-swing: .settings src/main/java/org/crosswire/common/config/swing src/main/java/org/crosswire/common/progress/swing src/main/java/org/crosswire/common/swing src/main/java/org/crosswire/common/swing/desktop

dmsmith at crosswire.org dmsmith at crosswire.org
Sun Mar 5 05:37:42 MST 2006


Author: dmsmith
Date: 2006-03-05 05:37:21 -0700 (Sun, 05 Mar 2006)
New Revision: 1035

Modified:
   trunk/common-swing/.settings/org.eclipse.jdt.core.prefs
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/MapField.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TabbedConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java
   trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/MapTableModel.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ViewManager.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/Viewable.java
Log:
Updated to Java 5

Modified: trunk/common-swing/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common-swing/.settings/org.eclipse.jdt.core.prefs	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/.settings/org.eclipse.jdt.core.prefs	2006-03-05 12:37:21 UTC (rev 1035)
@@ -1,4 +1,4 @@
-#Thu Mar 02 07:13:19 EST 2006
+#Sat Mar 04 11:20:36 EST 2006
 eclipse.preferences.version=1
 org.eclipse.jdt.core.builder.cleanOutputFolder=clean
 org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -56,7 +56,7 @@
 org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
 org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -193,7 +193,7 @@
             fields.put(key, field);
 
             // Get or create a FieldPanel
-            FormPane card = (FormPane) decks.get(path);
+            FormPane card = decks.get(path);
 
             if (card == null)
             {
@@ -228,11 +228,11 @@
 
         try
         {
-            Field field = (Field) fields.get(key);
+            Field field = fields.get(key);
             if (field != null)
             {
                 fields.remove(field);
-                FormPane card = (FormPane) decks.get(path);
+                FormPane card = decks.get(path);
 
                 // Remove field from card.
                 String name = Config.getLeaf(model.getFullPath()) + ':';
@@ -275,7 +275,7 @@
             try
             {
                 String key = (String) it.next();
-                Field field = (Field) fields.get(key);
+                Field field = fields.get(key);
                 String value = field.getValue();
 
                 if (value == null)
@@ -304,7 +304,7 @@
             {
                 String key = (String) it.next();
 
-                Field field = (Field) fields.get(key);
+                Field field = fields.get(key);
                 String value = config.getLocal(key);
 
                 if (field == null)
@@ -351,12 +351,12 @@
     /**
      * A fast way to get at the configuration panels
      */
-    protected Map decks = new HashMap();
+    protected Map<String, FormPane> decks = new HashMap<String, FormPane>();
 
     /**
      * The set of fields that we are displaying
      */
-    protected Map fields = new HashMap();
+    protected Map<String, Field> fields = new HashMap<String, Field>();
 
     /**
      * The large task icon

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -59,7 +59,7 @@
         tree = new JTree();
         JScrollPane scroll = new JScrollPane();
         CustomTreeCellRenderer render = new CustomTreeCellRenderer();
-        comps = new HashMap();
+        comps = new HashMap<String, Component>();
 
         // Hack: tree depends on it being a Color not a sub of it.
         Color orig = UIManager.getColor("control"); //$NON-NLS-1$
@@ -139,13 +139,13 @@
     {
         try
         {
-            Field field = (Field) fields.get(key);
+            Field field = fields.get(key);
             if (field != null)
             {
                 fields.remove(field);
             }
 
-            Component comp = (Component) comps.get(key);
+            Component comp = comps.get(key);
             if (comp != null)
             {
                 comps.remove(key);
@@ -203,7 +203,7 @@
     /**
      * A hash of components
      */
-    protected Map comps;
+    protected Map<String, Component> comps;
 
     /**
      * Serialization ID
@@ -222,7 +222,7 @@
         @Override
         protected List getChildren(String path)
         {
-            List retcode = new ArrayList();
+            List<String> retcode = new ArrayList<String>();
 
             Iterator it = config.getNames();
             while (it.hasNext())

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/MapField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/MapField.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/MapField.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -117,7 +117,7 @@
      * Set the current value using a Map
      * @param value The new text
      */
-    public void setMap(Map value)
+    public void setMap(Map<String, String> value)
     {
         tableModel.setMap(value);
         table.setModel(tableModel);
@@ -238,7 +238,7 @@
          */
         protected NamedMapTableModel()
         {
-            super(new Hashtable());
+            super(new Hashtable<String, String>());
         }
 
         /* (non-Javadoc)

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TabbedConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TabbedConfigEditor.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TabbedConfigEditor.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -120,7 +120,7 @@
                     if (index == -1)
                     {
                         // log.fine("  Adding named panel");
-                        FormPane card = (FormPane) decks.get(path);
+                        FormPane card = decks.get(path);
                         if (card != null)
                         {
                             card.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@@ -134,7 +134,7 @@
                         if (comp instanceof JTabbedPane)
                         {
                             nest = (JTabbedPane) comp;
-                            FormPane card = (FormPane) decks.get(path);
+                            FormPane card = decks.get(path);
                             if (card != null)
                             {
                                 card.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -158,7 +158,7 @@
 
         // Sort the tree out
         String path = Config.getPath(model.getFullPath());
-        FormPane card = (FormPane) decks.get(path);
+        FormPane card = decks.get(path);
         if (card != null && card.getParent() == null)
         {
             JScrollPane scroll = new JScrollPane(card);
@@ -177,7 +177,7 @@
 
         // Sort the tree out
         String path = Config.getPath(model.getFullPath());
-        FormPane card = (FormPane) decks.get(path);
+        FormPane card = decks.get(path);
         if (card != null && card.isEmpty())
         {
             deck.remove(card.getParent());
@@ -281,7 +281,7 @@
          */
         protected List getChildren(String path)
         {
-            List retcode = new ArrayList();
+            List<String> retcode = new ArrayList<String>();
 
             Iterator it = config.getPaths();
             while (it.hasNext())

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -77,7 +77,7 @@
     {
         actions = new ActionFactory(WizardConfigEditor.class, this);
 
-        names = new ArrayList();
+        names = new ArrayList<String>();
         layout = new CardLayout();
         deck = new JPanel(layout);
 
@@ -91,7 +91,7 @@
             int last_dot = key.lastIndexOf('.');
             String path = key.substring(0, last_dot);
 
-            FormPane card = (FormPane) decks.get(path);
+            FormPane card = decks.get(path);
             if (card.getParent() == null)
             {
                 JScrollPane scroll = new JScrollPane(card);
@@ -292,7 +292,7 @@
     /**
      * The list of path names
      */
-    private List names;
+    private List<String> names;
 
     /**
      * The title for the config panels

Modified: trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsProgressBar.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -63,8 +63,8 @@
      */
     public JobsProgressBar(boolean small)
     {
-        jobs = new HashMap();
-        positions = new ArrayList();
+        jobs = new HashMap<Job, JobData>();
+        positions = new ArrayList<JobData>();
         if (small)
         {
             // They start off at 15pt (on Windows at least)
@@ -115,7 +115,7 @@
     public void workStateChanged(WorkEvent ev)
     {
         Job job = (Job) ev.getSource();
-        JobData jobdata = (JobData) jobs.get(job);
+        JobData jobdata = jobs.get(job);
         jobdata.workStateChanged(ev);
     }
 
@@ -163,7 +163,7 @@
      */
     protected synchronized void updateJob(Job job)
     {
-        JobData jobdata = (JobData) jobs.get(job);
+        JobData jobdata = jobs.get(job);
 
         int percent = job.getPercent();
         jobdata.getProgress().setString(job.getStateDescription() + ": (" + percent + "%)"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -177,7 +177,7 @@
     {
         job.removeWorkListener(this);
 
-        JobData jobdata = (JobData) jobs.get(job);
+        JobData jobdata = jobs.get(job);
 
         positions.set(jobdata.getIndex(), null);
         jobs.remove(job);
@@ -215,12 +215,12 @@
     /**
      * Where we store the currently displayed jobs
      */
-    protected Map jobs;
+    protected Map<Job, JobData> jobs;
 
     /**
      * Array telling us what y position the jobs have in the window
      */
-    private List positions;
+    private List<JobData> positions;
 
     /**
      * The font for the progress-bars
@@ -240,7 +240,7 @@
     /**
      * A simple struct to group information about a Job
      */
-    private static class JobData implements WorkListener
+    public static class JobData implements WorkListener
     {
         /**
          * Simple ctor

Modified: trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -82,8 +82,8 @@
     private void init()
     {
         noJobLabel = new JLabel(Msg.NO_JOBS.toString());
-        jobs = new HashMap();
-        positions = new ArrayList();
+        jobs = new HashMap<Job, JobData>();
+        positions = new ArrayList<JobData>();
         jobsPanel = new JPanel(new GridBagLayout());
         jobsPanel.setBorder(null);
 
@@ -171,7 +171,7 @@
      */
     protected void updateJob(Job job)
     {
-        JobData jobdata = (JobData) jobs.get(job);
+        JobData jobdata = jobs.get(job);
 
         int percent = job.getPercent();
         jobdata.getProgress().setString(percent + "%"); //$NON-NLS-1$
@@ -184,7 +184,7 @@
      */
     protected void removeJob(Job job)
     {
-        JobData jobdata = (JobData) jobs.get(job);
+        JobData jobdata = jobs.get(job);
 
         log.debug("removing job from panel at " + jobdata.getIndex() + ": " + job.getJobDescription()); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -245,12 +245,12 @@
     /**
      * Map of Jobs to JobDatas
      */
-    protected Map jobs;
+    protected Map<Job, JobData> jobs;
 
     /**
      * Array telling us what y position the jobs have in the window
      */
-    private List positions;
+    private List<JobData> positions;
 
     /**
      * The panel containing jobs

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -66,7 +66,7 @@
      */
     public ActionFactory(Class type, Object bean)
     {
-        actions = new HashMap();
+        actions = new HashMap<String, CWAction>();
 
         buildActionMap(type);
 
@@ -112,7 +112,7 @@
      */
     public Action getAction(String key)
     {
-        Action action = (CWAction) actions.get(key);
+        Action action = actions.get(key);
 
         if (action != null)
         {
@@ -444,5 +444,5 @@
     /**
      * The map of known CWActions
      */
-    private Map actions;
+    private Map<String, CWAction> actions;
 }

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -135,14 +135,14 @@
         JScrollPane textScroll = new JScrollPane(text);
         textScroll.setColumnHeaderView(label);
 
-        List causes = new ArrayList();
+        List<Throwable> causes = new ArrayList<Throwable>();
         Throwable throwable = ex;
         while (throwable != null)
         {
             causes.add(throwable);
             throwable = throwable.getCause();
         }
-        Throwable[] exs = (Throwable[]) causes.toArray(new Throwable[causes.size()]);
+        Throwable[] exs = causes.toArray(new Throwable[causes.size()]);
 
         JComboBox traces = new JComboBox();
         traces.setModel(new DefaultComboBoxModel(exs));

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -69,7 +69,7 @@
     public void removeEntry(String prompt)
     {
         JLabel label = (JLabel) comps.get(prompt + SUFFIX_LABEL);
-        Component comp = (Component) comps.get(prompt + SUFFIX_COMP);
+        Component comp = comps.get(prompt + SUFFIX_COMP);
 
         remove(label);
         remove(comp);
@@ -131,5 +131,5 @@
     /**
      * A store of the available components
      */
-    protected Hashtable comps = new Hashtable();
+    protected Hashtable<String, Component> comps = new Hashtable<String, Component>();
 }

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/MapTableModel.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/MapTableModel.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/MapTableModel.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -56,9 +56,9 @@
      * Create an internal store from a 2D array
      * @param map The table to model
      */
-    public MapTableModel(Map map)
+    public MapTableModel(Map<String, String> map)
     {
-        list = new ArrayList();
+        list = new ArrayList<StringPair>();
         setMap(map);
     }
 
@@ -66,7 +66,7 @@
      * Change the map that we report on
      * @param map The map we are getting our data from
      */
-    public void setMap(Map map)
+    public void setMap(Map<String, String> map)
     {
         this.map = map;
         list.clear();
@@ -200,7 +200,7 @@
             return null;
         }
 
-        StringPair entry = (StringPair) list.get(row);
+        StringPair entry = list.get(row);
         if (col == 0)
         {
             return entry.getKey();
@@ -214,7 +214,7 @@
      * @return String.class
      */
     @Override
-    public Class getColumnClass(int col)
+    public Class<?> getColumnClass(int col)
     {
         return String.class;
     }
@@ -244,12 +244,12 @@
      * The List that is a copy of the list.
      * A list is used for direct access performance.
      */
-    private List list;
+    private List<StringPair> list;
 
     /**
      * The backing map
      */
-    private Map map;
+    private Map<String, String> map;
 
     /**
      * The default column names

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/AbstractViewLayout.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -52,7 +52,7 @@
     protected AbstractViewLayout()
     {
         panel = new JPanel(new BorderLayout());
-        views = new ArrayList();
+        views = new ArrayList<Component>();
         listenerList = new EventListenerList();
     }
 
@@ -85,9 +85,9 @@
      * Get a snapshot of the views as a collection.
      * @return the views
      */
-    public Collection getViews()
+    public Collection<Component> getViews()
     {
-        return new ArrayList(views);
+        return new ArrayList<Component>(views);
     }
 
     /**
@@ -203,7 +203,7 @@
      */
     public Component getView(int i)
     {
-        return (Component) views.get(i);
+        return views.get(i);
     }
 
     /**
@@ -307,7 +307,7 @@
     /**
      * The list of views.
      */
-    private List views;
+    private List<Component> views;
 
     /**
      * The listeners for handling ViewEvent Listeners

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ViewManager.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ViewManager.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ViewManager.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -148,7 +148,7 @@
     /* (non-Javadoc)
      * @see org.crosswire.common.swing.desktop.Viewable#getViews()
      */
-    public Collection getViews()
+    public Collection<Component> getViews()
     {
         return getViewLayout().getViews();
     }

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/Viewable.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/Viewable.java	2006-03-05 12:36:08 UTC (rev 1034)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/Viewable.java	2006-03-05 12:37:21 UTC (rev 1035)
@@ -50,7 +50,7 @@
      * Get a snapshot of the views as a collection.
      * @return the views
      */
-    Collection getViews();
+    Collection<Component> getViews();
 
     /**
      * Get an iterator of a snapshot of views.



More information about the jsword-svn mailing list