1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.request.components.editor.raw;
14
15 import javax.swing.JComponent;
16 import javax.swing.JScrollPane;
17 import javax.swing.JTextArea;
18
19 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.XmlEditor;
20 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.views.AbstractEditorView;
21 import com.eviware.soapui.support.UISupport;
22
23 public abstract class RawXmlEditor extends AbstractEditorView
24 {
25 private JTextArea textArea;
26 private JScrollPane scrollPane;
27
28 public RawXmlEditor( String title, XmlEditor xmlEditor, String tooltip )
29 {
30 super( title, xmlEditor );
31
32 textArea = new JTextArea();
33 textArea.setEditable( false );
34 textArea.setToolTipText( tooltip );
35 scrollPane = new JScrollPane( textArea );
36 UISupport.addPreviewCorner( scrollPane, true );
37 }
38
39 @Override
40 public void setXml( String xml )
41 {
42 textArea.setText( xml == null ? "" : getContent() );
43 textArea.setCaretPosition( 0 );
44 }
45
46 public abstract String getContent();
47
48 public JComponent getComponent()
49 {
50 return scrollPane;
51 }
52
53 public String getViewId()
54 {
55 return RawXmlEditorFactory.VIEW_ID;
56 }
57
58 public boolean isInspectable()
59 {
60 return false;
61 }
62
63 public boolean saveDocument( boolean validate )
64 {
65 return true;
66 }
67
68 public void setEditable( boolean enabled )
69 {
70
71 }
72
73 }