X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationExporter.java;h=a23496d3b38fb25e70fc163418e650c18fade4f4;hb=0ebbad305e982eeda562a1842362dc415c36cc8d;hp=0b0916d1ec753e5e1d7264117944b94fb32b0bb9;hpb=3595f261bc6f18dd8a4780976716bea81bd4fae4;p=jalview.git diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 0b0916d..a23496d 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -20,22 +20,13 @@ */ package jalview.gui; -import jalview.api.FeatureRenderer; -import jalview.bin.Cache; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.SequenceI; -import jalview.io.AnnotationFile; -import jalview.io.FeaturesFile; -import jalview.io.JalviewFileChooser; -import jalview.io.JalviewFileView; -import jalview.util.MessageManager; - import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileWriter; import java.io.PrintWriter; +import java.util.Locale; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; @@ -48,6 +39,16 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.SwingConstants; +import jalview.api.FeatureRenderer; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.SequenceI; +import jalview.io.AnnotationFile; +import jalview.io.FeaturesFile; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.util.MessageManager; + /** * * GUI dialog for exporting features or alignment annotations depending upon @@ -106,6 +107,7 @@ public class AnnotationExporter extends JPanel } frame = new JInternalFrame(); + frame.setFrameIcon(null); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); Dimension preferredSize = frame.getPreferredSize(); @@ -114,9 +116,9 @@ public class AnnotationExporter extends JPanel } /** - * Configures the dialog for options to export visible features. If from a split - * frame panel showing linked features, make the option to include these in the - * export visible. + * Configures the dialog for options to export visible features. If from a + * split frame panel showing linked features, make the option to include these + * in the export visible. */ public void exportFeatures() { @@ -161,8 +163,17 @@ public class AnnotationExporter extends JPanel frame.setTitle(MessageManager.getString("label.export_annotations")); } + public void setExportAsCSV() + { + if (CSVFormat != null) + { + CSVFormat.setSelected(true); + } + } + private void toFile_actionPerformed() { + // TODO: JAL-3048 JalviewFileChooser - Save option JalviewFileChooser chooser = new JalviewFileChooser( Cache.getProperty("LAST_DIRECTORY")); @@ -194,28 +205,30 @@ public class AnnotationExporter extends JPanel } /** - * Answers the text to output for either Features (in GFF or Jalview format) or - * Annotations (in CSV or Jalview format) + * Answers the text to output for either Features (in GFF or Jalview format) + * or Annotations (in CSV or Jalview format) * * @return */ - private String getText() + public String getText() { return exportFeatures ? getFeaturesText() : getAnnotationsText(); } /** - * Returns the text contents for output of annotations in either CSV or Jalview - * format + * Returns the text contents for output of annotations in either CSV or + * Jalview format * * @return */ - private String getAnnotationsText() + public String getAnnotationsText() { String text; if (CSVFormat.isSelected()) { - text = new AnnotationFile().printCSVAnnotations(annotations); + text = new AnnotationFile().printCSVAnnotations( + wholeView ? ap.av.getAlignment().getAlignmentAnnotation() + : annotations); } else { @@ -238,7 +251,7 @@ public class AnnotationExporter extends JPanel * * @return */ - private String getFeaturesText() + public String getFeaturesText() { String text; SequenceI[] sequences = ap.av.getAlignment().getSequencesArray(); @@ -322,10 +335,10 @@ public class AnnotationExporter extends JPanel } /** - * Builds a panel with a checkbox for the option to export linked (CDS/peptide) - * features. This is hidden by default, and only made visible if exporting - * features from a split frame panel which is configured to show linked - * features. + * Builds a panel with a checkbox for the option to export linked + * (CDS/peptide) features. This is hidden by default, and only made visible if + * exporting features from a split frame panel which is configured to show + * linked features. * * @return */ @@ -335,17 +348,14 @@ public class AnnotationExporter extends JPanel linkedFeaturesPanel.setOpaque(false); boolean nucleotide = ap.av.isNucleotide(); - String complement = nucleotide - ? MessageManager.getString("label.protein").toLowerCase() - : "CDS"; - JLabel label = new JLabel( - MessageManager.formatMessage("label.include_linked_features", - complement)); + String complement = nucleotide ? MessageManager + .getString("label.protein").toLowerCase(Locale.ROOT) : "CDS"; + JLabel label = new JLabel(MessageManager + .formatMessage("label.include_linked_features", complement)); label.setHorizontalAlignment(SwingConstants.TRAILING); String tooltip = MessageManager .formatMessage("label.include_linked_tooltip", complement); - label.setToolTipText( - JvSwingUtils.wrapTooltip(true, tooltip)); + label.setToolTipText(JvSwingUtils.wrapTooltip(true, tooltip)); includeLinkedFeatures = new JCheckBox(); linkedFeaturesPanel.add(label); @@ -402,8 +412,8 @@ public class AnnotationExporter extends JPanel } /** - * Builds the panel with options to output in Jalview, GFF or CSV format. GFF is - * only made visible when exporting features, CSV only when exporting + * Builds the panel with options to output in Jalview, GFF or CSV format. GFF + * is only made visible when exporting features, CSV only when exporting * annotation. * * @return