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.core.event.client2serv.dom.msie;
15:
16: import org.itsnat.core.ItsNatException;
17: import org.itsnat.impl.core.ItsNatServletRequestImpl;
18: import org.itsnat.impl.core.event.client2serv.dom.DOMEventImpl;
19: import org.itsnat.impl.core.listener.dom.DOMEventListenerWrapperImpl;
20: import org.itsnat.impl.core.event.client2serv.dom.DOMEventTypeInfo;
21: import org.itsnat.impl.core.event.client2serv.dom.NodeContainer;
22: import org.w3c.dom.events.Event;
23: import org.w3c.dom.events.EventTarget;
24:
25: /**
26: * Es un intento de ver de forma estándar el evento del Internet Explorer
27: *
28: http://en.wikipedia.org/wiki/DOM_Events
29: http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28DOM%29#Events
30: http://www-128.ibm.com/developerworks/web/library/wa-ie2mozgd/#event_differences
31: http://linuxalpha1.eicn.ch/OReilly_books/books/webprog/jscript/ch19_03.htm
32:
33: http://www.w3.org/TR/DOM-Level-3-Events/events.html precisa más cosas que DOM-2
34:
35: * @author jmarranz
36: */
37: public class MSIEEventImpl extends DOMEventImpl {
38: protected MSIEOriginalEventImpl originalEvt;
39: protected DOMEventTypeInfo eventTypeInfo = null;
40:
41: protected long timeStamp = System.currentTimeMillis();
42:
43: /**
44: * Creates a new instance of MSIEEventImpl
45: */
46: public MSIEEventImpl(DOMEventListenerWrapperImpl listenerWrapper,
47: ItsNatServletRequestImpl request) {
48: super (listenerWrapper, request);
49: }
50:
51: public MSIEOriginalEventImpl getMSIEOriginalEvent() {
52: return originalEvt;
53: }
54:
55: public void setMSIEOriginalEvent(MSIEOriginalEventImpl originalEvt) {
56: this .originalEvt = originalEvt;
57:
58: this .stopPropagation = originalEvt.getCancelBubble(); // valor inicial
59: this .preventDefault = !originalEvt.getReturnValue(); // Valor inicial, si returnValue es false es que prevent default es true
60: }
61:
62: public DOMEventTypeInfo getEventTypeInfo() {
63: if (eventTypeInfo == null)
64: this .eventTypeInfo = DOMEventTypeInfo
65: .getEventTypeInfo(getType());
66: return eventTypeInfo;
67: }
68:
69: public void initEvent(String eventTypeArg, boolean canBubbleArg,
70: boolean cancelableArg) {
71: throw new ItsNatException("Not implemented");
72: }
73:
74: public EventTarget getTarget() {
75: if (target == null)
76: this .target = new NodeContainer(originalEvt.getSrcElement());
77: return (EventTarget) target.get();
78: }
79:
80: public String getType() {
81: return originalEvt.getType();
82: }
83:
84: public short getEventPhase() {
85: return Event.AT_TARGET;
86: }
87:
88: public boolean getBubbles() {
89: return getEventTypeInfo().getBubbles();
90: }
91:
92: public boolean getCancelable() {
93: return getEventTypeInfo().getCancelable();
94: }
95:
96: public long getTimeStamp() {
97: return timeStamp;
98: }
99: }
|