View Javadoc

1   /*
2    *  soapUI, copyright (C) 2006 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
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  public abstract class AbstractXmlInspector implements XmlInspector
22  {
23  	private final PropertyChangeSupport propertySupport;
24  	private String title;
25  	private String description;
26  	private boolean enabled;
27  	private XmlEditor editor;
28  	
29  	protected AbstractXmlInspector( String title, String description, boolean enabled )
30  	{
31  		this.title = title;
32  		this.description = description;
33  		this.enabled = enabled;
34  	
35  		propertySupport = new PropertyChangeSupport( this );
36  	}
37  	
38  	public void addPropertyChangeListener( PropertyChangeListener listener )
39  	{
40  		propertySupport.addPropertyChangeListener( listener );
41  	}
42  
43  	public void removePropertyChangeListener( PropertyChangeListener listener )
44  	{
45  		propertySupport.removePropertyChangeListener( listener );
46  	}
47  
48  	public String getDescription()
49  	{
50  		return description;
51  	}
52  
53  	public String getTitle()
54  	{
55  		return title;
56  	}
57  
58  	public void setDescription( String description )
59  	{
60  		String oldDescription = this.description;
61  		this.description = description;
62  		propertySupport.firePropertyChange( DESCRIPTION_PROPERTY, oldDescription, description );
63  	}
64  
65  	public void setTitle( String title )
66  	{
67  		String oldTitle = this.title;
68  		this.title = title;
69  		propertySupport.firePropertyChange( TITLE_PROPERTY, oldTitle, title );
70  	}
71  
72  	public boolean isEnabled()
73  	{
74  		return enabled;
75  	}
76  
77  	public void setEnabled( boolean enabled )
78  	{
79  		boolean oldEnabled = this.enabled;
80  		this.enabled = enabled;
81  		propertySupport.firePropertyChange( ENABLED_PROPERTY, oldEnabled, enabled );
82  	}
83  
84  	public void init( XmlEditor editor )
85  	{
86  		this.editor = editor;
87  	}
88  
89  	public XmlEditor getEditor()
90  	{
91  		return editor;
92  	}
93  }