Search in sources :

Example 1 with Cytopanels

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;
}
Also used : SessionState(org.cytoscape.internal.io.sessionstate.SessionState) CytoPanelName(org.cytoscape.application.swing.CytoPanelName) Cytopanels(org.cytoscape.internal.io.sessionstate.Cytopanels) CytoPanel(org.cytoscape.application.swing.CytoPanel) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) File(java.io.File) Cytopanel(org.cytoscape.internal.io.sessionstate.Cytopanel)

Aggregations

File (java.io.File)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CytoPanel (org.cytoscape.application.swing.CytoPanel)1 CytoPanelName (org.cytoscape.application.swing.CytoPanelName)1 Cytopanel (org.cytoscape.internal.io.sessionstate.Cytopanel)1 Cytopanels (org.cytoscape.internal.io.sessionstate.Cytopanels)1 SessionState (org.cytoscape.internal.io.sessionstate.SessionState)1