View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2007 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.impl.wsdl.panels.monitor;
14  
15  import java.awt.BorderLayout;
16  import java.awt.Dimension;
17  
18  import javax.swing.JPanel;
19  import javax.swing.JTabbedPane;
20  
21  import com.eviware.soapui.impl.wsdl.WsdlProject;
22  import com.eviware.soapui.impl.wsdl.actions.support.ShowOnlineHelpAction;
23  import com.eviware.soapui.impl.wsdl.monitor.SoapMonitor;
24  import com.eviware.soapui.impl.wsdl.support.HelpUrls;
25  import com.eviware.soapui.support.UISupport;
26  import com.eviware.soapui.support.components.JXToolBar;
27  import com.eviware.soapui.ui.support.DefaultDesktopPanel;
28  
29  public class SoapMonitorDesktopPanel extends DefaultDesktopPanel
30  {
31  	private SoapMonitor soapMonitor;
32  	private final WsdlProject project;
33  
34  	public SoapMonitorDesktopPanel( WsdlProject project, String targetHost, int sourcePort, boolean addEndpoint, boolean isProxy,
35  				String incomingRequestWss, String incomingResponseWss )
36  	{
37  		super( "SOAP Monitor [" + project.getName() + "]", null, new JPanel( new BorderLayout() ) );
38  		this.project = project;
39  		
40  		JPanel p = ( JPanel ) getComponent();
41  		JTabbedPane tabs = new JTabbedPane();
42  
43  		JXToolBar toolbar = UISupport.createToolbar();
44  		soapMonitor = new SoapMonitor( project, sourcePort, targetHost, addEndpoint, isProxy, incomingRequestWss, incomingResponseWss, toolbar );
45  		
46  		tabs.add( soapMonitor, "Traffic Log" );
47  		
48  		toolbar.add( UISupport.createToolbarButton( new ShowOnlineHelpAction( HelpUrls.SOAPMONITOR_HELP_URL ) ) );
49  		
50  		p.add( toolbar, BorderLayout.NORTH );
51  		p.add( UISupport.createTabPanel( tabs, true ), BorderLayout.CENTER );
52  		
53  		p.setPreferredSize( new Dimension( 700, 600 ) );
54  	}
55  	
56  	@Override
57  	public boolean onClose( boolean canCancel )
58  	{
59  		soapMonitor.stop();
60  		soapMonitor.release();
61  		return true;
62  	}
63  	
64  	public WsdlProject getProject()
65  	{
66  		return project;
67  	}
68  }