use of org.cytoscape.internal.io.networklist.Network in project cytoscape-impl by cytoscape.
the class SessionHandler method setSessionNetworks.
private void setSessionNetworks(final List<Network> netInfoList, final CySession sess) {
final Map<Long, Integer> netOrder = new HashMap<>();
for (final Network n : netInfoList) {
// in order to retrieve the new SUID
final CyNetwork net = sess.getObject(n.getId(), CyNetwork.class);
if (net != null)
netOrder.put(net.getSUID(), n.getOrder());
}
setSessionNetworks(netOrder);
}
use of org.cytoscape.internal.io.networklist.Network in project cytoscape-impl by cytoscape.
the class SessionHandler method saveNetworkList.
private File saveNetworkList(final SessionAboutToBeSavedEvent e) {
final Map<Long, Integer> netOrder = netPanel.getNetworkListOrder();
// Create the JAXB objects
final NetworkList netList = new NetworkList();
for (final Entry<Long, Integer> entry : netOrder.entrySet()) {
final Long suid = entry.getKey();
final Integer order = entry.getValue();
if (order != null) {
final Network n = new Network();
n.setId(suid);
n.setOrder(order);
netList.getNetwork().add(n);
}
}
// Create temp file
File tmpFile = new File(System.getProperty("java.io.tmpdir"), NETWORK_LIST_FILENAME);
tmpFile.deleteOnExit();
// Write to the file
sessionIO.write(netList, tmpFile);
return tmpFile;
}
Aggregations