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.impl.wsdl.panels.request.components.editor.inspectors;
14  
15  import java.beans.PropertyChangeListener;
16  import java.beans.PropertyChangeSupport;
17  
18  import com.eviware.soapui.impl.wsdl.panels.request.components.editor.XmlEditor;
19  import com.eviware.soapui.impl.wsdl.panels.request.components.editor.XmlInspector;
20  
21  /***
22   * Abstract base-class to be extended by XmlInspectors
23   * 
24   * @author ole.matzura
25   */
26  
27  public abstract class AbstractXmlInspector implements XmlInspector
28  {
29  	private final PropertyChangeSupport propertySupport;
30  	private String title;
31  	private String description;
32  	private boolean enabled;
33  	private XmlEditor editor;
34  	
35  	protected AbstractXmlInspector( String title, String description, boolean enabled )
36  	{
37  		this.title = title;
38  		this.description = description;
39  		this.enabled = enabled;
40  	
41  		propertySupport = new PropertyChangeSupport( this );
42  	}
43  	
44  	public void addPropertyChangeListener( PropertyChangeListener listener )
45  	{
46  		propertySupport.addPropertyChangeListener( listener );
47  	}
48  
49  	public void removePropertyChangeListener( PropertyChangeListener listener )
50  	{
51  		propertySupport.removePropertyChangeListener( listener );
52  	}
53  	
54  	public String getDescription()
55  	{
56  		return description;
57  	}
58  
59  	public String getTitle()
60  	{
61  		return title;
62  	}
63  
64  	public void setDescription( String description )
65  	{
66  		String oldDescription = this.description;
67  		this.description = description;
68  		propertySupport.firePropertyChange( DESCRIPTION_PROPERTY, oldDescription, description );
69  	}
70  
71  	public void setTitle( String title )
72  	{
73  		String oldTitle = this.title;
74  		this.title = title;
75  		propertySupport.firePropertyChange( TITLE_PROPERTY, oldTitle, title );
76  	}
77  
78  	public boolean isEnabled()
79  	{
80  		return enabled;
81  	}
82  
83  	public void setEnabled( boolean enabled )
84  	{
85  		boolean oldEnabled = this.enabled;
86  		this.enabled = enabled;
87  		propertySupport.firePropertyChange( ENABLED_PROPERTY, oldEnabled, enabled );
88  	}
89  
90  	public void init( XmlEditor editor )
91  	{
92  		this.editor = editor;
93  	}
94  
95  	public XmlEditor getEditor()
96  	{
97  		return editor;
98  	}
99  
100 	public void release()
101 	{
102 	}
103 }