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.fromserv.domext;
15:
16: import org.itsnat.core.event.DOMExtensionEvent;
17: import org.itsnat.impl.core.ItsNatDocumentImpl;
18: import org.itsnat.impl.core.event.fromserv.ServerDOMBasedEventImpl;
19: import org.w3c.dom.DOMException;
20: import org.w3c.dom.events.Event;
21:
22: /**
23: *
24: * @author jmarranz
25: */
26: public abstract class ServerDOMExtensionEventImpl extends
27: ServerDOMBasedEventImpl implements DOMExtensionEvent {
28:
29: /** Creates a new instance of ServerDOMExtensionEventImpl */
30: public ServerDOMExtensionEventImpl(ItsNatDocumentImpl itsNatDoc) {
31: super (itsNatDoc);
32: }
33:
34: public static Event createDOMExtensionEvent(String eventGroup,
35: ItsNatDocumentImpl itsNatDoc) throws DOMException {
36: if (eventGroup.startsWith("itsnat:UserEvents")
37: || eventGroup.startsWith("itsnat:UserEvent"))
38: return new ServerUserEventImpl(itsNatDoc);
39: else if (eventGroup.startsWith("itsnat:ContinueEvents")
40: || eventGroup.startsWith("itsnat:ContinueEvent"))
41: return new ServerContinueEventImpl(itsNatDoc);
42: else
43: throw new DOMException(
44: DOMException.NOT_SUPPORTED_ERR,
45: "NOT_SUPPORTED_ERR: The implementation does not support the requested type of event.");
46: }
47:
48: public void initEvent(String eventTypeArg, boolean canBubbleArg,
49: boolean cancelableArg) {
50: super .initEvent(eventTypeArg, canBubbleArg, cancelableArg);
51:
52: if (canBubbleArg)
53: throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
54: "NOT_SUPPORTED_ERR: DOM extension events do not bubble.");
55: if (cancelableArg)
56: throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
57: "NOT_SUPPORTED_ERR: DOM extension events are not cancelable");
58: }
59: }
|