View Javadoc

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