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.support.editor.inspectors.wsa;
14  
15  import java.awt.event.ItemEvent;
16  import java.awt.event.ItemListener;
17  import java.beans.PropertyChangeEvent;
18  import java.beans.PropertyChangeListener;
19  
20  import javax.swing.JCheckBox;
21  import javax.swing.JTextField;
22  
23  import com.eviware.soapui.config.MustUnderstandTypeConfig;
24  import com.eviware.soapui.config.WsaVersionTypeConfig;
25  import com.eviware.soapui.impl.wsdl.WsdlRequest;
26  import com.eviware.soapui.support.components.SimpleBindingForm;
27  import com.eviware.soapui.support.editor.xml.XmlInspector;
28  
29  public class WsdlRequestWsaInspector extends AbstractWsaInspector implements XmlInspector, PropertyChangeListener
30  {
31  	private final WsdlRequest request;
32  	private JCheckBox generateMessageIdCheckBox;
33  	private JCheckBox addDefaultToCheckBox;
34  	private JCheckBox addDefaultActionCheckBox;
35  	private JTextField messageIdTextField;
36  	private JTextField toTextField;
37  	private JTextField actionTextField;
38  
39  	public WsdlRequestWsaInspector( WsdlRequest request )
40  	{
41  		super( request );
42  		this.request = request;
43  	}
44  
45  	public void propertyChange(PropertyChangeEvent arg0)
46  	{
47  	}
48  
49  	public void buildContent(SimpleBindingForm form)
50  	{
51  		form.addSpace( 5 );
52  		form.appendCheckBox("wsaEnabled", "Enable WS-A addressing", "Enable/Disable WS-A addressing");
53  		form.addSpace( 5 );
54  		//add mustUnderstand drop down list
55  		form.appendComboBox( "mustUnderstand", "Must understand", new String[] {MustUnderstandTypeConfig.NONE.toString(), 
56  				MustUnderstandTypeConfig.TRUE.toString(), MustUnderstandTypeConfig.FALSE.toString()},
57  			"The  property for controlling use of the mustUnderstand attribute" );
58  		
59  		form.appendComboBox( "version", "WS-A Version", new String[] {WsaVersionTypeConfig.X_200508.toString(), WsaVersionTypeConfig.X_200408.toString()},
60  			"The  property for managing WS-A version" );
61  		
62  		addDefaultActionCheckBox = form.appendCheckBox("addDefaultAction", "Add default wsa:Action", "Add default wsa:Action");
63  		actionTextField = form.appendTextField(  "action", "Action", "The action related to a message, will be generated if left empty and ws-a settings 'use default action...' checked " );
64  		actionTextField.setEnabled(!addDefaultActionCheckBox.isSelected());
65  		addDefaultActionCheckBox.addItemListener(new ItemListener() {
66  
67  		public void itemStateChanged(ItemEvent arg0)
68  		{
69  			actionTextField.setEnabled(!addDefaultActionCheckBox.isSelected());
70  		}});
71  		
72  		
73  		addDefaultToCheckBox = form.appendCheckBox("addDefaultTo", "Add default wsa:To", "Add default wsa:To");
74  		toTextField = form.appendTextField( "to", "To", "The destination endpoint reference, will be generated if left empty" );
75  		toTextField.setEnabled(!addDefaultToCheckBox.isSelected());
76  		addDefaultToCheckBox.addItemListener(new ItemListener() {
77  
78  		public void itemStateChanged(ItemEvent arg0)
79  		{
80  			toTextField.setEnabled(!addDefaultToCheckBox.isSelected());
81  		}});
82  		
83  		form.appendTextField( "replyTo", "Reply to", "The reply endpoint reference, will be generated if left empty" );
84  		form.appendTextArea("replyToRefParams", "ReplyTo Reference Parameters","ReplyTo Reference Parameters, content will be inserted as an xml (not text)");
85  		generateMessageIdCheckBox = form.appendCheckBox("generateMessageId", "Generate MessageID", "Randomly generate MessageId");
86  		messageIdTextField = form.appendTextField( "messageID", "MessageID", " The ID of a message that can be used to uniquely identify a message, will be generated if left empty and ws-a settings 'generate message id' checked " );
87  		messageIdTextField.setEnabled(!generateMessageIdCheckBox.isSelected());
88  		generateMessageIdCheckBox.addItemListener(new ItemListener() {
89  
90  		public void itemStateChanged(ItemEvent arg0)
91  		{
92  			messageIdTextField.setEnabled(!generateMessageIdCheckBox.isSelected());
93  		}});
94  		form.addSpace( 10 );
95  		form.appendTextField( "from", "From", "The source endpoint reference" );
96  		form.appendTextField( "faultTo", "Fault to", "The fault endpoint reference" );
97  		form.appendTextArea("faultToRefParams", "FaultTo Reference Parameters","FaultTo Reference Parameters, content will be inserted as an xml (not text)");
98  		form.appendTextField( "relatesTo", "Relates to", "The endpoint reference request relates to" );
99  		form.appendTextField( "relationshipType", "Relationship type", "Relationship type" );
100 		form.addSpace( 5 );
101 	}
102 }