* @version $Revision$\r
*/\r
public class AlignFrame\r
- extends GAlignFrame\r
+ extends GAlignFrame implements ClipboardOwner\r
{\r
/** DOCUMENT ME!! */\r
public static final int NEW_WINDOW_WIDTH = 700;\r
al.setDataset(null);\r
}\r
\r
- AlignViewport ds = new AlignViewport(al.getDataset());\r
- ds.setDataset(true);\r
+ AlignViewport ds = new AlignViewport(al.getDataset(), true);\r
AlignmentPanel dap = new AlignmentPanel(this, ds);\r
tabbedPane.add("Dataset", dap);\r
viewports.add(ds);\r
alignPanel.repaint();\r
}\r
\r
+ public void lostOwnership(Clipboard clipboard, Transferable contents)\r
+ {\r
+ Desktop.jalviewClipboard = null;\r
+ }\r
+\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
{\r
if (viewport.getSelectionGroup() == null)\r
{\r
- System.out.println("null here");\r
+ System.out.println("nothing selected");\r
return;\r
}\r
\r
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
\r
Hashtable orderedSeqs = new Hashtable();\r
- SequenceI [] seqs = new SequenceI[sg.getSize()];\r
+ SequenceI[] seqs = new SequenceI[sg.getSize()];\r
\r
for (int i = 0; i < sg.getSize(); i++)\r
{\r
}\r
}\r
\r
-\r
//FIND START RES\r
//Returns residue following index if gap\r
startRes = seq.findPosition(sg.getStartRes());\r
}\r
\r
seqs[i] = new Sequence(seq.getName(),\r
- seq.getSequence(sg.getStartRes(), sg.getEndRes()+1),\r
+ seq.getSequence(sg.getStartRes(), sg.getEndRes() + 1),\r
startRes,\r
endRes);\r
+ seqs[i].setDescription(seq.getDescription());\r
+ seqs[i].setDBRef(seq.getDBRef());\r
+ seqs[i].setSequenceFeatures(seq.getSequenceFeatures());\r
+ seqs[i].setDatasetSequence(seq.getDatasetSequence());\r
}\r
\r
- c.setContents(new StringSelection(new FastaFile().print(seqs)), null);\r
+ Desktop.jalviewClipboard = new Object[]{seqs, viewport.alignment.getDataset()};\r
+ FastaFile ff = new FastaFile();\r
+ ff.addDBPrefix( viewport.showDBPrefix );\r
+ ff.addJVSuffix( viewport.showJVSuffix );\r
+ c.setContents(new StringSelection( ff.print(seqs)), this);\r
}\r
\r
/**\r
return;\r
\r
String format = IdentifyFile.Identify(str, "Paste");\r
- SequenceI[] sequences = new FormatAdapter().readFile(str, "Paste", format);\r
+ SequenceI[] sequences;\r
+\r
+ if(Desktop.jalviewClipboard!=null)\r
+ {\r
+ // The clipboard was filled from within Jalview, we must use the sequences\r
+ // And dataset from the copied alignment\r
+ sequences = (SequenceI[])Desktop.jalviewClipboard[0];\r
+ }\r
+ else\r
+ sequences = new FormatAdapter().readFile(str, "Paste", format);\r
\r
\r
if (newAlignment)\r
{\r
+\r
Alignment alignment = new Alignment(sequences);\r
- alignment.setDataset( viewport.alignment.getDataset() );\r
+\r
+ if(Desktop.jalviewClipboard!=null)\r
+ alignment.setDataset( (Alignment)Desktop.jalviewClipboard[1] );\r
+ else\r
+ alignment.setDataset( null );\r
+\r
+\r
AlignFrame af = new AlignFrame(alignment);\r
String newtitle = new String("Copied sequences");\r
\r
*\r
* @param e DOCUMENT ME!\r
*/\r
- protected void fullSeqId_actionPerformed(ActionEvent e)\r
+ protected void seqLimit_actionPerformed(ActionEvent e)\r
{\r
- viewport.setShowFullId(fullSeqId.isSelected());\r
+ viewport.setShowJVSuffix(seqLimits.isSelected());\r
\r
alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());\r
alignPanel.repaint();\r
}\r
\r
+ public void seqDBRef_actionPerformed(ActionEvent e)\r
+ {\r
+ viewport.setShowDBPrefix(seqDBRef.isSelected());\r
+\r
+ alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());\r
+ alignPanel.repaint();\r
+ }\r
+\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
{\r
viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
\r
- if (viewport.showSequenceFeatures &&\r
- ! ( (Alignment) viewport.alignment).featuresAdded)\r
+ // if (viewport.showSequenceFeatures &&\r
+ // ! ( (Alignment) viewport.alignment.getDataset()).featuresAdded)\r
{\r
- new SequenceFeatureFetcher(viewport.\r
- alignment,\r
- alignPanel);\r
+ // System.out.println("new fetcher");\r
+ // new SequenceFeatureFetcher(viewport.\r
+ // alignment,\r
+ // alignPanel);\r
}\r
\r
featureSettings.setEnabled(true);\r
int endRes;\r
int startSeq;\r
int endSeq;\r
- boolean showFullId = false;\r
+ boolean showDBPrefix = true;\r
+ boolean showJVSuffix = true;\r
boolean showText = true;\r
boolean showColourText = false;\r
boolean showBoxes = true;\r
\r
boolean isDataset = false;\r
\r
+\r
+ public AlignViewport(AlignmentI al, boolean dataset)\r
+ {\r
+ isDataset = dataset;\r
+ setAlignment(al);\r
+ init();\r
+ }\r
/**\r
* Creates a new AlignViewport object.\r
*\r
public AlignViewport(AlignmentI al)\r
{\r
setAlignment(al);\r
+ init();\r
+ }\r
+\r
+ void init()\r
+ {\r
this.startRes = 0;\r
- this.endRes = al.getWidth() - 1;\r
+ this.endRes = alignment.getWidth() - 1;\r
this.startSeq = 0;\r
- this.endSeq = al.getHeight() - 1;\r
+ this.endSeq = alignment.getHeight() - 1;\r
\r
-\r
- showFullId = Cache.getDefault("SHOW_FULL_ID", true);\r
+ showDBPrefix = Cache.getDefault("SHOW_DBPREFIX", true);\r
+ showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);\r
showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);\r
showConservation = Cache.getDefault("SHOW_CONSERVATION", true);\r
\r
\r
// We must set conservation and consensus before setting colour,\r
// as Blosum and Clustal require this to be done\r
- if(vconsensus==null)\r
+ if(vconsensus==null && !isDataset)\r
{\r
updateConservation();\r
updateConsensus();\r
*\r
* @return DOCUMENT ME!\r
*/\r
- public boolean getShowFullId()\r
+ public boolean getShowJVSuffix()\r
+ {\r
+ return showJVSuffix;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setShowJVSuffix(boolean b)\r
+ {\r
+ showJVSuffix = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getShowDBPrefix()\r
{\r
- return showFullId;\r
+ return showDBPrefix;\r
}\r
\r
/**\r
*\r
* @param b DOCUMENT ME!\r
*/\r
- public void setShowFullId(boolean b)\r
+ public void setShowDBPrefix(boolean b)\r
{\r
- showFullId = b;\r
+ showDBPrefix = b;\r
}\r
\r
/**\r