1
2
3
4
5
6
7
8
9
10
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 getEditorComponent()
38 {
39 return new JPanel();
40 }
41
42 public void releaseEditorComponent( )
43 {
44 }
45
46 public void release()
47 {
48 mockOperation = null;
49 }
50
51 public XmlObject getConfig()
52 {
53 return mockOperation.getConfig().getDispatchConfig();
54 }
55
56 protected void saveConfig( XmlObject xmlObject )
57 {
58 mockOperation.getConfig().getDispatchConfig().set( xmlObject );
59 }
60
61 public WsdlMockOperation getMockOperation()
62 {
63 return mockOperation;
64 }
65
66 public void addPropertyChangeListener( String propertyName, PropertyChangeListener listener )
67 {
68 propertyChangeSupport.addPropertyChangeListener( propertyName, listener );
69 }
70
71 public void addPropertyChangeListener( PropertyChangeListener listener )
72 {
73 propertyChangeSupport.addPropertyChangeListener( listener );
74 }
75
76 public void removePropertyChangeListener( PropertyChangeListener listener )
77 {
78 propertyChangeSupport.removePropertyChangeListener( listener );
79 }
80
81 public void removePropertyChangeListener( String propertyName, PropertyChangeListener listener )
82 {
83 propertyChangeSupport.removePropertyChangeListener( propertyName, listener );
84 }
85
86 protected PropertyChangeSupport getPropertyChangeSupport()
87 {
88 return propertyChangeSupport;
89 }
90 }