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.impl.wsdl.panels.request;
14  
15  import com.eviware.soapui.impl.wsdl.WsdlRequest;
16  import com.eviware.soapui.impl.wsdl.actions.request.AddRequestToTestCaseAction;
17  import com.eviware.soapui.impl.wsdl.support.HelpUrls;
18  import com.eviware.soapui.support.action.swing.SwingActionDelegate;
19  import com.eviware.soapui.support.components.JXToolBar;
20  
21  import javax.swing.*;
22  
23  /***
24   * DesktopPanel for standard WsdlRequests
25   * 
26   * @author ole.matzura
27   */
28  
29  public class WsdlRequestDesktopPanel extends AbstractWsdlRequestDesktopPanel<WsdlRequest,WsdlRequest>
30  {
31  	private JButton addToTestCaseButton;
32  	
33  	public WsdlRequestDesktopPanel(WsdlRequest request)
34  	{
35  		super(request, request);
36  
37        try
38        {
39           request.getOperation().getInterface().getWsdlContext().loadIfNecessary();
40        }
41        catch( Exception e )
42        {
43           e.printStackTrace();
44        }
45     }
46  	
47  	@Override
48  	protected void init(WsdlRequest request)
49  	{
50  		addToTestCaseButton = createActionButton(
51  				SwingActionDelegate.createDelegate( AddRequestToTestCaseAction.SOAPUI_ACTION_ID, getRequest(), 
52  							null, "/addToTestCase.gif"), true );
53  		
54  		super.init(request);
55  	}
56  
57  	protected String getHelpUrl()
58  	{
59  		return HelpUrls.REQUESTEDITOR_HELP_URL;
60  	}
61  	
62  	public void setEnabled(boolean enabled)
63  	{
64  		super.setEnabled(enabled);
65  		addToTestCaseButton.setEnabled(enabled);
66  	}
67  
68  	protected void insertButtons(JXToolBar toolbar)
69  	{
70  		toolbar.add(addToTestCaseButton);
71  		super.insertButtons(toolbar);
72  	}
73  }