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.x.impl.swing;
14:
15: import com.eviware.soapui.support.types.StringToStringMap;
16: import com.eviware.x.form.XFormDialog;
17:
18: public abstract class SwingXFormDialog implements XFormDialog {
19: private int returnValue;
20:
21: public int getReturnValue() {
22: return returnValue;
23: }
24:
25: public void setReturnValue(int returnValue) {
26: this .returnValue = returnValue;
27: }
28:
29: public StringToStringMap show(StringToStringMap values) {
30: setValues(values);
31: setVisible(true);
32: return getValues();
33: }
34:
35: public boolean getBooleanValue(String name) {
36: try {
37: return Boolean.parseBoolean(getValue(name));
38: } catch (NumberFormatException e) {
39: return false;
40: }
41: }
42:
43: public int getIntValue(String name, int defaultValue) {
44: try {
45: return Integer.parseInt(getValue(name));
46: } catch (NumberFormatException e) {
47: return defaultValue;
48: }
49: }
50:
51: public void setBooleanValue(String name, boolean b) {
52: setValue(name, Boolean.toString(b));
53: }
54:
55: public void setIntValue(String name, int value) {
56: setValue(name, Integer.toString(value));
57: }
58: }
|