View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 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 javax.swing.AbstractAction;
16  import javax.swing.JButton;
17  
18  import com.eviware.soapui.impl.wsdl.WsdlRequest;
19  import com.eviware.soapui.impl.wsdl.actions.request.AddRequestAsMockResponseStepAction;
20  import com.eviware.soapui.impl.wsdl.actions.request.AddRequestToTestCaseAction;
21  import com.eviware.soapui.impl.wsdl.support.HelpUrls;
22  import com.eviware.soapui.support.action.swing.SwingActionDelegate;
23  import com.eviware.soapui.support.components.JXToolBar;
24  
25  /***
26   * DesktopPanel for standard WsdlRequests
27   * 
28   * @author ole.matzura
29   */
30  
31  public class WsdlRequestDesktopPanel extends AbstractWsdlRequestDesktopPanel<WsdlRequest, WsdlRequest>
32  {
33  	private JButton addToTestCaseButton;
34  	private JButton addAsMockResponseStepToTestCaseButton;
35  
36  	public WsdlRequestDesktopPanel( WsdlRequest request )
37  	{
38  		super( request, request );
39  	}
40  
41  	@Override
42  	protected void init( WsdlRequest request )
43  	{
44  		addToTestCaseButton = createActionButton( SwingActionDelegate.createDelegate(
45  				AddRequestToTestCaseAction.SOAPUI_ACTION_ID, getRequest(), 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  }