thread.start();\r
}\r
\r
+ public void associatedData_actionPerformed(ActionEvent e)\r
+ {\r
+ // Pick the tree file\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+ getProperty(\r
+ "LAST_DIRECTORY"));\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Load Jalview Annotations or Features File");\r
+ chooser.setToolTipText("Load Jalview Annotations / Features file");\r
+\r
+ int value = chooser.showOpenDialog(null);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+ loadJalviewDataFile(choice);\r
+ }\r
+\r
+ }\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
AlignFrame af = new AlignFrame(alignment);\r
String newtitle = new String("Copied sequences");\r
\r
+ //>>>This is a fix for the moment, until a better solution is found!!<<<\r
+ FeatureRenderer fr = af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer();\r
+ fr.featureColours = alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours;\r
+\r
if (title.startsWith("Copied sequences"))\r
{\r
newtitle = title;\r
alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(type, ucs.findColour("A"));\r
}\r
\r
- sf = new SequenceFeature(type, desc, "", start, end);\r
- sf.setFeatureGroup(featureGroup);\r
+ sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
\r
seq.getDatasetSequence().addSequenceFeature(sf);\r
}\r
{\r
e.printStackTrace();\r
}\r
-\r
if (files != null)\r
{\r
try\r
{\r
- boolean isAnnotation = false;\r
\r
for (int i = 0; i < files.size(); i++)\r
{\r
- String file = files.get(i).toString();\r
-\r
- isAnnotation = new AnnotationReader().readAnnotationFile(viewport.alignment, file);\r
-\r
- if( !isAnnotation )\r
- {\r
- boolean isGroupsFile = parseGroupsFile(file);\r
- if (!isGroupsFile)\r
- {\r
- String protocol = "File";\r
- String format = new IdentifyFile().Identify(file, protocol);\r
- SequenceI[] sequences = new FormatAdapter().readFile(file, protocol, format);\r
-\r
- FastaFile ff = new FastaFile();\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- c.setContents(new StringSelection(ff.print(sequences)), this);\r
-\r
- this.paste(false);\r
-\r
- }\r
- }\r
+ loadJalviewDataFile(files.get(i).toString());\r
}\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+}\r
+\r
+ // This method will attempt to load a "dropped" file first by testing\r
+ // whether its and Annotation file, then group file. If both are\r
+ // false then the user may have dropped an alignment file onto this\r
+ // AlignFrame\r
+ void loadJalviewDataFile(String file)\r
+ {\r
+ try{\r
+ boolean isAnnotation = new AnnotationReader().readAnnotationFile(viewport.\r
+ alignment, file);\r
\r
- if(isAnnotation)\r
+ if (!isAnnotation)\r
+ {\r
+ boolean isGroupsFile = parseGroupsFile(file);\r
+ if (!isGroupsFile)\r
{\r
- int height = alignPanel.annotationPanel.adjustPanelHeight();\r
- alignPanel.annotationScroller.setPreferredSize(\r
- new Dimension(alignPanel.annotationScroller.getWidth(),\r
- height));\r
+ String protocol = "File";\r
+ String format = new IdentifyFile().Identify(file, protocol);\r
+ SequenceI[] sequences = new FormatAdapter().readFile(file, protocol,\r
+ format);\r
\r
- alignPanel.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
- alignPanel.annotationSpaceFillerHolder.getWidth(),\r
- height));\r
+ FastaFile ff = new FastaFile();\r
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+ c.setContents(new StringSelection(ff.print(sequences)), this);\r
\r
- alignPanel.addNotify();\r
+ this.paste(false);\r
}\r
}\r
- catch (Exception ex)\r
+\r
+ if (isAnnotation)\r
{\r
- ex.printStackTrace();\r
+ int height = alignPanel.annotationPanel.adjustPanelHeight();\r
+ alignPanel.annotationScroller.setPreferredSize(\r
+ new Dimension(alignPanel.annotationScroller.getWidth(),\r
+ height));\r
+\r
+ alignPanel.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
+ alignPanel.annotationSpaceFillerHolder.getWidth(),\r
+ height));\r
+\r
+ alignPanel.addNotify();\r
}\r
- }\r
-}\r
\r
+ }catch(Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
}\r