class MethodPropertyChangeListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent ev) {
if (Command.ENABLED.equals(ev.getPropertyName())) {
boolean on = ((Boolean) ev.getNewValue()).booleanValue();
Command command = (Command) ev.getSource();
if (on != ((Boolean) ev.getOldValue()).booleanValue()) {
int type;
if (on) {
type = DataModelEvent.ENABLE_METHOD;
} else {
type = DataModelEvent.DISABLE_METHOD;
}
DataModelEvent event = new DataModelEvent(DataModel.this, type, true);
event.setTransmitter(DataModel.this);
event.setData(command.getCommandName());
fireEvent(event);
}
}
}