View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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  	public JComponent getComponent()
42  	{
43  		if( mainPanel == null )
44  		{
45  			mainPanel = new JPanel( new BorderLayout() );
46  			form = new SimpleBindingForm( new PresentationModel<AbstractHttpRequest<?>>( wsaContainer.getWsaConfig() ) );
47  			buildContent(form);
48  			mainPanel.add( new JScrollPane( form.getPanel() ), BorderLayout.CENTER );
49  		}
50  		return mainPanel;
51  	}
52  
53  	public void buildContent(SimpleBindingForm form){};
54  
55  	@Override
56  	public boolean isEnabledFor(EditorView<XmlDocument> view)
57  	{
58  		return !view.getViewId().equals( RawXmlEditorFactory.VIEW_ID );
59  	}
60  
61  }