Author: Christian Lopes
Date: 2010-12-07 09:48:01 -0800 (Tue, 07 Dec 2010)
New Revision: 23105

Modified:
   
core3/session-api/trunk/src/main/java/org/cytoscape/session/events/SessionAboutToBeSavedEvent.java
Log:
Added new methods to SessionAboutToBeSavedEvent, so plugins can set desktop and 
cypanels info before the session is saved.

Modified: 
core3/session-api/trunk/src/main/java/org/cytoscape/session/events/SessionAboutToBeSavedEvent.java
===================================================================
--- 
core3/session-api/trunk/src/main/java/org/cytoscape/session/events/SessionAboutToBeSavedEvent.java
  2010-12-07 03:39:35 UTC (rev 23104)
+++ 
core3/session-api/trunk/src/main/java/org/cytoscape/session/events/SessionAboutToBeSavedEvent.java
  2010-12-07 17:48:01 UTC (rev 23105)
@@ -1,18 +1,18 @@
 
 package org.cytoscape.session.events;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Map;
-import java.util.HashMap;
-import java.io.File;
 
-import org.cytoscape.session.CySession;
+import org.cytoscape.event.AbstractCyEvent;
+import org.cytoscape.property.session.Cytopanel;
+import org.cytoscape.property.session.Desktop;
 import org.cytoscape.session.CySessionManager;
 
-import org.cytoscape.event.AbstractCyEvent;
-
 /**
  * This event is fired synchronously by the CySessionManager at beginning of 
the
  * {...@link CySessionManager#getCySession()} method.  The intent is to allow
@@ -20,8 +20,10 @@
  * state before that state is interrogated by the CySessionManager. 
  */
 public final class SessionAboutToBeSavedEvent extends 
AbstractCyEvent<CySessionManager> {
-       final Map<String,List<File>> pluginFileListMap;
-
+       private final Map<String,List<File>> pluginFileListMap;
+       private final List<Cytopanel> cytopanels;
+       private Desktop desktop;
+       
        // TODO should the source be the session manager??
        /**
         * Constructor.
@@ -31,6 +33,7 @@
                super(source, SessionAboutToBeSavedListener.class);
 
                pluginFileListMap = new HashMap<String,List<File>>();
+               cytopanels = new ArrayList<Cytopanel>();
        }
 
        /**
@@ -55,7 +58,6 @@
                        throw new Exception("file list is null");
 
                // allow empty lists
-
                pluginFileListMap.put(pluginName, new ArrayList<File>(files));
        }
 
@@ -72,4 +74,42 @@
                // can't mess with us.
                return Collections.unmodifiableMap( pluginFileListMap );
        }
+
+       /**
+        * This method is not meant to be used by listeners for this event.
+        * @return
+        */
+       public Desktop getDesktop() {
+               return desktop;
+       }
+
+       /**
+        * A method that allows plugins to specify desktop-related data to be
+        * stored in the session.
+        * @param desktop
+        */
+       public void setDesktop(Desktop desktop) {
+               this.desktop = desktop;
+       }
+
+       /**
+        * This method is not meant to be used by listeners for this event.
+        * @return
+        */
+       public List<Cytopanel> getCytopanels() {
+               // Make the return value immutable so that listeners
+               // can't mess with us.
+               return Collections.unmodifiableList( cytopanels );
+       }
+
+       /**
+        * A method that allows plugins to add Cytopanel-related information to 
be
+        * stored in the session.
+        * @param cytopanels
+        */
+       public void addCytopanels(Cytopanel cytopanel) throws Exception {
+               if ( cytopanel == null ) throw new Exception("cytopanel is 
null");
+               cytopanels.add(cytopanel);
+       }
+       
 }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to