1 |
iliev |
912 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
1143 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
912 |
* |
6 |
|
|
* This file is part of JSampler. |
7 |
|
|
* |
8 |
|
|
* JSampler is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License version 2 |
10 |
|
|
* as published by the Free Software Foundation. |
11 |
|
|
* |
12 |
|
|
* JSampler is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with JSampler; if not, write to the Free Software |
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
|
|
* MA 02111-1307 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
package org.jsampler.event; |
24 |
|
|
|
25 |
|
|
/** |
26 |
|
|
* A semantic event which indicates LS Console changes. |
27 |
|
|
* @author Grigor Iliev |
28 |
|
|
*/ |
29 |
|
|
public class LSConsoleEvent extends java.util.EventObject { |
30 |
|
|
private String response; |
31 |
|
|
private String oldCmdLine; |
32 |
|
|
|
33 |
|
|
/** |
34 |
|
|
* Constructs an <code>LSConsoleEvent</code> object. |
35 |
|
|
* @param source The object that originated the event. |
36 |
|
|
*/ |
37 |
|
|
public |
38 |
|
|
LSConsoleEvent(Object source) { this(source, null); } |
39 |
|
|
|
40 |
|
|
/** |
41 |
|
|
* Constructs an <code>LSConsoleEvent</code> object. |
42 |
|
|
* @param source The object that originated the event. |
43 |
|
|
*/ |
44 |
|
|
public |
45 |
|
|
LSConsoleEvent(Object source, String response) { |
46 |
|
|
this(source, response, null); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
/** |
50 |
|
|
* Constructs an <code>LSConsoleEvent</code> object. |
51 |
|
|
* @param source The object that originated the event. |
52 |
|
|
* @param response Provides the LinuxSampler's response |
53 |
|
|
* when <code>responseReceived</code> event occurs. |
54 |
|
|
* @param oldCmdLine Provides the previous text of the command line |
55 |
|
|
* when <code>commandLineTextChanged</code> event occurs. |
56 |
|
|
*/ |
57 |
|
|
public |
58 |
|
|
LSConsoleEvent(Object source, String response, String oldCmdLine) { |
59 |
|
|
super(source); |
60 |
|
|
this.response = response; |
61 |
|
|
setPreviousCommandLineText(oldCmdLine); |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
/** |
65 |
|
|
* Returns the LinuxSampler's response when <code>responseReceived</code> event occurs. |
66 |
|
|
* @return The LinuxSampler's response when <code>responseReceived</code> event occurs |
67 |
|
|
* and <code>null</code> for all other events. |
68 |
|
|
*/ |
69 |
|
|
public String |
70 |
|
|
getResponse() { return response; } |
71 |
|
|
|
72 |
|
|
/** |
73 |
|
|
* Returns the previous command line text when |
74 |
|
|
* <code>commandLineTextChanged</code> event occurs. |
75 |
|
|
* @return The previous command line text when <code>commandLineTextChanged</code> |
76 |
|
|
* event occurs and <code>null</code> for all other events. |
77 |
|
|
*/ |
78 |
|
|
public String |
79 |
|
|
getPreviousCommandLineText() { return oldCmdLine; } |
80 |
|
|
|
81 |
|
|
/** |
82 |
|
|
* Sets the previous text of the command line. |
83 |
|
|
* @param oldCmdLine Provides the previous text of the command line. |
84 |
|
|
*/ |
85 |
|
|
private void |
86 |
|
|
setPreviousCommandLineText(String oldCmdLine) { this.oldCmdLine = oldCmdLine; } |
87 |
|
|
} |