1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.request.components.editor.inspectors.attachments;
14
15 import java.beans.PropertyChangeEvent;
16 import java.beans.PropertyChangeListener;
17
18 import javax.swing.JComponent;
19
20 import com.eviware.soapui.impl.wsdl.AttachmentContainer;
21 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.XmlLocation;
22 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.inspectors.AbstractXmlInspector;
23
24 public class AttachmentsInspector extends AbstractXmlInspector implements PropertyChangeListener
25 {
26 private AttachmentContainer container;
27 private AttachmentsPanel attachmentsPanel;
28
29 public AttachmentsInspector( AttachmentContainer container)
30 {
31 super( "Attachments (" + container.getAttachmentCount() + ")", "Files attached to this request",
32 true, AttachmentsInspectorFactory.INSPECTOR_ID );
33 this.container = container;
34
35 container.addAttachmentsChangeListener( this );
36 }
37
38 public JComponent getComponent()
39 {
40 if( attachmentsPanel == null )
41 attachmentsPanel = new AttachmentsPanel( container );
42
43 return attachmentsPanel;
44 }
45
46 @Override
47 public void release()
48 {
49 super.release();
50 attachmentsPanel.release();
51 container.removeAttachmentsChangeListener( this );
52 }
53
54 public void locationChanged( XmlLocation location )
55 {
56 }
57
58 public void propertyChange( PropertyChangeEvent evt )
59 {
60 setTitle( "Attachments (" + container.getAttachmentCount() + ")");
61 }
62 }