return;
}
- Hashtable<String,AlignFrame> dsses = new Hashtable<String,AlignFrame>();
+ Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
try
{
SaveState(apanel, fileName, jout);
- String dssid = getDatasetIdRef(af.getViewport().getAlignment().getDataset());
+ String dssid = getDatasetIdRef(af.getViewport().getAlignment()
+ .getDataset());
if (!dsses.containsKey(dssid))
{
dsses.put(dssid, af);
}
}
- writeDatasetFor(dsses, ""+jout.hashCode()+" "+uniqueSetSuffix, jout);
-
+ writeDatasetFor(dsses, "" + jout.hashCode() + " " + uniqueSetSuffix,
+ jout);
+
try
{
jout.flush();
int ap, apSize = af.alignPanels.size();
FileOutputStream fos = new FileOutputStream(jarFile);
JarOutputStream jout = new JarOutputStream(fos);
- Hashtable<String,AlignFrame> dsses = new Hashtable<String,AlignFrame>();
+ Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
for (ap = 0; ap < apSize; ap++)
{
AlignmentPanel apanel = (AlignmentPanel) af.alignPanels
jfileName = jfileName + ".xml";
}
SaveState(apanel, jfileName, jout);
- String dssid = getDatasetIdRef(af.getViewport().getAlignment().getDataset());
+ String dssid = getDatasetIdRef(af.getViewport().getAlignment()
+ .getDataset());
if (!dsses.containsKey(dssid))
{
dsses.put(dssid, af);
String fileName, JarOutputStream jout)
{
- for (String dssids:dsses.keySet())
+ for (String dssids : dsses.keySet())
{
AlignFrame _af = dsses.get(dssids);
- String jfileName = fileName + " Dataset for "+ _af.getTitle();
+ String jfileName = fileName + " Dataset for " + _af.getTitle();
if (!jfileName.endsWith(".xml"))
{
jfileName = jfileName + ".xml";
public JalviewModel SaveState(AlignmentPanel ap, String fileName,
JarOutputStream jout)
{
- return SaveState(ap, fileName, false,jout);
+ return SaveState(ap, fileName, false, jout);
}
+
/**
- * create a JalviewModel from an algnment view and marshall it to a
- * JarOutputStream
- *
- * @param ap
- * panel to create jalview model for
- * @param fileName
- * name of alignment panel written to output stream
- * @param storeDS
- * when true, only write the dataset for the alignment, not the data associated with the view.
- * @param jout
- * jar output stream
- * @param out
- * jar entry name
- */
- public JalviewModel SaveState(AlignmentPanel ap, String fileName, boolean storeDS,
- JarOutputStream jout)
+ * create a JalviewModel from an algnment view and marshall it to a
+ * JarOutputStream
+ *
+ * @param ap
+ * panel to create jalview model for
+ * @param fileName
+ * name of alignment panel written to output stream
+ * @param storeDS
+ * when true, only write the dataset for the alignment, not the data
+ * associated with the view.
+ * @param jout
+ * jar output stream
+ * @param out
+ * jar entry name
+ */
+ public JalviewModel SaveState(AlignmentPanel ap, String fileName,
+ boolean storeDS, JarOutputStream jout)
{
initSeqRefs();
Vector jmolViewIds = new Vector(); //
object.setVamsasModel(new jalview.schemabinding.version2.VamsasModel());
object.setCreationDate(new java.util.Date(System.currentTimeMillis()));
- object.setVersion(jalview.bin.Cache.getDefault("VERSION","Development Build"));
+ object.setVersion(jalview.bin.Cache.getDefault("VERSION",
+ "Development Build"));
jalview.datamodel.AlignmentI jal = av.getAlignment();
// SAVE SEQUENCES
String id = "";
- jalview.datamodel.SequenceI jds,jdatasq;
+ jalview.datamodel.SequenceI jds, jdatasq;
for (int i = 0; i < jal.getHeight(); i++)
{
jds = jal.getSequenceAt(i);
- jdatasq=jds.getDatasetSequence() == null ? jds : jds.getDatasetSequence();
+ jdatasq = jds.getDatasetSequence() == null ? jds : jds
+ .getDatasetSequence();
id = seqHash(jds);
if (seqRefIds.get(id) != null)
IdentityHashMap groupRefs = new IdentityHashMap();
if (storeDS)
{
- for (SequenceI sq:jal.getSequences())
+ for (SequenceI sq : jal.getSequences())
+ {
+ // Store annotation on dataset sequences only
+ jalview.datamodel.AlignmentAnnotation[] aa = sq.getAnnotation();
+ if (aa != null && aa.length > 0)
{
- // Store annotation on dataset sequences only
- jalview.datamodel.AlignmentAnnotation[] aa = sq.getAnnotation();
- if (aa!=null && aa.length>0)
- {
- storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS,
- vamsasSet);
- }
+ storeAlignmentAnnotation(aa, groupRefs, av, calcIdSet, storeDS,
+ vamsasSet);
}
- } else {
+ }
+ }
+ else
+ {
if (jal.getAlignmentAnnotation() != null)
{
// Store the annotation shown on the alignment.
}
if (!storeDS || (storeDS && !aa[i].autoCalculated))
{
- // skip autocalculated annotation - these are only provided for alignments
+ // skip autocalculated annotation - these are only provided for
+ // alignments
vamsasSet.addAnnotation(an);
}
}
-
+
}
private CalcIdParam createCalcIdParam(String calcId, AlignViewport av)
try
{
// create list to store references for any new Jmol viewers created
- newStructureViewers=new Vector<AppJmol>();
+ newStructureViewers = new Vector<AppJmol>();
// UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING
// Workaround is to make sure caller implements the JarInputStreamProvider
// interface
jarInputStreamProvider jprovider = createjarInputStreamProvider(file);
af = LoadJalviewAlign(jprovider);
-
+
} catch (MalformedURLException e)
{
errorMessage = "Invalid URL format for '" + file + "'";
reportErrors();
- }
- finally {
+ } finally
+ {
try
{
SwingUtilities.invokeAndWait(new Runnable()
frefedSequence = new Vector();
}
- jalview.gui.AlignFrame af= null,_af = null;
+ jalview.gui.AlignFrame af = null, _af = null;
Hashtable gatherToThisFrame = new Hashtable();
final String file = jprovider.getFilename();
try
JalviewModelSequence jms = object.getJalviewModelSequence();
- Viewport view = (jms.getViewportCount()>0) ? jms.getViewport(0) : null;
-
+ Viewport view = (jms.getViewportCount() > 0) ? jms.getViewport(0)
+ : null;
+
// ////////////////////////////////
// LOAD SEQUENCES
}
}
}
-
// ///////////////////////
// LOAD GROUPS
// Create alignment markup and styles for this view
}
}
- if (view==null)
+ if (view == null)
{
// only dataset in this model, so just return.
return null;
Vector<AppJmol> newStructureViewers=null;
protected void addNewStructureViewer(AppJmol sview)
{
- if (newStructureViewers!=null)
+ if (newStructureViewers != null)
{
sview.jmb.setFinishedLoadingFromArchive(false);
newStructureViewers.add(sview);
}
}
+
protected void setLoadingFinishedForNewStructureViewers()
{
- if (newStructureViewers!=null)
+ if (newStructureViewers != null)
{
- for (AppJmol sview:newStructureViewers)
+ for (AppJmol sview : newStructureViewers)
{
sview.jmb.setFinishedLoadingFromArchive(true);
}
newStructureViewers.clear();
- newStructureViewers=null;
+ newStructureViewers = null;
}
}
{ // make this dataset sequence sq's dataset sequence
sq.setDatasetSequence(dsq);
// and update the current dataset alignment
- if (ds==null) {
- if (dseqs!=null) {
+ if (ds == null)
+ {
+ if (dseqs != null)
+ {
if (!dseqs.contains(dsq))
{
dseqs.add(dsq);
}
- } else {
- if (ds.findIndex(dsq)<0)
+ }
+ else
+ {
+ if (ds.findIndex(dsq) < 0)
{
ds.addSequence(dsq);
}
}
// TODO: merges will never happen if we 'know' we have the real dataset
// sequence - this should be detected when id==dssid
- System.err.println("DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
+ System.err
+ .println("DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
// + (pre ? "prepended" : "") + " "
// + (post ? "appended" : ""));
}