Parameters in constructors omgedraait.

This commit is contained in:
Bram Veenboer
2011-05-08 16:26:37 +00:00
parent e135ea5a6d
commit 23b54e8403
9 changed files with 42 additions and 40 deletions

View File

@@ -5,7 +5,7 @@ import pm.exception.device.DeviceInitialiseException;
import pm.exception.event.spreader.NetworkSpreaderException; import pm.exception.event.spreader.NetworkSpreaderException;
public class Client extends Manager { public class Client extends Manager {
public static final String IP = "localhost"; public static final String IP = "192.168.1.100";
public static final int PORT = 6789; public static final int PORT = 6789;
public Client(String ip, int port) throws NetworkSpreaderException { public Client(String ip, int port) throws NetworkSpreaderException {

View File

@@ -5,7 +5,9 @@ import java.util.ArrayList;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import pm.device.javainput.rumblepad.RumblepadDevice;
import pm.device.network.NetworkDevice; import pm.device.network.NetworkDevice;
import pm.device.panel.PanelDevice;
import pm.device.wiimote.WiimoteDevice; import pm.device.wiimote.WiimoteDevice;
import pm.event.EventHandler; import pm.event.EventHandler;
import pm.event.EventSpreader; import pm.event.EventSpreader;
@@ -26,11 +28,11 @@ public abstract class Manager extends EventHandler {
public void initialise() throws DeviceInitialiseException { public void initialise() throws DeviceInitialiseException {
//add(new JIntellitypeDevice()); //add(new JIntellitypeDevice());
//add(new PlayerDevice()); //add(new PlayerDevice());
//add(new RumblepadDevice()); add(new RumblepadDevice());
add(new WiimoteDevice()); //add(new WiimoteDevice());
//add(new GUIDevice()); //add(new GUIDevice());
//add(new TextDevice()); //add(new TextDevice());
//add(new PanelDevice()); add(new PanelDevice());
//add(new LanTextDevice()); //add(new LanTextDevice());
//add(new Extreme3DDevice()); //add(new Extreme3DDevice());
//add(new NetworkDevice()); //add(new NetworkDevice());

View File

@@ -25,14 +25,14 @@ public class Extreme3DDevice extends JavaInputDevice {
try { try {
add( add(
new Press(Extreme3DButton.TWELVE), new Press(Extreme3DButton.TWELVE),
new Task(Action.TEST, Target.APPLICATION)); new Task(Target.APPLICATION, Action.TEST));
add( add(
new Macro( new Macro(
new Hold(Extreme3DButton.ONE), new Hold(Extreme3DButton.ONE),
new Press(Extreme3DButton.TWO), new Press(Extreme3DButton.TWO),
new Press(Extreme3DButton.ELEVEN), new Press(Extreme3DButton.ELEVEN),
new Release(Extreme3DButton.ONE)), new Release(Extreme3DButton.ONE)),
new Task(Action.EXIT, Target.MANAGER)); new Task(Target.MANAGER, Action.EXIT));
} catch (MacroException e) { } catch (MacroException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -23,19 +23,19 @@ public class RumblepadDevice extends JavaInputDevice {
super.initialise(NAME); super.initialise(NAME);
add( add(
new Press(RumblepadButton.ONE), new Press(RumblepadButton.ONE),
new Task(Action.PLAY, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PLAY));
add( add(
new Press(RumblepadButton.TWO), new Press(RumblepadButton.TWO),
new Task(Action.PAUSE, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PAUSE));
add( add(
new Press(RumblepadButton.THREE), new Press(RumblepadButton.THREE),
new Task(Action.RESUME, Target.APPLICATION)); new Task(Target.APPLICATION, Action.RESUME));
add( add(
new Press(RumblepadButton.SIX), new Press(RumblepadButton.SIX),
new Task(Action.NEXT, Target.APPLICATION)); new Task(Target.APPLICATION, Action.NEXT));
add( add(
new Press(RumblepadButton.EIGHT), new Press(RumblepadButton.EIGHT),
new Task(Action.PREVIOUS, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PREVIOUS));
add( add(
new Hold(RumblepadButton.FIVE), new Hold(RumblepadButton.FIVE),
new Dynamic(Action.FORWARD, Target.APPLICATION, 200, -30)); new Dynamic(Action.FORWARD, Target.APPLICATION, 200, -30));

View File

@@ -32,25 +32,25 @@ public class JIntellitypeDevice extends Device implements HotkeyListener, Intell
jit.addIntellitypeListener(this); jit.addIntellitypeListener(this);
add( add(
new Hotkey(Key.PRIOR), new Hotkey(Key.PRIOR),
new Task(Action.PREVIOUS, Target.MANAGER)); new Task(Target.MANAGER, Action.PREVIOUS));
add( add(
new Hotkey(Key.NEXT), new Hotkey(Key.NEXT),
new Task(Action.NEXT, Target.MANAGER)); new Task(Target.MANAGER, Action.NEXT));
add( add(
new Press(CommandButton.VOLUME_DOWN), new Press(CommandButton.VOLUME_DOWN),
new Task(Action.VOLUME_DOWN, Target.APPLICATIONS)); new Task(Target.APPLICATIONS, Action.VOLUME_DOWN));
add( add(
new Press(CommandButton.VOLUME_UP), new Press(CommandButton.VOLUME_UP),
new Task(Action.VOLUME_UP, Target.APPLICATIONS)); new Task(Target.APPLICATIONS, Action.VOLUME_UP));
add( add(
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'), new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
new Task(Action.EXIT, Target.MANAGER)); new Task(Target.MANAGER, Action.EXIT));
add( add(
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'n'), new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'n'),
new Task(Action.NEXT, Target.APPLICATION)); new Task(Target.APPLICATION, Action.NEXT));
add( add(
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'p'), new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'p'),
new Task(Action.PREVIOUS, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PREVIOUS));
/*add( /*add(
new Hotkey(Modifier.CTRL | Modifier.WIN, 't'), new Hotkey(Modifier.CTRL | Modifier.WIN, 't'),
new Task(Action.TEST, Target.MAIN)); new Task(Action.TEST, Target.MAIN));

View File

@@ -15,16 +15,16 @@ public class PanelDevice extends Device implements PanelButtonListener {
panel = new Panel(this); panel = new Panel(this);
//panel.updateTime(12342398); //panel.updateTime(12342398);
//panel.updatePosition(43); //panel.updatePosition(43);
add(new Press(PanelButton.PREVIOUS), new Task(Action.PREVIOUS, Target.APPLICATION)); add(new Press(PanelButton.PREVIOUS), new Task(Target.APPLICATION, Action.PREVIOUS));
add(new Press(PanelButton.REWIND), new Task(Action.REWIND, Target.APPLICATION)); add(new Press(PanelButton.REWIND), new Task(Target.APPLICATION, Action.REWIND));
add(new Press(PanelButton.STOP), new Task(Action.STOP, Target.APPLICATION)); add(new Press(PanelButton.STOP), new Task(Target.APPLICATION, Action.STOP));
add(new Press(PanelButton.PAUSE), new Task(Action.PAUSE, Target.APPLICATION)); add(new Press(PanelButton.PAUSE), new Task(Target.APPLICATION, Action.PAUSE));
add(new Press(PanelButton.PLAY), new Task(Action.PLAY, Target.APPLICATION)); add(new Press(PanelButton.PLAY), new Task(Target.APPLICATION, Action.PLAY));
add(new Press(PanelButton.FORWARD), new Task(Action.FORWARD, Target.APPLICATION)); add(new Press(PanelButton.FORWARD), new Task(Target.APPLICATION, Action.FORWARD));
add(new Press(PanelButton.NEXT), new Task(Action.NEXT, Target.APPLICATION)); add(new Press(PanelButton.NEXT), new Task(Target.APPLICATION, Action.NEXT));
add(new Press(PanelButton.VOLUME_DOWN), new Task(Action.VOLUME_DOWN, Target.APPLICATION)); add(new Press(PanelButton.VOLUME_DOWN), new Task(Target.APPLICATION, Action.VOLUME_DOWN));
add(new Press(PanelButton.MUTE), new Task(Action.MUTE, Target.APPLICATION)); add(new Press(PanelButton.MUTE), new Task(Target.APPLICATION, Action.MUTE));
add(new Press(PanelButton.VOLUME_UP), new Task(Action.VOLUME_UP, Target.APPLICATION)); add(new Press(PanelButton.VOLUME_UP), new Task(Target.APPLICATION, Action.VOLUME_UP));
} }
public void exit() { public void exit() {

View File

@@ -67,22 +67,22 @@ public class WiimoteDevice extends Device implements GestureListener {
new Task(Action.STOP));*/ new Task(Action.STOP));*/
add( add(
new Press(WiimoteButton.A), new Press(WiimoteButton.A),
new Task(Action.PLAY, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PLAY));
add( add(
new Press(WiimoteButton.B), new Press(WiimoteButton.B),
new Task(Action.MUTE, Target.APPLICATION)); new Task(Target.APPLICATION, Action.MUTE));
add( add(
new Press(WiimoteButton.ONE), new Press(WiimoteButton.ONE),
new Task(Action.SHUFFLE, Target.APPLICATION)); new Task(Target.APPLICATION, Action.SHUFFLE));
add( add(
new Press(WiimoteButton.TWO), new Press(WiimoteButton.TWO),
new Task(Action.REPEAT, Target.APPLICATION)); new Task(Target.APPLICATION, Action.REPEAT));
add( add(
new Press(WiimoteButton.UP), new Press(WiimoteButton.UP),
new Task(Action.NEXT, Target.APPLICATION)); new Task(Target.APPLICATION, Action.NEXT));
add( add(
new Press(WiimoteButton.DOWN), new Press(WiimoteButton.DOWN),
new Task(Action.PREVIOUS, Target.APPLICATION)); new Task(Target.APPLICATION, Action.PREVIOUS));
add( add(
new Hold(WiimoteButton.RIGHT), new Hold(WiimoteButton.RIGHT),
new Dynamic(Action.FORWARD, Target.APPLICATION, 200, -30)); new Dynamic(Action.FORWARD, Target.APPLICATION, 200, -30));
@@ -97,20 +97,20 @@ public class WiimoteDevice extends Device implements GestureListener {
new Continuous(Action.VOLUME_UP, Target.APPLICATION, 100)); new Continuous(Action.VOLUME_UP, Target.APPLICATION, 100));
add( add(
new Press(WiimoteButton.HOME), new Press(WiimoteButton.HOME),
new Task(Action.NEXT, Target.MANAGER)); new Task(Target.MANAGER, Action.NEXT));
try { try {
add( add(
new Macro( new Macro(
new Hold(WiimoteButton.TWO), new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.PLUS), new Press(WiimoteButton.PLUS),
new Release(WiimoteButton.TWO)), new Release(WiimoteButton.TWO)),
new Task(Action.LIKE, Target.APPLICATION)); new Task(Target.APPLICATION, Action.LIKE));
add( add(
new Macro( new Macro(
new Hold(WiimoteButton.TWO), new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.MINUS), new Press(WiimoteButton.MINUS),
new Release(WiimoteButton.TWO)), new Release(WiimoteButton.TWO)),
new Task(Action.DISLIKE, Target.APPLICATION)); new Task(Target.APPLICATION, Action.DISLIKE));
} catch (StateOrderException e) {} } catch (StateOrderException e) {}
} }

View File

@@ -7,13 +7,13 @@ import pm.value.Target;
public class Task extends Event { public class Task extends Event {
protected Action action; protected Action action;
public Task(Action action, Target target) { public Task(Target target, Action action) {
super(target); super(target);
this.action = action; this.action = action;
} }
public Task(Action action) { public Task(Action action) {
this(action, Target.SELF); this(Target.SELF, action);
} }
public Action getAction() { public Action getAction() {

View File

@@ -12,7 +12,7 @@ public class Continuous extends Task {
protected boolean stop; protected boolean stop;
public Continuous(Action action, Target target, int sleep) { public Continuous(Action action, Target target, int sleep) {
super(action, target); super(target, action);
this.sleep = sleep; this.sleep = sleep;
reset(); reset();
} }