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.support.editor.registry;
14  
15  import com.eviware.soapui.model.ModelItem;
16  import com.eviware.soapui.support.editor.Editor;
17  import com.eviware.soapui.support.editor.EditorDocument;
18  import com.eviware.soapui.support.editor.EditorInspector;
19  import com.eviware.soapui.support.editor.EditorView;
20  
21  /***
22   * XmlEditor for the request of a WsdlRequest
23   * 
24   * @author ole.matzura
25   */
26  
27  public class RequestMessageEditor<T1 extends EditorDocument, T2 extends ModelItem> extends Editor<T1>
28  {
29  	private final T2 modelItem;
30  
31  	@SuppressWarnings( "unchecked" )
32  	public RequestMessageEditor( T1 xmlDocument, T2 modelItem )
33  	{
34  		super( xmlDocument );
35  		this.modelItem = modelItem;
36  
37  		EditorViewFactory[] editorFactories = EditorViewFactoryRegistry.getInstance().getFactoriesOfType(
38  				RequestEditorViewFactory.class );
39  
40  		for( EditorViewFactory factory : editorFactories )
41  		{
42  			RequestEditorViewFactory f = ( RequestEditorViewFactory )factory;
43  			EditorView<T1> editorView = ( EditorView<T1> )f.createRequestEditorView( this, modelItem );
44  			if( editorView != null )
45  				addEditorView( editorView );
46  		}
47  
48  		InspectorFactory[] inspectorFactories = InspectorRegistry.getInstance().getFactoriesOfType(
49  				RequestInspectorFactory.class );
50  
51  		for( InspectorFactory factory : inspectorFactories )
52  		{
53  			RequestInspectorFactory f = ( RequestInspectorFactory )factory;
54  			EditorInspector<T1> inspector = ( EditorInspector<T1> )f.createRequestInspector( this, modelItem );
55  			if( inspector != null )
56  				addInspector( inspector );
57  		}
58  	}
59  
60  	public T2 getModelItem()
61  	{
62  		return modelItem;
63  	}
64  }