*/\r
package jalview.gui;\r
\r
-import jalview.binding.*;\r
-\r
import jalview.io.*;\r
\r
import jalview.schemes.*;\r
\r
import javax.swing.*;\r
\r
+import jalview.binding.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
}\r
catch (Exception ex)\r
{\r
+ ex.printStackTrace();\r
}\r
}\r
\r
AlignViewport av = af.viewport;\r
\r
JalviewModel object = new JalviewModel();\r
- object.setVamsasModel(new VamsasModel());\r
+ object.setVamsasModel(new jalview.binding.VamsasModel());\r
\r
object.setCreationDate(new java.util.Date(timeStamp));\r
- object.setVersion(jalview.bin.Cache.VERSION);\r
+ object.setVersion(jalview.bin.Cache.getProperty("VERSION"));\r
\r
jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
\r
///////////////////////////////////\r
if (af.viewport.currentTree != null)\r
{\r
- // FIND ANY ASSOCIATED TREES\r
+ // FIND ANY ASSOCIATED TREES\r
+ // NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT\r
+ if (Desktop.desktop != null)\r
+ {\r
JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
\r
for (int t = 0; t < frames.length; t++)\r
{\r
- if (frames[t] instanceof TreePanel)\r
- {\r
- TreePanel tp = (TreePanel) frames[t];\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
+ 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.setFontName(tp.getTreeFont().getName());\r
+ tree.setFontSize(tp.getTreeFont().getSize());\r
+ tree.setFontStyle(tp.getTreeFont().getStyle());\r
+ tree.setMarkUnlinked(tp.placeholdersMenu.getState());\r
+\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
//SAVE ANNOTATIONS\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
+ if(sg.cs!=null)\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
+ if (sg.cs.conservationApplied())\r
+ {\r
+ groups[i].setConsThreshold(sg.cs.getConservationInc());\r
\r
- if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
- {\r
+ if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ {\r
+ groups[i].setColour(SetUserColourScheme(sg.cs,\r
+ userColours,\r
+ jms));\r
+ }\r
+ else\r
+ {\r
+ groups[i].setColour(ColourSchemeProperty.getColourName(sg.\r
+ cs));\r
+ }\r
+ }\r
+ else if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ {\r
groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
- jms));\r
- }\r
- else\r
- {\r
+ jms));\r
+ }\r
+ else\r
+ {\r
groups[i].setColour(ColourSchemeProperty.getColourName(\r
- sg.cs));\r
+ sg.cs));\r
+ }\r
+\r
+ groups[i].setPidThreshold(sg.cs.getThreshold());\r
}\r
\r
groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
\r
ColourSchemeI cs = av.getGlobalColourScheme();\r
\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- view.setConsThreshold(((ConservationColourScheme) cs).inc);\r
- }\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- view.setPidThreshold(((ResidueColourScheme) cs).getThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
+ if(cs!=null)\r
{\r
- view.setPidThreshold(((ScoreColourScheme) cs).getThreshold());\r
+ if (cs.conservationApplied())\r
+ {\r
+ view.setConsThreshold(cs.getConservationInc());\r
+ if (cs instanceof jalview.schemes.UserColourScheme)\r
+ view.setBgColour(SetUserColourScheme(cs, userColours, jms));\r
+ }\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ view.setPidThreshold(cs.getThreshold());\r
+ }\r
}\r
\r
view.setConservationSelected(av.getConservationSelected());\r
view.setPidSelected(av.getAbovePIDThreshold());\r
- view.setFontName(av.font.getFontName());\r
+ view.setFontName(av.font.getName());\r
view.setFontSize(av.font.getSize());\r
view.setFontStyle(av.font.getStyle());\r
view.setRenderGaps(av.renderGaps);\r
}\r
while (jarentry != null);\r
}\r
+ catch(java.net.UnknownHostException ex)\r
+ {\r
+ ex.printStackTrace();\r
+ System.err.println("Couldn't locate 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
+ }\r
catch (Exception ex)\r
{\r
+ ex.printStackTrace();\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
+ "Error loading " + file,\r
+ "Error loading Jalview file",\r
JOptionPane.WARNING_MESSAGE);\r
\r
}\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
+ cs.setThreshold(groups[i].getPidThreshold(), true);\r
}\r
\r
Vector seqs = new Vector();\r
sg.getWidth() - 1);\r
c.calculate();\r
c.verdict(false, 25);\r
- cs = new ConservationColourScheme(c, cs);\r
- sg.cs = cs;\r
+ sg.cs.setConservation(c);\r
}\r
\r
al.addGroup(sg);\r
}\r
}\r
\r
- Desktop.addInternalFrame(af, view.getTitle(),\r
- AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+\r
af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
view.getHeight());\r
af.viewport.setStartRes(view.getStartRes());\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
+ if(cs!=null)\r
{\r
- ((ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ((ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ cs.setThreshold(view.getPidThreshold(), true);\r
+ cs.setConsensus(af.viewport.vconsensus);\r
}\r
}\r
\r
+ af.setColourSelected(view.getBgColour());\r
af.viewport.setGlobalColourScheme(cs);\r
-\r
af.viewport.setColourAppliesToAllGroups(false);\r
- af.changeColour(af.viewport.getGlobalColourScheme());\r
+ af.changeColour(cs);\r
+ if (view.getConservationSelected() && cs!=null)\r
+ {\r
+ cs.setConservationInc(view.getConsThreshold());\r
+ }\r
+\r
af.viewport.setColourAppliesToAllGroups(true);\r
\r
if (view.getShowSequenceFeatures())\r
al.featuresAdded = true;\r
}\r
\r
+ Desktop.addInternalFrame(af, view.getTitle(),\r
+ view.getWidth(), view.getHeight());\r
+\r
//LOAD TREES\r
///////////////////////////////////////\r
if (jms.getTreeCount() > 0)\r
{\r
for (int t = 0; t < jms.getTreeCount(); t++)\r
{\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
+ tree.getNewick()), tree.getTitle(),\r
+ tree.getWidth(), tree.getHeight(),\r
+ tree.getXpos(), tree.getYpos());\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
+\r
+ if(tree.getFontName()!=null)\r
+ tp.setTreeFont(new java.awt.Font(tree.getFontName(),\r
+ tree.getFontStyle(),\r
+ tree.getFontSize()));\r
+ else\r
+ tp.setTreeFont(new java.awt.Font(view.getFontName(),\r
+ view.getFontStyle(),\r
+ tree.getFontSize()));\r
+\r
+ tp.showPlaceholders(tree.getMarkUnlinked());\r
+ tp.showBootstrap(tree.getShowBootstrap());\r
+ tp.showDistances(tree.getShowDistances());\r
+\r
tp.treeCanvas.threshold = tree.getThreshold();\r
\r
if (tree.getCurrentTree())\r
af.viewport.setCurrentTree(tp.getTree());\r
}\r
+\r
}\r
catch (Exception ex)\r
{\r
ex.printStackTrace();\r
}\r
+\r
}\r
+\r
return af;\r
}\r
}\r