X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=cc57961160589c5068f7df08939f9a45573cb9ef;hb=e3eb93bc131a0f088312fddde91b728dbebe40d4;hp=05ba50cb09a3e88ce75cafea9baf0797e15eeb3b;hpb=7c05496d1da22f21ce5ae1a199afb9b16c8777ea;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 05ba50c..cc57961 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -37,7 +37,6 @@ import jalview.ws.*; import java.awt.dnd.*; import org.biojava.dasobert.eventmodel.*; - /** * DOCUMENT ME! * @@ -69,6 +68,7 @@ public class AlignFrame */ public AlignFrame(AlignmentI al) { + viewport = new AlignViewport(al); this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); @@ -352,15 +352,20 @@ public class AlignFrame if (viewport.hasHiddenColumns) { - System.out.println("PROMPT USER HERE"); - omitHidden = viewport.getSelectionAsString(); + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + "The Alignment contains hidden columns." + + "\nDo you want to save only the visible alignment?", + "Save / Omit Hidden Columns", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + + if (reply == JOptionPane.YES_OPTION) + omitHidden = viewport.getViewAsString(false); } String output = new FormatAdapter().formatSequences( format, - viewport.getSelectionAsNewSequence(), - omitHidden) ; - + viewport.alignment.getSequencesArray(), + omitHidden); if (output == null) { @@ -392,20 +397,31 @@ public class AlignFrame */ protected void outputText_actionPerformed(ActionEvent e) { - CutAndPasteTransfer cap = new CutAndPasteTransfer(); - - String [] omitHidden = null; if(viewport.hasHiddenColumns) { - System.out.println("PROMPT USER HERE"); - omitHidden = viewport.getSelectionAsString(); + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + "The Alignment contains hidden columns." + +"\nDo you want to output only the visible alignment?", + "Save / Omit Hidden Columns", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + + if(reply==JOptionPane.YES_OPTION) + { + omitHidden = viewport.getViewAsString(false); + } } + CutAndPasteTransfer cap = new CutAndPasteTransfer(); + Desktop.addInternalFrame(cap, + "Alignment output - " + e.getActionCommand(), 600, + 500); + + cap.setText(new FormatAdapter().formatSequences( e.getActionCommand(), - viewport.getSelectionAsNewSequence(), + viewport.alignment.getSequencesArray(), omitHidden)); } @@ -463,6 +479,7 @@ public class AlignFrame new AnnotationExporter().exportFeatures(alignPanel); } + public void exportAnnotations_actionPerformed(ActionEvent e) { new AnnotationExporter().exportAnnotations( @@ -667,22 +684,23 @@ public class AlignFrame { return; } - SequenceI [] seqs; - if(viewport.getSelectionGroup()==null) - { - seqs = viewport.alignment.getSequencesArray(); - } - else + + SequenceI [] seqs = viewport.getSelectionAsNewSequence(); + String[] omitHidden = null; + + if (viewport.hasHiddenColumns) { - seqs = viewport.getSelectionGroup().getSequencesInOrder(viewport.alignment); + omitHidden = viewport.getViewAsString(true); } - Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + String output = new FormatAdapter().formatSequences( + "Fasta", + seqs, + omitHidden); - FastaFile ff = new FastaFile(); - ff.addJVSuffix( viewport.showJVSuffix ); - c.setContents(new StringSelection(ff.print(seqs)), Desktop.instance); + Toolkit.getDefaultToolkit().getSystemClipboard() + .setContents(new StringSelection(output), Desktop.instance); Vector hiddenColumns = null; if(viewport.hasHiddenColumns && viewport.getSelectionGroup()!=null) @@ -698,6 +716,7 @@ public class AlignFrame region[1]-hiddenOffset}); } } + Desktop.jalviewClipboard = new Object[]{ seqs, viewport.alignment.getDataset(), hiddenColumns}; @@ -749,6 +768,7 @@ public class AlignFrame String format = new IdentifyFile().Identify(str, "Paste"); SequenceI[] sequences; + if(Desktop.jalviewClipboard!=null) { // The clipboard was filled from within Jalview, we must use the sequences @@ -764,32 +784,40 @@ public class AlignFrame if (newAlignment) { + System.out.println(format +" 2"); alignment = new Alignment(sequences); if(Desktop.jalviewClipboard!=null) alignment.setDataset( (Alignment)Desktop.jalviewClipboard[1] ); else alignment.setDataset( null ); + } else { + System.out.println(format +" 24"); alignment = viewport.getAlignment(); //!newAlignment for (int i = 0; i < sequences.length; i++) { - Sequence newseq = new Sequence(sequences[i].getName(), sequences[i].getSequence(), sequences[i].getStart(), sequences[i].getEnd()); alignment.addSequence(newseq); } + + viewport.setEndSeq(alignment.getHeight()); alignment.getWidth(); viewport.firePropertyChange("alignment", null, alignment.getSequences()); } + + + + // Add any annotations attached to sequences for (int i = 0; i < sequences.length; i++) { @@ -830,9 +858,7 @@ public class AlignFrame for(int i=0; i