ToolExplorer.java

00001 package edu.stanford.hci.r3.tools;
00002 
00003 import java.io.File;
00004 
00005 import edu.stanford.hci.r3.PaperToolkit;
00006 import edu.stanford.hci.r3.flash.FlashCommunicationServer;
00007 import edu.stanford.hci.r3.flash.FlashListener;
00008 import edu.stanford.hci.r3.pen.PenSample;
00009 import edu.stanford.hci.r3.pen.streaming.listeners.PenListener;
00010 import edu.stanford.hci.r3.tools.design.sketch.SketchToPaperUI;
00011 import edu.stanford.hci.r3.util.DebugUtils;
00012 
00025 public class ToolExplorer implements FlashListener {
00026 
00027         private FlashCommunicationServer flash;
00028         private SketchToPaperUI sketchToPaperUI;
00029 
00033         public ToolExplorer() {
00034                 // start the Flash Communications Server, and register our listeners...
00035 
00036                 // Start the Apollo GUI
00037                 File r3RootPath = PaperToolkit.getToolkitRootPath();
00038                 final File toolExplorerApollo = new File(r3RootPath, "flash/bin/ToolExplorer.exe");
00039                 flash = new FlashCommunicationServer(8989);
00040                 flash.addFlashClientListener(this);
00041                 flash.openFlashApolloGUI(toolExplorerApollo);
00042         }
00043 
00044         /*
00045          * (non-Javadoc)
00046          * 
00047          * @see edu.stanford.hci.r3.flash.FlashListener#messageReceived(java.lang.String)
00048          */
00049         @Override
00050         public void messageReceived(String command) {
00051                 DebugUtils.println(command);
00052 
00053                 if (command.equals("Design Clicked")) {
00054                         sketchToPaperUI = new SketchToPaperUI();
00055                         sketchToPaperUI.addPenListener(new PenListener() {
00056                                 @Override
00057                                 public void penDown(PenSample sample) {
00058 
00059                                 }
00060 
00061                                 @Override
00062                                 public void penUp(PenSample sample) {
00063 
00064                                 }
00065 
00066                                 @Override
00067                                 public void sample(PenSample sample) {
00068                                         DebugUtils.println(sample);
00069                                 }
00070                         });
00071                 } else if (command.equals("Back Clicked")) {
00072                         if (sketchToPaperUI != null) {
00073                                 sketchToPaperUI.exit();
00074                                 sketchToPaperUI = null;
00075                         } else {
00076 
00077                         }
00078                 }
00079         }
00080 }

Generated on Sat Apr 14 18:21:39 2007 for R3 Paper Toolkit by  doxygen 1.4.7