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