Commit in java/sandbox on MAIN
RecordLoopExample.java+29added 993
Add example of automating the Wired event display by processing events on the loop at a fixed interval.

java/sandbox
RecordLoopExample.java added at 993
--- java/sandbox/RecordLoopExample.java	                        (rev 0)
+++ java/sandbox/RecordLoopExample.java	2014-09-11 04:24:04 UTC (rev 993)
@@ -0,0 +1,29 @@
+import org.freehep.application.studio.Studio;
+import org.freehep.record.loop.RecordLoop;
+import org.freehep.record.loop.RecordLoop.Command;
+import org.freehep.record.loop.RecordLoop.State;
+
+/**
+ * This is a simple example of automating the event loop
+ * in JAS3, e.g. to get events for Wired every X seconds.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class RecordLoopExample {
+
+    public static void main(String[] args) {
+        RecordLoop loop = (RecordLoop) ((Studio) Studio.getApplication()).getLookup().lookup(RecordLoop.class);
+        while (true) {
+            loop.execute(Command.NEXT);
+            try {
+                // Gets next event every 5 seconds.
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            if (loop.getState().equals(State.IDLE)) {
+                break;
+            }
+        }
+    }
+}
\ No newline at end of file
SVNspam 0.1