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.tree.nodes.support;
14:
15: import java.beans.PropertyChangeListener;
16: import java.beans.PropertyChangeSupport;
17:
18: import javax.swing.ImageIcon;
19:
20: import com.eviware.soapui.model.ModelItem;
21: import com.eviware.soapui.model.settings.Settings;
22:
23: /**
24: * Empty ModelItem used by intermediary TreeNodes
25: *
26: * @author ole.matzura
27: */
28:
29: public class EmptyModelItem implements ModelItem {
30: private String name;
31: private ImageIcon icon;
32: private PropertyChangeSupport propertyChangeSupport;
33:
34: public EmptyModelItem(String name, ImageIcon icon) {
35: this .name = name;
36: this .icon = icon;
37: }
38:
39: public void setName(String name) {
40: String oldName = this .name;
41: this .name = name;
42:
43: if (propertyChangeSupport != null) {
44: propertyChangeSupport.firePropertyChange(
45: ModelItem.NAME_PROPERTY, oldName, name);
46: }
47: }
48:
49: public String getName() {
50: return name;
51: }
52:
53: public ImageIcon getIcon() {
54: return icon;
55: }
56:
57: public String getDescription() {
58: return name;
59: }
60:
61: public void addPropertyChangeListener(String propertyName,
62: PropertyChangeListener listener) {
63: if (propertyChangeSupport == null)
64: propertyChangeSupport = new PropertyChangeSupport(this );
65:
66: propertyChangeSupport.addPropertyChangeListener(propertyName,
67: listener);
68: }
69:
70: public void addPropertyChangeListener(
71: PropertyChangeListener listener) {
72: if (propertyChangeSupport == null)
73: propertyChangeSupport = new PropertyChangeSupport(this );
74:
75: propertyChangeSupport.addPropertyChangeListener(listener);
76: }
77:
78: public void removePropertyChangeListener(
79: PropertyChangeListener listener) {
80: if (propertyChangeSupport != null)
81: propertyChangeSupport
82: .removePropertyChangeListener(listener);
83: }
84:
85: public void removePropertyChangeListener(String propertyName,
86: PropertyChangeListener listener) {
87: if (propertyChangeSupport != null)
88: propertyChangeSupport.removePropertyChangeListener(
89: propertyName, listener);
90: }
91:
92: public Settings getSettings() {
93: return null;
94: }
95:
96: public void release() {
97: }
98: }
|