From e8bbe1ce7295ef61311eb64ab431df198a24a0fd Mon Sep 17 00:00:00 2001 From: ishmal Date: Sun, 16 Mar 2008 21:37:50 +0000 Subject: [PATCH] jdk1.5, 1.6 dont seem to have Level 3 DOM Events. Let's provide the interfaces for now. --- .../java/org/w3c/dom/events/CustomEvent.java | 70 ++++++ .../org/w3c/dom/events/DocumentEvent.java | 86 +++++++ src/bind/java/org/w3c/dom/events/Event.java | 209 +++++++++++++++++ .../org/w3c/dom/events/EventException.java | 41 ++++ .../org/w3c/dom/events/EventListener.java | 40 ++++ .../java/org/w3c/dom/events/EventTarget.java | 202 ++++++++++++++++ .../org/w3c/dom/events/KeyboardEvent.java | 178 ++++++++++++++ .../java/org/w3c/dom/events/MouseEvent.java | 219 ++++++++++++++++++ .../org/w3c/dom/events/MutationEvent.java | 160 +++++++++++++ .../org/w3c/dom/events/MutationNameEvent.java | 104 +++++++++ .../java/org/w3c/dom/events/TextEvent.java | 81 +++++++ src/bind/java/org/w3c/dom/events/UIEvent.java | 82 +++++++ 12 files changed, 1472 insertions(+) create mode 100644 src/bind/java/org/w3c/dom/events/CustomEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/DocumentEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/Event.java create mode 100644 src/bind/java/org/w3c/dom/events/EventException.java create mode 100644 src/bind/java/org/w3c/dom/events/EventListener.java create mode 100644 src/bind/java/org/w3c/dom/events/EventTarget.java create mode 100644 src/bind/java/org/w3c/dom/events/KeyboardEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/MouseEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/MutationEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/MutationNameEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/TextEvent.java create mode 100644 src/bind/java/org/w3c/dom/events/UIEvent.java diff --git a/src/bind/java/org/w3c/dom/events/CustomEvent.java b/src/bind/java/org/w3c/dom/events/CustomEvent.java new file mode 100644 index 000000000..c7bdf0433 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/CustomEvent.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +/** + * The CustomEvent interface gives access to the attributes + * Event.currentTarget and Event.eventPhase. It is + * intended to be used by the DOM Events implementation to access the + * underlying current target and event phase while dispatching a custom + * Event in the tree; it is also intended to be implemented, + * and not used, by DOM applications. + *

The methods contained in this interface are not intended to be used by + * a DOM application, especially during the dispatch on the + * Event object. Changing the current target or the current + * phase may result in unpredictable results of the event flow. The DOM + * Events implementation should ensure that both methods return the + * appropriate current target and phase before invoking each event listener + * on the current target to protect DOM applications from malicious event + * listeners. + *

Note: If this interface is supported by the event object, + * Event.isCustom() must return true. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 3 + */ +public interface CustomEvent extends Event { + /** + * The setDispatchState method is used by the DOM Events + * implementation to set the values of Event.currentTarget + * and Event.eventPhase. It also reset the states of + * isPropagationStopped and + * isImmediatePropagationStopped. + * @param target Specifies the new value for the + * Event.currentTarget attribute. + * @param phase Specifies the new value for the + * Event.eventPhase attribute. + */ + public void setDispatchState(EventTarget target, + short phase); + + /** + * This method will return true if the method + * stopPropagation() has been called for this event, + * false in any other cases. + * @return true if the event propagation has been stopped + * in the current group. + */ + public boolean isPropagationStopped(); + + /** + * The isImmediatePropagationStopped method is used by the + * DOM Events implementation to know if the method + * stopImmediatePropagation() has been called for this + * event. It returns true if the method has been called, + * false otherwise. + * @return true if the event propagation has been stopped + * immediately in the current group. + */ + public boolean isImmediatePropagationStopped(); + +} diff --git a/src/bind/java/org/w3c/dom/events/DocumentEvent.java b/src/bind/java/org/w3c/dom/events/DocumentEvent.java new file mode 100644 index 000000000..8f50dd74b --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/DocumentEvent.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.DOMException; + +/** + * The DocumentEvent interface provides a mechanism by which the + * user can create an Event object of a type supported by the + * implementation. If the feature "Events" is supported by the + * Document object, the DocumentEvent interface + * must be implemented on the same object. If the feature "+Events" is + * supported by the Document object, an object that supports + * the DocumentEvent interface must be returned by invoking the + * method Node.getFeature("+Events", "3.0") on the + * Document object. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface DocumentEvent { + /** + * + * @param eventType The eventType parameter specifies the + * name of the DOM Events interface to be supported by the created + * event object, e.g. "Event", "MouseEvent", + * "MutationEvent" and so on. If the Event + * is to be dispatched via the EventTarget.dispatchEvent() + * method the appropriate event init method must be called after + * creation in order to initialize the Event's values. + * As an example, a user wishing to synthesize some kind of + * UIEvent would invoke + * DocumentEvent.createEvent("UIEvent"). The + * UIEvent.initUIEventNS() method could then be called on + * the newly created UIEvent object to set the specific + * type of user interface event to be dispatched, + * {"http://www.w3.org/2001/xml-events", "DOMActivate"} + * for example, and set its context information, e.g. + * UIEvent.detail in this example. The + * createEvent method is used in creating + * Events when it is either inconvenient or unnecessary + * for the user to create an Event themselves. In cases + * where the implementation provided Event is + * insufficient, users may supply their own Event + * implementations for use with the + * EventTarget.dispatchEvent() method. However, the DOM + * implementation needs access to the attributes + * Event.currentTarget and Event.eventPhase + * to appropriately propagate the event in the DOM tree. Therefore + * users' Event implementations might need to support the + * CustomEvent interface for that effect. + *

Note: For backward compatibility reason, "UIEvents", + * "MouseEvents", "MutationEvents", and "HTMLEvents" feature names are + * valid values for the parameter eventType and represent + * respectively the interfaces "UIEvent", "MouseEvent", + * "MutationEvent", and "Event". + * @return The newly created event object. + * @exception DOMException + * NOT_SUPPORTED_ERR: Raised if the implementation does not support the + * Event interface requested. + */ + public Event createEvent(String eventType) + throws DOMException; + + /** + * Test if the implementation can generate events of a specified type. + * @param namespaceURI Specifies the Event.namespaceURI of + * the event. + * @param type Specifies the Event.type of the event. + * @return true if the implementation can generate and + * dispatch this event type, false otherwise. + * @since DOM Level 3 + */ + public boolean canDispatch(String namespaceURI, + String type); + +} diff --git a/src/bind/java/org/w3c/dom/events/Event.java b/src/bind/java/org/w3c/dom/events/Event.java new file mode 100644 index 000000000..949931518 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/Event.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +/** + * The Event interface is used to provide contextual information + * about an event to the listener processing the event. An object which + * implements the Event interface is passed as the parameter to + * an EventListener. More specific context information is + * passed to event listeners by deriving additional interfaces from + * Event which contain information directly relating to the + * type of event they represent. These derived interfaces are also + * implemented by the object passed to the event listener. + *

To create an instance of the Event interface, use the + * DocumentEvent.createEvent("Event") method call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface Event { + // PhaseType + /** + * The current event phase is the capture phase. + */ + public static final short CAPTURING_PHASE = 1; + /** + * The current event is in the target phase, i.e. it is being evaluated + * at the event target. + */ + public static final short AT_TARGET = 2; + /** + * The current event phase is the bubbling phase. + */ + public static final short BUBBLING_PHASE = 3; + + /** + * The name should be an NCName as defined in [XML Namespaces] + * and is case-sensitive. + *
If the attribute Event.namespaceURI is different from + * null, this attribute represents a local name. + */ + public String getType(); + + /** + * Used to indicate the event target. This attribute contains the target + * node when used with the . + */ + public EventTarget getTarget(); + + /** + * Used to indicate the EventTarget whose + * EventListeners are currently being processed. This is + * particularly useful during the capture and bubbling phases. This + * attribute could contain the target node or a target ancestor when + * used with the . + */ + public EventTarget getCurrentTarget(); + + /** + * Used to indicate which phase of event flow is currently being + * accomplished. + */ + public short getEventPhase(); + + /** + * Used to indicate whether or not an event is a bubbling event. If the + * event can bubble the value is true, otherwise the value + * is false. + */ + public boolean getBubbles(); + + /** + * Used to indicate whether or not an event can have its default action + * prevented (see also ). If the default action can be prevented the + * value is true, otherwise the value is false + * . + */ + public boolean getCancelable(); + + /** + * Used to specify the time (in milliseconds relative to the epoch) at + * which the event was created. Due to the fact that some systems may + * not provide this information the value of timeStamp may + * be not available for all events. When not available, a value of + * 0 will be returned. Examples of epoch time are the time + * of the system start or 0:0:0 UTC 1st January 1970. + */ + public long getTimeStamp(); + + /** + * This method is used to prevent event listeners of the same group to be + * triggered but its effect is deferred until all event listeners + * attached on the currentTarget have been triggered (see + * ). Once it has been called, further calls to that method have no + * additional effect. + *

Note: This method does not prevent the default action from + * being invoked; use preventDefault for that effect. + */ + public void stopPropagation(); + + /** + * If an event is cancelable, the preventDefault method is + * used to signify that the event is to be canceled, meaning any default + * action normally taken by the implementation as a result of the event + * will not occur (see also ), and thus independently of event groups. + * Calling this method for a non-cancelable event has no effect. + *

Note: This method does not stop the event propagation; use + * stopPropagation or stopImmediatePropagation + * for that effect. + */ + public void preventDefault(); + + /** + * The initEvent method is used to initialize the value of + * an Event created through the + * DocumentEvent.createEvent method. This method may only + * be called before the Event has been dispatched via the + * EventTarget.dispatchEvent() method. If the method is + * called several times before invoking + * EventTarget.dispatchEvent, only the final invocation + * takes precedence. This method has no effect if called after the event + * has been dispatched. If called from a subclass of the + * Event interface only the values specified in this method + * are modified, all other attributes are left unchanged. + *
This method sets the Event.type attribute to + * eventTypeArg, and Event.namespaceURI to + * null. To initialize an event with a namespace URI, use + * the Event.initEventNS(namespaceURIArg, eventTypeArg, ...) + * method. + * @param eventTypeArg Specifies Event.type. + * @param canBubbleArg Specifies Event.bubbles. This + * parameter overrides the intrinsic bubbling behavior of the event. + * @param cancelableArg Specifies Event.cancelable. This + * parameter overrides the intrinsic cancelable behavior of the event. + */ + public void initEvent(String eventTypeArg, + boolean canBubbleArg, + boolean cancelableArg); + + /** + * The namespace URI associated with this event at creation time, or + * null if it is unspecified. + *
For events initialized with a DOM Level 2 Events method, such as + * Event.initEvent(), this is always null. + * @since DOM Level 3 + */ + public String getNamespaceURI(); + + /** + * This method will always return false, unless the event + * implements the CustomEvent interface. + * @return false, unless the event object implements the + * CustomEvent interface. + * @since DOM Level 3 + */ + public boolean isCustom(); + + /** + * This method is used to prevent event listeners of the same group to be + * triggered and, unlike stopPropagation its effect is + * immediate (see ). Once it has been called, further calls to that + * method have no additional effect. + *

Note: This method does not prevent the default action from + * being invoked; use Event.preventDefault() for that + * effect. + * @since DOM Level 3 + */ + public void stopImmediatePropagation(); + + /** + * This method will return true if the method + * Event.preventDefault() has been called for this event, + * false otherwise. + * @return true if Event.preventDefault() has + * been called for this event. + * @since DOM Level 3 + */ + public boolean isDefaultPrevented(); + + /** + * The initEventNS method is used to initialize the value of + * an Event object and has the same behavior as + * Event.initEvent(). + * @param namespaceURIArg Specifies Event.namespaceuRI, the + * namespace URI associated with this event, or null if + * no namespace. + * @param eventTypeArg Specifies Event.type, the local name + * of the event type. + * @param canBubbleArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @since DOM Level 3 + */ + public void initEventNS(String namespaceURIArg, + String eventTypeArg, + boolean canBubbleArg, + boolean cancelableArg); + +} diff --git a/src/bind/java/org/w3c/dom/events/EventException.java b/src/bind/java/org/w3c/dom/events/EventException.java new file mode 100644 index 000000000..51763b46b --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/EventException.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +/** + * Event operations may throw an EventException as specified in + * their method descriptions. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public class EventException extends RuntimeException { + public EventException(short code, String message) { + super(message); + this.code = code; + } + public short code; + // EventExceptionCode + /** + * If the Event.type was not specified by initializing the + * event before the method was called. Specification of the + * Event.type as null or an empty string will + * also trigger this exception. + */ + public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0; + /** + * If the Event object is already dispatched in the tree. + * @since DOM Level 3 + */ + public static final short DISPATCH_REQUEST_ERR = 1; + +} diff --git a/src/bind/java/org/w3c/dom/events/EventListener.java b/src/bind/java/org/w3c/dom/events/EventListener.java new file mode 100644 index 000000000..a5102b130 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/EventListener.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +/** + * The EventListener interface is the primary way for handling + * events. Users implement the EventListener interface and + * register their event listener on an EventTarget. The users + * should also remove their EventListener from its + * EventTarget after they have completed using the listener. + *

Copying a Node, with methods such as + * Node.cloneNode or Range.cloneContents, does not + * copy the event listeners attached to it. Event listeners must be attached + * to the newly created Node afterwards if so desired. + *

Moving a Node, with methods Document.adoptNode + * , Node.appendChild, or Range.extractContents, + * does not affect the event listeners attached to it. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface EventListener { + /** + * This method is called whenever an event occurs of the event type for + * which the EventListener interface was registered. + * @param evt The Event contains contextual information + * about the event. + */ + public void handleEvent(Event evt); + +} diff --git a/src/bind/java/org/w3c/dom/events/EventTarget.java b/src/bind/java/org/w3c/dom/events/EventTarget.java new file mode 100644 index 000000000..1be6edace --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/EventTarget.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +/** + * The EventTarget interface is implemented by all the objects + * which could be event targets in an implementation which supports the . + * The interface allows registration, removal or query of event listeners, + * and dispatch of events to an event target. + *

When used with , this interface is implemented by all target nodes and + * target ancestors, i.e. all DOM Nodes of the tree support + * this interface when the implementation conforms to DOM Level 3 Events + * and, therefore, this interface can be obtained by using binding-specific + * casting methods on an instance of the Node interface. + *

Invoking addEventListener or + * addEventListenerNS multiple times on the same + * EventTarget with the same parameters ( + * namespaceURI, type, listener, and + * useCapture) is considered to be a no-op and thus + * independently of the event group. They do not cause the + * EventListener to be called more than once and do not cause a + * change in the triggering order. In order to guarantee that an event + * listener will be added to the event target for the specified event group, + * one needs to invoke removeEventListener or + * removeEventListenerNS first. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface EventTarget { + /** + * This method allows the registration of an event listener in the + * default group and, depending on the useCapture + * parameter, on the capture phase of the DOM event flow or its target + * and bubbling phases. + * @param type Specifies the Event.type associated with the + * event for which the user is registering. + * @param listener The listener parameter takes an object + * implemented by the user which implements the + * EventListener interface and contains the method to be + * called when the event occurs. + * @param useCapture If true, useCapture indicates that the + * user wishes to add the event listener for the capture phase only, + * i.e. this event listener will not be triggered during the target + * and bubbling phases. If false, the event listener will + * only be triggered during the target and bubbling phases. + */ + public void addEventListener(String type, + EventListener listener, + boolean useCapture); + + /** + * This method allows the removal of event listeners from the default + * group. + *
Calling removeEventListener with arguments which do + * not identify any currently registered EventListener on + * the EventTarget has no effect. + * @param type Specifies the Event.type for which the user + * registered the event listener. + * @param listener The EventListener to be removed. + * @param useCapture Specifies whether the EventListener + * being removed was registered for the capture phase or not. If a + * listener was registered twice, once for the capture phase and once + * for the target and bubbling phases, each must be removed + * separately. Removal of an event listener registered for the capture + * phase does not affect the same event listener registered for the + * target and bubbling phases, and vice versa. + */ + public void removeEventListener(String type, + EventListener listener, + boolean useCapture); + + /** + * This method allows the dispatch of events into the implementation's + * event model. The event target of the event is the + * EventTarget object on which dispatchEvent + * is called. + * @param evt The event to be dispatched. + * @return Indicates whether any of the listeners which handled the + * event called Event.preventDefault(). If + * Event.preventDefault() was called the returned value + * is false, else it is true. + * @exception EventException + * UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event.type + * was not specified by initializing the event before + * dispatchEvent was called. Specification of the + * Event.type as null or an empty string + * will also trigger this exception. + *
DISPATCH_REQUEST_ERR: Raised if the Event object is + * already being dispatched in the tree. + *
NOT_SUPPORTED_ERR: Raised if the Event object has + * not been created using DocumentEvent.createEvent() or + * does not support the interface CustomEvent. + * @version DOM Level 3 + */ + public boolean dispatchEvent(Event evt) + throws EventException; + + /** + * This method allows the registration of an event listener in a + * specified group or the default group and, depending on the + * useCapture parameter, on the capture phase of the DOM + * event flow or its target and bubbling phases. + * @param namespaceURI Specifies the Event.namespaceURI + * associated with the event for which the user is registering. + * @param type Specifies the Event.type associated with the + * event for which the user is registering. + * @param listener The listener parameter takes an object + * implemented by the user which implements the + * EventListener interface and contains the method to be + * called when the event occurs. + * @param useCapture If true, useCapture indicates that the + * user wishes to add the event listener for the capture phase only, + * i.e. this event listener will not be triggered during the target + * and bubbling phases. If false, the event listener will + * only be triggered during the target and bubbling phases. + * @param evtGroup The object that represents the event group to + * associate with the EventListener (see also ). Use + * null to attach the event listener to the default + * group. + * @since DOM Level 3 + */ + public void addEventListenerNS(String namespaceURI, + String type, + EventListener listener, + boolean useCapture, + Object evtGroup); + + /** + * This method allows the removal of an event listener, independently of + * the associated event group. + *
Calling removeEventListenerNS with arguments which do + * not identify any currently registered EventListener on + * the EventTarget has no effect. + * @param namespaceURI Specifies the Event.namespaceURI + * associated with the event for which the user registered the event + * listener. + * @param type Specifies the Event.type associated with the + * event for which the user registered the event listener. + * @param listener The EventListener parameter indicates + * the EventListener to be removed. + * @param useCapture Specifies whether the EventListener + * being removed was registered for the capture phase or not. If a + * listener was registered twice, once for the capture phase and once + * for the target and bubbling phases, each must be removed + * separately. Removal of an event listener registered for the capture + * phase does not affect the same event listener registered for the + * target and bubbling phases, and vice versa. + * @since DOM Level 3 + */ + public void removeEventListenerNS(String namespaceURI, + String type, + EventListener listener, + boolean useCapture); + + /** + * This method allows the DOM application to know if an event listener, + * attached to this EventTarget or one of its ancestors, + * will be triggered by the specified event type during the dispatch of + * the event to this event target or one of its descendants. + * @param namespaceURI Specifies the Event.namespaceURI + * associated with the event. + * @param type Specifies the Event.type associated with the + * event. + * @return true if an event listener will be triggered on + * the EventTarget with the specified event type, + * false otherwise. + * @since DOM Level 3 + */ + public boolean willTriggerNS(String namespaceURI, + String type); + + /** + * This method allows the DOM application to know if this + * EventTarget contains an event listener registered for + * the specified event type. This is useful for determining at which + * nodes within a hierarchy altered handling of specific event types has + * been introduced, but should not be used to determine whether the + * specified event type triggers an event listener (see + * EventTarget.willTriggerNS()). + * @param namespaceURI Specifies the Event.namespaceURI + * associated with the event. + * @param type Specifies the Event.type associated with the + * event. + * @return true if an event listener is registered on this + * EventTarget for the specified event type, + * false otherwise. + * @since DOM Level 3 + */ + public boolean hasEventListenerNS(String namespaceURI, + String type); + +} diff --git a/src/bind/java/org/w3c/dom/events/KeyboardEvent.java b/src/bind/java/org/w3c/dom/events/KeyboardEvent.java new file mode 100644 index 000000000..e166f5f77 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/KeyboardEvent.java @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.views.AbstractView; + +/** + * The KeyboardEvent interface provides specific contextual + * information associated with keyboard devices. Each keyboard event + * references a key using an identifier. Keyboard events are commonly + * directed at the element that has the focus. + *

The KeyboardEvent interface provides convenient attributes + * for some common modifiers keys: KeyboardEvent.ctrlKey, + * KeyboardEvent.shiftKey, KeyboardEvent.altKey, + * KeyboardEvent.metaKey. These attributes are equivalent to + * use the method + * KeyboardEvent.getModifierState(keyIdentifierArg) with + * "Control", "Shift", "Alt", or "Meta" respectively. + *

To create an instance of the KeyboardEvent interface, use + * the DocumentEvent.createEvent("KeyboardEvent") method call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 3 + */ +public interface KeyboardEvent extends UIEvent { + // KeyLocationCode + /** + * The key activation is not distinguished as the left or right version + * of the key, and did not originate from the numeric keypad (or did not + * originate with a virtual key corresponding to the numeric keypad). + * Example: the 'Q' key on a PC 101 Key US keyboard. + */ + public static final int DOM_KEY_LOCATION_STANDARD = 0x00; + /** + * The key activated is in the left key location (there is more than one + * possible location for this key). Example: the left Shift key on a PC + * 101 Key US keyboard. + */ + public static final int DOM_KEY_LOCATION_LEFT = 0x01; + /** + * The key activation is in the right key location (there is more than + * one possible location for this key). Example: the right Shift key on + * a PC 101 Key US keyboard. + */ + public static final int DOM_KEY_LOCATION_RIGHT = 0x02; + /** + * The key activation originated on the numeric keypad or with a virtual + * key corresponding to the numeric keypad. Example: the '1' key on a PC + * 101 Key US keyboard located on the numeric pad. + */ + public static final int DOM_KEY_LOCATION_NUMPAD = 0x03; + + /** + * keyIdentifier holds the identifier of the key. The key + * identifiers are defined in Appendix A.2 "". Implementations that are + * unable to identify a key must use the key identifier + * "Unidentified". + */ + public String getKeyIdentifier(); + + /** + * The keyLocation attribute contains an indication of the + * location of they key on the device, as described in . + */ + public int getKeyLocation(); + + /** + * true if the control (Ctrl) key modifier is activated. + */ + public boolean getCtrlKey(); + + /** + * true if the shift (Shift) key modifier is activated. + */ + public boolean getShiftKey(); + + /** + * true if the alternative (Alt) key modifier is activated. + *

Note: The Option key modifier on Macintosh systems must be + * represented using this key modifier. + */ + public boolean getAltKey(); + + /** + * true if the meta (Meta) key modifier is activated. + *

Note: The Command key modifier on Macintosh systems must be + * represented using this key modifier. + */ + public boolean getMetaKey(); + + /** + * This methods queries the state of a modifier using a key identifier. + * See also . + * @param keyIdentifierArg A modifier key identifier. Common modifier + * keys are "Alt", "AltGraph", + * "CapsLock", "Control", "Meta" + * , "NumLock", "Scroll", or + * "Shift". + *

Note: If an application wishes to distinguish between + * right and left modifiers, this information could be deduced using + * keyboard events and KeyboardEvent.keyLocation. + * @return true if it is modifier key and the modifier is + * activated, false otherwise. + */ + public boolean getModifierState(String keyIdentifierArg); + + /** + * The initKeyboardEvent method is used to initialize the + * value of a KeyboardEvent object and has the same + * behavior as UIEvent.initUIEvent(). The value of + * UIEvent.detail remains undefined. + * @param typeArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param keyIdentifierArg Specifies + * KeyboardEvent.keyIdentifier. + * @param keyLocationArg Specifies KeyboardEvent.keyLocation + * . + * @param modifiersList A white space separated list of modifier key identifiers to be activated on this + * object. + */ + public void initKeyboardEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + String keyIdentifierArg, + int keyLocationArg, + String modifiersList); + + /** + * The initKeyboardEventNS method is used to initialize the + * value of a KeyboardEvent object and has the same + * behavior as UIEvent.initUIEventNS(). The value of + * UIEvent.detail remains undefined. + * @param namespaceURI Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param typeArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param keyIdentifierArg Refer to the + * KeyboardEvent.initKeyboardEvent() method for a + * description of this parameter. + * @param keyLocationArg Refer to the + * KeyboardEvent.initKeyboardEvent() method for a + * description of this parameter. + * @param modifiersList A white space separated list of modifier key identifiers to be activated on this + * object. As an example, "Control Alt" will activated + * the control and alt modifiers. + */ + public void initKeyboardEventNS(String namespaceURI, + String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + String keyIdentifierArg, + int keyLocationArg, + String modifiersList); + +} diff --git a/src/bind/java/org/w3c/dom/events/MouseEvent.java b/src/bind/java/org/w3c/dom/events/MouseEvent.java new file mode 100644 index 000000000..9877e8dbc --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/MouseEvent.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.views.AbstractView; + +/** + * The MouseEvent interface provides specific contextual + * information associated with Mouse events. + *

In the case of nested elements mouse events are always targeted at the + * most deeply nested element. Ancestors of the targeted element may use + * bubbling to obtain notification of mouse events which occur within theirs + * descendent elements. + *

To create an instance of the MouseEvent interface, use the + * DocumentEvent.createEvent("MouseEvent") method call. + *

Note: When initializing MouseEvent objects using + * initMouseEvent or initMouseEventNS, + * implementations should use the client coordinates clientX + * and clientY for calculation of other coordinates (such as + * target coordinates exposed by DOM Level 0 implementations). + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface MouseEvent extends UIEvent { + /** + * The horizontal coordinate at which the event occurred relative to the + * origin of the screen coordinate system. + */ + public int getScreenX(); + + /** + * The vertical coordinate at which the event occurred relative to the + * origin of the screen coordinate system. + */ + public int getScreenY(); + + /** + * The horizontal coordinate at which the event occurred relative to the + * DOM implementation's client area. + */ + public int getClientX(); + + /** + * The vertical coordinate at which the event occurred relative to the DOM + * implementation's client area. + */ + public int getClientY(); + + /** + * true if the control (Ctrl) key modifier is activated. + */ + public boolean getCtrlKey(); + + /** + * true if the shift (Shift) key modifier is activated. + */ + public boolean getShiftKey(); + + /** + * true if the alt (alternative) key modifier is activated. + *

Note: The Option key modifier on Macintosh systems must be + * represented using this key modifier. + */ + public boolean getAltKey(); + + /** + * true if the meta (Meta) key modifier is activated. + *

Note: The Command key modifier on Macintosh system must be + * represented using this meta key. + */ + public boolean getMetaKey(); + + /** + * During mouse events caused by the depression or release of a mouse + * button, button is used to indicate which mouse button + * changed state. 0 indicates the normal button of the + * mouse (in general on the left or the one button on Macintosh mice, + * used to activate a button or select text). 2 indicates + * the contextual property (in general on the right, used to display a + * context menu) button of the mouse if present. 1 + * indicates the extra (in general in the middle and often combined with + * the mouse wheel) button. Some mice may provide or simulate more + * buttons, and values higher than 2 can be used to + * represent such buttons. + */ + public short getButton(); + + /** + * Used to identify a secondary EventTarget related to a UI + * event. Currently this attribute is used with the mouseover event to + * indicate the EventTarget which the pointing device + * exited and with the mouseout event to indicate the + * EventTarget which the pointing device entered. + */ + public EventTarget getRelatedTarget(); + + /** + * The initMouseEvent method is used to initialize the value + * of a MouseEvent object and has the same behavior as + * UIEvent.initUIEvent(). + * @param typeArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param detailArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param screenXArg Specifies MouseEvent.screenX. + * @param screenYArg Specifies MouseEvent.screenY. + * @param clientXArg Specifies MouseEvent.clientX. + * @param clientYArg Specifies MouseEvent.clientY. + * @param ctrlKeyArg Specifies MouseEvent.ctrlKey. + * @param altKeyArg Specifies MouseEvent.altKey. + * @param shiftKeyArg Specifies MouseEvent.shiftKey. + * @param metaKeyArg Specifies MouseEvent.metaKey. + * @param buttonArg Specifies MouseEvent.button. + * @param relatedTargetArg Specifies + * MouseEvent.relatedTarget. + */ + public void initMouseEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + int detailArg, + int screenXArg, + int screenYArg, + int clientXArg, + int clientYArg, + boolean ctrlKeyArg, + boolean altKeyArg, + boolean shiftKeyArg, + boolean metaKeyArg, + short buttonArg, + EventTarget relatedTargetArg); + + /** + * This methods queries the state of a modifier using a key identifier. + * See also . + * @param keyIdentifierArg A modifier key identifier, as defined by the + * KeyboardEvent.keyIdentifier attribute. Common modifier + * keys are "Alt", "AltGraph", + * "CapsLock", "Control", "Meta" + * , "NumLock", "Scroll", or + * "Shift". + *

Note: If an application wishes to distinguish between + * right and left modifiers, this information could be deduced using + * keyboard events and KeyboardEvent.keyLocation. + * @return true if it is modifier key and the modifier is + * activated, false otherwise. + * @since DOM Level 3 + */ + public boolean getModifierState(String keyIdentifierArg); + + /** + * The initMouseEventNS method is used to initialize the + * value of a MouseEvent object and has the same behavior + * as UIEvent.initUIEventNS(). + * @param namespaceURI Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param typeArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param detailArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param screenXArg Refer to the + * MouseEvent.initMouseEvent() method for a description + * of this parameter. + * @param screenYArg Refer to the + * MouseEvent.initMouseEvent() method for a description + * of this parameter. + * @param clientXArg Refer to the + * MouseEvent.initMouseEvent() method for a description + * of this parameter. + * @param clientYArg Refer to the + * MouseEvent.initMouseEvent() method for a description + * of this parameter. + * @param buttonArg Refer to the MouseEvent.initMouseEvent() + * method for a description of this parameter. + * @param relatedTargetArg Refer to the + * MouseEvent.initMouseEvent() method for a description + * of this parameter. + * @param modifiersList A white space separated list of modifier key identifiers to be activated on this + * object. As an example, "Control Alt" will activated + * the control and alt modifiers. + * @since DOM Level 3 + */ + public void initMouseEventNS(String namespaceURI, + String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + int detailArg, + int screenXArg, + int screenYArg, + int clientXArg, + int clientYArg, + short buttonArg, + EventTarget relatedTargetArg, + String modifiersList); + +} diff --git a/src/bind/java/org/w3c/dom/events/MutationEvent.java b/src/bind/java/org/w3c/dom/events/MutationEvent.java new file mode 100644 index 000000000..12d8b2f6b --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/MutationEvent.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.Node; + +/** + * The MutationEvent interface provides specific contextual + * information associated with Mutation events. + *

To create an instance of the MutationEvent interface, use + * the DocumentEvent.createEvent("MutationEvent") method call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface MutationEvent extends Event { + // attrChangeType + /** + * The Attr was modified in place. + */ + public static final short MODIFICATION = 1; + /** + * The Attr was just added. + */ + public static final short ADDITION = 2; + /** + * The Attr was just removed. + */ + public static final short REMOVAL = 3; + + /** + * relatedNode is used to identify a secondary node related + * to a mutation event. For example, if a mutation event is dispatched + * to a node indicating that its parent has changed, the + * relatedNode is the changed parent. If an event is + * instead dispatched to a subtree indicating a node was changed within + * it, the relatedNode is the changed node. In the case of + * the + * {"http://www.w3.org/2001/xml-events", "DOMAttrModified"} + * event it indicates the Attr node which was modified, + * added, or removed. + */ + public Node getRelatedNode(); + + /** + * prevValue indicates the previous value of the + * Attr node in + * {"http://www.w3.org/2001/xml-events", "DOMAttrModified"} + * events, and of the CharacterData node in + * {"http://www.w3.org/2001/xml-events", "DOMCharacterDataModified"} + * events. + */ + public String getPrevValue(); + + /** + * newValue indicates the new value of the Attr + * node in + * {"http://www.w3.org/2001/xml-events", "DOMAttrModified"} + * events, and of the CharacterData node in + * {"http://www.w3.org/2001/xml-events", "DOMCharacterDataModified"} + * events. + */ + public String getNewValue(); + + /** + * attrName indicates the name of the changed + * Attr node in a + * {"http://www.w3.org/2001/xml-events", "DOMAttrModified"} + * event. + */ + public String getAttrName(); + + /** + * attrChange indicates the type of change which triggered + * the + * {"http://www.w3.org/2001/xml-events", "DOMAttrModified"} + * event. The values can be MODIFICATION, + * ADDITION, or REMOVAL. + */ + public short getAttrChange(); + + /** + * The initMutationEvent method is used to initialize the + * value of a MutationEvent object and has the same + * behavior as Event.initEvent(). + * @param typeArg Refer to the Event.initEvent() method for + * a description of this parameter. + * @param canBubbleArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @param relatedNodeArg Specifies MutationEvent.relatedNode + * . + * @param prevValueArg Specifies MutationEvent.prevValue. + * This value may be null. + * @param newValueArg Specifies MutationEvent.newValue. + * This value may be null. + * @param attrNameArg Specifies MutationEvent.attrname. + * This value may be null. + * @param attrChangeArg Specifies MutationEvent.attrChange. + * This value may be null. + */ + public void initMutationEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + Node relatedNodeArg, + String prevValueArg, + String newValueArg, + String attrNameArg, + short attrChangeArg); + + /** + * The initMutationEventNS method is used to initialize the + * value of a MutationEvent object and has the same + * behavior as Event.initEventNS(). + * @param namespaceURI Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param typeArg Refer to the Event.initEventNS() method + * for a description of this parameter. + * @param canBubbleArg Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param cancelableArg Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param relatedNodeArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param prevValueArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param newValueArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param attrNameArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param attrChangeArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @since DOM Level 3 + */ + public void initMutationEventNS(String namespaceURI, + String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + Node relatedNodeArg, + String prevValueArg, + String newValueArg, + String attrNameArg, + short attrChangeArg); + +} diff --git a/src/bind/java/org/w3c/dom/events/MutationNameEvent.java b/src/bind/java/org/w3c/dom/events/MutationNameEvent.java new file mode 100644 index 000000000..f5c217198 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/MutationNameEvent.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.Node; + +/** + * The MutationNameEvent interface provides specific contextual + * information associated with Mutation name event types. + *

To create an instance of the MutationNameEvent interface, + * use the Document.createEvent("MutationNameEvent") method + * call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 3 + */ +public interface MutationNameEvent extends MutationEvent { + /** + * The previous value of the relatedNode's + * namespaceURI. + */ + public String getPrevNamespaceURI(); + + /** + * The previous value of the relatedNode's + * nodeName. + */ + public String getPrevNodeName(); + + /** + * The initMutationNameEvent method is used to initialize + * the value of a MutationNameEvent object and has the same + * behavior as MutationEvent.initMutationEvent(). + * @param typeArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param canBubbleArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param cancelableArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param relatedNodeArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param prevNamespaceURIArg Specifies + * MutationNameEvent.prevNamespaceURI. This value may be + * null. + * @param prevNodeNameArg Specifies + * MutationNameEvent.prevNodeName. + * @since DOM Level 3 + */ + public void initMutationNameEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + Node relatedNodeArg, + String prevNamespaceURIArg, + String prevNodeNameArg); + + /** + * The initMutationNameEventNS method is used to initialize + * the value of a MutationNameEvent object and has the same + * behavior as MutationEvent.initMutationEventNS(). + * @param namespaceURI Refer to the + * MutationEvent.initMutationEventNS() method for a + * description of this parameter. + * @param typeArg Refer to the + * MutationEvent.initMutationEventNS() method for a + * description of this parameter. + * @param canBubbleArg Refer to the + * MutationEvent.initMutationEventNS() method for a + * description of this parameter. + * @param cancelableArg Refer to the + * MutationEvent.initMutationEventNS() method for a + * description of this parameter. + * @param relatedNodeArg Refer to the + * MutationEvent.initMutationEventNS() method for a + * description of this parameter. + * @param prevNamespaceURIArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @param prevNodeNameArg Refer to the + * MutationEvent.initMutationEvent() method for a + * description of this parameter. + * @since DOM Level 3 + */ + public void initMutationNameEventNS(String namespaceURI, + String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + Node relatedNodeArg, + String prevNamespaceURIArg, + String prevNodeNameArg); + +} diff --git a/src/bind/java/org/w3c/dom/events/TextEvent.java b/src/bind/java/org/w3c/dom/events/TextEvent.java new file mode 100644 index 000000000..4ba5f5abf --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/TextEvent.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.views.AbstractView; + +/** + * The TextEvent interface provides specific contextual + * information associated with Text Events. + *

To create an instance of the TextEvent interface, use the + * DocumentEvent.createEvent("TextEvent") method call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 3 + */ +public interface TextEvent extends UIEvent { + /** + * data holds the value of the characters generated by the + * character device. This may be a single Unicode character or a + * non-empty sequence of Unicode characters [Unicode]. Characters should be normalized as defined by the Unicode + * normalization form NFC, defined in [UTR #15]. This + * attribute cannot be null or contain the empty string. + */ + public String getData(); + + /** + * The initTextEvent method is used to initialize the value + * of a TextEvent object and has the same behavior as + * UIEvent.initUIEvent(). The value of + * UIEvent.detail remains undefined. + * @param typeArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param dataArg Specifies TextEvent.data. + */ + public void initTextEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + String dataArg); + + /** + * The initTextEventNS method is used to initialize the + * value of a TextEvent object and has the same behavior as + * UIEvent.initUIEventNS(). The value of + * UIEvent.detail remains undefined. + * @param namespaceURI Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param type Refer to the UIEvent.initUIEventNS() method + * for a description of this parameter. + * @param canBubbleArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param cancelableArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEventNS() + * method for a description of this parameter. + * @param dataArg Refer to the TextEvent.initTextEvent() + * method for a description of this parameter. + */ + public void initTextEventNS(String namespaceURI, + String type, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + String dataArg); + +} diff --git a/src/bind/java/org/w3c/dom/events/UIEvent.java b/src/bind/java/org/w3c/dom/events/UIEvent.java new file mode 100644 index 000000000..e4a819c73 --- /dev/null +++ b/src/bind/java/org/w3c/dom/events/UIEvent.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2003 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.events; + +import org.w3c.dom.views.AbstractView; + +/** + * The UIEvent interface provides specific contextual + * information associated with User Interface events. + *

To create an instance of the UIEvent interface, use the + * DocumentEvent.createEvent("UIEvent") method call. + *

See also the Document Object Model (DOM) Level 3 Events Specification. + * @since DOM Level 2 + */ +public interface UIEvent extends Event { + /** + * The view attribute identifies the AbstractView + * from which the event was generated. + */ + public AbstractView getView(); + + /** + * Specifies some detail information about the Event, + * depending on the type of event. + */ + public int getDetail(); + + /** + * The initUIEvent method is used to initialize the value of + * a UIEvent object and has the same behavior as + * Event.initEvent(). + * @param typeArg Refer to the Event.initEvent() method for + * a description of this parameter. + * @param canBubbleArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @param cancelableArg Refer to the Event.initEvent() + * method for a description of this parameter. + * @param viewArg Specifies UIEvent.view. + * @param detailArg Specifies UIEvent.detail. + */ + public void initUIEvent(String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + int detailArg); + + /** + * The initUIEventNS method is used to initialize the value + * of a UIEvent object and has the same behavior as + * Event.initEventNS(). + * @param namespaceURI Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param typeArg Refer to the Event.initEventNS() method + * for a description of this parameter. + * @param canBubbleArg Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param cancelableArg Refer to the Event.initEventNS() + * method for a description of this parameter. + * @param viewArg Refer to the UIEvent.initUIEvent() method + * for a description of this parameter. + * @param detailArg Refer to the UIEvent.initUIEvent() + * method for a description of this parameter. + * @since DOM Level 3 + */ + public void initUIEventNS(String namespaceURI, + String typeArg, + boolean canBubbleArg, + boolean cancelableArg, + AbstractView viewArg, + int detailArg); + +} -- 2.30.2