Only add 1 feature settings table
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 Aug 2006 13:17:29 +0000 (13:17 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 Aug 2006 13:17:29 +0000 (13:17 +0000)
src/jalview/gui/AlignFrame.java
src/jalview/gui/DasSourceBrowser.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/SeqPanel.java

index b85d5d4..9b3bd4a 100755 (executable)
@@ -212,8 +212,6 @@ public class AlignFrame
     {\r
       alignPanel.seqPanel.seqCanvas.fr.featuresAdded();\r
       alignPanel.repaint();\r
-      if(featureSettings!=null)\r
-        featureSettings.setTableData();\r
     }\r
   }\r
 \r
@@ -1529,7 +1527,7 @@ public class AlignFrame
   }\r
 \r
 \r
-  FeatureSettings featureSettings;\r
+  public FeatureSettings featureSettings;\r
   public void featureSettings_actionPerformed(ActionEvent e)\r
   {\r
     if(featureSettings !=null )\r
index 6388e07..36e5164 100755 (executable)
@@ -41,11 +41,13 @@ public class DasSourceBrowser extends GDasSourceBrowser
 \r
   Vector selectedSources;\r
 \r
+  String DEFAULT_REGISTRY = "http://das.sanger.ac.uk/registry/das1/sources/";\r
+\r
 \r
   public DasSourceBrowser()\r
   {\r
     registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
-        "http://das.sanger.ac.uk/registry/das1/sources/") );\r
+        DEFAULT_REGISTRY) );\r
 \r
     setSelectedFromProperties();\r
 \r
@@ -678,6 +680,11 @@ public class DasSourceBrowser extends GDasSourceBrowser
      }\r
   }\r
 \r
+  public void reset_actionPerformed(ActionEvent e)\r
+  {\r
+    registryURL.setText(DEFAULT_REGISTRY);\r
+  }\r
+\r
   public void saveProperties(Properties properties)\r
   {\r
     if (registryURL.getText() == null || registryURL.getText().length() < 1)\r
index 314c357..687c18b 100755 (executable)
@@ -48,7 +48,6 @@ public class FeatureSettings extends JPanel
   JSlider transparency = new JSlider();\r
 \r
   JPanel transPanel = new JPanel(new FlowLayout());\r
-  boolean alignmentHasFeatures = false;\r
 \r
   public FeatureSettings(AlignFrame af)\r
   {\r
@@ -66,6 +65,54 @@ public class FeatureSettings extends JPanel
      ex.printStackTrace();\r
    }\r
 \r
+   table = new JTable();\r
+   table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));\r
+   table.setFont(new Font("Verdana", Font.PLAIN, 12));\r
+   table.setDefaultRenderer(Color.class,\r
+                            new ColorRenderer());\r
+\r
+   table.setDefaultEditor(Color.class,\r
+                          new ColorEditor());\r
+\r
+   table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+\r
+   table.addMouseListener(new MouseAdapter()\r
+   {\r
+     public void mousePressed(MouseEvent evt)\r
+     {\r
+       selectedRow = table.rowAtPoint(evt.getPoint());\r
+     }\r
+   });\r
+\r
+   table.addMouseMotionListener(new MouseMotionAdapter()\r
+   {\r
+     public void mouseDragged(MouseEvent evt)\r
+     {\r
+       int newRow = table.rowAtPoint(evt.getPoint());\r
+       if (newRow != selectedRow\r
+           && selectedRow != -1\r
+           && newRow != -1)\r
+       {\r
+         Object[] temp = new Object[3];\r
+         temp[0] = table.getValueAt(selectedRow, 0);\r
+         temp[1] = table.getValueAt(selectedRow, 1);\r
+         temp[2] = table.getValueAt(selectedRow, 2);\r
+\r
+         table.setValueAt(table.getValueAt(newRow, 0), selectedRow, 0);\r
+         table.setValueAt(table.getValueAt(newRow, 1), selectedRow, 1);\r
+         table.setValueAt(table.getValueAt(newRow, 2), selectedRow, 2);\r
+\r
+         table.setValueAt(temp[0], newRow, 0);\r
+         table.setValueAt(temp[1], newRow, 1);\r
+         table.setValueAt(temp[2], newRow, 2);\r
+\r
+         selectedRow = newRow;\r
+       }\r
+     }\r
+   });\r
+\r
+   scrollPane.setViewportView(table);\r
+\r
     dassourceBrowser = new DasSourceBrowser();\r
     dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);\r
 \r
@@ -84,8 +131,6 @@ public class FeatureSettings extends JPanel
 \r
   synchronized public void setTableData()\r
   {\r
-    alignmentHasFeatures = false;\r
-\r
     if (fr.featureGroups == null)\r
       fr.featureGroups = new Hashtable();\r
 \r
@@ -99,8 +144,6 @@ public class FeatureSettings extends JPanel
       if (af.getViewport().alignment.getSequenceAt(i).getDatasetSequence().getSequenceFeatures() == null)\r
         continue;\r
 \r
-      alignmentHasFeatures = true;\r
-\r
       tmpfeatures = af.getViewport().alignment.getSequenceAt(i).getDatasetSequence().getSequenceFeatures();\r
 \r
       int index = 0;\r
@@ -173,19 +216,6 @@ public class FeatureSettings extends JPanel
     }\r
   }\r
 \r
-\r
-    if(!alignmentHasFeatures)\r
-     {\r
-    //   try\r
-     //  { frame.setClosed(true);  }\r
-    //   catch (Exception ex){}\r
-\r
-    //   JOptionPane.showInternalMessageDialog(\r
-    ///       Desktop.desktop, "No features have been added to this alignment!",\r
-    //\r
-   //    return;\r
-     }\r
-\r
      resetTable(false);\r
   }\r
 \r
@@ -271,54 +301,9 @@ public class FeatureSettings extends JPanel
       System.arraycopy(data,0,originalData,0,data.length);\r
     }\r
 \r
-    table = new JTable(new FeatureTableModel(data));\r
-    scrollPane.setViewportView(table);\r
-    table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));\r
-    table.setFont(new Font("Verdana", Font.PLAIN, 12));\r
-    table.setDefaultRenderer(Color.class,\r
-                         new ColorRenderer());\r
-\r
-    table.setDefaultEditor(Color.class,\r
-                      new ColorEditor());\r
-\r
+    table.setModel(new FeatureTableModel(data));\r
     table.getColumnModel().getColumn(0).setPreferredWidth(200);\r
 \r
-    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
-\r
-    table.addMouseListener(new MouseAdapter()\r
-        {\r
-          public void mousePressed(MouseEvent evt)\r
-          {\r
-            selectedRow = table.rowAtPoint(evt.getPoint());\r
-          }\r
-        });\r
-\r
-    table.addMouseMotionListener(new MouseMotionAdapter()\r
-        {\r
-          public void mouseDragged(MouseEvent evt)\r
-          {\r
-            int newRow = table.rowAtPoint(evt.getPoint());\r
-            if(newRow!=selectedRow\r
-               && selectedRow!=-1\r
-               && newRow!=-1)\r
-            {\r
-              Object[] temp = new Object[3];\r
-              temp[0] = table.getValueAt(selectedRow, 0);\r
-              temp[1] = table.getValueAt(selectedRow, 1);\r
-              temp[2] = table.getValueAt(selectedRow, 2);\r
-\r
-              table.setValueAt(table.getValueAt(newRow, 0), selectedRow, 0);\r
-              table.setValueAt(table.getValueAt(newRow, 1), selectedRow, 1);\r
-              table.setValueAt(table.getValueAt(newRow, 2), selectedRow, 2);\r
-\r
-              table.setValueAt(temp[0], newRow, 0);\r
-              table.setValueAt(temp[1], newRow, 1);\r
-              table.setValueAt(temp[2], newRow, 2);\r
-\r
-              selectedRow = newRow;\r
-            }\r
-          }\r
-    });\r
 \r
     if (groupPanel != null)\r
     {\r
index e5b841a..a4d9240 100755 (executable)
@@ -1243,14 +1243,6 @@ public class SeqPanel extends JPanel implements MouseListener,
 \r
         }\r
 \r
-        if (av.cursorMode)\r
-        {\r
-          seqCanvas.cursorX = findRes(evt);\r
-          seqCanvas.cursorY = findSeq(evt);\r
-          seqCanvas.repaint();\r
-          return;\r
-        }\r
-\r
 \r
         if (javax.swing.SwingUtilities.isRightMouseButton(evt))\r
         {\r
@@ -1271,9 +1263,18 @@ public class SeqPanel extends JPanel implements MouseListener,
 \r
             jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(ap, null, links);\r
             pop.show(this, evt.getX(), evt.getY());\r
+            return;\r
+        }\r
 \r
+        if (av.cursorMode)\r
+        {\r
+          seqCanvas.cursorX = findRes(evt);\r
+          seqCanvas.cursorY = findSeq(evt);\r
+          seqCanvas.repaint();\r
+          return;\r
         }\r
-        else if (stretchGroup == null)\r
+\r
+        if (stretchGroup == null)\r
         {\r
           //Only if left mouse button do we want to change group sizes\r
 \r