*/\r
package jalview.gui;\r
\r
+import jalview.binding.*;\r
+\r
+import jalview.io.*;\r
+\r
+import jalview.schemes.*;\r
+\r
import java.io.*;\r
+\r
import java.net.*;\r
+\r
import java.util.*;\r
import java.util.jar.*;\r
\r
import javax.swing.*;\r
\r
-import jalview.binding.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class Jalview2XML\r
{\r
- // SAVES SEVERAL ALIGNEMENT WINDOWS TO SAME JARFILE\r
- public static void SaveState(File statefile)\r
- {\r
- long creation = System.currentTimeMillis();\r
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
-\r
- if (frames == null)\r
- {\r
- return;\r
- }\r
-\r
- try\r
+ // SAVES SEVERAL ALIGNEMENT WINDOWS TO SAME JARFILE\r
+ public static void SaveState(File statefile)\r
{\r
- FileOutputStream fos = new FileOutputStream(statefile);\r
- JarOutputStream jout = new JarOutputStream(fos);\r
-\r
- //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
- ////////////////////////////////////////////////////\r
- PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
- "UTF-8"));\r
+ long creation = System.currentTimeMillis();\r
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
\r
- Vector shortNames = new Vector();\r
-\r
- //REVERSE ORDER\r
- for (int i = frames.length - 1; i > -1; i--)\r
- {\r
- if (frames[i] instanceof AlignFrame)\r
+ if (frames == null)\r
{\r
- AlignFrame af = (AlignFrame) frames[i];\r
+ return;\r
+ }\r
\r
- String shortName = af.getTitle();\r
+ try\r
+ {\r
+ FileOutputStream fos = new FileOutputStream(statefile);\r
+ JarOutputStream jout = new JarOutputStream(fos);\r
\r
- if (shortName.indexOf(File.separatorChar) > -1)\r
- {\r
- shortName = shortName.substring(shortName.lastIndexOf(\r
- File.separatorChar) + 1);\r
- }\r
+ //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
+ ////////////////////////////////////////////////////\r
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+ "UTF-8"));\r
\r
- int count = 1;\r
+ Vector shortNames = new Vector();\r
\r
- while (shortNames.contains(shortName))\r
- {\r
- if (shortName.endsWith("_" + (count - 1)))\r
+ //REVERSE ORDER\r
+ for (int i = frames.length - 1; i > -1; i--)\r
{\r
- shortName = shortName.substring(0,\r
- shortName.lastIndexOf("_"));\r
- }\r
+ if (frames[i] instanceof AlignFrame)\r
+ {\r
+ AlignFrame af = (AlignFrame) frames[i];\r
\r
- shortName = shortName.concat("_" + count);\r
- count++;\r
- }\r
+ String shortName = af.getTitle();\r
\r
- shortNames.addElement(shortName);\r
+ if (shortName.indexOf(File.separatorChar) > -1)\r
+ {\r
+ shortName = shortName.substring(shortName.lastIndexOf(\r
+ File.separatorChar) + 1);\r
+ }\r
\r
- if (!shortName.endsWith(".xml"))\r
- {\r
- shortName = shortName + ".xml";\r
- }\r
+ int count = 1;\r
\r
- SaveState(af, creation, shortName, jout, out);\r
- }\r
- }\r
+ while (shortNames.contains(shortName))\r
+ {\r
+ if (shortName.endsWith("_" + (count - 1)))\r
+ {\r
+ shortName = shortName.substring(0,\r
+ shortName.lastIndexOf("_"));\r
+ }\r
\r
- out.close();\r
- jout.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
+ shortName = shortName.concat("_" + count);\r
+ count++;\r
+ }\r
\r
- // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW\r
- public static void SaveState(AlignFrame af, String jarFile, String fileName)\r
- {\r
- try\r
- {\r
- FileOutputStream fos = new FileOutputStream(jarFile);\r
- JarOutputStream jout = new JarOutputStream(fos);\r
+ shortNames.addElement(shortName);\r
\r
- //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
- ////////////////////////////////////////////////////\r
- PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
- "UTF-8"));\r
+ if (!shortName.endsWith(".xml"))\r
+ {\r
+ shortName = shortName + ".xml";\r
+ }\r
\r
- SaveState(af, System.currentTimeMillis(), fileName, jout, out);\r
- out.close();\r
- jout.close();\r
- }\r
- catch (Exception ex)\r
- {\r
+ SaveState(af, creation, shortName, jout, out);\r
+ }\r
+ }\r
+\r
+ out.close();\r
+ jout.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
- }\r
\r
- public static void SaveState(AlignFrame af, long timeStamp,\r
- String fileName, JarOutputStream jout,\r
- PrintWriter out)\r
- {\r
- Vector seqids = new Vector();\r
- Vector userColours = new Vector();\r
+ // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW\r
+ public static void SaveAlignment(AlignFrame af, String jarFile,\r
+ String fileName)\r
+ {\r
+ try\r
+ {\r
+ FileOutputStream fos = new FileOutputStream(jarFile);\r
+ JarOutputStream jout = new JarOutputStream(fos);\r
\r
- AlignViewport av = af.viewport;\r
+ //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
+ ////////////////////////////////////////////////////\r
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+ "UTF-8"));\r
\r
- JalviewModel object = new JalviewModel();\r
- object.setVamsasModel(new VamsasModel());\r
+ SaveState(af, System.currentTimeMillis(), fileName, jout, out);\r
+ out.close();\r
+ jout.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
\r
- object.setCreationDate(new java.util.Date(timeStamp));\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param af DOCUMENT ME!\r
+ * @param timeStamp DOCUMENT ME!\r
+ * @param fileName DOCUMENT ME!\r
+ * @param jout DOCUMENT ME!\r
+ * @param out DOCUMENT ME!\r
+ */\r
+ public static void SaveState(AlignFrame af, long timeStamp,\r
+ String fileName, JarOutputStream jout, PrintWriter out)\r
+ {\r
+ Vector seqids = new Vector();\r
+ Vector userColours = new Vector();\r
\r
- jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
+ AlignViewport av = af.viewport;\r
\r
- SequenceSet vamsasSet = new SequenceSet();\r
- Sequence vamsasSeq;\r
- JalviewModelSequence jms = new JalviewModelSequence();\r
+ JalviewModel object = new JalviewModel();\r
+ object.setVamsasModel(new VamsasModel());\r
\r
- vamsasSet.setGapChar(jal.getGapCharacter() + "");\r
+ object.setCreationDate(new java.util.Date(timeStamp));\r
+ object.setVersion(jalview.bin.Cache.getProperty("VERSION"));\r
\r
- JSeq jseq;\r
+ jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
\r
- //SAVE SEQUENCES\r
- int id = 0;\r
+ SequenceSet vamsasSet = new SequenceSet();\r
+ Sequence vamsasSeq;\r
+ JalviewModelSequence jms = new JalviewModelSequence();\r
\r
- for (int i = 0; i < jal.getHeight(); i++)\r
- {\r
- seqids.add(jal.getSequenceAt(i));\r
+ vamsasSet.setGapChar(jal.getGapCharacter() + "");\r
\r
- vamsasSeq = new Sequence();\r
- vamsasSeq.setId(id + "");\r
- vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
- vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
+ JSeq jseq;\r
\r
- jseq = new JSeq();\r
- jseq.setStart(jal.getSequenceAt(i).getStart());\r
- jseq.setEnd(jal.getSequenceAt(i).getEnd());\r
+ //SAVE SEQUENCES\r
+ int id = 0;\r
\r
- jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());\r
+ for (int i = 0; i < jal.getHeight(); i++)\r
+ {\r
+ seqids.add(jal.getSequenceAt(i));\r
\r
- jseq.setId(id);\r
+ vamsasSeq = new Sequence();\r
+ vamsasSeq.setId(id + "");\r
+ vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
+ vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
\r
- jms.addJSeq(jseq);\r
- vamsasSet.addSequence(vamsasSeq);\r
- id++;\r
- }\r
+ jseq = new JSeq();\r
+ jseq.setStart(jal.getSequenceAt(i).getStart());\r
+ jseq.setEnd(jal.getSequenceAt(i).getEnd());\r
\r
- //SAVE TREES\r
- if (af.viewport.currentTree != null)\r
- {\r
- object.getVamsasModel().addTree(af.viewport.currentTree.toString());\r
- }\r
+ jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());\r
\r
- //SAVE ANNOTATIONS\r
- if (jal.getAlignmentAnnotation() != null)\r
- {\r
- jalview.datamodel.AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();\r
+ jseq.setId(id);\r
\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- if (aa[i].label.equals("Quality") ||\r
- aa[i].label.equals("Conservation") ||\r
- aa[i].label.equals("Consensus"))\r
- {\r
- continue;\r
+ jms.addJSeq(jseq);\r
+ vamsasSet.addSequence(vamsasSeq);\r
+ id++;\r
}\r
\r
- Annotation an = new Annotation();\r
- an.setDescription(aa[i].description);\r
- an.setGraph(aa[i].isGraph);\r
- an.setLabel(aa[i].label);\r
-\r
- AnnotationElement ae;\r
-\r
- for (int a = 0; a < aa[i].annotations.length; a++)\r
+ //SAVE TREES\r
+ ///////////////////////////////////\r
+ if (af.viewport.currentTree != null)\r
{\r
- if ( (aa[i] == null) || (aa[i].annotations[a] == null))\r
+ // FIND ANY ASSOCIATED TREES\r
+ // NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT\r
+ if (Desktop.desktop != null)\r
{\r
- continue;\r
- }\r
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
\r
- ae = new AnnotationElement();\r
- ae.setDescription(aa[i].annotations[a].description);\r
- ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);\r
- ae.setValue(aa[i].annotations[a].value);\r
- ae.setPosition(a);\r
- ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +\r
- "");\r
- an.addAnnotationElement(ae);\r
+ for (int t = 0; t < frames.length; t++)\r
+ {\r
+ if (frames[t] instanceof TreePanel)\r
+ {\r
+ TreePanel tp = (TreePanel) frames[t];\r
+\r
+ if (tp.treeCanvas.av.alignment == jal)\r
+ {\r
+ Tree tree = new Tree();\r
+ tree.setTitle(tp.getTitle());\r
+ tree.setCurrentTree( (af.viewport.currentTree == tp.getTree()));\r
+ tree.setNewick(tp.getTree().toString());\r
+ tree.setThreshold(tp.treeCanvas.threshold);\r
+\r
+ tree.setFitToWindow(tp.fitToWindow.getState());\r
+ tree.setFontSize(tp.treeCanvas.fontSize);\r
+ tree.setMarkUnlinked(tp.placeholdersMenu.getState());\r
+ tree.setShowBootstrap(tp.bootstrapMenu.getState());\r
+ tree.setShowDistances(tp.distanceMenu.getState());\r
+\r
+ tree.setHeight(tp.getHeight());\r
+ tree.setWidth(tp.getWidth());\r
+ tree.setXpos(tp.getX());\r
+ tree.setYpos(tp.getY());\r
+\r
+ jms.addTree(tree);\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
\r
- vamsasSet.addAnnotation(an);\r
- }\r
- }\r
+ //SAVE ANNOTATIONS\r
+ if (jal.getAlignmentAnnotation() != null)\r
+ {\r
+ jalview.datamodel.AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();\r
\r
- //SAVE GROUPS\r
- if (jal.getGroups() != null)\r
- {\r
- JGroup[] groups = new JGroup[jal.getGroups().size()];\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (aa[i].label.equals("Quality") ||\r
+ aa[i].label.equals("Conservation") ||\r
+ aa[i].label.equals("Consensus"))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ Annotation an = new Annotation();\r
+ an.setDescription(aa[i].description);\r
+ an.setGraph(aa[i].isGraph);\r
+ an.setLabel(aa[i].label);\r
+\r
+ AnnotationElement ae;\r
+\r
+ for (int a = 0; a < aa[i].annotations.length; a++)\r
+ {\r
+ if ((aa[i] == null) || (aa[i].annotations[a] == null))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ ae = new AnnotationElement();\r
+ ae.setDescription(aa[i].annotations[a].description);\r
+ ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);\r
+ ae.setValue(aa[i].annotations[a].value);\r
+ ae.setPosition(a);\r
+ ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +\r
+ "");\r
+ an.addAnnotationElement(ae);\r
+ }\r
+\r
+ vamsasSet.addAnnotation(an);\r
+ }\r
+ }\r
\r
- for (int i = 0; i < groups.length; i++)\r
- {\r
- groups[i] = new JGroup();\r
+ //SAVE GROUPS\r
+ if (jal.getGroups() != null)\r
+ {\r
+ JGroup[] groups = new JGroup[jal.getGroups().size()];\r
\r
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup)\r
- jal.getGroups()\r
- .elementAt(i);\r
- groups[i].setStart(sg.getStartRes());\r
- groups[i].setEnd(sg.getEndRes());\r
- groups[i].setName(sg.getName());\r
+ for (int i = 0; i < groups.length; i++)\r
+ {\r
+ groups[i] = new JGroup();\r
+\r
+ jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) jal.getGroups()\r
+ .elementAt(i);\r
+ groups[i].setStart(sg.getStartRes());\r
+ groups[i].setEnd(sg.getEndRes());\r
+ groups[i].setName(sg.getName());\r
+\r
+ if (sg.cs instanceof ConservationColourScheme)\r
+ {\r
+ groups[i].setConsThreshold(((ConservationColourScheme) sg.cs).inc);\r
+ }\r
+\r
+ if (sg.cs instanceof ResidueColourScheme)\r
+ {\r
+ groups[i].setPidThreshold(((ResidueColourScheme) sg.cs).getThreshold());\r
+ }\r
+ else if (sg.cs instanceof ScoreColourScheme)\r
+ {\r
+ groups[i].setPidThreshold(((ScoreColourScheme) sg.cs).getThreshold());\r
+ }\r
+\r
+ if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ {\r
+ groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
+ jms));\r
+ }\r
+ else\r
+ {\r
+ groups[i].setColour(ColourSchemeProperty.getColourName(\r
+ sg.cs));\r
+ }\r
+\r
+ groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
+ groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
+ groups[i].setDisplayText(sg.getDisplayText());\r
+ groups[i].setColourText(sg.getColourText());\r
+\r
+ for (int s = 0; s < sg.getSize(); s++)\r
+ {\r
+ jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg.getSequenceAt(s);\r
+ int index = seqids.indexOf(seq);\r
+ groups[i].addSeq(index);\r
+ }\r
+ }\r
\r
- if (sg.cs instanceof ConservationColourScheme)\r
- {\r
- groups[i].setConsThreshold( ( (ConservationColourScheme) sg.cs).inc);\r
+ jms.setJGroup(groups);\r
}\r
\r
- if (sg.cs instanceof ResidueColourScheme)\r
+ ///////////SAVE VIEWPORT\r
+ Viewport view = new Viewport();\r
+ view.setTitle(af.getTitle());\r
+ view.setXpos(af.getX());\r
+ view.setYpos(af.getY());\r
+ view.setWidth(af.getWidth());\r
+ view.setHeight(af.getHeight());\r
+ view.setStartRes(av.startRes);\r
+ view.setStartSeq(av.startSeq);\r
+\r
+ if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
{\r
- groups[i].setPidThreshold( ( (ResidueColourScheme) sg.cs).\r
- getThreshold());\r
+ view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),\r
+ userColours, jms));\r
}\r
- else if (sg.cs instanceof ScoreColourScheme)\r
+ else\r
{\r
- groups[i].setPidThreshold( ( (ScoreColourScheme) sg.cs).getThreshold());\r
+ view.setBgColour(ColourSchemeProperty.getColourName(\r
+ av.getGlobalColourScheme()));\r
}\r
\r
- if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ ColourSchemeI cs = av.getGlobalColourScheme();\r
+\r
+ if (cs instanceof ConservationColourScheme)\r
{\r
- groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
- jms));\r
+ view.setConsThreshold(((ConservationColourScheme) cs).inc);\r
}\r
- else\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
{\r
- groups[i].setColour(ColourSchemeProperty.getColourName(\r
- sg.cs));\r
+ view.setPidThreshold(((ResidueColourScheme) cs).getThreshold());\r
}\r
-\r
- groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
- groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
- groups[i].setDisplayText(sg.getDisplayText());\r
- groups[i].setColourText(sg.getColourText());\r
-\r
- for (int s = 0; s < sg.getSize(); s++)\r
+ else if (cs instanceof ScoreColourScheme)\r
{\r
- jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg.\r
- getSequenceAt(s);\r
- int index = seqids.indexOf(seq);\r
- groups[i].addSeq(index);\r
+ view.setPidThreshold(((ScoreColourScheme) cs).getThreshold());\r
}\r
- }\r
-\r
- jms.setJGroup(groups);\r
- }\r
\r
- ///////////SAVE VIEWPORT\r
- Viewport view = new Viewport();\r
- view.setTitle(af.getTitle());\r
- view.setXpos(af.getX());\r
- view.setYpos(af.getY());\r
- view.setWidth(af.getWidth());\r
- view.setHeight(af.getHeight());\r
- view.setStartRes(av.startRes);\r
- view.setStartSeq(av.startSeq);\r
-\r
- if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
- {\r
- view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),\r
- userColours, jms));\r
- }\r
- else\r
- {\r
- view.setBgColour(ColourSchemeProperty.getColourName(\r
- av.getGlobalColourScheme()));\r
- }\r
+ view.setConservationSelected(av.getConservationSelected());\r
+ view.setPidSelected(av.getAbovePIDThreshold());\r
+ view.setFontName(av.font.getName());\r
+ view.setFontSize(av.font.getSize());\r
+ view.setFontStyle(av.font.getStyle());\r
+ view.setRenderGaps(av.renderGaps);\r
+ view.setShowAnnotation(av.getShowAnnotation());\r
+ view.setShowBoxes(av.getShowBoxes());\r
+ view.setShowColourText(av.getColourText());\r
+ view.setShowConservation(av.showConservation);\r
+ view.setShowFullId(av.getShowFullId());\r
+ view.setShowIdentity(av.showIdentity);\r
+ view.setShowQuality(av.showQuality);\r
+ view.setShowSequenceFeatures(av.showSequenceFeatures);\r
+ view.setShowText(av.getShowText());\r
+ view.setWrapAlignment(av.getWrapAlignment());\r
+\r
+ jms.addViewport(view);\r
+\r
+ object.setJalviewModelSequence(jms);\r
+ object.getVamsasModel().addSequenceSet(vamsasSet);\r
+\r
+ try\r
+ {\r
+ if (!fileName.endsWith(".xml"))\r
+ {\r
+ fileName = fileName + ".xml";\r
+ }\r
\r
- ColourSchemeI cs = av.getGlobalColourScheme();\r
+ JarEntry entry = new JarEntry(fileName);\r
+ jout.putNextEntry(entry);\r
\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- view.setConsThreshold( ( (ConservationColourScheme) cs).inc);\r
+ object.marshal(out);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- view.setPidThreshold( ( (ResidueColourScheme) cs).getThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
+ static String SetUserColourScheme(jalview.schemes.ColourSchemeI cs,\r
+ Vector userColours, JalviewModelSequence jms)\r
{\r
- view.setPidThreshold( ( (ScoreColourScheme) cs).getThreshold());\r
- }\r
+ String id = null;\r
+ jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs;\r
\r
- view.setConservationSelected(av.getConservationSelected());\r
- view.setPidSelected(av.getAbovePIDThreshold());\r
- view.setFontName(av.font.getFontName());\r
- view.setFontSize(av.font.getSize());\r
- view.setFontStyle(av.font.getStyle());\r
- view.setRenderGaps(av.renderGaps);\r
- view.setShowAnnotation(av.getShowAnnotation());\r
- view.setShowBoxes(av.getShowBoxes());\r
- view.setShowColourText(av.getColourText());\r
- view.setShowConservation(av.showConservation);\r
- view.setShowFullId(av.getShowFullId());\r
- view.setShowIdentity(av.showIdentity);\r
- view.setShowQuality(av.showQuality);\r
- view.setShowSequenceFeatures(av.showSequenceFeatures);\r
- view.setShowText(av.getShowText());\r
- view.setWrapAlignment(av.getWrapAlignment());\r
-\r
- jms.addViewport(view);\r
-\r
- object.setJalviewModelSequence(jms);\r
- object.getVamsasModel().addSequenceSet(vamsasSet);\r
-\r
- try\r
- {\r
- if (!fileName.endsWith(".xml"))\r
- {\r
- fileName = fileName + ".xml";\r
- }\r
+ if (!userColours.contains(ucs))\r
+ {\r
+ userColours.add(ucs);\r
\r
- JarEntry entry = new JarEntry(fileName);\r
- jout.putNextEntry(entry);\r
+ java.awt.Color[] colours = ucs.getColours();\r
+ jalview.binding.UserColours uc = new jalview.binding.UserColours();\r
+ jalview.binding.UserColourScheme jbucs = new jalview.binding.UserColourScheme();\r
\r
- object.marshal(out);\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
+ for (int i = 0; i < colours.length; i++)\r
+ {\r
+ jalview.binding.Colour col = new jalview.binding.Colour();\r
+ col.setRGB(jalview.util.Format.getHexString(colours[i]));\r
+ jbucs.addColour(col);\r
+ }\r
\r
- static String SetUserColourScheme(jalview.schemes.ColourSchemeI cs,\r
- Vector userColours,\r
- JalviewModelSequence jms)\r
- {\r
- String id = null;\r
- jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme)\r
- cs;\r
+ id = "ucs" + userColours.indexOf(ucs);\r
+ uc.setId(id);\r
+ uc.setUserColourScheme(jbucs);\r
+ jms.addUserColours(uc);\r
+ }\r
\r
- if (!userColours.contains(ucs))\r
- {\r
- userColours.add(ucs);\r
-\r
- java.awt.Color[] colours = ucs.getColours();\r
- jalview.binding.UserColours uc = new jalview.binding.UserColours();\r
- jalview.binding.UserColourScheme jbucs = new jalview.binding.\r
- UserColourScheme();\r
-\r
- for (int i = 0; i < colours.length; i++)\r
- {\r
- jalview.binding.Colour col = new jalview.binding.Colour();\r
- col.setRGB(jalview.util.Format.getHexString(colours[i]));\r
- jbucs.addColour(col);\r
- }\r
-\r
- id = "ucs" + userColours.indexOf(ucs);\r
- uc.setId(id);\r
- uc.setUserColourScheme(jbucs);\r
- jms.addUserColours(uc);\r
+ return id;\r
}\r
\r
- return id;\r
- }\r
-\r
- static jalview.schemes.UserColourScheme GetUserColourScheme(\r
- JalviewModelSequence jms, String id)\r
- {\r
- UserColours[] uc = jms.getUserColours();\r
- UserColours colours = null;\r
-\r
- for (int i = 0; i < uc.length; i++)\r
+ static jalview.schemes.UserColourScheme GetUserColourScheme(\r
+ JalviewModelSequence jms, String id)\r
{\r
- if (uc[i].getId().equals(id))\r
- {\r
- colours = uc[i];\r
+ UserColours[] uc = jms.getUserColours();\r
+ UserColours colours = null;\r
\r
- break;\r
- }\r
- }\r
+ for (int i = 0; i < uc.length; i++)\r
+ {\r
+ if (uc[i].getId().equals(id))\r
+ {\r
+ colours = uc[i];\r
\r
- int csize = colours.getUserColourScheme().getColourCount();\r
- java.awt.Color[] newColours = new java.awt.Color[csize];\r
+ break;\r
+ }\r
+ }\r
\r
- for (int i = 0; i < csize; i++)\r
- {\r
- newColours[i] = new java.awt.Color(Integer.parseInt(\r
- colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
- }\r
+ int csize = colours.getUserColourScheme().getColourCount();\r
+ java.awt.Color[] newColours = new java.awt.Color[csize];\r
\r
- return new jalview.schemes.UserColourScheme(newColours);\r
- }\r
+ for (int i = 0; i < csize; i++)\r
+ {\r
+ newColours[i] = new java.awt.Color(Integer.parseInt(\r
+ colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
+ }\r
\r
- public static void LoadJalviewAlign(String file)\r
- {\r
- JalviewModel object = new JalviewModel();\r
+ return new jalview.schemes.UserColourScheme(newColours);\r
+ }\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ */\r
+ public static AlignFrame LoadJalviewAlign(String file)\r
{\r
- //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
- URL url = null;\r
+ JalviewModel object = new JalviewModel();\r
+ jalview.gui.AlignFrame af = null;\r
+\r
+ try\r
+ {\r
+ //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
+ URL url = null;\r
\r
- if (file.startsWith("http://"))\r
- {\r
- url = new URL(file);\r
- }\r
+ if (file.startsWith("http://"))\r
+ {\r
+ url = new URL(file);\r
+ }\r
\r
- JarInputStream jin = null;\r
- JarEntry jarentry = null;\r
- int entryCount = 1;\r
+ JarInputStream jin = null;\r
+ JarEntry jarentry = null;\r
+ int entryCount = 1;\r
\r
- do\r
- {\r
- if (url != null)\r
- {\r
- jin = new JarInputStream(url.openStream());\r
+ do\r
+ {\r
+ if (url != null)\r
+ {\r
+ jin = new JarInputStream(url.openStream());\r
+ }\r
+ else\r
+ {\r
+ jin = new JarInputStream(new FileInputStream(file));\r
+ }\r
+\r
+ for (int i = 0; i < entryCount; i++)\r
+ {\r
+ jarentry = jin.getNextJarEntry();\r
+ }\r
+\r
+ if (jarentry != null)\r
+ {\r
+ InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
+ object = (JalviewModel) object.unmarshal(in);\r
+ af = LoadFromObject(object);\r
+ entryCount++;\r
+ }\r
+ }\r
+ while (jarentry != null);\r
}\r
- else\r
+ catch (Exception ex)\r
{\r
- jin = new JarInputStream(new FileInputStream(file));\r
- }\r
+ System.err.println("Exception whilst loading jalview XML file : " +\r
+ ex + "\n");\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't locate " + file,\r
+ "URL not found",\r
+ JOptionPane.WARNING_MESSAGE);\r
\r
- for (int i = 0; i < entryCount; i++)\r
- {\r
- jarentry = jin.getNextJarEntry();\r
}\r
\r
- if (jarentry != null)\r
- {\r
- InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
- object = (JalviewModel) object.unmarshal(in);\r
- LoadFromObject(object);\r
- entryCount++;\r
- }\r
- }\r
- while (jarentry != null);\r
+ return af;\r
}\r
- catch (Exception ex)\r
+\r
+ static AlignFrame LoadFromObject(JalviewModel object)\r
{\r
- System.err.println("Exception whilst loading jalview XML file : " +\r
- ex + "\n");\r
- ex.printStackTrace();\r
+ Vector seqids = new Vector();\r
+ SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
+ Sequence[] vamsasSeq = vamsasSet.getSequence();\r
\r
- return;\r
- }\r
- }\r
+ JalviewModelSequence jms = object.getJalviewModelSequence();\r
\r
- static void LoadFromObject(JalviewModel object)\r
- {\r
- Vector seqids = new Vector();\r
- SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
- Sequence[] vamsasSeq = vamsasSet.getSequence();\r
+ //////////////////////////////////\r
+ //LOAD SEQUENCES\r
+ jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
+ JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
\r
- JalviewModelSequence jms = object.getJalviewModelSequence();\r
+ for (int i = 0; i < vamsasSeq.length; i++)\r
+ {\r
+ jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
+ vamsasSeq[i].getSequence());\r
\r
- //////////////////////////////////\r
- //LOAD SEQUENCES\r
- jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[\r
- vamsasSeq.length];\r
- JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
+ jseqs[i].setStart(JSEQ[i].getStart());\r
+ jseqs[i].setEnd(JSEQ[i].getEnd());\r
+ jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
+ seqids.add(jseqs[i]);\r
+ }\r
\r
- for (int i = 0; i < vamsasSeq.length; i++)\r
- {\r
- jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
- vamsasSeq[i].getSequence());\r
+ /////////////////////////////////\r
+ jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
\r
- jseqs[i].setStart(JSEQ[i].getStart());\r
- jseqs[i].setEnd(JSEQ[i].getEnd());\r
- jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
- seqids.add(jseqs[i]);\r
- }\r
+ /////////////////////////////////\r
+ //////////////////////////////////\r
+ //LOAD ANNOTATIONS\r
+ if (vamsasSet.getAnnotation() != null)\r
+ {\r
+ Annotation[] an = vamsasSet.getAnnotation();\r
\r
- /////////////////////////////////\r
- jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
+ for (int i = 0; i < an.length; i++)\r
+ {\r
+ AnnotationElement[] ae = an[i].getAnnotationElement();\r
+ jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al.getWidth()];\r
+\r
+ for (int aa = 0; aa < ae.length; aa++)\r
+ {\r
+ anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].getDisplayCharacter(),\r
+ ae[aa].getDescription(),\r
+ ae[aa].getSecondaryStructure().charAt(0),\r
+ ae[aa].getValue());\r
+ }\r
+\r
+ jalview.datamodel.AlignmentAnnotation jaa = null;\r
+\r
+ if (an[i].getGraph())\r
+ {\r
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+ an[i].getDescription(), anot, 0, 0, 1);\r
+ }\r
+ else\r
+ {\r
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+ an[i].getDescription(), anot);\r
+ }\r
+\r
+ al.addAnnotation(jaa);\r
+ }\r
+ }\r
\r
- /////////////////////////////////\r
- //////////////////////////////////\r
- //LOAD ANNOTATIONS\r
- if (vamsasSet.getAnnotation() != null)\r
- {\r
- Annotation[] an = vamsasSet.getAnnotation();\r
+ /////////////////////////////////\r
+ // LOAD VIEWPORT\r
+ Viewport[] views = jms.getViewport();\r
+ Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
\r
- for (int i = 0; i < an.length; i++)\r
- {\r
- AnnotationElement[] ae = an[i].getAnnotationElement();\r
- jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[\r
- al.getWidth()];\r
+ AlignFrame af = new AlignFrame(al);\r
\r
- for (int aa = 0; aa < ae.length; aa++)\r
+ // af.changeColour() );\r
+ /////////////////////////\r
+ //LOAD GROUPS\r
+ if (jms.getJGroupCount() > 0)\r
{\r
- anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].\r
- getDisplayCharacter(),\r
- ae[aa].getDescription(),\r
- ae[aa].getSecondaryStructure().charAt(0),\r
- ae[aa].getValue());\r
- }\r
+ JGroup[] groups = jms.getJGroup();\r
\r
- jalview.datamodel.AlignmentAnnotation jaa = null;\r
+ for (int i = 0; i < groups.length; i++)\r
+ {\r
+ ColourSchemeI cs = null;\r
+\r
+ if (groups[i].getColour() != null)\r
+ {\r
+ if (groups[i].getColour().startsWith("ucs"))\r
+ {\r
+ cs = GetUserColourScheme(jms, groups[i].getColour());\r
+ }\r
+ else\r
+ {\r
+ cs = ColourSchemeProperty.getColour(al,\r
+ groups[i].getColour());\r
+ }\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ }\r
+ }\r
+\r
+ Vector seqs = new Vector();\r
+ int[] ids = groups[i].getSeq();\r
+\r
+ for (int s = 0; s < ids.length; s++)\r
+ {\r
+ seqs.addElement((jalview.datamodel.SequenceI) seqids.elementAt(\r
+ ids[s]));\r
+ }\r
+\r
+ jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(seqs,\r
+ groups[i].getName(), cs, groups[i].getDisplayBoxes(),\r
+ groups[i].getDisplayText(), groups[i].getColourText(),\r
+ groups[i].getStart(), groups[i].getEnd());\r
+\r
+ sg.setOutlineColour(new java.awt.Color(\r
+ groups[i].getOutlineColour()));\r
+\r
+ if (groups[i].getConsThreshold() != 0)\r
+ {\r
+ jalview.analysis.Conservation c = new jalview.analysis.Conservation("All",\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ sg.getWidth() - 1);\r
+ c.calculate();\r
+ c.verdict(false, 25);\r
+ cs = new ConservationColourScheme(c, cs);\r
+ sg.cs = cs;\r
+ }\r
+\r
+ al.addGroup(sg);\r
+ }\r
+ }\r
\r
- if (an[i].getGraph())\r
+ Desktop.addInternalFrame(af, view.getTitle(),\r
+ AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
+ view.getHeight());\r
+ af.viewport.setStartRes(view.getStartRes());\r
+ af.viewport.setStartSeq(view.getStartSeq());\r
+ af.viewport.showConservation = view.getShowConservation();\r
+ af.viewport.showQuality = view.getShowQuality();\r
+ af.viewport.showIdentity = view.getShowIdentity();\r
+ af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
+ af.abovePIDThreshold.setSelected(view.getPidSelected());\r
+ af.viewport.setColourText(view.getShowColourText());\r
+ af.colourTextMenuItem.setSelected(view.getShowColourText());\r
+ af.viewport.setConservationSelected(view.getConservationSelected());\r
+ af.conservationMenuItem.setSelected(view.getConservationSelected());\r
+\r
+ af.viewport.setShowFullId(view.getShowFullId());\r
+ af.fullSeqId.setSelected(view.getShowFullId());\r
+\r
+ af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
+ view.getFontStyle(), view.getFontSize()));\r
+ af.alignPanel.fontChanged();\r
+\r
+ af.viewport.setRenderGaps(view.getRenderGaps());\r
+ af.renderGapsMenuItem.setSelected(view.getRenderGaps());\r
+\r
+ af.viewport.setWrapAlignment(view.getWrapAlignment());\r
+ af.wrapMenuItem.setSelected(view.getWrapAlignment());\r
+\r
+ if (view.getWrapAlignment())\r
{\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot, 0, 0, 1);\r
+ af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
}\r
else\r
{\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot);\r
+ af.annotationPanelMenuItem.setState(view.getShowAnnotation());\r
+ af.viewport.setShowAnnotation(view.getShowAnnotation());\r
+ af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
}\r
\r
- al.addAnnotation(jaa);\r
- }\r
- }\r
-\r
- /////////////////////////////////\r
- // LOAD VIEWPORT\r
- Viewport[] views = jms.getViewport();\r
- Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
-\r
- AlignFrame af = new AlignFrame(al);\r
+ af.viewport.setShowBoxes(view.getShowBoxes());\r
+ af.viewBoxesMenuItem.setSelected(view.getShowBoxes());\r
+ af.viewport.setShowText(view.getShowText());\r
+ af.viewTextMenuItem.setSelected(view.getShowText());\r
\r
- // af.changeColour() );\r
- /////////////////////////\r
- //LOAD GROUPS\r
- if (jms.getJGroupCount() > 0)\r
- {\r
- JGroup[] groups = jms.getJGroup();\r
-\r
- for (int i = 0; i < groups.length; i++)\r
- {\r
ColourSchemeI cs = null;\r
\r
- if (groups[i].getColour() != null)\r
+ if (view.getBgColour() != null)\r
{\r
- if (groups[i].getColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, groups[i].getColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al,\r
- groups[i].getColour());\r
- }\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
- }\r
- }\r
+ if (view.getBgColour().startsWith("ucs"))\r
+ {\r
+ cs = GetUserColourScheme(jms, view.getBgColour());\r
+ }\r
+ else\r
+ {\r
+ cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
+ }\r
\r
- Vector seqs = new Vector();\r
- int[] ids = groups[i].getSeq();\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
+ ((ConservationColourScheme) cs).inc = view.getConsThreshold();\r
+ }\r
\r
- for (int s = 0; s < ids.length; s++)\r
- {\r
- seqs.addElement( (jalview.datamodel.SequenceI) seqids.elementAt(\r
- ids[s]));\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ }\r
}\r
\r
- jalview.datamodel.SequenceGroup sg = new jalview.datamodel.\r
- SequenceGroup(seqs, groups[i].getName(),\r
- cs, groups[i].getDisplayBoxes(),\r
- groups[i].getDisplayText(), groups[i].getColourText(),\r
- groups[i].getStart(), groups[i].getEnd());\r
-\r
- sg.setOutlineColour(new java.awt.Color(\r
- groups[i].getOutlineColour()));\r
+ af.viewport.setGlobalColourScheme(cs);\r
\r
+ af.viewport.setColourAppliesToAllGroups(false);\r
+ af.changeColour(af.viewport.getGlobalColourScheme());\r
+ af.viewport.setColourAppliesToAllGroups(true);\r
\r
- if (groups[i].getConsThreshold() != 0)\r
+ if (view.getShowSequenceFeatures())\r
{\r
- jalview.analysis.Conservation c = new jalview.analysis.Conservation(\r
- "All",\r
- ResidueProperties.propHash, 3, sg.sequences, 0,\r
- sg.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, 25);\r
- cs = new ConservationColourScheme(c, cs);\r
- sg.cs = cs;\r
+ af.viewport.showSequenceFeatures = true;\r
+ af.sequenceFeatures.setSelected(true);\r
+ new SequenceFeatureFetcher(al, af.alignPanel);\r
+ al.featuresAdded = true;\r
}\r
\r
- al.addGroup(sg);\r
- }\r
- }\r
-\r
- Desktop.addInternalFrame(af, view.getTitle(),\r
- AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
- view.getHeight());\r
- af.viewport.setStartRes(view.getStartRes());\r
- af.viewport.setStartSeq(view.getStartSeq());\r
- af.viewport.showConservation = view.getShowConservation();\r
- af.viewport.showQuality = view.getShowQuality();\r
- af.viewport.showIdentity = view.getShowIdentity();\r
- af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
- af.viewport.setColourText(view.getShowColourText());\r
- af.viewport.setConservationSelected(view.getConservationSelected());\r
- af.viewport.setShowFullId(view.getShowFullId());\r
- af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
- view.getFontStyle(), view.getFontSize()));\r
- af.alignPanel.fontChanged();\r
-\r
- af.sequenceFeatures_actionPerformed(null);\r
- af.viewport.setRenderGaps(view.getRenderGaps());\r
-\r
- af.viewport.setWrapAlignment(view.getWrapAlignment());\r
-\r
- if (view.getWrapAlignment())\r
- {\r
- af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
- }\r
- else\r
- {\r
- af.viewport.setShowAnnotation(view.getShowAnnotation());\r
- af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
- }\r
-\r
- af.viewport.setShowBoxes(view.getShowBoxes());\r
- af.viewport.setShowText(view.getShowText());\r
-\r
- ColourSchemeI cs = null;\r
-\r
- if (view.getBgColour() != null)\r
- {\r
- if (view.getBgColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, view.getBgColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
- }\r
-\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- ( (ConservationColourScheme) cs).inc = view.getConsThreshold();\r
- }\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
- }\r
- }\r
-\r
- af.viewport.setGlobalColourScheme(cs);\r
-\r
- af.viewport.setColourAppliesToAllGroups(false);\r
- af.changeColour(af.viewport.getGlobalColourScheme());\r
- af.viewport.setColourAppliesToAllGroups(true);\r
-\r
- if (view.getShowSequenceFeatures())\r
- {\r
- af.viewport.showSequenceFeatures = true;\r
- SequenceFeatureFetcher sft = new SequenceFeatureFetcher(al,\r
- af.alignPanel);\r
- al.featuresAdded = true;\r
- }\r
-\r
- //LOAD TREES - THIS RELEASE ONLY ALLOWS 1 TREE\r
- if (object.getVamsasModel().getTreeCount() > 0)\r
- {\r
- try\r
- {\r
- af.ShowNewickTree(new jalview.io.NewickFile(\r
- (String) object.getVamsasModel().getTree(0)), "Tree");\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
+ //LOAD TREES\r
+ ///////////////////////////////////////\r
+ if (jms.getTreeCount() > 0)\r
+ {\r
+ try\r
+ {\r
+ for (int t = 0; t < jms.getTreeCount(); t++)\r
+ {\r
+ Tree tree = jms.getTree(t);\r
+\r
+ TreePanel tp = af.ShowNewickTree(new jalview.io.NewickFile(\r
+ tree.getNewick()), tree.getTitle());\r
+\r
+ tp.setBounds(tree.getXpos(), tree.getYpos(),\r
+ tree.getWidth(), tree.getHeight());\r
+\r
+ tp.fitToWindow.setState(tree.getFitToWindow());\r
+ tp.fitToWindow_actionPerformed(null);\r
+ tp.treeCanvas.fontSize = tree.getFontSize();\r
+ tp.fontSize.setText("Font Size - " + tree.getFontSize());\r
+ tp.placeholdersMenu.setState(tree.getMarkUnlinked());\r
+ tp.placeholdersMenu_actionPerformed(null);\r
+ tp.bootstrapMenu.setState(tree.getShowBootstrap());\r
+ tp.bootstrapMenu_actionPerformed(null);\r
+ tp.distanceMenu.setState(tree.getShowDistances());\r
+ tp.distanceMenu_actionPerformed(null);\r
+ tp.treeCanvas.threshold = tree.getThreshold();\r
+\r
+ if (tree.getCurrentTree())\r
+ af.viewport.setCurrentTree(tp.getTree());\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ return af;\r
}\r
- }\r
}\r