Save Feature Rendering
authoramwaterhouse <Andrew Waterhouse>
Mon, 5 Dec 2005 13:39:56 +0000 (13:39 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 5 Dec 2005 13:39:56 +0000 (13:39 +0000)
src/jalview/gui/AlignFrame.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/SequenceFetcher.java

index adc2195..86d7cb6 100755 (executable)
@@ -1204,16 +1204,6 @@ public class AlignFrame
    if(alignPanel.overviewPanel!=null)\r
      alignPanel.overviewPanel.updateOverviewImage();\r
 \r
-  Provenance prov = viewport.alignment.getProvenance();\r
-  if(prov == null)\r
-   {\r
-     prov = new Provenance();\r
-     viewport.alignment.setProvenance(prov);\r
-   }\r
-\r
-   prov.addEntry("Me",\r
-       "Edited in Jalview", new java.util.Date(), "myID");\r
-\r
    alignPanel.repaint();\r
  }\r
 \r
index b8b623d..5325180 100755 (executable)
@@ -145,8 +145,13 @@ public class FeatureSettings extends JPanel
     int fSize = allFeatures.size();\r
 \r
     String type;\r
+    boolean originalExists = false;\r
+    if(originalData!=null)\r
+      originalExists = true;\r
+    else\r
+      originalData = new Object[fSize][3];\r
+\r
     Object [][] data = new Object[fSize][3];\r
-    originalData = new Object[fSize][3];\r
     for(int i=0; i<fSize; i++)\r
     {\r
       type = allFeatures.elementAt(i).toString();\r
@@ -158,12 +163,15 @@ public class FeatureSettings extends JPanel
       else\r
         data[i][2] = new Boolean(true);\r
 \r
-      originalData[i][0]=type;\r
-      originalData[i][1]=col;\r
-      if(fr.featuresDisplayed!=null)\r
-         originalData[i][2] = new Boolean(fr.featuresDisplayed.contains(type));\r
-      else\r
-        originalData[i][2] = new Boolean(true);\r
+      if(!originalExists)\r
+      {\r
+        originalData[i][0] = type;\r
+        originalData[i][1] = col;\r
+        if (fr.featuresDisplayed != null)\r
+          originalData[i][2] = new Boolean(fr.featuresDisplayed.contains(type));\r
+        else\r
+          originalData[i][2] = new Boolean(true);\r
+      }\r
     }\r
     ////////////////////////////////////\r
         //Now build the table\r
index bbe3389..08b3903 100755 (executable)
@@ -452,8 +452,33 @@ public class Jalview2XML
         view.setShowText(av.getShowText());\r
         view.setWrapAlignment(av.getWrapAlignment());\r
 \r
+        if(af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed!=null)\r
+        {\r
+          jalview.binding.FeatureSettings fs = new jalview.binding.FeatureSettings();\r
+\r
+          Enumeration e = af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours.keys();\r
+          while (e.hasMoreElements())\r
+          {\r
+            String type = e.nextElement().toString();\r
+            Setting setting = new Setting();\r
+            setting.setType(type);\r
+            setting.setColour(\r
+                af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().getColour(type).getRGB()\r
+                );\r
+            setting.setDisplay(\r
+                af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed.contains(type)\r
+                );\r
+\r
+            fs.addSetting(setting);\r
+\r
+          }\r
+          jms.setFeatureSettings(fs);\r
+\r
+        }\r
+\r
         jms.addViewport(view);\r
 \r
+\r
         object.setJalviewModelSequence(jms);\r
         object.getVamsasModel().addSequenceSet(vamsasSet);\r
 \r
@@ -711,6 +736,7 @@ public class Jalview2XML
 \r
         AlignFrame af = new AlignFrame(al);\r
 \r
+\r
         //  af.changeColour() );\r
         /////////////////////////\r
         //LOAD GROUPS\r
@@ -850,6 +876,22 @@ public class Jalview2XML
            af.sequenceFeatures.setSelected(true);\r
         }\r
 \r
+        if(jms.getFeatureSettings()!=null)\r
+        {\r
+          af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed = new Vector();\r
+         // af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed!=null)\r
+         // jalview.binding.FeatureSettings fs = new jalview.binding.FeatureSettings();\r
+         for(int fs=0; fs<jms.getFeatureSettings().getSettingCount(); fs++)\r
+         {\r
+           Setting setting = jms.getFeatureSettings().getSetting(fs);\r
+\r
+           af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(setting.getType(),\r
+               new java.awt.Color(setting.getColour()));\r
+           if(setting.getDisplay())\r
+             af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed.addElement(setting.getType());\r
+         }\r
+        }\r
+\r
         Desktop.addInternalFrame(af, view.getTitle(),\r
              view.getWidth(), view.getHeight());\r
 \r
index 75ff09c..28d7002 100755 (executable)
@@ -48,7 +48,13 @@ public class SequenceFetcher
       throws Exception\r
   {\r
     this.setLayout(gridBagLayout1);\r
+    DefaultListCellRenderer dlcr = new DefaultListCellRenderer();\r
+    dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);\r
+    database.setRenderer(dlcr);\r
+\r
     database.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    database.setMinimumSize(new Dimension(160, 21));\r
+    database.setPreferredSize(new Dimension(160, 21));\r
     jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));\r
     jLabel1.setText(\r
         "Separate multiple accession ids with semi colon \";\"");\r
@@ -82,16 +88,16 @@ public class SequenceFetcher
                                              , GridBagConstraints.WEST,\r
                                              GridBagConstraints.NONE,\r
                                              new Insets(7, 4, 0, 6), 77, 6));\r
-    this.add(textfield, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0\r
-                                               , GridBagConstraints.WEST,\r
-                                               GridBagConstraints.HORIZONTAL,\r
-                                               new Insets(0, 0, 0, 6), 221, 1));\r
     this.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0\r
                                              , GridBagConstraints.WEST,\r
                                              GridBagConstraints.BOTH,\r
                                              new Insets(7, -2, 7, 12), 241, -2));\r
+    this.add(textfield, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0\r
+                                               , GridBagConstraints.WEST,\r
+                                               GridBagConstraints.HORIZONTAL,\r
+                                               new Insets(0, 0, 0, 6), 200, 1));\r
     this.add(database, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0\r
-                                              , GridBagConstraints.CENTER,\r
+                                              , GridBagConstraints.WEST,\r
                                               GridBagConstraints.NONE,\r
                                               new Insets(0, 4, 0, 0), 1, 0));\r
   }\r