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.rest.panels.request;
14  
15  import javax.swing.JButton;
16  
17  import com.eviware.soapui.impl.rest.RestRequest;
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 AbstractRestRequestDesktopPanel<RestRequest, RestRequest> 
24  {
25  	private JButton addToTestCaseButton;
26  	
27  	public RestRequestDesktopPanel(RestRequest modelItem)
28  	{
29  		super(modelItem, modelItem);
30  	}
31  
32  	@Override
33  	protected void init(RestRequest request)
34  	{
35  		addToTestCaseButton = createActionButton(
36  				SwingActionDelegate.createDelegate( AddRestRequestToTestCaseAction.SOAPUI_ACTION_ID, getRequest(), 
37  							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  
48  	public void setEnabled(boolean enabled)
49  	{
50  		super.setEnabled(enabled);
51  		addToTestCaseButton.setEnabled(enabled);
52  	}
53  
54  	protected void insertButtons(JXToolBar toolbar)
55  	{
56  		toolbar.add(addToTestCaseButton);
57  	}
58  }