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;
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 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.LogFactory;
import pm.device.javainput.rumblepad.RumblepadDevice;
import pm.device.network.NetworkDevice;
import pm.device.panel.PanelDevice;
import pm.device.wiimote.WiimoteDevice;
import pm.event.EventHandler;
import pm.event.EventSpreader;
@@ -26,11 +28,11 @@ public abstract class Manager extends EventHandler {
public void initialise() throws DeviceInitialiseException {
//add(new JIntellitypeDevice());
//add(new PlayerDevice());
//add(new RumblepadDevice());
add(new WiimoteDevice());
add(new RumblepadDevice());
//add(new WiimoteDevice());
//add(new GUIDevice());
//add(new TextDevice());
//add(new PanelDevice());
add(new PanelDevice());
//add(new LanTextDevice());
//add(new Extreme3DDevice());
//add(new NetworkDevice());

View File

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

View File

@@ -23,19 +23,19 @@ public class RumblepadDevice extends JavaInputDevice {
super.initialise(NAME);
add(
new Press(RumblepadButton.ONE),
new Task(Action.PLAY, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PLAY));
add(
new Press(RumblepadButton.TWO),
new Task(Action.PAUSE, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PAUSE));
add(
new Press(RumblepadButton.THREE),
new Task(Action.RESUME, Target.APPLICATION));
new Task(Target.APPLICATION, Action.RESUME));
add(
new Press(RumblepadButton.SIX),
new Task(Action.NEXT, Target.APPLICATION));
new Task(Target.APPLICATION, Action.NEXT));
add(
new Press(RumblepadButton.EIGHT),
new Task(Action.PREVIOUS, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PREVIOUS));
add(
new Hold(RumblepadButton.FIVE),
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);
add(
new Hotkey(Key.PRIOR),
new Task(Action.PREVIOUS, Target.MANAGER));
new Task(Target.MANAGER, Action.PREVIOUS));
add(
new Hotkey(Key.NEXT),
new Task(Action.NEXT, Target.MANAGER));
new Task(Target.MANAGER, Action.NEXT));
add(
new Press(CommandButton.VOLUME_DOWN),
new Task(Action.VOLUME_DOWN, Target.APPLICATIONS));
new Task(Target.APPLICATIONS, Action.VOLUME_DOWN));
add(
new Press(CommandButton.VOLUME_UP),
new Task(Action.VOLUME_UP, Target.APPLICATIONS));
new Task(Target.APPLICATIONS, Action.VOLUME_UP));
add(
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
new Task(Action.EXIT, Target.MANAGER));
new Task(Target.MANAGER, Action.EXIT));
add(
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'n'),
new Task(Action.NEXT, Target.APPLICATION));
new Task(Target.APPLICATION, Action.NEXT));
add(
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'p'),
new Task(Action.PREVIOUS, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PREVIOUS));
/*add(
new Hotkey(Modifier.CTRL | Modifier.WIN, 't'),
new Task(Action.TEST, Target.MAIN));

View File

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

View File

@@ -67,22 +67,22 @@ public class WiimoteDevice extends Device implements GestureListener {
new Task(Action.STOP));*/
add(
new Press(WiimoteButton.A),
new Task(Action.PLAY, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PLAY));
add(
new Press(WiimoteButton.B),
new Task(Action.MUTE, Target.APPLICATION));
new Task(Target.APPLICATION, Action.MUTE));
add(
new Press(WiimoteButton.ONE),
new Task(Action.SHUFFLE, Target.APPLICATION));
new Task(Target.APPLICATION, Action.SHUFFLE));
add(
new Press(WiimoteButton.TWO),
new Task(Action.REPEAT, Target.APPLICATION));
new Task(Target.APPLICATION, Action.REPEAT));
add(
new Press(WiimoteButton.UP),
new Task(Action.NEXT, Target.APPLICATION));
new Task(Target.APPLICATION, Action.NEXT));
add(
new Press(WiimoteButton.DOWN),
new Task(Action.PREVIOUS, Target.APPLICATION));
new Task(Target.APPLICATION, Action.PREVIOUS));
add(
new Hold(WiimoteButton.RIGHT),
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));
add(
new Press(WiimoteButton.HOME),
new Task(Action.NEXT, Target.MANAGER));
new Task(Target.MANAGER, Action.NEXT));
try {
add(
new Macro(
new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.PLUS),
new Release(WiimoteButton.TWO)),
new Task(Action.LIKE, Target.APPLICATION));
new Task(Target.APPLICATION, Action.LIKE));
add(
new Macro(
new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.MINUS),
new Release(WiimoteButton.TWO)),
new Task(Action.DISLIKE, Target.APPLICATION));
new Task(Target.APPLICATION, Action.DISLIKE));
} catch (StateOrderException e) {}
}

View File

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

View File

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