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.rest.panels.request;
14  
15  import javax.swing.JButton;
16  
17  import com.eviware.soapui.impl.rest.RestRequestInterface;
18  import com.eviware.soapui.impl.rest.actions.request.AddRestRequestToTestCaseAction;
19  import com.eviware.soapui.impl.wsdl.support.HelpUrls;
20  import com.eviware.soapui.support.action.swing.SwingActionDelegate;
21  import com.eviware.soapui.support.components.JXToolBar;
22  
23  public class RestRequestDesktopPanel extends
24  		AbstractRestRequestDesktopPanel<RestRequestInterface, RestRequestInterface>
25  {
26  	private JButton addToTestCaseButton;
27  
28  	public RestRequestDesktopPanel( RestRequestInterface modelItem )
29  	{
30  		super( modelItem, modelItem );
31  	}
32  
33  	@Override
34  	protected void init( RestRequestInterface request )
35  	{
36  		addToTestCaseButton = createActionButton( SwingActionDelegate.createDelegate(
37  				AddRestRequestToTestCaseAction.SOAPUI_ACTION_ID, getRequest(), null, "/addToTestCase.gif" ), true );
38  
39  		super.init( request );
40  	}
41  
42  	protected String getHelpUrl()
43  	{
44  		return HelpUrls.RESTREQUESTEDITOR_HELP_URL;
45  	}
46  
47  	public void setEnabled( boolean enabled )
48  	{
49  		super.setEnabled( enabled );
50  		addToTestCaseButton.setEnabled( enabled );
51  	}
52  
53  	protected void insertButtons( JXToolBar toolbar )
54  	{
55  		toolbar.add( addToTestCaseButton );
56  	}
57  }