01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.impl.comp.html.ui;
15:
16: import org.itsnat.comp.ItsNatButtonGroup;
17: import org.itsnat.comp.ItsNatButtonRadio;
18: import org.itsnat.comp.html.ItsNatHTMLInputRadio;
19: import org.itsnat.comp.ui.ItsNatButtonRadioUI;
20: import org.itsnat.impl.comp.html.ItsNatHTMLInputRadioImpl;
21: import org.itsnat.impl.core.domutil.ItsNatDOMUtilInternal;
22: import org.w3c.dom.html.HTMLInputElement;
23:
24: /**
25: *
26: * @author jmarranz
27: */
28: public class ItsNatHTMLInputRadioUIImpl extends
29: ItsNatHTMLInputButtonToggleUIImpl implements
30: ItsNatButtonRadioUI {
31: /** Creates a new instance of ItsNatHTMLInputRadioUIImpl */
32: public ItsNatHTMLInputRadioUIImpl(
33: ItsNatHTMLInputRadioImpl parentComp) {
34: super (parentComp);
35:
36: HTMLInputElement element = getHTMLInputElement();
37: ItsNatDOMUtilInternal.setAttribute(element, "type", "radio"); // para asegurarnos
38: }
39:
40: public void setItsNatButtonGroup(ItsNatButtonGroup buttonGroup) {
41: HTMLInputElement element = getHTMLInputElement();
42: if (buttonGroup != null)
43: element.setName(buttonGroup.getName()); // Pasa a formar parte del nuevo grupo (si ya tiene ese nombre pues no hace nada)
44: else
45: element.setName("");
46: }
47:
48: public ItsNatButtonRadio getItsNatButtonRadio() {
49: return (ItsNatButtonRadio) parentComp;
50: }
51:
52: public ItsNatHTMLInputRadio getItsNatHTMLInputRadio() {
53: return (ItsNatHTMLInputRadio) parentComp;
54: }
55: }
|