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.SoapUI;
20 import com.eviware.soapui.settings.UISettings;
21 import com.eviware.soapui.support.UISupport;
22 import com.eviware.soapui.support.editor.views.AbstractXmlEditorView;
23 import com.eviware.soapui.support.editor.xml.XmlDocument;
24 import com.eviware.soapui.support.editor.xml.XmlEditor;
25
26 public abstract class RawXmlEditor<T extends XmlDocument> extends AbstractXmlEditorView<T>
27 {
28 private JTextArea textArea;
29 private JScrollPane scrollPane;
30
31 public RawXmlEditor( String title, XmlEditor<T> xmlEditor, String tooltip )
32 {
33 super( title, xmlEditor, RawXmlEditorFactory.VIEW_ID );
34
35 textArea = new JTextArea();
36 textArea.setEditable( false );
37 textArea.setLineWrap( SoapUI.getSettings().getBoolean( UISettings.WRAP_RAW_MESSAGES ) );
38 textArea.setToolTipText( tooltip );
39 scrollPane = new JScrollPane( textArea );
40 UISupport.addPreviewCorner( scrollPane, true );
41 }
42
43 @Override
44 public void setXml( String xml )
45 {
46 textArea.setText( getContent() );
47 textArea.setLineWrap( SoapUI.getSettings().getBoolean( UISettings.WRAP_RAW_MESSAGES ) );
48 textArea.setCaretPosition( 0 );
49 }
50
51 public abstract String getContent();
52
53 public JComponent getComponent()
54 {
55 return scrollPane;
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 }