JAL-3032 tweak inner/outer class references
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 9 Jan 2019 15:52:56 +0000 (15:52 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 9 Jan 2019 15:52:56 +0000 (15:52 +0000)
src/jalview/gui/FeatureSettings.java

index 93b5f31..37a51ef 100644 (file)
@@ -98,7 +98,6 @@ import javax.swing.ToolTipManager;
 import javax.swing.border.Border;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-import javax.swing.plaf.TableUI;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.TableCellEditor;
 import javax.swing.table.TableCellRenderer;
@@ -451,15 +450,13 @@ public class FeatureSettings extends JPanel
     JMenuItem scr = new JMenuItem(
             MessageManager.getString("label.sort_by_score"));
     men.add(scr);
-    final FeatureSettings me = this;
     scr.addActionListener(new ActionListener()
     {
 
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        me.af.avc
-                .sortAlignmentByFeatureScore(Arrays.asList(new String[]
+        af.avc.sortAlignmentByFeatureScore(Arrays.asList(new String[]
                 { type }));
       }
     });
@@ -471,8 +468,7 @@ public class FeatureSettings extends JPanel
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        me.af.avc
-                .sortAlignmentByFeatureDensity(Arrays.asList(new String[]
+        af.avc.sortAlignmentByFeatureDensity(Arrays.asList(new String[]
                 { type }));
       }
     });
@@ -505,7 +501,7 @@ public class FeatureSettings extends JPanel
             /*
              * toggle simple colour to variable colour - show dialog
              */
-            FeatureTypeSettings fc = new FeatureTypeSettings(me.fr, type);
+            FeatureTypeSettings fc = new FeatureTypeSettings(fr, type);
             fc.addActionListener(this);
           }
           else
@@ -522,12 +518,13 @@ public class FeatureSettings extends JPanel
                 table.setValueAt(new FeatureColour(c), rowSelected,
                         COLOUR_COLUMN);
                 table.validate();
-                me.updateFeatureRenderer(
+                updateFeatureRenderer(
                         ((FeatureTableModel) table.getModel()).getData(),
                         false);
               }
             };
-            JalviewColourChooser.showColourChooser(me, title, featureColour.getMaxColour(), listener);
+            JalviewColourChooser.showColourChooser(FeatureSettings.this, title,
+               featureColour.getMaxColour(), listener);
           }
         }
         else    
@@ -541,7 +538,7 @@ public class FeatureSettings extends JPanel
             FeatureColourI fci = fr.getFeatureColours().get(type);
             table.setValueAt(fci, rowSelected, COLOUR_COLUMN);
             // BH 2018 setting a table value does not invalidate it.
-            System.out.println("FeatureSettings is valied" + table.isValid());
+//            System.out.println("FeatureSettings is valied" + table.isValid());
 //            table.validate();
           }
         }
@@ -1713,8 +1710,6 @@ public class FeatureSettings extends JPanel
 class ColorEditor extends AbstractCellEditor
           implements TableCellEditor, ActionListener
   {
-//    FeatureSettings me;
-
     FeatureColourI currentColor;
 
     FeatureTypeSettings chooser;
@@ -1813,7 +1808,16 @@ class ColorEditor extends AbstractCellEditor
       }
     }
 
-    // Implement the one CellEditor method that AbstractCellEditor doesn't.
+    /**
+     * Override allows access to this method from anonymous inner classes 
+     */
+    @Override
+       protected void fireEditingStopped() 
+    {
+           super.fireEditingStopped();
+       }
+
+       // Implement the one CellEditor method that AbstractCellEditor doesn't.
     @Override
     public Object getCellEditorValue()
     {
@@ -1829,7 +1833,7 @@ class ColorEditor extends AbstractCellEditor
       this.rowSelected = row;
       type = table.getValueAt(row, TYPE_COLUMN).toString();
       button.setOpaque(true);
-      button.setBackground(getBackground());
+      button.setBackground(FeatureSettings.this.getBackground());
       if (!currentColor.isSimpleColour())
       {
         JLabel btn = new JLabel();
@@ -1944,7 +1948,7 @@ class FilterEditor extends AbstractCellEditor
       this.rowSelected = row;
       type = table.getValueAt(row, TYPE_COLUMN).toString();
       button.setOpaque(true);
-      button.setBackground(getBackground());
+      button.setBackground(FeatureSettings.this.getBackground());
       button.setText(currentFilter.toString());
       button.setIcon(null);
       return button;