01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.model.support;
14:
15: import java.awt.event.ActionEvent;
16: import java.beans.PropertyChangeListener;
17: import java.beans.PropertyChangeSupport;
18:
19: import javax.swing.AbstractAction;
20:
21: import com.eviware.soapui.model.ModelItem;
22: import com.eviware.soapui.support.UISupport;
23:
24: /**
25: * Base-class for ModelItem implementations
26: *
27: * @author Ole.Matzura
28: */
29:
30: public abstract class AbstractModelItem implements ModelItem {
31: private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
32: this );
33:
34: public void addPropertyChangeListener(String propertyName,
35: PropertyChangeListener listener) {
36: propertyChangeSupport.addPropertyChangeListener(propertyName,
37: listener);
38: }
39:
40: public void addPropertyChangeListener(
41: PropertyChangeListener listener) {
42: propertyChangeSupport.addPropertyChangeListener(listener);
43: }
44:
45: public void removePropertyChangeListener(
46: PropertyChangeListener listener) {
47: propertyChangeSupport.removePropertyChangeListener(listener);
48: }
49:
50: public void removePropertyChangeListener(String propertyName,
51: PropertyChangeListener listener) {
52: propertyChangeSupport.removePropertyChangeListener(
53: propertyName, listener);
54: }
55:
56: public void notifyPropertyChanged(String name, Object oldValue,
57: Object newValue) {
58: propertyChangeSupport.firePropertyChange(name, oldValue,
59: newValue);
60: }
61:
62: public void notifyPropertyChanged(String name, int oldValue,
63: int newValue) {
64: propertyChangeSupport.firePropertyChange(name, oldValue,
65: newValue);
66: }
67:
68: public void notifyPropertyChanged(String name, boolean oldValue,
69: boolean newValue) {
70: propertyChangeSupport.firePropertyChange(name, oldValue,
71: newValue);
72: }
73:
74: public class ShowModelItemAction extends AbstractAction {
75: public ShowModelItemAction() {
76: super ("Show Editor");
77: }
78:
79: public void actionPerformed(ActionEvent e) {
80: UISupport.selectAndShow(AbstractModelItem.this);
81: }
82: }
83: }
|