formatting
[jalview.git] / src / jalview / gui / AnnotationExporter.java
index 857eabc..a0c1ecf 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)\r
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -18,6 +18,7 @@
 package jalview.gui;\r
 \r
 import java.util.*;\r
+import java.util.List;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
@@ -44,7 +45,7 @@ public class AnnotationExporter extends JPanel
 \r
   AlignmentAnnotation[] annotations;\r
 \r
-  Vector sequenceGroups;\r
+  List<SequenceGroup> sequenceGroups;\r
 \r
   Hashtable alignmentProperties;\r
 \r
@@ -61,7 +62,8 @@ public class AnnotationExporter extends JPanel
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
     frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
-    Desktop.addInternalFrame(frame, "", 260, 125);\r
+    Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width,\r
+            frame.getPreferredSize().height);\r
   }\r
 \r
   public void exportFeatures(AlignmentPanel ap)\r
@@ -73,7 +75,7 @@ public class AnnotationExporter extends JPanel
   }\r
 \r
   public void exportAnnotations(AlignmentPanel ap,\r
-          AlignmentAnnotation[] annotations, Vector sequenceGroups,\r
+          AlignmentAnnotation[] annotations, List<SequenceGroup> list,\r
           Hashtable alProperties)\r
   {\r
     this.ap = ap;\r
@@ -81,7 +83,7 @@ public class AnnotationExporter extends JPanel
     GFFFormat.setVisible(false);\r
     CSVFormat.setVisible(true);\r
     this.annotations = annotations;\r
-    this.sequenceGroups = sequenceGroups;\r
+    this.sequenceGroups = list;\r
     this.alignmentProperties = alProperties;\r
     frame.setTitle("Export Annotations");\r
   }\r
@@ -105,13 +107,13 @@ public class AnnotationExporter extends JPanel
       {\r
         if (GFFFormat.isSelected())\r
         {\r
-          text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+          text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
                   .getDataset().getSequencesArray(),\r
                   getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);\r
         }\r
         else\r
         {\r
-          text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+          text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
                   .getDataset().getSequencesArray(),\r
                   getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);\r
         }\r
@@ -152,13 +154,13 @@ public class AnnotationExporter extends JPanel
     {\r
       if (GFFFormat.isSelected())\r
       {\r
-        text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+        text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
                 .getDataset().getSequencesArray(),\r
                 getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
       }\r
       else\r
       {\r
-        text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+        text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
                 .getDataset().getSequencesArray(),\r
                 getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
       }\r
@@ -196,6 +198,10 @@ public class AnnotationExporter extends JPanel
   private Hashtable getDisplayedFeatureCols()\r
   {\r
     Hashtable fcols = new Hashtable();\r
+    if (ap.av.featuresDisplayed == null)\r
+    {\r
+      return fcols;\r
+    }\r
     Enumeration en = ap.av.featuresDisplayed.keys();\r
     FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider\r
                                                                      // higher\r
@@ -221,7 +227,8 @@ public class AnnotationExporter extends JPanel
 \r
   private void jbInit() throws Exception\r
   {\r
-    this.setLayout(flowLayout1);\r
+    this.setLayout(new BorderLayout());\r
+\r
     toFile.setText("to File");\r
     toFile.addActionListener(new ActionListener()\r
     {\r
@@ -269,8 +276,8 @@ public class AnnotationExporter extends JPanel
     buttonGroup.add(jalviewFormat);\r
     buttonGroup.add(GFFFormat);\r
     buttonGroup.add(CSVFormat);\r
-    this.add(jPanel3, null);\r
-    this.add(jPanel1, null);\r
+    this.add(jPanel3, BorderLayout.CENTER);\r
+    this.add(jPanel1, BorderLayout.SOUTH);\r
   }\r
 \r
   JPanel jPanel1 = new JPanel();\r