summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleFrame.java11
-rw-r--r--embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleIOProc.java19
2 files changed, 9 insertions, 21 deletions
diff --git a/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleFrame.java b/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleFrame.java
index 8ef0d32..a88cce4 100644
--- a/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleFrame.java
+++ b/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleFrame.java
@@ -14,7 +14,7 @@ import org.uscxml.InterpreterException;
public class ConsoleFrame extends Frame {
private static final long serialVersionUID = 3682378173372160680L;
- public static Map<Interpreter, Frame> perInterpreter = new HashMap<Interpreter, Frame>();
+ private ConsoleIOProc ioProc;
public ConsoleFrame() throws InterpreterException {
super("Input Frame");
@@ -46,7 +46,8 @@ public class ConsoleFrame extends Frame {
+ " <final id=\"quit\" />"
+ "</scxml>");
- perInterpreter.put(interpreter, this);
+ ioProc = new ConsoleIOProc(this);
+ interpreter.addIOProcessor(ioProc);
Thread intrerpreterThread = new Thread(new Runnable() {
@Override
@@ -64,11 +65,7 @@ public class ConsoleFrame extends Frame {
}
public static void main(String[] args) throws InterpreterException {
- System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib");
-
- ConsoleIOProc ioProc = new ConsoleIOProc();
- Factory.getInstance().registerIOProcessor(ioProc);
-
+ System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib");
ConsoleFrame frame = new ConsoleFrame();
}
diff --git a/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleIOProc.java b/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleIOProc.java
index 7dca28d..a95f6cb 100644
--- a/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleIOProc.java
+++ b/embedding/java/src/org/uscxml/tests/ioprocessor/console/ConsoleIOProc.java
@@ -1,31 +1,22 @@
package org.uscxml.tests.ioprocessor.console;
+import java.awt.Frame;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import org.uscxml.Data;
import org.uscxml.Event;
import org.uscxml.IOProcessor;
-import org.uscxml.Interpreter;
import org.uscxml.SendRequest;
import org.uscxml.StringList;
public class ConsoleIOProc extends IOProcessor implements KeyListener {
- /** IOProcessor */
- @Override
- public IOProcessor create(Interpreter interpreter) {
- ConsoleIOProc ioProc = new ConsoleIOProc();
- ioProc.swigReleaseOwnership();
-
- if (ConsoleFrame.perInterpreter.containsKey(interpreter)) {
- ConsoleFrame.perInterpreter.get(interpreter).addKeyListener(ioProc);
- } else {
- System.err.println("No data for interpreter specific instances");
- }
- return ioProc;
+ public ConsoleIOProc(Frame frame) {
+ super();
+ frame.addKeyListener(this);
}
-
+
/** IOProcessor */
@Override
public StringList getNames() {