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.ui;
15:
16: import org.itsnat.comp.ItsNatButtonToggle;
17: import org.itsnat.core.ItsNatException;
18: import org.itsnat.comp.ui.ItsNatButtonToggleUI;
19: import org.itsnat.impl.comp.ItsNatElementComponentImpl;
20:
21: /**
22: *
23: * @author jmarranz
24: */
25: public abstract class ItsNatButtonToggleBasedUIImpl extends
26: ItsNatButtonBasedUIImpl implements ItsNatButtonToggleUI {
27:
28: /**
29: * Creates a new instance of ItsNatButtonToggleBasedUIImpl
30: */
31: public ItsNatButtonToggleBasedUIImpl(
32: ItsNatElementComponentImpl parentComp) {
33: super (parentComp);
34: }
35:
36: public abstract boolean domElementCanBeChecked();
37:
38: public abstract boolean isDOMElementChecked();
39:
40: public abstract void setDOMElementChecked(boolean b);
41:
42: public boolean isSelectedInDOM() {
43: if (domElementCanBeChecked()) // No delegamos porque está propiedad está en el DOM
44: return isDOMElementChecked();
45: else
46: throw new ItsNatException("Internal Error");
47: }
48:
49: public void setSelected(boolean b) {
50: if (domElementCanBeChecked())
51: setDOMElementChecked(b);
52: }
53:
54: public ItsNatButtonToggle getItsNatButtonToggle() {
55: return (ItsNatButtonToggle) parentComp;
56: }
57: }
|