View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2007 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  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  {
31  	private String name;
32  	private ImageIcon icon;
33  	private PropertyChangeSupport propertyChangeSupport;
34  	
35  	public EmptyModelItem(String name, ImageIcon icon)
36  	{
37  		this.name = name;
38  		this.icon = icon;
39  	}
40  
41  	public void setName( String name )
42  	{
43  		String oldName = this.name;
44  		this.name = name;
45  		
46  		if( propertyChangeSupport != null )
47  		{
48  			propertyChangeSupport.firePropertyChange( ModelItem.NAME_PROPERTY, oldName, name );
49  		}
50  	}
51  
52  	public String getName()
53  	{
54  		return name;
55  	}
56  
57  	public ImageIcon getIcon()
58  	{
59  		return icon;
60  	}
61  
62  	public String getDescription()
63  	{
64  		return name;
65  	}
66  
67  	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
68  	{
69  		if( propertyChangeSupport == null )
70  			propertyChangeSupport = new PropertyChangeSupport( this );
71  		
72  		propertyChangeSupport.addPropertyChangeListener( propertyName, listener );
73  	}
74  
75  	public void addPropertyChangeListener(PropertyChangeListener listener)
76  	{
77  		if( propertyChangeSupport == null )
78  			propertyChangeSupport = new PropertyChangeSupport( this );
79  		
80  		propertyChangeSupport.addPropertyChangeListener( listener );
81  	}
82  
83  	public void removePropertyChangeListener(PropertyChangeListener listener)
84  	{
85  		if( propertyChangeSupport != null )
86  			propertyChangeSupport.removePropertyChangeListener( listener );
87  	}
88  
89  	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
90  	{
91  		if( propertyChangeSupport != null )
92  			propertyChangeSupport.removePropertyChangeListener( propertyName, listener );
93  	}
94  
95  	public Settings getSettings()
96  	{
97  		return null;
98  	}
99  
100 	public void release()
101 	{
102 	}}