git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e57835e
)
JAL-2156 refactor saveState & saveAlignment to common method
author
Jim Procter
<jprocter@issues.jalview.org>
Wed, 27 Jul 2016 10:55:51 +0000
(11:55 +0100)
committer
Jim Procter
<jprocter@issues.jalview.org>
Wed, 27 Jul 2016 13:36:50 +0000
(14:36 +0100)
src/jalview/gui/Jalview2XML.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/Jalview2XML.java
b/src/jalview/gui/Jalview2XML.java
index
0694525
..
9861697
100644
(file)
--- a/
src/jalview/gui/Jalview2XML.java
+++ b/
src/jalview/gui/Jalview2XML.java
@@
-108,6
+108,7
@@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
@@
-492,7
+493,20
@@
public class Jalview2XML
{
return;
}
{
return;
}
+ saveAllFrames(Arrays.asList(frames), jout);
+ }
+ /**
+ * core method for storing state for a set of AlignFrames.
+ *
+ * @param frames
+ * - frames involving all data to be exported (including containing
+ * splitframes)
+ * @param jout
+ * - project output stream
+ */
+ private void saveAllFrames(List<AlignFrame> frames, JarOutputStream jout)
+ {
Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
/*
Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
/*
@@
-512,9
+526,9
@@
public class Jalview2XML
List<String> viewIds = new ArrayList<String>();
// REVERSE ORDER
List<String> viewIds = new ArrayList<String>();
// REVERSE ORDER
- for (int i = frames.length - 1; i > -1; i--)
+ for (int i = frames.size() - 1; i > -1; i--)
{
{
- AlignFrame af = frames[i];
+ AlignFrame af = frames.get(i);
// skip ?
if (skipList != null
&& skipList
// skip ?
if (skipList != null
&& skipList
@@
-617,30
+631,14
@@
public class Jalview2XML
{
try
{
{
try
{
- int ap = 0;
- int apSize = af.alignPanels.size();
FileOutputStream fos = new FileOutputStream(jarFile);
JarOutputStream jout = new JarOutputStream(fos);
FileOutputStream fos = new FileOutputStream(jarFile);
JarOutputStream jout = new JarOutputStream(fos);
- Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
- List<String> viewIds = new ArrayList<String>();
+ List<AlignFrame> frames = new ArrayList<AlignFrame>();
- for (AlignmentPanel apanel : af.alignPanels)
{
{
- String jfileName = apSize == 1 ? fileName : fileName + ap;
- ap++;
- if (!jfileName.endsWith(".xml"))
- {
- jfileName = jfileName + ".xml";
- }
- saveState(apanel, jfileName, jout, viewIds);
- String dssid = getDatasetIdRef(af.getViewport().getAlignment()
- .getDataset());
- if (!dsses.containsKey(dssid))
- {
- dsses.put(dssid, af);
- }
}
}
- writeDatasetFor(dsses, fileName, jout);
+ frames.add(af);
+ saveAllFrames(frames, jout);
try
{
jout.flush();
try
{
jout.flush();