JAL-1355 (basic i18n support)
[jalview.git] / src / jalview / gui / FeatureSettings.java
old mode 100755 (executable)
new mode 100644 (file)
index d8a674f..963209c
@@ -1,30 +1,28 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
  * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
  * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  */
 package jalview.gui;
 
 import java.io.*;
 import java.util.*;
+import java.util.List;
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 
@@ -33,11 +31,14 @@ import javax.swing.event.*;
 import javax.swing.table.*;
 
 import jalview.analysis.AlignmentSorter;
+import jalview.bin.Cache;
 import jalview.commands.OrderCommand;
 import jalview.datamodel.*;
 import jalview.io.*;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
 
 public class FeatureSettings extends JPanel
 {
@@ -134,7 +135,7 @@ public class FeatureSettings extends JPanel
 
     scrollPane.setViewportView(table);
 
-    dassourceBrowser = new DasSourceBrowser();
+    dassourceBrowser = new DasSourceBrowser(this);
     dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);
 
     if (af.getViewport().featuresDisplayed == null
@@ -163,24 +164,32 @@ public class FeatureSettings extends JPanel
 
     frame = new JInternalFrame();
     frame.setContentPane(this);
-    Desktop.addInternalFrame(frame, "Sequence Feature Settings", 400, 450);
-    frame
-            .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
-            {
-              public void internalFrameClosed(
-                      javax.swing.event.InternalFrameEvent evt)
-              {
-                fr.removePropertyChangeListener(change);
-              };
-            });
+    if (new jalview.util.Platform().isAMac())
+    {
+      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 475, 480);
+    }
+    else
+    {
+      Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 400, 450);
+    }
+
+    frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+    {
+      public void internalFrameClosed(
+              javax.swing.event.InternalFrameEvent evt)
+      {
+        fr.removePropertyChangeListener(change);
+        dassourceBrowser.fs = null;
+      };
+    });
     frame.setLayer(JLayeredPane.PALETTE_LAYER);
   }
 
   protected void popupSort(final int selectedRow, final String type,
           final Object typeCol, final Hashtable minmax, int x, int y)
   {
-    JPopupMenu men = new JPopupMenu("Settings for " + type);
-    JMenuItem scr = new JMenuItem("Sort by Score");
+    JPopupMenu men = new JPopupMenu(MessageManager.formatMessage("label.settings_for_param", new String[]{type}));
+    JMenuItem scr = new JMenuItem(MessageManager.getString("label.sort_by_score"));
     men.add(scr);
     final FeatureSettings me = this;
     scr.addActionListener(new ActionListener()
@@ -193,7 +202,7 @@ public class FeatureSettings extends JPanel
       }
 
     });
-    JMenuItem dens = new JMenuItem("Sort by Density");
+    JMenuItem dens = new JMenuItem(MessageManager.getString("label.sort_by_density"));
     dens.addActionListener(new ActionListener()
     {
 
@@ -272,8 +281,9 @@ public class FeatureSettings extends JPanel
                 // probably the color chooser!
                 table.setValueAt(colorChooser.getColor(), selectedRow, 1);
                 table.validate();
-                me.updateFeatureRenderer(((FeatureTableModel) table
-                        .getModel()).getData(), false);
+                me.updateFeatureRenderer(
+                        ((FeatureTableModel) table.getModel()).getData(),
+                        false);
               }
             }
           }
@@ -304,15 +314,15 @@ public class FeatureSettings extends JPanel
     Vector allGroups = new Vector();
     SequenceFeature[] tmpfeatures;
     String group;
-    for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+    for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
     {
-      if (af.getViewport().alignment.getSequenceAt(i).getDatasetSequence()
-              .getSequenceFeatures() == null)
+      if (af.getViewport().getAlignment().getSequenceAt(i)
+              .getDatasetSequence().getSequenceFeatures() == null)
       {
         continue;
       }
 
-      tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+      tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
               .getDatasetSequence().getSequenceFeatures();
 
       int index = 0;
@@ -397,8 +407,8 @@ public class FeatureSettings extends JPanel
     {
       public void itemStateChanged(ItemEvent evt)
       {
-        fr.featureGroups.put(check.getText(), new Boolean(check
-                .isSelected()));
+        fr.featureGroups.put(check.getText(),
+                new Boolean(check.isSelected()));
         af.alignPanel.seqPanel.seqCanvas.repaint();
         if (af.alignPanel.overviewPanel != null)
         {
@@ -433,10 +443,10 @@ public class FeatureSettings extends JPanel
     // Find out which features should be visible depending on which groups
     // are selected / deselected
     // and recompute average width ordering
-    for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+    for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
     {
 
-      tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+      tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
               .getDatasetSequence().getSequenceFeatures();
       if (tmpfeatures == null)
       {
@@ -512,8 +522,8 @@ public class FeatureSettings extends JPanel
 
         data[dataIndex][0] = type;
         data[dataIndex][1] = fr.getFeatureStyle(type);
-        data[dataIndex][2] = new Boolean(af.getViewport().featuresDisplayed
-                .containsKey(type));
+        data[dataIndex][2] = new Boolean(
+                af.getViewport().featuresDisplayed.containsKey(type));
         dataIndex++;
         visibleChecks.removeElement(type);
       }
@@ -587,13 +597,13 @@ public class FeatureSettings extends JPanel
 
   void load()
   {
-    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
-            .getProperty("LAST_DIRECTORY"), new String[]
-    { "fc" }, new String[]
-    { "Sequence Feature Colours" }, "Sequence Feature Colours");
+    JalviewFileChooser chooser = new JalviewFileChooser(
+            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+            { "fc" }, new String[]
+            { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
     chooser.setDialogTitle("Load Feature Colours");
-    chooser.setToolTipText("Load");
+    chooser.setToolTipText(MessageManager.getString("action.load"));
 
     int value = chooser.showOpenDialog(this);
 
@@ -606,15 +616,65 @@ public class FeatureSettings extends JPanel
         InputStreamReader in = new InputStreamReader(new FileInputStream(
                 file), "UTF-8");
 
-        jalview.binding.JalviewUserColours jucs = new jalview.binding.JalviewUserColours();
-        jucs = (jalview.binding.JalviewUserColours) jucs.unmarshal(in);
+        jalview.schemabinding.version2.JalviewUserColours jucs = new jalview.schemabinding.version2.JalviewUserColours();
+        jucs = (jalview.schemabinding.version2.JalviewUserColours) jucs
+                .unmarshal(in);
 
         for (int i = jucs.getColourCount() - 1; i >= 0; i--)
         {
           String name;
-          // TODO: update Colour XML
-          fr.setColour(name = jucs.getColour(i).getName(), new Color(
-                  Integer.parseInt(jucs.getColour(i).getRGB(), 16)));
+          jalview.schemabinding.version2.Colour newcol = jucs.getColour(i);
+          if (newcol.hasMax())
+          {
+            Color mincol = null, maxcol = null;
+            try
+            {
+              mincol = new Color(Integer.parseInt(newcol.getMinRGB(), 16));
+              maxcol = new Color(Integer.parseInt(newcol.getRGB(), 16));
+
+            } catch (Exception e)
+            {
+              Cache.log.warn("Couldn't parse out graduated feature color.",
+                      e);
+            }
+            GraduatedColor gcol = new GraduatedColor(mincol, maxcol,
+                    newcol.getMin(), newcol.getMax());
+            if (newcol.hasAutoScale())
+            {
+              gcol.setAutoScaled(newcol.getAutoScale());
+            }
+            if (newcol.hasColourByLabel())
+            {
+              gcol.setColourByLabel(newcol.getColourByLabel());
+            }
+            if (newcol.hasThreshold())
+            {
+              gcol.setThresh(newcol.getThreshold());
+              gcol.setThreshType(AnnotationColourGradient.NO_THRESHOLD); // default
+            }
+            if (newcol.getThreshType().length() > 0)
+            {
+              String ttyp = newcol.getThreshType();
+              if (ttyp.equalsIgnoreCase("NONE"))
+              {
+                gcol.setThreshType(AnnotationColourGradient.NO_THRESHOLD);
+              }
+              if (ttyp.equalsIgnoreCase("ABOVE"))
+              {
+                gcol.setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);
+              }
+              if (ttyp.equalsIgnoreCase("BELOW"))
+              {
+                gcol.setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);
+              }
+            }
+            fr.setColour(name = newcol.getName(), gcol);
+          }
+          else
+          {
+            fr.setColour(name = jucs.getColour(i).getName(), new Color(
+                    Integer.parseInt(jucs.getColour(i).getRGB(), 16)));
+          }
           fr.setOrder(name, (i == 0) ? 0 : i / jucs.getColourCount());
         }
         if (table != null)
@@ -635,44 +695,70 @@ public class FeatureSettings extends JPanel
 
   void save()
   {
-    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
-            .getProperty("LAST_DIRECTORY"), new String[]
-    { "fc" }, new String[]
-    { "Sequence Feature Colours" }, "Sequence Feature Colours");
+    JalviewFileChooser chooser = new JalviewFileChooser(
+            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+            { "fc" }, new String[]
+            { "Sequence Feature Colours" }, "Sequence Feature Colours");
     chooser.setFileView(new jalview.io.JalviewFileView());
     chooser.setDialogTitle("Save Feature Colour Scheme");
-    chooser.setToolTipText("Save");
+    chooser.setToolTipText(MessageManager.getString("action.save"));
 
     int value = chooser.showSaveDialog(this);
 
     if (value == JalviewFileChooser.APPROVE_OPTION)
     {
       String choice = chooser.getSelectedFile().getPath();
-      jalview.binding.JalviewUserColours ucs = new jalview.binding.JalviewUserColours();
+      jalview.schemabinding.version2.JalviewUserColours ucs = new jalview.schemabinding.version2.JalviewUserColours();
       ucs.setSchemeName("Sequence Features");
       try
       {
         PrintWriter out = new PrintWriter(new OutputStreamWriter(
                 new FileOutputStream(choice), "UTF-8"));
 
-        Enumeration e = fr.featureColours.keys();
+        Iterator e = fr.featureColours.keySet().iterator();
         float[] sortOrder = new float[fr.featureColours.size()];
         String[] sortTypes = new String[fr.featureColours.size()];
         int i = 0;
-        while (e.hasMoreElements())
+        while (e.hasNext())
         {
-          sortTypes[i] = e.nextElement().toString();
+          sortTypes[i] = e.next().toString();
           sortOrder[i] = fr.getOrder(sortTypes[i]);
           i++;
         }
         jalview.util.QuickSort.sort(sortOrder, sortTypes);
         sortOrder = null;
+        Object fcol;
+        GraduatedColor gcol;
         for (i = 0; i < sortTypes.length; i++)
         {
-          jalview.binding.Colour col = new jalview.binding.Colour();
+          jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour();
           col.setName(sortTypes[i]);
           col.setRGB(jalview.util.Format.getHexString(fr.getColour(col
                   .getName())));
+          fcol = fr.getFeatureStyle(sortTypes[i]);
+          if (fcol instanceof GraduatedColor)
+          {
+            gcol = (GraduatedColor) fcol;
+            col.setMin(gcol.getMin());
+            col.setMax(gcol.getMax());
+            col.setMinRGB(jalview.util.Format.getHexString(gcol
+                    .getMinColor()));
+            col.setAutoScale(gcol.isAutoScale());
+            col.setThreshold(gcol.getThresh());
+            col.setColourByLabel(gcol.isColourByLabel());
+            switch (gcol.getThreshType())
+            {
+            case AnnotationColourGradient.NO_THRESHOLD:
+              col.setThreshType("NONE");
+              break;
+            case AnnotationColourGradient.ABOVE_THRESHOLD:
+              col.setThreshType("ABOVE");
+              break;
+            case AnnotationColourGradient.BELOW_THRESHOLD:
+              col.setThreshType("BELOW");
+              break;
+            }
+          }
           ucs.addColour(col);
         }
         ucs.marshal(out);
@@ -819,8 +905,8 @@ public class FeatureSettings extends JPanel
     settingsPane.setLayout(borderLayout2);
     dasSettingsPane.setLayout(borderLayout3);
     bigPanel.setLayout(borderLayout4);
-    invert.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    invert.setText("Invert Selection");
+    invert.setFont(JvSwingUtils.getLabelFont());
+    invert.setText(MessageManager.getString("label.invert_selection"));
     invert.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -828,8 +914,8 @@ public class FeatureSettings extends JPanel
         invertSelection();
       }
     });
-    optimizeOrder.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    optimizeOrder.setText("Optimise Order");
+    optimizeOrder.setFont(JvSwingUtils.getLabelFont());
+    optimizeOrder.setText(MessageManager.getString("label.optimise_order"));
     optimizeOrder.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -837,8 +923,8 @@ public class FeatureSettings extends JPanel
         orderByAvWidth();
       }
     });
-    sortByScore.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    sortByScore.setText("Seq sort by Score");
+    sortByScore.setFont(JvSwingUtils.getLabelFont());
+    sortByScore.setText(MessageManager.getString("label.seq_sort_by_score"));
     sortByScore.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -846,8 +932,8 @@ public class FeatureSettings extends JPanel
         sortByScore(null);
       }
     });
-    sortByDens.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    sortByDens.setText("Seq Sort by density");
+    sortByDens.setFont(JvSwingUtils.getLabelFont());
+    sortByDens.setText(MessageManager.getString("label.sequence_sort_by_density"));
     sortByDens.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -855,8 +941,8 @@ public class FeatureSettings extends JPanel
         sortByDens(null);
       }
     });
-    cancel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    cancel.setText("Cancel");
+    cancel.setFont(JvSwingUtils.getLabelFont());
+    cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -865,8 +951,8 @@ public class FeatureSettings extends JPanel
         close();
       }
     });
-    ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    ok.setText("OK");
+    ok.setFont(JvSwingUtils.getLabelFont());
+    ok.setText(MessageManager.getString("action.ok"));
     ok.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -874,8 +960,8 @@ public class FeatureSettings extends JPanel
         close();
       }
     });
-    loadColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    loadColours.setText("Load Colours");
+    loadColours.setFont(JvSwingUtils.getLabelFont());
+    loadColours.setText(MessageManager.getString("label.load_colours"));
     loadColours.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -883,8 +969,8 @@ public class FeatureSettings extends JPanel
         load();
       }
     });
-    saveColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
-    saveColours.setText("Save Colours");
+    saveColours.setFont(JvSwingUtils.getLabelFont());
+    saveColours.setText(MessageManager.getString("label.save_colours"));
     saveColours.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -902,7 +988,7 @@ public class FeatureSettings extends JPanel
     });
 
     transparency.setMaximum(70);
-    fetchDAS.setText("Fetch DAS Features");
+    fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
     fetchDAS.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -910,7 +996,7 @@ public class FeatureSettings extends JPanel
         fetchDAS_actionPerformed(e);
       }
     });
-    saveDAS.setText("Save as default");
+    saveDAS.setText(MessageManager.getString("action.save_as_default"));
     saveDAS.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -921,7 +1007,7 @@ public class FeatureSettings extends JPanel
     dasButtonPanel.setBorder(BorderFactory.createEtchedBorder());
     dasSettingsPane.setBorder(null);
     cancelDAS.setEnabled(false);
-    cancelDAS.setText("Cancel Fetch");
+    cancelDAS.setText(MessageManager.getString("action.cancel_fetch"));
     cancelDAS.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -967,18 +1053,30 @@ public class FeatureSettings extends JPanel
     gps = getDisplayedFeatureGroups();
     if (typ != null)
     {
+      ArrayList types = new ArrayList();
       for (int i = 0; i < typ.length; i++)
       {
-        System.err.println("Sorting on Types:" + typ[i]);
+        if (typ[i] != null)
+        {
+          types.add(typ[i]);
+        }
+        typ = new String[types.size()];
+        types.toArray(typ);
       }
     }
     if (gps != null)
     {
+      ArrayList grps = new ArrayList();
 
       for (int i = 0; i < gps.length; i++)
       {
-        System.err.println("Sorting on groups:" + gps[i]);
+        if (gps[i] != null)
+        {
+          grps.add(gps[i]);
+        }
       }
+      gps = new String[grps.size()];
+      grps.toArray(gps);
     }
     AlignmentPanel alignPanel = af.alignPanel;
     AlignmentI al = alignPanel.av.getAlignment();
@@ -1037,13 +1135,13 @@ public class FeatureSettings extends JPanel
 
       if (fr.featureGroups != null)
       {
-        Enumeration en = fr.featureGroups.keys();
+        Iterator en = fr.featureGroups.keySet().iterator();
         gps = new String[fr.featureColours.size()];
         int g = 0;
         boolean valid = false;
-        while (en.hasMoreElements())
+        while (en.hasNext())
         {
-          String gp = (String) en.nextElement();
+          String gp = (String) en.next();
           Boolean on = (Boolean) fr.featureGroups.get(gp);
           if (on != null && on.booleanValue())
           {
@@ -1068,6 +1166,7 @@ public class FeatureSettings extends JPanel
   {
     fetchDAS.setEnabled(false);
     cancelDAS.setEnabled(true);
+    dassourceBrowser.setGuiEnabled(false);
     Vector selectedSources = dassourceBrowser.getSelectedSources();
     doDasFeatureFetch(selectedSources, true, true);
   }
@@ -1079,7 +1178,7 @@ public class FeatureSettings extends JPanel
    * @param checkDbRefs
    * @param promptFetchDbRefs
    */
-  private void doDasFeatureFetch(Vector selectedSources,
+  private void doDasFeatureFetch(List<jalviewSourceI> selectedSources,
           boolean checkDbRefs, boolean promptFetchDbRefs)
   {
     SequenceI[] dataset, seqs;
@@ -1127,9 +1226,9 @@ public class FeatureSettings extends JPanel
    *          Vector of Strings to resolve to DAS source nicknames.
    * @return sources that are present in source list.
    */
-  public Vector resolveSourceNicknames(Vector sources)
+  public List<jalviewSourceI> resolveSourceNicknames(Vector sources)
   {
-    return dassourceBrowser.resolveSourceNicknames(sources);
+    return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
   }
 
   /**
@@ -1155,14 +1254,15 @@ public class FeatureSettings extends JPanel
   public void fetchDasFeatures(Vector sources, boolean block)
   {
     initDasSources();
-    Vector resolved = resolveSourceNicknames(sources);
+    List<jalviewSourceI> resolved = dassourceBrowser.sourceRegistry
+            .resolveSourceNicknames(sources);
     if (resolved.size() == 0)
     {
       resolved = dassourceBrowser.getSelectedSources();
     }
     if (resolved.size() > 0)
     {
-      final Vector dassources = resolved;
+      final List<jalviewSourceI> dassources = resolved;
       fetchDAS.setEnabled(false);
       // cancelDAS.setEnabled(true); doDasFetch does this.
       Runnable fetcher = new Runnable()
@@ -1195,6 +1295,8 @@ public class FeatureSettings extends JPanel
   {
     fetchDAS.setEnabled(true);
     cancelDAS.setEnabled(false);
+    dassourceBrowser.setGuiEnabled(true);
+
   }
 
   public void cancelDAS_actionPerformed(ActionEvent e)
@@ -1203,17 +1305,15 @@ public class FeatureSettings extends JPanel
     {
       dasFeatureFetcher.cancel();
     }
-    fetchDAS.setEnabled(true);
-    cancelDAS.setEnabled(false);
+    complete();
   }
 
   public void noDasSourceActive()
   {
     complete();
     JOptionPane.showInternalConfirmDialog(Desktop.desktop,
-            "No das sources were selected.\n"
-                    + "Please select some sources and\n" + " try again.",
-            "No Sources Selected", JOptionPane.DEFAULT_OPTION,
+            MessageManager.getString("label.no_das_sources_selected_warn"),
+            MessageManager.getString("label.no_das_sources_selected_title"), JOptionPane.DEFAULT_OPTION,
             JOptionPane.INFORMATION_MESSAGE);
   }
 
@@ -1297,6 +1397,8 @@ public class FeatureSettings extends JPanel
     public ColorRenderer()
     {
       setOpaque(true); // MUST do this for background to show up.
+      setHorizontalTextPosition(SwingConstants.CENTER);
+      setVerticalTextPosition(SwingConstants.CENTER);
     }
 
     public Component getTableCellRendererComponent(JTable table,
@@ -1378,22 +1480,28 @@ public class FeatureSettings extends JPanel
   public static void renderGraduatedColor(JLabel comp, GraduatedColor gcol,
           int w, int h)
   {
-
+    boolean thr = false;
     String tt = "";
     String tx = "";
     if (gcol.getThreshType() == AnnotationColourGradient.ABOVE_THRESHOLD)
     {
-      tx += "> ";
+      thr = true;
+      tx += ">";
       tt += "Thresholded (Above " + gcol.getThresh() + ") ";
     }
     if (gcol.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)
     {
-      tx += "< ";
+      thr = true;
+      tx += "<";
       tt += "Thresholded (Below " + gcol.getThresh() + ") ";
     }
     if (gcol.isColourByLabel())
     {
       tt = "Coloured by label text. " + tt;
+      if (thr)
+      {
+        tx += " ";
+      }
       tx += "Label";
       comp.setIcon(null);
     }
@@ -1401,14 +1509,15 @@ public class FeatureSettings extends JPanel
     {
       Color newColor = gcol.getMaxColor();
       comp.setBackground(newColor);
-      System.err.println("Width is " + w / 2);
-      Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w / 2, h);
+      // System.err.println("Width is " + w / 2);
+      Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w, h, thr);
       comp.setIcon(ficon);
       // tt+="RGB value: Max (" + newColor.getRed() + ", "
       // + newColor.getGreen() + ", " + newColor.getBlue()
       // + ")\nMin (" + minCol.getRed() + ", " + minCol.getGreen()
       // + ", " + minCol.getBlue() + ")");
     }
+    comp.setHorizontalAlignment(SwingConstants.CENTER);
     comp.setText(tx);
     if (tt.length() > 0)
     {
@@ -1430,14 +1539,31 @@ class FeatureIcon implements Icon
 
   Color backg;
 
+  boolean midspace = false;
+
   int width = 50, height = 20;
 
-  FeatureIcon(GraduatedColor gfc, Color bg, int w, int h)
+  int s1, e1; // start and end of midpoint band for thresholded symbol
+
+  Color mpcolour = Color.white;
+
+  FeatureIcon(GraduatedColor gfc, Color bg, int w, int h, boolean mspace)
   {
     gcol = gfc;
     backg = bg;
     width = w;
     height = h;
+    midspace = mspace;
+    if (midspace)
+    {
+      s1 = width / 3;
+      e1 = s1 * 2;
+    }
+    else
+    {
+      s1 = width / 2;
+      e1 = s1;
+    }
   }
 
   public int getIconWidth()
@@ -1467,14 +1593,21 @@ class FeatureIcon implements Icon
       // width/g.getFontMetrics().stringWidth("Label"),
       // height/g.getFontMetrics().getHeight())));
 
-      g.drawString("Label", 0, 0);
+      g.drawString(MessageManager.getString("label.label"), 0, 0);
 
     }
     else
     {
       Color minCol = gcol.getMinColor();
       g.setColor(minCol);
-      g.fillRect(0, 0, width, height);
+      g.fillRect(0, 0, s1, height);
+      if (midspace)
+      {
+        g.setColor(Color.white);
+        g.fillRect(s1, 0, e1 - s1, height);
+      }
+      g.setColor(gcol.getMaxColor());
+      g.fillRect(0, e1, width - e1, height);
     }
   }
 }