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.free;
15:
16: import org.itsnat.comp.ui.ItsNatButtonUI;
17: import javax.swing.ButtonModel;
18: import javax.swing.event.ChangeEvent;
19: import org.itsnat.core.ItsNatException;
20: import org.itsnat.core.event.ParamTransport;
21: import org.itsnat.core.NameValue;
22: import org.itsnat.impl.comp.*;
23: import org.w3c.dom.Element;
24: import org.w3c.dom.Node;
25: import org.w3c.dom.events.Event;
26:
27: /**
28: *
29: * @author jmarranz
30: */
31: public abstract class ItsNatFreeButtonImpl extends
32: ItsNatFreeElementComponentImpl implements ItsNatButtonInternal {
33:
34: /**
35: * Creates a new instance of ItsNatFreeButtonImpl
36: */
37: public ItsNatFreeButtonImpl(Element element, NameValue[] artifacts,
38: ItsNatComponentManagerImpl componentMgr) {
39: super (element, artifacts, componentMgr);
40: }
41:
42: public Class getStructureClass() {
43: return null;
44: }
45:
46: public Object createDefaultStructure() {
47: return null;
48: }
49:
50: public void enableEventListeners() {
51: enableEventListener("click"); // Por defecto se procesa, pues es lo importante
52: }
53:
54: public ItsNatButtonUI getItsNatButtonUI() {
55: return (ItsNatButtonUI) compUI;
56: }
57:
58: public void bindDataModel() {
59: ItsNatButtonBasedSharedImpl.bindDataModel(this );
60: }
61:
62: public void unbindDataModel() {
63: ItsNatButtonBasedSharedImpl.unbindDataModel(this );
64: }
65:
66: public void syncUIWithDataModel() {
67: ItsNatButtonBasedSharedImpl.syncUIWithDataModel(this );
68: }
69:
70: public void stateChanged(ChangeEvent e) {
71: ItsNatButtonBasedSharedImpl.stateChanged(this , e);
72: }
73:
74: public ButtonModel getButtonModel() {
75: return (ButtonModel) dataModel;
76: }
77:
78: public void setButtonModel(ButtonModel dataModel) {
79: setDataModel(dataModel);
80: }
81:
82: public boolean isEnabled() {
83: return getButtonModel().isEnabled();
84: }
85:
86: public void setEnabled(boolean b) {
87: getButtonModel().setEnabled(b);
88: }
89:
90: public void processDOMEvent(Event evt) {
91: // Evento click al menos
92: if (!ItsNatButtonBasedSharedImpl.handleEvent(getButtonModel(),
93: evt))
94: return;
95:
96: super.processDOMEvent(evt);
97: }
98: }
|