View Javadoc

1   /*
2    * soapUI, copyright (C) 2004-2009 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.mock.dispatch;
14  
15  import java.beans.PropertyChangeListener;
16  import java.beans.PropertyChangeSupport;
17  
18  import javax.swing.JComponent;
19  import javax.swing.JPanel;
20  
21  import org.apache.xmlbeans.XmlObject;
22  
23  import com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation;
24  import com.eviware.soapui.support.PropertyChangeNotifier;
25  
26  public abstract class AbstractMockOperationDispatcher implements PropertyChangeNotifier, MockOperationDispatcher
27  {
28  	private WsdlMockOperation mockOperation;
29  	private PropertyChangeSupport propertyChangeSupport;
30  
31  	protected AbstractMockOperationDispatcher( WsdlMockOperation mockOperation )
32  	{
33  		this.mockOperation = mockOperation;
34  		propertyChangeSupport = new PropertyChangeSupport( this );
35  	}
36  
37  	public JComponent buildEditorComponent()
38  	{
39  		return new JPanel();
40  	}
41  
42  	public void release()
43  	{
44  		mockOperation = null;
45  	}
46  
47  	public XmlObject getConfig()
48  	{
49  		return mockOperation.getConfig().getDispatchConfig();
50  	}
51  
52  	protected void saveConfig( XmlObject xmlObject )
53  	{
54  		mockOperation.getConfig().getDispatchConfig().set( xmlObject );
55  	}
56  
57  	public WsdlMockOperation getMockOperation()
58  	{
59  		return mockOperation;
60  	}
61  
62  	public void addPropertyChangeListener( String propertyName, PropertyChangeListener listener )
63  	{
64  		propertyChangeSupport.addPropertyChangeListener( propertyName, listener );
65  	}
66  
67  	public void addPropertyChangeListener( PropertyChangeListener listener )
68  	{
69  		propertyChangeSupport.addPropertyChangeListener( listener );
70  	}
71  
72  	public void removePropertyChangeListener( PropertyChangeListener listener )
73  	{
74  		propertyChangeSupport.removePropertyChangeListener( listener );
75  	}
76  
77  	public void removePropertyChangeListener( String propertyName, PropertyChangeListener listener )
78  	{
79  		propertyChangeSupport.removePropertyChangeListener( propertyName, listener );
80  	}
81  
82  	protected PropertyChangeSupport getPropertyChangeSupport()
83  	{
84  		return propertyChangeSupport;
85  	}
86  }