Author: sfederow
Date: 2009-12-27 00:34:06 -0800 (Sun, 27 Dec 2009)
New Revision: 18805

Modified:
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/FrameManager.java
Log:


Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java   
2009-12-25 23:03:30 UTC (rev 18804)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java   
2009-12-27 08:34:06 UTC (rev 18805)
@@ -35,6 +35,8 @@
 import javax.swing.JMenu;
 import javax.swing.table.*;
 import javax.swing.Timer;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.*;
 
 import javax.swing.border.Border;
 import javax.swing.border.EtchedBorder;
@@ -113,6 +115,7 @@
        private JPanel mainPanel;
        private JPopupMenu thumbnailMenu;
        private JSlider speedSlider;
+       final JFileChooser fc = new JFileChooser();
        
        private ArrayList<JPopupMenu> menuList;
        private ArrayList<JButton> thumbnailList;
@@ -244,7 +247,6 @@
                //add current frame to key frame list
                if(command.equals("capture")){
                        frameManager.addKeyFrame();
-
                        updateThumbnails();
                }
                
@@ -277,12 +279,22 @@
                
                
                if(command.equals("record")){
-                       try{
-                               frameManager.recordAnimation();
-                       }catch (Exception excp) {
-                               System.out.println(excp.getMessage()); 
-                       }
+                       fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
+                       int returnVal = fc.showSaveDialog(new JPanel());
+                        if (returnVal == JFileChooser.APPROVE_OPTION) {
+                       File file = fc.getSelectedFile();
+                       String filePath = file.getPath();
+                       System.out.println(filePath+" "+file.getName());
+                       try{
+                                       frameManager.recordAnimation(filePath);
+                               }catch (Exception excp) {
+                                       System.out.println(excp.getMessage()); 
+                               }
+                        } else {
+                       
+                }
                        
+                       
                        updateThumbnails();
                        frameManager.makeTimer();
                }

Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java    2009-12-25 
23:03:30 UTC (rev 18804)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java    2009-12-27 
08:34:06 UTC (rev 18805)
@@ -672,7 +672,7 @@
                        //
                }
                
-               System.out.println("written?");
+               System.out.println("writing...");
        }
 
        /**

Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/FrameManager.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/FrameManager.java       
2009-12-25 23:03:30 UTC (rev 18804)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/FrameManager.java       
2009-12-27 08:34:06 UTC (rev 18805)
@@ -167,16 +167,18 @@
         * can be easily compressed into a standard movie format.
         * 
         */
-       public void recordAnimation() throws IOException {
+       public void recordAnimation(String directory) throws IOException {
                
                //gets the directory from which cytoscape is running
                String curDir = System.getProperty("user.dir");
-               
+               curDir = directory;
                //assigns the output directory, for now it is by default 
cytoscape/outputImgs
-               File file = new File(curDir+"/outputImgs");
+               File file = new File(curDir); //+"/outputImgs");
                
                //make the directory
-               file.mkdir();
+               if(!file.exists()){
+                       file.mkdir();
+               }
                
                
                for(int i=0; i<frames.length; i++){
@@ -184,7 +186,7 @@
                        
                        //assign the appropriate path and extension
                        //String name = 
curDir+"/outputImgs/Frame_"+frame.format(i)+".png";
-                       String name = 
curDir+"/outputImgs/Frame_"+frame.format(i)+".jpeg";
+                       String name = curDir+"/Frame_"+frame.format(i)+".jpeg";
                        
                        frames[i].writeImage(name);
                }

--

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