X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=c60355c6554497a5e37407297d1167d75f078c1a;hb=d3fb461d66f67625686387cb75f6e9589510a577;hp=c0271acec3c0781a334467878a459adcc69b1412;hpb=d0b7395c10aec7c5da5a5662fc69783ec78fae8d;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c0271ac..c60355c 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -112,8 +112,6 @@ public class AlignFrame void init() { - this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); - if (viewport.conservation == null) { BLOSUM62Colour.setEnabled(false); @@ -137,6 +135,7 @@ public class AlignFrame if (Desktop.desktop != null) { + this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); addServiceListeners(); setGUINucleotide(viewport.alignment.isNucleotide()); } @@ -170,12 +169,15 @@ public class AlignFrame { public void keyPressed(KeyEvent evt) { - if (viewport.cursorMode - && evt.getKeyCode() >= KeyEvent.VK_0 - && evt.getKeyCode() <= KeyEvent.VK_9) - { + if (viewport.cursorMode && + ( (evt.getKeyCode() >= KeyEvent.VK_0 && + evt.getKeyCode() <= KeyEvent.VK_9) + || + (evt.getKeyCode() >= KeyEvent.VK_NUMPAD0 && + evt.getKeyCode() <= KeyEvent.VK_NUMPAD9) + ) + && Character.isDigit(evt.getKeyChar())) alignPanel.seqPanel.numberPressed(evt.getKeyChar()); - } switch (evt.getKeyCode()) { @@ -849,7 +851,7 @@ public class AlignFrame */ protected void htmlMenuItem_actionPerformed(ActionEvent e) { - new HTMLOutput(viewport, + new HTMLOutput(alignPanel, alignPanel.seqPanel.seqCanvas.getSequenceRenderer(), alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); } @@ -962,7 +964,7 @@ public class AlignFrame PaintRefresher.RemoveComponent(ap.seqPanel.seqCanvas); PaintRefresher.RemoveComponent(ap.idPanel.idCanvas); PaintRefresher.RemoveComponent(ap); - ap.av.alignment.destroyAlignment(); + ap.av.alignment = null; } } else @@ -973,7 +975,7 @@ public class AlignFrame PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas); PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas); PaintRefresher.RemoveComponent(alignPanel); - alignPanel.av.alignment.destroyAlignment(); + viewport.alignment = null; alignPanel = null; viewport = null; @@ -1307,8 +1309,8 @@ public class AlignFrame { return; } - - SequenceI [] seqs = viewport.getSelectionAsNewSequence(); + // TODO: preserve the ordering of displayed alignment annotation in any internal paste (particularly sequence associated annotation) + SequenceI [] seqs = viewport.getSelectionAsNewSequence(); String[] omitHidden = null; if (viewport.hasHiddenColumns) @@ -1405,6 +1407,7 @@ public class AlignFrame */ void paste(boolean newAlignment) { + boolean externalPaste=true; try { Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -1447,102 +1450,149 @@ public class AlignFrame } SequenceI[] sequences; - + boolean annotationAdded = false; + AlignmentI alignment = null; if(Desktop.jalviewClipboard!=null) { // The clipboard was filled from within Jalview, we must use the sequences // And dataset from the copied alignment - sequences = (SequenceI[])Desktop.jalviewClipboard[0]; + SequenceI[] newseq = (SequenceI[])Desktop.jalviewClipboard[0]; + // be doubly sure that we create *new* sequence objects. + sequences = new SequenceI[newseq.length]; + for (int i=0;i>>This is a fix for the moment, until a better solution is found!!<<< af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings( alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); - - - if (title.startsWith("Copied sequences")) - { - newtitle = title; - } - else - { - newtitle = newtitle.concat("- from " + title); + + // TODO: maintain provenance of an alignment, rather than just make the title a concatenation of operations. + if (!externalPaste) { + if (title.startsWith("Copied sequences")) + { + newtitle = title; + } + else + { + newtitle = newtitle.concat("- from " + title); + } + } else { + newtitle = new String("Pasted sequences"); } Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, @@ -3265,7 +3319,7 @@ public class AlignFrame } wsmenu.add(secstrmenu); } - this.webService.removeAll(); + resetWebServiceMenu(); for (int i = 0, j = wsmenu.size(); i < j; i++) { webService.add( (JMenu) wsmenu.get(i)); @@ -3273,7 +3327,7 @@ public class AlignFrame } else { - this.webService.removeAll(); + resetWebServiceMenu(); this.webService.add(this.webServiceNoServices); } // TODO: add in rediscovery function @@ -3281,6 +3335,31 @@ public class AlignFrame // TODO: group services by location as well as function. } + + /** + * empty the web service menu and add any ad-hoc functions + * not dynamically discovered. + * + */ + private void resetWebServiceMenu() + { + webService.removeAll(); + // Temporary hack - DBRef Fetcher always top level ws entry. + JMenuItem rfetch = new JMenuItem("Fetch DB References"); + rfetch.setToolTipText("Retrieve and parse uniprot records for the alignment or the currently selected sequences"); + webService.add(rfetch); + rfetch.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + new jalview.io.DBRefFetcher( + alignPanel.av.getSequenceSelection(), + alignPanel.alignFrame).fetchDBRefs(false); + } + + }); + } + /* public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. @@ -3302,13 +3381,12 @@ public class AlignFrame - public void showTranslation_actionPerformed(ActionEvent e) { /////////////////////////////// // Collect Data to be translated/transferred - SequenceI [] selection = viewport.getSelectionAsNewSequence(); + SequenceI [] selection = viewport.getSequenceSelection(); String [] seqstring = viewport.getViewAsString(true); AlignmentI al = null; try {