001package headfirst.combined.djview;
002
003public class BeatController implements ControllerInterface {
004        BeatModelInterface model;
005        DJView view;
006
007        public BeatController(BeatModelInterface model) {
008                this.model = model;
009                view = new DJView(this, model);
010                view.createView();
011                view.createControls();
012                view.disableStopMenuItem();
013                view.enableStartMenuItem();
014                model.initialize();
015        }
016
017        public void start() {
018                model.on();
019                view.disableStartMenuItem();
020                view.enableStopMenuItem();
021        }
022
023        public void stop() {
024                model.off();
025                view.disableStopMenuItem();
026                view.enableStartMenuItem();
027        }
028
029        public void increaseBPM() {
030                int bpm = model.getBPM();
031                model.setBPM(bpm + 1);
032        }
033
034        public void decreaseBPM() {
035                int bpm = model.getBPM();
036                model.setBPM(bpm - 1);
037        }
038
039        public void setBPM(int bpm) {
040                model.setBPM(bpm);
041        }
042}