View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.support.editor.inspectors.wsa;
14  
15  import java.awt.BorderLayout;
16  
17  import javax.swing.JComponent;
18  import javax.swing.JPanel;
19  import javax.swing.JScrollPane;
20  
21  import com.eviware.soapui.impl.support.AbstractHttpRequest;
22  import com.eviware.soapui.impl.wsdl.support.wsa.WsaContainer;
23  import com.eviware.soapui.support.components.SimpleBindingForm;
24  import com.eviware.soapui.support.editor.EditorView;
25  import com.eviware.soapui.support.editor.inspectors.AbstractXmlInspector;
26  import com.eviware.soapui.support.editor.views.xml.raw.RawXmlEditorFactory;
27  import com.eviware.soapui.support.editor.xml.XmlDocument;
28  import com.jgoodies.binding.PresentationModel;
29  
30  public abstract class AbstractWsaInspector extends AbstractXmlInspector
31  {
32  	private JPanel mainPanel;
33  	private SimpleBindingForm form;
34  	private final WsaContainer wsaContainer;
35  
36  	protected AbstractWsaInspector( WsaContainer wsaContainer )
37  	{
38  		super( "WS-A", "WS-Addressing related settings", true, WsaInspectorFactory.INSPECTOR_ID );
39  		this.wsaContainer = wsaContainer;
40  	}
41  
42  	public JComponent getComponent()
43  	{
44  		if( mainPanel == null )
45  		{
46  			mainPanel = new JPanel( new BorderLayout() );
47  			form = new SimpleBindingForm( new PresentationModel<AbstractHttpRequest<?>>( wsaContainer.getWsaConfig() ) );
48  			buildContent( form );
49  			mainPanel.add( new JScrollPane( form.getPanel() ), BorderLayout.CENTER );
50  		}
51  		return mainPanel;
52  	}
53  
54  	public void buildContent( SimpleBindingForm form )
55  	{
56  	};
57  
58  	@Override
59  	public boolean isEnabledFor( EditorView<XmlDocument> view )
60  	{
61  		return !view.getViewId().equals( RawXmlEditorFactory.VIEW_ID );
62  	}
63  
64  }