X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationExporter.java;h=ab3f0d1006903cc74bc1024c64ff6e2bf55970cf;hb=50ea78c7b98de7614cd386956e9aa0ee73dd7936;hp=676611c1d818e897e122c19df1cb6fae5f9f402e;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 676611c..ab3f0d1 100755 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -28,6 +28,13 @@ import javax.swing.*; import jalview.datamodel.*; import jalview.io.*; +/** + * + * GUI dialog for exporting features or alignment annotations depending upon which method is called. + * + * @author AMW + * + */ public class AnnotationExporter extends JPanel { @@ -36,6 +43,7 @@ public class AnnotationExporter boolean features = true; AlignmentAnnotation[] annotations; Vector sequenceGroups; + Hashtable alignmentProperties; public AnnotationExporter() { @@ -60,18 +68,22 @@ public class AnnotationExporter { this.ap = ap; features = true; + CSVFormat.setVisible(false); frame.setTitle("Export Features"); } public void exportAnnotations(AlignmentPanel ap, AlignmentAnnotation[] annotations, - Vector sequenceGroups) + Vector sequenceGroups, + Hashtable alProperties) { this.ap = ap; features = false; GFFFormat.setVisible(false); + CSVFormat.setVisible(true); this.annotations = annotations; this.sequenceGroups = sequenceGroups; + this.alignmentProperties = alProperties; frame.setTitle("Export Annotations"); } @@ -107,9 +119,15 @@ public class AnnotationExporter } else { - text = new AnnotationFile().printAnnotations( + if (CSVFormat.isSelected()) + { + text = new AnnotationFile().printCSVAnnotations(annotations); + } else { + text = new AnnotationFile().printAnnotations( annotations, - sequenceGroups); + sequenceGroups, + alignmentProperties); + } } try @@ -125,6 +143,8 @@ public class AnnotationExporter ex.printStackTrace(); } } + + close_actionPerformed(null); } public void toTextbox_actionPerformed(ActionEvent e) @@ -147,9 +167,15 @@ public class AnnotationExporter } else if (!features) { - text = new AnnotationFile().printAnnotations( + if (CSVFormat.isSelected()) + { + text = new AnnotationFile().printCSVAnnotations(annotations); + } else { + text = new AnnotationFile().printAnnotations( annotations, - sequenceGroups); + sequenceGroups, + alignmentProperties); + } } CutAndPasteTransfer cap = new CutAndPasteTransfer(); @@ -161,6 +187,7 @@ public class AnnotationExporter 600, 500); + close_actionPerformed(null); } public void close_actionPerformed(ActionEvent e) @@ -206,6 +233,8 @@ public class AnnotationExporter jalviewFormat.setText("Jalview"); GFFFormat.setOpaque(false); GFFFormat.setText("GFF"); + CSVFormat.setOpaque(false); + CSVFormat.setText("CSV(Spreadsheet)"); jLabel1.setHorizontalAlignment(SwingConstants.TRAILING); jLabel1.setText("Format: "); this.setBackground(Color.white); @@ -218,8 +247,10 @@ public class AnnotationExporter jPanel3.add(jLabel1); jPanel3.add(jalviewFormat); jPanel3.add(GFFFormat); + jPanel3.add(CSVFormat); buttonGroup.add(jalviewFormat); buttonGroup.add(GFFFormat); + buttonGroup.add(CSVFormat); this.add(jPanel3, null); this.add(jPanel1, null); } @@ -231,6 +262,7 @@ public class AnnotationExporter ButtonGroup buttonGroup = new ButtonGroup(); JRadioButton jalviewFormat = new JRadioButton(); JRadioButton GFFFormat = new JRadioButton(); + JRadioButton CSVFormat = new JRadioButton(); JLabel jLabel1 = new JLabel(); JPanel jPanel3 = new JPanel(); FlowLayout flowLayout1 = new FlowLayout();