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