01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.widgets.form;
10:
11: import com.google.gwt.core.client.JavaScriptObject;
12: import com.gwtext.client.widgets.form.event.CheckboxListener;
13:
14: /**
15: * Single radio field. Radio grouping is handled automatically by the browser if you give each radio in a group the same name.
16: *
17: */
18: public class Radio extends Checkbox {
19:
20: private static JavaScriptObject configPrototype;
21:
22: static {
23: init();
24: }
25:
26: private static native void init()/*-{
27: var c = new $wnd.Ext.form.Radio();
28: @com.gwtext.client.widgets.form.Radio::configPrototype = c.initialConfig;
29: }-*/;
30:
31: protected JavaScriptObject getConfigPrototype() {
32: return configPrototype;
33: }
34:
35: public String getXType() {
36: return "radio";
37: }
38:
39: public Radio() {
40: }
41:
42: public Radio(String label) {
43: super (label);
44: }
45:
46: public Radio(String fieldLabel, String name) {
47: super (fieldLabel, name);
48: }
49:
50: public Radio(String label, CheckboxListener listener) {
51: super (label, listener);
52: }
53:
54: public Radio(JavaScriptObject jsObj) {
55: super (jsObj);
56: }
57:
58: protected native JavaScriptObject create(JavaScriptObject config)/*-{
59: return new $wnd.Ext.form.Radio(config);
60: }-*/;
61:
62: /**
63: * If this radio is part of a group, it will return the selected value.
64: *
65: * @return the group value
66: */
67: public native String getGroupValue() /*-{
68: var rb = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
69: return rb.getGroupValue();
70: }-*/;
71: }
|