LircDevice begonnen. Main en Client omgeschreven: nu niet meer via Manager, maar via Mimis. Manager wordt nu gebruikt om Applications / Devices in te beheren. In de Managers worden de knoppen aangemaakt, die weer door de GUI worden weergegeven. Tegelijkertijd draait in de Manager een Worker die controleert of er actief is. Interfaces toegevoegd: Exitable en Titled. Verder een aantal ongebruikte dingen weggehaald en naamgevingen aangepast. Nog eens goed alle namen nalopen!

This commit is contained in:
2011-06-01 17:16:48 +00:00
parent 585b187c0a
commit d17d60c8b4
32 changed files with 475 additions and 350 deletions

View File

@@ -16,63 +16,39 @@ 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.LocalRouter;
import pm.util.ArrayCycle;
import pm.value.Action;
public class Main extends Manager {
public class Main {
protected Log log = LogFactory.getLog(getClass());
protected ArrayCycle<Application> applicationCycle;
protected EventRouter eventRouter;
protected Application[] applicationArray;
protected Device[] deviceArray;
public Main() {
super(new LocalRouter());
}
protected void action(Action action) {
log.debug(String.format("action(%s)", action));
switch (action) {
case NEXT:
eventRouter.set(applicationCycle.next());
System.out.println(applicationCycle.current());
break;
case PREVIOUS:
eventRouter.set(applicationCycle.previous());
System.out.println(applicationCycle.current());
break;
case EXIT:
exit();
break;
}
}
public void start() {
super.start();
Application[] applicationArray = new Application[] {
eventRouter = new LocalRouter();
applicationArray = new Application[] {
new iTunesApplication(),
new GomPlayerApplication(),
new WMPApplication(),
new MPCApplication(),
new VLCApplication(),
new WinampApplication()};
applicationCycle = new ArrayCycle<Application>(applicationArray);
Device[] deviceArray = new Device[] {
new WiimoteDevice(),
new PanelDevice(),
new JIntellitypeDevice(),
new PlayerDevice(),
new RumblepadDevice(),
new Extreme3DDevice(),
new NetworkDevice()};
GUI gui = new GUI(applicationArray, deviceArray);
eventRouter.set(applicationCycle.current());
super.start(false);
deviceArray = new Device[] {
new WiimoteDevice(),
new PanelDevice(),
new JIntellitypeDevice(),
new PlayerDevice(),
new RumblepadDevice(),
new Extreme3DDevice(),
new NetworkDevice()};
}
public void exit() {
System.out.println("Exit applications...");
for (Application application : applicationCycle) {
application.exit();
}
public void start() {
log.debug("Main");
Mimis mimis = new Mimis(eventRouter, applicationArray, deviceArray);
mimis.start();
}
public static void main(String[] args) {