01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.wsdl.actions.mockservice;
14:
15: import com.eviware.soapui.impl.wsdl.mock.WsdlMockService;
16: import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
17: import com.eviware.x.form.XFormDialog;
18: import com.eviware.x.form.support.ADialogBuilder;
19: import com.eviware.x.form.support.AField;
20: import com.eviware.x.form.support.AForm;
21: import com.eviware.x.form.support.AField.AFieldType;
22:
23: /**
24: * Displays the options for the specified WsdlMockService
25: *
26: * @author ole.matzura
27: */
28:
29: public class MockServiceOptionsAction extends
30: AbstractSoapUIAction<WsdlMockService> {
31: private XFormDialog dialog;
32:
33: public MockServiceOptionsAction() {
34: super ("Options", "Sets options for this MockService");
35: }
36:
37: public void perform(WsdlMockService mockService, Object param) {
38: if (dialog == null)
39: dialog = ADialogBuilder.buildDialog(OptionsForm.class);
40:
41: dialog.setValue(OptionsForm.PATH, mockService.getPath());
42: dialog.setIntValue(OptionsForm.PORT, mockService.getPort());
43:
44: boolean enabled = mockService.getMockRunner() == null;
45:
46: dialog.getFormField(OptionsForm.PATH).setEnabled(enabled);
47: dialog.getFormField(OptionsForm.PORT).setEnabled(enabled);
48:
49: if (dialog.show()) {
50: mockService.setPath(dialog.getValue(OptionsForm.PATH));
51: mockService.setPort(dialog.getIntValue(OptionsForm.PORT,
52: mockService.getPort()));
53: }
54: }
55:
56: @AForm(name="MockService Options",description="Set options for this MockService")
57: private class OptionsForm {
58: @AField(name="Path",description="The path this MockService will mount on")
59: public final static String PATH = "Path";
60:
61: @AField(name="Port",description="The port this MockService will mount on",type=AFieldType.INT)
62: public final static String PORT = "Port";
63: }
64: }
|