1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005, 2006 Grigor Kirilov Iliev |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
24 |
|
|
25 |
import net.sf.juife.AbstractTask; |
import net.sf.juife.AbstractTask; |
26 |
|
|
27 |
|
import org.linuxsampler.lscp.LSException; |
28 |
|
|
29 |
|
|
30 |
/** |
/** |
31 |
* |
* This class extends <code>AbstractTask</code> to add new features. |
32 |
* @author Grigor Iliev |
* @author Grigor Iliev |
33 |
*/ |
*/ |
34 |
public abstract class EnhancedTask<R> extends AbstractTask<R> { |
public abstract class EnhancedTask<R> extends AbstractTask<R> { |
35 |
private boolean stopped = false; |
private boolean stopped = false; |
36 |
|
private boolean silent = false; |
37 |
|
|
38 |
/** |
/** |
39 |
* Marks that the execution of this task was interrupted. |
* Marks that the execution of this task was interrupted. |
48 |
*/ |
*/ |
49 |
public boolean |
public boolean |
50 |
isStopped() { return stopped; } |
isStopped() { return stopped; } |
51 |
|
|
52 |
|
/** |
53 |
|
* Determines whether an error message should be shown |
54 |
|
* if the execution of the task fail. |
55 |
|
*/ |
56 |
|
public boolean |
57 |
|
isSilent() { return silent; } |
58 |
|
|
59 |
|
/** |
60 |
|
* DSets whether an error message should be shown |
61 |
|
* if the execution of the task fail. |
62 |
|
*/ |
63 |
|
public void |
64 |
|
setSilent(boolean b) { silent = b; } |
65 |
|
|
66 |
|
/** |
67 |
|
* Sets the error details provided by the given exception (if the given |
68 |
|
* exception is <code>LSException</code> instance and contains error details). |
69 |
|
*/ |
70 |
|
public void |
71 |
|
setErrorDetails(Exception e) { |
72 |
|
if(e == null) return; |
73 |
|
|
74 |
|
if(e instanceof LSException) { |
75 |
|
LSException x = (LSException)e; |
76 |
|
if(x.getDetails() != null && x.getDetails().length() > 0) { |
77 |
|
setErrorDetails(x.getDetails()); |
78 |
|
} |
79 |
|
} |
80 |
|
} |
81 |
} |
} |