/[svn]/jsampler/trunk/src/org/jsampler/Resource.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/Resource.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2288 - (show annotations) (download)
Wed Nov 23 21:19:44 2011 UTC (12 years, 4 months ago) by iliev
File size: 2555 byte(s)
* Added option to select a sampler engine in Add/Edit Instrument dialog
* Moved all Swing dependent code outside the JSampler core

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 java.util.Vector;
26
27 import net.sf.juife.event.GenericEvent;
28 import net.sf.juife.event.GenericListener;
29
30
31 /**
32 *
33 * @author Grigor Iliev
34 */
35 public class Resource {
36 private String name = "Untitled";
37 private String description = "";
38
39 private final Vector<GenericListener> listeners = new Vector<GenericListener>();
40
41 /**
42 * Creates a new instance of Resource
43 */
44 public
45 Resource() { }
46
47 /**
48 * Registers the specified listener to be notified when the resource info is changed.
49 * @param l The <code>GenericListener</code> to register.
50 */
51 public void
52 addChangeListener(GenericListener l) { listeners.add(l); }
53
54 /**
55 * Removes the specified listener.
56 * @param l The <code>GenericListener</code> to remove.
57 */
58 public void
59 removeChangeListener(GenericListener l) { listeners.remove(l); }
60
61 /**
62 * Gets the name of this resource.
63 * @return The name of this resource.
64 */
65 public String
66 getName() { return name; }
67
68 /**
69 * Sets the name of this resource.
70 * @param name The new name of this resource.
71 */
72 public void
73 setName(String name) {
74 this.name = name;
75 fireChangeEvent();
76 }
77
78 /**
79 * Gets a brief description about this resource.
80 * @return A brief description about this resource.
81 */
82 public String
83 getDescription() { return description; }
84
85 /**
86 * Sets a description about this resource.
87 * @param desc A brief description about this resource.
88 */
89 public void
90 setDescription(String desc) {
91 description = desc;
92 fireChangeEvent();
93 }
94
95 /** Notifies listeners that the recourse properties has changed. */
96 protected void
97 fireChangeEvent() {
98 GenericEvent e = new GenericEvent(this);
99 for(GenericListener l : listeners) l.jobDone(e);
100 }
101 }

  ViewVC Help
Powered by ViewVC