From 6bf9b12de158cb5fc6c94ab41b84c27968ea9340 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 31 Jul 2014 01:35:20 +0200 Subject: Updated tests with new addIOProcessor function --- .../tests/ioprocessor/console/ConsoleFrame.java | 11 ++++------- .../tests/ioprocessor/console/ConsoleIOProc.java | 19 +++++-------------- 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 perInterpreter = new HashMap(); + private ConsoleIOProc ioProc; public ConsoleFrame() throws InterpreterException { super("Input Frame"); @@ -46,7 +46,8 @@ public class ConsoleFrame extends Frame { + " " + ""); - 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() { -- cgit v0.12