1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
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; |
24 |
|
25 |
import org.jsampler.event.ListListener; |
26 |
|
27 |
import org.w3c.dom.Document; |
28 |
import org.w3c.dom.Node; |
29 |
|
30 |
|
31 |
/** |
32 |
* A data model representing list of orchestras. |
33 |
* @author Grigor Iliev |
34 |
*/ |
35 |
public interface OrchestraListModel { |
36 |
/** |
37 |
* Registers the specified listener for receiving event messages. |
38 |
* @param l The <code>OrchestraListListener</code> to register. |
39 |
*/ |
40 |
public void addOrchestraListListener(ListListener<OrchestraModel> l); |
41 |
|
42 |
/** |
43 |
* Removes the specified listener. |
44 |
* @param l The <code>OrchestraListListener</code> to remove. |
45 |
*/ |
46 |
public void removeOrchestraListListener(ListListener<OrchestraModel> l); |
47 |
|
48 |
/** |
49 |
* Gets the current number of orchestras in the list. |
50 |
* @return The current number of orchestras in the list. |
51 |
*/ |
52 |
public int getOrchestraCount(); |
53 |
|
54 |
/** |
55 |
* Gets the orchestra at the specified position. |
56 |
* @param idx The index of the orchestra to be returned. |
57 |
* @return The orchestra at the specified position. |
58 |
*/ |
59 |
public OrchestraModel getOrchestra(int idx); |
60 |
|
61 |
/** |
62 |
* Adds the specified orchestra to the list. |
63 |
* @param orchestra The model of the orchestra to be added. |
64 |
* @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>. |
65 |
*/ |
66 |
public void addOrchestra(OrchestraModel orchestra); |
67 |
|
68 |
/** |
69 |
* Inserts the specified orchestra at the specified position. |
70 |
* @param orchestra The orchestra to be inserted. |
71 |
* @param idx The position of the orchestra. |
72 |
* @throws IllegalArgumentException If <code>orchestra</code> is <code>null</code>. |
73 |
* @throws ArrayIndexOutOfBoundsException If the specified index is invalid. |
74 |
*/ |
75 |
public void insertOrchestra(OrchestraModel orchestra, int idx); |
76 |
|
77 |
/** |
78 |
* Removes the specified orchestra from the list. |
79 |
* @param idx The index of the orchestra to remove. |
80 |
*/ |
81 |
public void removeOrchestra(int idx); |
82 |
|
83 |
/** |
84 |
* Removes the specified orchestra from the list. |
85 |
* @param orchestraModel The model of the orchestra to remove. |
86 |
* @return <code>true</code> if the specified orchestra was in the list, |
87 |
* <code>false</code> otherwise. |
88 |
*/ |
89 |
public boolean removeOrchestra(OrchestraModel orchestraModel); |
90 |
|
91 |
/** Removes all orchestras from the list. */ |
92 |
public void removeAllOrchestras(); |
93 |
|
94 |
/** |
95 |
* Gets the position of the specified orchestra in this orchestra list. |
96 |
* @param orchestra The orchestra whose index should be returned. |
97 |
* @return The position of the specified orchestra in this orchestra list, |
98 |
* and -1 if <code>orchestra</code> is <code>null</code> or |
99 |
* the orchestra list does not contain the specified orchestra. |
100 |
*/ |
101 |
public int getOrchestraIndex(OrchestraModel orchestra); |
102 |
|
103 |
/** |
104 |
* Moves the specified orchestra one the top of the orchestra list. |
105 |
* This method does nothing if <code>orchestra</code> is <code>null</code>, |
106 |
* the orchestra list does not contain the specified orchestra, |
107 |
* or if the orchestra is already on the top. |
108 |
* @param orchestra The orchestra to move on top. |
109 |
*/ |
110 |
public void moveOrchestraOnTop(OrchestraModel orchestra); |
111 |
|
112 |
/** |
113 |
* Moves the specified orchestra one position up in the orchestra list. |
114 |
* This method does nothing if <code>orchestra</code> is <code>null</code>, |
115 |
* the orchestra list does not contain the specified orchestra, |
116 |
* or if the orchestra is already on the top. |
117 |
* @param orchestra The orchestra to move up. |
118 |
*/ |
119 |
public void moveOrchestraUp(OrchestraModel orchestra); |
120 |
|
121 |
/** |
122 |
* Moves the specified orchestra one position down in the orchestra list. |
123 |
* This method does nothing if <code>orchestra</code> is <code>null</code>, |
124 |
* the orchestra list does not contain the specified orchestra, |
125 |
* or if the orchestra is already at the bottom. |
126 |
* @param orchestra The orchestra to move down. |
127 |
*/ |
128 |
public void moveOrchestraDown(OrchestraModel orchestra); |
129 |
|
130 |
/** |
131 |
* Moves the specified orchestra at the bottom of the orchestra list. |
132 |
* This method does nothing if <code>orchestra</code> is <code>null</code>, |
133 |
* the orchestra list does not contain the specified orchestra, |
134 |
* or if the orchestra is already at the bottom. |
135 |
* @param orchestra The orchestra to move at bottom. |
136 |
*/ |
137 |
public void moveOrchestraAtBottom(OrchestraModel orchestra); |
138 |
|
139 |
/** |
140 |
* Reads and loads the content provided by <code>node</code> to this orchestra list. |
141 |
* @param node The node providing the content of this orchestra list. |
142 |
* @throws IllegalArgumentException If an error occurs while |
143 |
* reading the content of this orchestra list. |
144 |
*/ |
145 |
public void readObject(Node node); |
146 |
|
147 |
/** |
148 |
* Writes the content of this orchestra list to the |
149 |
* specified node of document <code>doc</code>. |
150 |
* @param doc The document containing <code>node</code>. |
151 |
* @param node Specifies the node where the content of this orchestra |
152 |
* list should be written. |
153 |
*/ |
154 |
public void writeObject(Document doc, Node node); |
155 |
} |