diff --git a/java/src/pm/Application.java b/java/src/pm/Application.java deleted file mode 100644 index eed205d..0000000 --- a/java/src/pm/Application.java +++ /dev/null @@ -1,25 +0,0 @@ -package pm; - -import pm.event.EventHandler; -import pm.manager.Titled; - -public abstract class Application extends EventHandler implements Titled, Exitable { - protected String title; - protected boolean active; - - public Application(String title) { - this.title = title; - active = false; - } - - public String title() { - return title; - } - - public void exit() { - if (active()) { - deactivate(); - } - stop(); - } -} \ No newline at end of file diff --git a/java/src/pm/Button.java b/java/src/pm/Button.java deleted file mode 100644 index dcf6739..0000000 --- a/java/src/pm/Button.java +++ /dev/null @@ -1,3 +0,0 @@ -package pm; - -public interface Button {} diff --git a/java/src/pm/Client.java b/java/src/pm/Client.java deleted file mode 100644 index aa076b0..0000000 --- a/java/src/pm/Client.java +++ /dev/null @@ -1,53 +0,0 @@ -package pm; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import pm.device.javainput.extreme3d.Extreme3DDevice; -import pm.device.javainput.rumblepad.RumblepadDevice; -import pm.device.jintellitype.JIntellitypeDevice; -import pm.device.lirc.LircDevice; -import pm.device.network.NetworkDevice; -import pm.device.panel.PanelDevice; -import pm.device.player.PlayerDevice; -import pm.device.wiimote.WiimoteDevice; -import pm.event.EventRouter; -import pm.event.router.GlobalRouter; -import pm.exception.event.router.GlobalRouterException; - -public class Client { - protected Log log = LogFactory.getLog(getClass()); - - public static final String IP = "127.0.0.1"; - public static final int PORT = 6789; - - protected EventRouter eventRouter; - protected Device[] deviceArray; - - public Client() throws GlobalRouterException { - this(IP, PORT); - } - - public Client(String ip, int port) throws GlobalRouterException { - eventRouter = new GlobalRouter(ip, port); - deviceArray = new Device[] { - new LircDevice(), - new WiimoteDevice(), - new PanelDevice(), - new JIntellitypeDevice(), - new PlayerDevice(), - new RumblepadDevice(), - new Extreme3DDevice(), - new NetworkDevice()}; - } - - public void start() { - log.debug("Client"); - Mimis mimis = new Mimis(eventRouter, deviceArray); - mimis.start(); - } - - public static void main(String[] args) { - new Main().start(); - } -} diff --git a/java/src/pm/Device.java b/java/src/pm/Device.java deleted file mode 100644 index 090a370..0000000 --- a/java/src/pm/Device.java +++ /dev/null @@ -1,92 +0,0 @@ -package pm; - -import pm.event.EventHandler; -import pm.event.Task; -import pm.event.task.Continuous; -import pm.event.task.Stopper; -import pm.macro.Sequence; -import pm.macro.SequenceListener; -import pm.macro.State; -import pm.macro.state.Hold; -import pm.macro.state.Press; -import pm.macro.state.Release; -import pm.manager.Titled; - -public abstract class Device extends EventHandler implements Titled, Exitable { - protected String title; - protected boolean active; - protected SequenceListener sequenceListener; - - static { - SequenceListener.initialise(eventRouter); - } - - public Device(String title) { - this.title = title; - active = false; - sequenceListener = new SequenceListener(this); - } - - /* Register macro's */ - protected void add(Sequence sequence, Task task) { - sequenceListener.add(sequence, task); - } - - protected void add(State state, Task task) { - add(new Sequence(state), task); - } - - protected void add(Press press, Task task, boolean macro) { - if (macro) { - add(new Macro(press), task); - } else { - add((State) press, task); - } - } - - protected void add(Press press, Task task) { - add(press, task, true); - } - - protected void add(Hold hold, Task pressTask, Task releaseTask) { - Button button = hold.getButton(); - add(new Press(button), pressTask, false); - add(new Release(button), releaseTask); - } - - protected void add(Sequence startSequence, Sequence stopSequence, Continuous continuous) { - add(startSequence, continuous); - add(stopSequence, new Stopper(continuous)); - } - - protected void add(State startEvent, State stopEvent, Continuous continuous) { - add(startEvent, continuous); - add(stopEvent, new Stopper(continuous)); - } - - protected void add(Press startPress, Press stopPress, Continuous continuous) { - add(new Macro(startPress), continuous); - add(new Macro(stopPress), new Stopper(continuous)); - } - - protected void add(Hold hold, Continuous continuous) { - Button button = hold.getButton(); - add(new Press(button), new Release(button), continuous); - } - - /* Recognize events */ - protected void add(State state) { - sequenceListener.add(state); - } - - public String title() { - return title; - } - - public void exit() { - if (active()) { - deactivate(); - } - stop(); - } -} diff --git a/java/src/pm/Event.java b/java/src/pm/Event.java deleted file mode 100644 index 7470111..0000000 --- a/java/src/pm/Event.java +++ /dev/null @@ -1,33 +0,0 @@ -package pm; - -import pm.event.EventListener; -import pm.value.Target; - -public class Event { - protected static final long serialVersionUID = 1L; - - protected Target target; - - public Event(Target target) { - this.target = target; - } - - public Target getTarget() { - return target; - } - - public boolean compatible(EventListener eventListener) { - switch (target) { - case ALL: - return true; - case MIMIS: - return eventListener instanceof Mimis; - case DEVICES: - return eventListener instanceof Device; - case APPLICATIONS: - return eventListener instanceof Application; - default: - return false; - } - } -} diff --git a/java/src/pm/Exitable.java b/java/src/pm/Exitable.java deleted file mode 100644 index 4f9fc25..0000000 --- a/java/src/pm/Exitable.java +++ /dev/null @@ -1,5 +0,0 @@ -package pm; - -public interface Exitable { - public void exit(); -} diff --git a/java/src/pm/GUI.java b/java/src/pm/GUI.java deleted file mode 100644 index bd79f12..0000000 --- a/java/src/pm/GUI.java +++ /dev/null @@ -1,83 +0,0 @@ -package pm; - -import java.awt.GridLayout; -import java.awt.TextArea; -import java.awt.event.WindowEvent; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JToggleButton; -import javax.swing.SwingConstants; -import javax.swing.WindowConstants; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class GUI extends JFrame { - protected Log log = LogFactory.getLog(getClass()); - protected static final long serialVersionUID = 1L; - - protected static final String TITLE = "Mimis GUI"; - protected static final String APPLICATION_TITLE = "Applications"; - protected static final String DEVICE_TITLE = "Devices"; - - protected Mimis mimis; - - public GUI(Mimis mimis, Manager applicationManager, Manager deviceManager) { - super(TITLE); - this.mimis = mimis; - createFrame(applicationManager, deviceManager); - } - - protected void createFrame(Manager applicationManager, Manager deviceManager) { - setLayout(new GridLayout(0, 1)); - JPanel controlPanel = createControlPanel(applicationManager, deviceManager); - add(controlPanel); - JPanel feedbackPanel = createFeedbackPanel(); - add(feedbackPanel); - setResizable(false); - setVisible(true); - setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - pack(); - } - - protected JPanel createControlPanel(Manager applicationManager, Manager deviceManager) { - JPanel controlPanel = new JPanel(new GridLayout(1, 0)); - JPanel applicationPanel = createManagerPanel(applicationManager, APPLICATION_TITLE); - controlPanel.add(applicationPanel); - JPanel devicePanel = createManagerPanel(deviceManager, DEVICE_TITLE); - controlPanel.add(devicePanel); - return controlPanel; - } - - protected JPanel createManagerPanel(Manager manager, String title) { - JPanel panel = new JPanel(new GridLayout(0, 1)); - panel.add(new JLabel(title, SwingConstants.CENTER)); - for (JToggleButton button : manager.getButtons()) { - panel.add(button); - } - return panel; - } - - protected JPanel createFeedbackPanel() { - JPanel feedbackPanel = new JPanel(); - TextArea textArea = new TextArea(); - textArea.setEditable(false); - feedbackPanel.add(textArea); - return feedbackPanel; - } - - protected void processWindowEvent(WindowEvent e) { - if (e.getID() == WindowEvent.WINDOW_CLOSING) { - log.debug("Window closing"); - exit(); - mimis.exit(); - } - } - - protected void exit() { - log.debug("Dispose"); - dispose(); - } -} diff --git a/java/src/pm/Macro.java b/java/src/pm/Macro.java deleted file mode 100644 index a901a2b..0000000 --- a/java/src/pm/Macro.java +++ /dev/null @@ -1,48 +0,0 @@ -package pm; - -import java.util.ArrayList; - -import pm.exception.macro.StateOrderException; -import pm.macro.Sequence; -import pm.macro.State; -import pm.macro.state.Hold; -import pm.macro.state.Press; -import pm.macro.state.Release; - -public class Macro extends Sequence { - public Macro(Press press) { - Button button = press.getButton(); - this.eventArray = new State[] {press, new Release(button)}; - } - - public Macro(State... eventArray) throws StateOrderException { - ArrayList