1 /**
2 *
3 */
4 package siouxsie.desktop.commands.impl;
5
6 import java.beans.PropertyChangeListener;
7 import java.beans.PropertyChangeSupport;
8
9 import siouxsie.desktop.commands.ICommand;
10
11 /**
12 * Convenient class for command.
13 * @author Arnaud Cogoluegnes
14 * @version $Id: AbstractCommand.java 107 2008-01-09 16:05:50Z acogo $
15 */
16 public abstract class AbstractCommand implements ICommand {
17
18 private boolean enabled = true;
19
20 private PropertyChangeSupport support = new PropertyChangeSupport(this);
21
22
23
24
25 public boolean isEnabled() {
26 return enabled;
27 }
28
29
30
31
32 public void setEnabled(boolean enable) {
33 boolean old = this.enabled;
34 this.enabled = enable;
35 support.firePropertyChange(PROPERTY_ENABLED, old, enable);
36 }
37
38
39
40
41
42 public void addPropertyChangeListener(PropertyChangeListener lst) {
43 support.addPropertyChangeListener(lst);
44 }
45
46
47
48
49
50 public void removePropertyChangeListener(PropertyChangeListener lst) {
51 support.removePropertyChangeListener(lst);
52 }
53
54 }