X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationExporter.java;h=9c6231a2e066a9e0d8892f493cb06389082669e7;hb=1a802c6cf08e703f6b722a91b1e7f58f76356476;hp=2a3da7bb7f81d1b3d9e55e8abd392044858ee7af;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git
diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java
index 2a3da7b..9c6231a 100755
--- a/src/jalview/gui/AnnotationExporter.java
+++ b/src/jalview/gui/AnnotationExporter.java
@@ -1,24 +1,24 @@
/*
- * 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.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.
*
- * 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
+ * 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 Jalview. If not, see .
*/
package jalview.gui;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
@@ -45,7 +45,7 @@ public class AnnotationExporter extends JPanel
AlignmentAnnotation[] annotations;
- Vector sequenceGroups;
+ List sequenceGroups;
Hashtable alignmentProperties;
@@ -62,7 +62,7 @@ public class AnnotationExporter extends JPanel
frame = new JInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
- Desktop.addInternalFrame(frame, "", 260, 125);
+ Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width, frame.getPreferredSize().height);
}
public void exportFeatures(AlignmentPanel ap)
@@ -74,7 +74,7 @@ public class AnnotationExporter extends JPanel
}
public void exportAnnotations(AlignmentPanel ap,
- AlignmentAnnotation[] annotations, Vector sequenceGroups,
+ AlignmentAnnotation[] annotations, List list,
Hashtable alProperties)
{
this.ap = ap;
@@ -82,15 +82,15 @@ public class AnnotationExporter extends JPanel
GFFFormat.setVisible(false);
CSVFormat.setVisible(true);
this.annotations = annotations;
- this.sequenceGroups = sequenceGroups;
+ this.sequenceGroups = list;
this.alignmentProperties = alProperties;
frame.setTitle("Export Annotations");
}
public void toFile_actionPerformed(ActionEvent e)
{
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
- .getProperty("LAST_DIRECTORY"));
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(features ? "Save Features to File"
@@ -106,15 +106,15 @@ public class AnnotationExporter extends JPanel
{
if (GFFFormat.isSelected())
{
- text = new FeaturesFile().printGFFFormat(ap.av.alignment
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
.getDataset().getSequencesArray(),
- getDisplayedFeatureCols());//ap.av.featuresDisplayed//);
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);
}
else
{
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
.getDataset().getSequencesArray(),
- getDisplayedFeatureCols()); // ap.av.featuresDisplayed);
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);
}
}
else
@@ -153,13 +153,15 @@ public class AnnotationExporter extends JPanel
{
if (GFFFormat.isSelected())
{
- text = new FeaturesFile().printGFFFormat(ap.av.alignment
- .getDataset().getSequencesArray(), getDisplayedFeatureCols());
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
}
else
{
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment
- .getDataset().getSequencesArray(), getDisplayedFeatureCols());
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
}
}
else if (!features)
@@ -176,10 +178,18 @@ public class AnnotationExporter extends JPanel
}
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- cap.setText(text);
- Desktop.addInternalFrame(cap, (features ? "Features for - "
- : "Annotations for - ")
- + ap.alignFrame.getTitle(), 600, 500);
+ try
+ {
+ cap.setText(text);
+ Desktop.addInternalFrame(cap, (features ? "Features for - "
+ : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("generating "
+ + (features ? "Features for - " : "Annotations for - ")
+ + ap.alignFrame.getTitle(), oom);
+ cap.dispose();
+ }
close_actionPerformed(null);
}
@@ -187,8 +197,15 @@ public class AnnotationExporter extends JPanel
private Hashtable getDisplayedFeatureCols()
{
Hashtable fcols = new Hashtable();
+ if (ap.av.featuresDisplayed == null)
+ {
+ return fcols;
+ }
Enumeration en = ap.av.featuresDisplayed.keys();
- FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider higher level method ?
+ FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider
+ // higher
+ // level
+ // method ?
while (en.hasMoreElements())
{
Object col = en.nextElement();
@@ -209,7 +226,8 @@ public class AnnotationExporter extends JPanel
private void jbInit() throws Exception
{
- this.setLayout(flowLayout1);
+ this.setLayout(new BorderLayout());
+
toFile.setText("to File");
toFile.addActionListener(new ActionListener()
{
@@ -257,8 +275,8 @@ public class AnnotationExporter extends JPanel
buttonGroup.add(jalviewFormat);
buttonGroup.add(GFFFormat);
buttonGroup.add(CSVFormat);
- this.add(jPanel3, null);
- this.add(jPanel1, null);
+ this.add(jPanel3, BorderLayout.CENTER);
+ this.add(jPanel1, BorderLayout.SOUTH);
}
JPanel jPanel1 = new JPanel();