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.ItsNatListMultSel;
17: import org.itsnat.comp.html.ItsNatHTMLSelectMult;
18: import org.itsnat.comp.ui.ItsNatListMultSelUI;
19: import org.itsnat.impl.comp.html.ItsNatHTMLSelectMultImpl;
20: import org.itsnat.impl.core.domutil.ItsNatDOMUtilInternal;
21: import org.w3c.dom.html.HTMLOptionElement;
22:
23: /**
24: *
25: * @author jmarranz
26: */
27: public class ItsNatHTMLSelectMultUIImpl extends ItsNatHTMLSelectUIImpl
28: implements ItsNatListMultSelUI {
29: /**
30: * Creates a new instance of ItsNatHTMLSelectMultUIImpl
31: */
32: public ItsNatHTMLSelectMultUIImpl(
33: ItsNatHTMLSelectMultImpl parentComp) {
34: super (parentComp);
35: }
36:
37: public ItsNatHTMLSelectMult getItsNatHTMLSelectMult() {
38: return (ItsNatHTMLSelectMult) parentComp;
39: }
40:
41: public ItsNatHTMLSelectMultImpl getItsNatHTMLSelectMultImpl() {
42: return (ItsNatHTMLSelectMultImpl) parentComp;
43: }
44:
45: public void setSelectedIndex(int index, boolean selected) {
46: HTMLOptionElement option = getHTMLOptionElementAt(index);
47:
48: if (option.getSelected() != selected) // Es porque genera un mutation event aunque no cambie (para evitarlo)
49: {
50: ItsNatDOMUtilInternal.setAttribute(option, "selected",
51: selected);
52: // option.setSelected(selected); no está definida en versiones de Xerces antiguas (ej. 2.6.2)
53: }
54: }
55:
56: public ItsNatListMultSel getItsNatListMultSel() {
57: return (ItsNatListMultSel) parentComp;
58: }
59:
60: }
|