Gewerkt aan items uit de TODO lijst, zie TODO voor details.

This commit is contained in:
Bram Veenboer
2011-02-22 18:51:46 +00:00
parent 0d62496d93
commit 88c849ff89
10 changed files with 61 additions and 64 deletions

View File

@@ -2,13 +2,13 @@ package pm;
import pm.exception.application.ApplicationExitException;
import pm.exception.application.ApplicationInitialiseException;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
import pm.task.TaskListener;
public abstract class Application extends TaskListener {
public Application() {
super();
TaskGatherer.add(this);
TaskManager.add(this);
}
public void run() {

View File

@@ -10,7 +10,7 @@ import pm.macro.event.Sequence;
import pm.macro.event.SequenceListener;
import pm.task.Continuous;
import pm.task.Stopper;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
import pm.task.TaskListener;
public abstract class Device extends TaskListener {
@@ -19,7 +19,7 @@ public abstract class Device extends TaskListener {
public Device() {
super();
sequenceListener = new SequenceListener();
TaskGatherer.add(this);
TaskManager.add(this);
}
/* Register macro's */

View File

@@ -18,7 +18,7 @@ import pm.device.wiimote.WiimoteDevice;
import pm.exception.application.ApplicationExitException;
import pm.exception.device.DeviceExitException;
import pm.exception.device.DeviceInitialiseException;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
import pm.task.TaskListener;
public class Main extends TaskListener {
@@ -35,18 +35,18 @@ public class Main extends TaskListener {
"pm.device.wiimote.WiimoteDevice"};*/
applicationCycle = new ApplicationCycle();
deviceList = new ArrayList<Device>();
TaskGatherer.initialise(applicationCycle);
TaskGatherer.add(this);
TaskManager.initialise(applicationCycle);
TaskManager.add(this);
}
public void initialise() throws DeviceInitialiseException {
add(new JIntellitypeDevice());
//add(new JIntellitypeDevice());
//add(new PlayerDevice());
//add(new RumblepadDevice());
//add(new WiimoteDevice());
//add(new GUIDevice());
//add(new TextDevice());
//add(new LanTextDevice());
add(new LanTextDevice());
for (Device device : deviceList) {
try {
device.initialise();
@@ -57,9 +57,9 @@ public class Main extends TaskListener {
add(new ExampleApplication());
//add(new WMPApplication());
add(new GomPlayerApplication());
//add(new GomPlayerApplication());
//add(new WinampApplication());
//add(new iTunesApplication());
add(new iTunesApplication());
for (Application application : applicationCycle) {
application.start();
}

View File

@@ -8,7 +8,7 @@ import javax.swing.JFrame;
import pm.Action;
import pm.Target;
import pm.Task;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
import layout.TableLayout;
import layout.TableLayoutConstraints;
@@ -157,42 +157,42 @@ public class GUIDeviceUI extends JFrame {
}
protected void playAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PLAY, Target.APPLICATION));
TaskManager.add(new Task(Action.PLAY, Target.APPLICATION));
}
protected void pauseAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PAUSE, Target.APPLICATION));
TaskManager.add(new Task(Action.PAUSE, Target.APPLICATION));
}
protected void resumeAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.RESUME, Target.APPLICATION));
TaskManager.add(new Task(Action.RESUME, Target.APPLICATION));
}
protected void nextAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.NEXT, Target.APPLICATION));
TaskManager.add(new Task(Action.NEXT, Target.APPLICATION));
}
protected void previousAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PREVIOUS, Target.APPLICATION));
TaskManager.add(new Task(Action.PREVIOUS, Target.APPLICATION));
}
protected void forwardAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.FORWARD, Target.APPLICATION));
TaskManager.add(new Task(Action.FORWARD, Target.APPLICATION));
}
protected void rewindAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.REWIND, Target.APPLICATION));
TaskManager.add(new Task(Action.REWIND, Target.APPLICATION));
}
protected void muteAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.MUTE, Target.APPLICATION));
TaskManager.add(new Task(Action.MUTE, Target.APPLICATION));
}
protected void volumeUpAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.VOLUME_UP, Target.APPLICATION));
TaskManager.add(new Task(Action.VOLUME_UP, Target.APPLICATION));
}
protected void volumeDownAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.VOLUME_DOWN, Target.APPLICATION));
TaskManager.add(new Task(Action.VOLUME_DOWN, Target.APPLICATION));
}
}

View File

@@ -24,7 +24,7 @@ public class LanTextDevice extends Device implements Runnable {
new LanTextListener(socket.accept());
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -4,20 +4,17 @@ import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;
import pm.Action;
import pm.Target;
import pm.Task;
import pm.task.TaskGatherer;
import pm.device.textinput.TextDevice;
public class LanTextListener implements Runnable {
static final int SLEEP = 100;
protected boolean run;
public class LanTextListener extends TextDevice {
protected Socket socket;
protected Scanner input;
public LanTextListener(Socket socket){
public LanTextListener(Socket socket) {
this.socket = socket;
initialise();
}
public void initialise() {
try {
input = new Scanner(socket.getInputStream());
} catch (IOException e) {
@@ -27,25 +24,11 @@ public class LanTextListener implements Runnable {
new Thread(this).start();
}
public void run() {
while (run && socket.isConnected() && input.hasNext()) {
String textinput = input.next().toUpperCase();
if(textinput != null) {
try {
TaskGatherer.add(
new Task(Action.valueOf(textinput), Target.APPLICATION));
} catch (IllegalArgumentException e) {}
}
try {
Thread.sleep(SLEEP);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
exit();
protected boolean running() {
return run && socket.isConnected() && input.hasNext();
}
protected void exit() {
public void exit() {
run = false;
try {
socket.close();

View File

@@ -6,7 +6,7 @@ import pm.Action;
import pm.Device;
import pm.Target;
import pm.Task;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
public class TextDevice extends Device implements Runnable {
static final int SLEEP = 100;
@@ -21,11 +21,11 @@ public class TextDevice extends Device implements Runnable {
public void run() {
run = true;
while (run) {
while (running()) {
String textinput = input.next().toUpperCase();
if(textinput != null) {
try {
TaskGatherer.add(
TaskManager.add(
new Task(Action.valueOf(textinput), Target.APPLICATION));
} catch(IllegalArgumentException e) {}
}
@@ -36,4 +36,8 @@ public class TextDevice extends Device implements Runnable {
}
}
}
protected boolean running() {
return run && input.hasNext();
}
}

View File

@@ -7,7 +7,7 @@ import pm.Device;
import pm.Task;
import pm.macro.Active;
import pm.macro.Event;
import pm.task.TaskGatherer;
import pm.task.TaskManager;
public class SequenceListener {
public ArrayList<Sequence> sequenceList;
@@ -34,7 +34,7 @@ public class SequenceListener {
if (active.next(event)) {
if (active.last()) {
Task task = taskMap.get(active.getSequence());
TaskGatherer.add(task);
TaskManager.add(task);
removeList.add(active);
}
} else {

View File

@@ -9,13 +9,13 @@ import pm.Target;
import pm.Task;
import pm.application.ApplicationCycle;
public class TaskGatherer {
public class TaskManager {
protected static ArrayList<TaskListener> taskListenerList;
protected static ApplicationCycle applicationCycle;
public static void initialise(ApplicationCycle applicationCycle) {
taskListenerList = new ArrayList<TaskListener>();
TaskGatherer.applicationCycle = applicationCycle;
TaskManager.applicationCycle = applicationCycle;
}
public static void add(TaskListener taskListener) {

View File

@@ -1,3 +1,6 @@
TODO
------------
log bijhouden
mappings lezen vanuit config bestand
@@ -12,16 +15,23 @@ nummerinfo weergeven, waar? via feedback?
javadoc maken, class diagram opstellen enz.....
naamgeving en indeling classes/packages controleren
meer applicaties implementeren, zoals VLC, WMP, Youtube? (interface naar flash?)
logo ontwerpen
exporteren naar uitvoerbare jar file
lantextdevice generiek maken met normale textdevice
client maken die remote devices kan beheren en lokaal acties kan uitvoeren
mogelijkheid tot webstart onderzoeken
mogelijkheid tot webstart onderzoeken
IN PROGRESS
-------------
naamgeving en indeling classes/packages controleren
+TaskGatherererer hernoemt naar TaskManager
exporteren naar uitvoerbare jar file
+Eclipse kan exporteren, maar bij uitvoeren gebeurd er niets. Moet er een status scherm komen? (Een swing console bijvoorbeeld)
DONE
-------------
lantextdevice generiek maken met normale textdevice