1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * BeanCommon.java |
---|
19 | * Copyright (C) 2002 University of Waikato, Hamilton, New Zealand |
---|
20 | * |
---|
21 | */ |
---|
22 | |
---|
23 | package weka.gui.beans; |
---|
24 | |
---|
25 | import java.beans.EventSetDescriptor; |
---|
26 | |
---|
27 | /** |
---|
28 | * Interface specifying routines that all weka beans should implement |
---|
29 | * in order to allow the bean environment to exercise some control over the |
---|
30 | * bean and also to allow the bean to exercise some control over connections. |
---|
31 | * |
---|
32 | * Beans may want to impose constraints in terms of |
---|
33 | * the number of connections they will allow via a particular |
---|
34 | * listener interface. Some beans may only want to be registered |
---|
35 | * as a listener for a particular event type with only one source, or |
---|
36 | * perhaps a limited number of sources. |
---|
37 | * |
---|
38 | * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a> |
---|
39 | * @version $Revision: 5820 $ |
---|
40 | * @since 1.0 |
---|
41 | */ |
---|
42 | public interface BeanCommon { |
---|
43 | |
---|
44 | /** |
---|
45 | * Set a custom (descriptive) name for this bean |
---|
46 | * |
---|
47 | * @param name the name to use |
---|
48 | */ |
---|
49 | void setCustomName(String name); |
---|
50 | |
---|
51 | /** |
---|
52 | * Get the custom (descriptive) name for this bean (if one has been set) |
---|
53 | * |
---|
54 | * @return the custom name (or the default name) |
---|
55 | */ |
---|
56 | String getCustomName(); |
---|
57 | |
---|
58 | /** |
---|
59 | * Stop any processing that the bean might be doing. |
---|
60 | */ |
---|
61 | void stop(); |
---|
62 | |
---|
63 | /** |
---|
64 | * Returns true if. at this time, the bean is busy with some |
---|
65 | * (i.e. perhaps a worker thread is performing some calculation). |
---|
66 | * |
---|
67 | * @return true if the bean is busy. |
---|
68 | */ |
---|
69 | boolean isBusy(); |
---|
70 | |
---|
71 | /** |
---|
72 | * Set a logger |
---|
73 | * |
---|
74 | * @param logger a <code>weka.gui.Logger</code> value |
---|
75 | */ |
---|
76 | void setLog(weka.gui.Logger logger); |
---|
77 | |
---|
78 | |
---|
79 | /** |
---|
80 | * Returns true if, at this time, |
---|
81 | * the object will accept a connection via the named event |
---|
82 | * |
---|
83 | * @param esd the EventSetDescriptor for the event in question |
---|
84 | * @return true if the object will accept a connection |
---|
85 | */ |
---|
86 | boolean connectionAllowed(EventSetDescriptor esd); |
---|
87 | |
---|
88 | /** |
---|
89 | * Returns true if, at this time, |
---|
90 | * the object will accept a connection via the named event |
---|
91 | * |
---|
92 | * @param eventName the name of the event |
---|
93 | * @return true if the object will accept a connection |
---|
94 | */ |
---|
95 | boolean connectionAllowed(String eventName); |
---|
96 | |
---|
97 | /** |
---|
98 | * Notify this object that it has been registered as a listener with |
---|
99 | * a source for recieving events described by the named event |
---|
100 | * This object is responsible for recording this fact. |
---|
101 | * |
---|
102 | * @param eventName the event |
---|
103 | * @param source the source with which this object has been registered as |
---|
104 | * a listener |
---|
105 | */ |
---|
106 | void connectionNotification(String eventName, Object source); |
---|
107 | |
---|
108 | /** |
---|
109 | * Notify this object that it has been deregistered as a listener with |
---|
110 | * a source for named event. This object is responsible |
---|
111 | * for recording this fact. |
---|
112 | * |
---|
113 | * @param eventName the event |
---|
114 | * @param source the source with which this object has been registered as |
---|
115 | * a listener |
---|
116 | */ |
---|
117 | void disconnectionNotification(String eventName, Object source); |
---|
118 | } |
---|