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.views.param;
14  
15  import com.eviware.soapui.impl.rest.RestRequest;
16  import com.eviware.soapui.impl.rest.panels.request.AbstractRestRequestDesktopPanel.RestRequestDocument;
17  import com.eviware.soapui.impl.rest.panels.request.AbstractRestRequestDesktopPanel.RestRequestMessageEditor;
18  import com.eviware.soapui.impl.rest.panels.resource.RestParamsTable;
19  import com.eviware.soapui.support.editor.views.AbstractXmlEditorView;
20  
21  import javax.swing.*;
22  
23  public class RestRequestParamsView extends AbstractXmlEditorView<RestRequestDocument>
24  {
25  	private final RestRequest restRequest;
26  	private RestParamsTable table;
27  
28  	public RestRequestParamsView(RestRequestMessageEditor restRequestMessageEditor, RestRequest restRequest)
29  	{
30  		super( "Params", restRequestMessageEditor, RestRequestParamsViewFactory.VIEW_ID );
31  		this.restRequest = restRequest;
32  	}
33  
34  	@Override
35  	public void setXml(String xml)
36  	{
37  	}
38  
39  	public boolean saveDocument(boolean validate)
40  	{
41  		return false;
42  	}
43  
44  	public JComponent getComponent()
45  	{
46  		if( table == null )
47  		{
48  			table = new RestParamsTable( restRequest.getParams(), true );
49  		}
50  		
51  		return table;
52  	}
53  
54  	@Override
55  	public void requestFocus()
56  	{
57  		table.requestFocusInWindow();
58  	}
59  
60  	public void setEditable(boolean enabled)
61  	{
62  	}
63  }