use of org.cytoscape.internal.io.sessionstate.Cytopanels in project cytoscape-impl by cytoscape.
the class SessionHandler method saveSessionState.
private File saveSessionState(final SessionAboutToBeSavedEvent e) {
final SessionState sessState = new SessionState();
// CytoPanels States
final Cytopanels cytopanels = new Cytopanels();
sessState.setCytopanels(cytopanels);
for (Map.Entry<String, CytoPanelName> entry : CYTOPANEL_NAMES.entrySet()) {
final CytoPanel p = desktop.getCytoPanel(entry.getValue());
final Cytopanel cytopanel = new Cytopanel();
cytopanel.setId(entry.getKey());
cytopanel.setPanelState(p.getState().toString());
cytopanel.setSelectedPanel(Integer.toString(p.getSelectedIndex()));
cytopanels.getCytopanel().add(cytopanel);
}
// Create temp file
File tmpFile = new File(System.getProperty("java.io.tmpdir"), SESSION_STATE_FILENAME);
tmpFile.deleteOnExit();
// Write to the file
sessionIO.write(sessState, tmpFile);
return tmpFile;
}
Aggregations