fileName = fileName + ".xml";
}
- JarEntry entry = new JarEntry(fileName);
- jout.putNextEntry(entry);
- out = new PrintWriter(new OutputStreamWriter(jout, "UTF-8"));
- SaveState(apanel, fileName,
- jout, out);
+ SaveState(apanel, fileName, jout);
}
}
}
- try { out.flush(); } catch (Exception foo) {};
- jout.closeEntry();
try { jout.flush(); } catch (Exception foo) {};
jout.close();
} catch (Exception ex)
{
jfileName = jfileName + ".xml";
}
- JarEntry entry = new JarEntry(jfileName);
- jout.putNextEntry(entry);
- PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,
- "UTF-8"));
- SaveState(apanel, jfileName, jout, out);
- try { out.flush(); } catch (Exception foo) {};
- jout.closeEntry();
+ SaveState(apanel, jfileName, jout);
}
try { jout.flush(); } catch (Exception foo) {};
}
/**
- * DOCUMENT ME!
+ * create a JalviewModel from an algnment view and marshall it
+ * to a JarOutputStream
*
- * @param af DOCUMENT ME!
- * @param timeStamp DOCUMENT ME!
- * @param fileName DOCUMENT ME!
- * @param jout DOCUMENT ME!
- * @param out DOCUMENT ME!
+ * @param ap panel to create jalview model for
+ * @param fileName name of alignment panel written to output stream
+ * @param jout jar output stream
+ * @param out jar entry name
*/
public JalviewModel SaveState(AlignmentPanel ap, String fileName,
- JarOutputStream jout, PrintWriter out)
+ JarOutputStream jout)
{
initSeqRefs();
object.setJalviewModelSequence(jms);
object.getVamsasModel().addSequenceSet(vamsasSet);
- if (out != null)
+ if (jout!=null && fileName!=null)
{
//We may not want to write the object to disk,
//eg we can copy the alignViewport to a new view object
//using save and then load
try
{
- org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(out);
+ JarEntry entry = new JarEntry(fileName);
+ jout.putNextEntry(entry);
+ PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout,
+ "UTF-8"));
+ org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(pout);
marshaller.marshal(object);
- out.flush();
+ pout.flush();
+ jout.closeEntry();
} catch (Exception ex)
{
+ // TODO: raise error in GUI if marshalling failed.
ex.printStackTrace();
}
}
+ ex + "\n");
} catch (Exception ex)
{
+ System.err.println("Parsing as Jalview Version 2 file failed.");
+ ex.printStackTrace(System.err);
+
//Is Version 1 Jar file?
try {
af = new Jalview2XML_V1(raiseGUI).LoadJalviewAlign(file);
public jalview.gui.AlignmentPanel copyAlignPanel(AlignmentPanel ap,
boolean keepSeqRefs)
{
- jalview.schemabinding.version2.JalviewModel jm = SaveState(ap, null,
- null, null);
+ jalview.schemabinding.version2.JalviewModel jm =
+ SaveState(ap, null, null);
if (!keepSeqRefs)
{