Werking nader bestudeerd, enkele dingen ligt aangepast.

This commit is contained in:
Bram Veenboer
2011-02-13 15:51:12 +00:00
parent 3805baf986
commit 7fe13d454b
9 changed files with 84 additions and 52 deletions

View File

@@ -2,8 +2,7 @@ package pm.device.gui;
import pm.Device;
public class GUIDevice extends Device {
public class GUIDevice extends Device {
protected GUIDeviceUI gui;
public GUIDevice() {

View File

@@ -7,27 +7,28 @@ import javax.swing.JButton;
import javax.swing.JFrame;
import pm.Action;
import pm.Target;
import pm.task.ActionProvider;
import pm.Task;
import pm.task.TaskGatherer;
import layout.TableLayout;
import layout.TableLayoutConstraints;
public class GUIDeviceUI extends JFrame {
private static final long serialVersionUID = 1L;
protected static final long serialVersionUID = 1L;
private JButton play;
private JButton pause;
private JButton resume;
private JButton next;
private JButton previous;
private JButton forward;
private JButton rewind;
private JButton mute;
private JButton volumeUp;
private JButton volumeDown;
protected JButton play;
protected JButton pause;
protected JButton resume;
protected JButton next;
protected JButton previous;
protected JButton forward;
protected JButton rewind;
protected JButton mute;
protected JButton volumeUp;
protected JButton volumeDown;
//ActionProvider.add
//TaskGatherer.add
public GUIDeviceUI() {
initComponents();
setSize(30, 300);
@@ -155,43 +156,43 @@ public class GUIDeviceUI extends JFrame {
add(volumeDown, new TableLayoutConstraints(0, 9, 0, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
}
private void playAction(ActionEvent e) {
ActionProvider.add(Action.PLAY.setTarget(Target.APPLICATION));
protected void playAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PLAY, Target.APPLICATION));
}
private void pauseAction(ActionEvent e) {
ActionProvider.add(Action.PAUSE.setTarget(Target.APPLICATION));
protected void pauseAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PAUSE, Target.APPLICATION));
}
private void resumeAction(ActionEvent e) {
ActionProvider.add(Action.RESUME.setTarget(Target.APPLICATION));
protected void resumeAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.RESUME, Target.APPLICATION));
}
private void nextAction(ActionEvent e) {
ActionProvider.add(Action.NEXT.setTarget(Target.APPLICATION));
protected void nextAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.NEXT, Target.APPLICATION));
}
private void previousAction(ActionEvent e) {
ActionProvider.add(Action.PREVIOUS.setTarget(Target.APPLICATION));
protected void previousAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.PREVIOUS, Target.APPLICATION));
}
private void forwardAction(ActionEvent e) {
ActionProvider.add(Action.FORWARD.setTarget(Target.APPLICATION));
protected void forwardAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.FORWARD, Target.APPLICATION));
}
private void rewindAction(ActionEvent e) {
ActionProvider.add(Action.REWIND.setTarget(Target.APPLICATION));
protected void rewindAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.REWIND, Target.APPLICATION));
}
private void muteAction(ActionEvent e) {
ActionProvider.add(Action.MUTE.setTarget(Target.APPLICATION));
protected void muteAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.MUTE, Target.APPLICATION));
}
private void volumeUpAction(ActionEvent e) {
ActionProvider.add(Action.VOLUME_UP.setTarget(Target.APPLICATION));
protected void volumeUpAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.VOLUME_UP, Target.APPLICATION));
}
private void volumeDownAction(ActionEvent e) {
ActionProvider.add(Action.VOLUME_DOWN.setTarget(Target.APPLICATION));
protected void volumeDownAction(ActionEvent e) {
TaskGatherer.add(new Task(Action.VOLUME_DOWN, Target.APPLICATION));
}
}

View File

@@ -12,6 +12,7 @@ import pm.exception.event.UnknownDirectionException;
import pm.macro.event.Hold;
import pm.macro.event.Press;
import pm.task.Continuous;
import pm.task.Dynamic;
import de.hardcode.jxinput.event.JXInputButtonEvent;
import de.hardcode.jxinput.event.JXInputDirectionalEvent;
@@ -37,12 +38,10 @@ public class RumblepadDevice extends JavaInputDevice {
new Task(Action.PREVIOUS, Target.APPLICATION));
add(
new Hold(RumblepadButton.FIVE),
new Continuous(Action.FORWARD, Target.APPLICATION, 200){
public int getSleep() {return sleep - 30 * iteration;}});
new Dynamic(Action.FORWARD, Target.APPLICATION, 200, -30));
add(
new Hold(RumblepadButton.SEVEN),
new Continuous(Action.REWIND, Target.APPLICATION, 200){
public int getSleep() {return sleep - 30 * iteration;}});
new Dynamic(Action.REWIND, Target.APPLICATION, 200, -30));
add(
new Hold(RumblepadButton.NINE),
new Continuous(Action.VOLUME_DOWN, Target.APPLICATION, 100));

View File

@@ -56,7 +56,7 @@ public class JIntellitypeDevice extends Device implements HotkeyListener, Intell
public void onHotKey(int id) {
Hotkey hotkey = hotkeyList.get(id);
add(hotkeyList.get(id));
add(new Release(hotkey.getButton()));
add(new Release(hotkey.getButton()));
}
public void exit() {