import jalview.binding.*;\r
import jalview.schemes.*;\r
import javax.swing.JInternalFrame;\r
+import java.net.URL;\r
\r
\r
public class Jalview2XML\r
{\r
long creation = System.currentTimeMillis();\r
JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
+ if(frames==null)\r
+ return;\r
+\r
try{\r
FileOutputStream fos = new FileOutputStream(statefile);\r
JarOutputStream jout = new JarOutputStream(fos);\r
PrintWriter out = new PrintWriter(new OutputStreamWriter(jout, "UTF-8"));\r
\r
Vector shortNames = new Vector();\r
- for (int i = 0; i < frames.length; i++)\r
+ //REVERSE ORDER\r
+ for (int i = frames.length-1; i > -1; i--)\r
{\r
if (frames[i] instanceof AlignFrame)\r
{\r
\r
String shortName = af.getTitle();\r
\r
- shortName = shortName.replace('/', '_');\r
- shortName = shortName.replace('\\', '_');\r
+ if(shortName.indexOf(File.separatorChar)>-1)\r
+ shortName = shortName.substring(\r
+ shortName.lastIndexOf(File.separatorChar)+1);\r
\r
int count=1;\r
while( shortNames.contains(shortName) )\r
JalviewModel object = new JalviewModel();\r
try{\r
//UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
- JarInputStream jin = new JarInputStream(new FileInputStream(file));\r
+\r
+ URL url = null;\r
+ if( file.startsWith("http://"))\r
+ url = new URL(file);\r
+\r
+ JarInputStream jin = null;\r
JarEntry jarentry=null;\r
int entryCount = 1;\r
do{\r
- jin = new JarInputStream(new FileInputStream(file));\r
+ if (url != null)\r
+ jin = new JarInputStream(url.openStream());\r
+ else\r
+ jin = new JarInputStream(new FileInputStream(file));\r
+\r
for(int i=0; i<entryCount; i++)\r
jarentry = jin.getNextJarEntry();\r
\r
for (int i = 0; i < groups.length; i++)\r
{\r
ColourSchemeI cs=null;\r
- if(groups[i].getColour().startsWith("ucs"))\r
- cs = GetUserColourScheme(jms,groups[i].getColour());\r
- else\r
- cs = ColourSchemeProperty.getColour(al, groups[i].getColour() );\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
- else if (cs instanceof ScoreColourScheme)\r
- ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ if(groups[i].getColour()!=null)\r
+ {\r
+ if (groups[i].getColour().startsWith("ucs"))\r
+ cs = GetUserColourScheme(jms, groups[i].getColour());\r
+ else\r
+ cs = ColourSchemeProperty.getColour(al, groups[i].getColour());\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ else if (cs instanceof ScoreColourScheme)\r
+ ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ }\r
\r
jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup\r
(groups[i].getName(),\r
af.viewport.setShowText( view.getShowText() );\r
\r
ColourSchemeI cs=null;\r
- if (view.getBgColour().startsWith("ucs"))\r
- cs = GetUserColourScheme(jms, view.getBgColour());\r
- else\r
- cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
- af.viewport.setGlobalColourScheme( cs );\r
+ if(view.getBgColour()!=null)\r
+ {\r
+\r
+ if (view.getBgColour().startsWith("ucs"))\r
+ cs = GetUserColourScheme(jms, view.getBgColour());\r
+ else\r
+ cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
\r
- if(cs instanceof ConservationColourScheme)\r
- ( (ConservationColourScheme) cs).inc = view.getConsThreshold();\r
+ if (cs instanceof ConservationColourScheme)\r
+ ( (ConservationColourScheme) cs).inc = view.getConsThreshold();\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ ( (ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ else if (cs instanceof ScoreColourScheme)\r
+ ( (ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
+\r
+ }\r
+ af.viewport.setGlobalColourScheme( cs );\r
\r
- if (cs instanceof ResidueColourScheme)\r
- ( (ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
- else if (cs instanceof ScoreColourScheme)\r
- ( (ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
\r
af.viewport.setColourAppliesToAllGroups(false);\r
af.changeColour(af.viewport.getGlobalColourScheme());\r