App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

AppCommand.java
Go to the documentation of this file.
1 package mhr.appcore.commands;
2
3 import mhr.appcore.AppCore;
4 import mhr.appcore.interfaces.PDFeedback;
8 public abstract class AppCommand {
9 protected PDFeedback feedback = null;
10 protected PDFeedback exceptionFeedback = null;
11
12 public RuntimeException e = null;
13
18 public void setPDFeedback(PDFeedback f) {
19 this.feedback = f;
20 }
21
26 public void setPDExceptionFeedback(PDFeedback ef) {
27 this.exceptionFeedback = ef;
28 }
29
34 public void execute(AppCore target) {
35 try {
36 action(target);
37 } catch (RuntimeException e) {
38 if (exceptionFeedback != null) {
39 this.e = e;
40 exceptionFeedback.feedback();
41 return;
42 } else {
43 throw e;
44 }
45 }
46 if (feedback != null) {
47 feedback.feedback();
48 }
49 }
50
55 protected abstract void action(AppCore target);
56
62 public void dispose() {
63
64 }
65 }