23 August 2001

Appendix C: Java Language Binding

This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Events.

The Java files are also available as http://www.w3.org/TR/2001/WD-DOM-Level-3-Events-20010823/java-binding.zip


package org.w3c.dom.events;

public class EventException extends RuntimeException {
    public EventException(short code, String message) {
       this.code = code;
    public short   code;
    // EventExceptionCode
    public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;



package org.w3c.dom.events;

public interface EventTarget {
    public void addEventListener(String type, 
                                 EventListener listener, 
                                 boolean useCapture);

    public void removeEventListener(String type, 
                                    EventListener listener, 
                                    boolean useCapture);

    public boolean dispatchEvent(Event evt)
                                 throws EventException;

    public EventListenerList getEventListeners();



package org.w3c.dom.events;

public interface EventListener {
    public void handleEvent(Event evt);



package org.w3c.dom.events;

public interface EventListenerList {
    public EventListener item(int index);

    public int getLength();



package org.w3c.dom.events;

public interface EventGroup {
    public boolean isSameEventGroup(EventGroup other);



package org.w3c.dom.events;

public interface EventTargetGroup {
    public void addEventListener(String type, 
                                 EventListener listener, 
                                 boolean useCapture, 
                                 EventGroup evtGroup);

    public void removeEventListener(String type, 
                                    EventListener listener, 
                                    boolean useCapture, 
                                    EventGroup evtGroup);



package org.w3c.dom.events;

public interface DocumentEventGroup {
    public EventGroup createEventGroup();



package org.w3c.dom.events;

public interface Event {
    // PhaseType
    public static final short CAPTURING_PHASE           = 1;
    public static final short AT_TARGET                 = 2;
    public static final short BUBBLING_PHASE            = 3;

    public String getType();

    public EventTarget getTarget();

    public EventTarget getCurrentTarget();

    public short getEventPhase();

    public boolean getBubbles();

    public boolean getCancelable();

    public long getTimeStamp();

    public void stopPropagation();

    public void preventDefault();

    public void initEvent(String eventTypeArg, 
                          boolean canBubbleArg, 
                          boolean cancelableArg);



package org.w3c.dom.events;

import org.w3c.dom.DOMException;

public interface DocumentEvent {
    public Event createEvent(String eventType)
                             throws DOMException;



package org.w3c.dom.events;

import org.w3c.dom.views.AbstractView;

public interface UIEvent extends Event {
    public AbstractView getView();

    public int getDetail();

    public void initUIEvent(String typeArg, 
                            boolean canBubbleArg, 
                            boolean cancelableArg, 
                            AbstractView viewArg, 
                            int detailArg);



package org.w3c.dom.events;

import org.w3c.dom.views.AbstractView;

public interface MouseEvent extends UIEvent {
    public int getScreenX();

    public int getScreenY();

    public int getClientX();

    public int getClientY();

    public boolean getCtrlKey();

    public boolean getShiftKey();

    public boolean getAltKey();

    public boolean getMetaKey();

    public short getButton();

    public EventTarget getRelatedTarget();

    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);



package org.w3c.dom.events;

import org.w3c.dom.views.AbstractView;

public interface TextEvent extends UIEvent {
    // VirtualKeyCode
    public static final int DOM_VK_UNDEFINED          = 0x0;
    public static final int DOM_VK_RIGHT_ALT          = 0x01;
    public static final int DOM_VK_LEFT_ALT           = 0x02;
    public static final int DOM_VK_LEFT_CONTROL       = 0x03;
    public static final int DOM_VK_RIGHT_CONTROL      = 0x04;
    public static final int DOM_VK_LEFT_SHIFT         = 0x05;
    public static final int DOM_VK_RIGHT_SHIFT        = 0x06;
    public static final int DOM_VK_LEFT_META          = 0x07;
    public static final int DOM_VK_RIGHT_META         = 0x08;
    public static final int DOM_VK_CAPS_LOCK          = 0x09;
    public static final int DOM_VK_DELETE             = 0x0A;
    public static final int DOM_VK_END                = 0x0B;
    public static final int DOM_VK_ENTER              = 0x0C;
    public static final int DOM_VK_ESCAPE             = 0x0D;
    public static final int DOM_VK_HOME               = 0x0E;
    public static final int DOM_VK_INSERT             = 0x0F;
    public static final int DOM_VK_NUM_LOCK           = 0x10;
    public static final int DOM_VK_PAUSE              = 0x11;
    public static final int DOM_VK_PRINTSCREEN        = 0x12;
    public static final int DOM_VK_SCROLL_LOCK        = 0x13;
    public static final int DOM_VK_LEFT               = 0x14;
    public static final int DOM_VK_RIGHT              = 0x15;
    public static final int DOM_VK_UP                 = 0x16;
    public static final int DOM_VK_DOWN               = 0x17;
    public static final int DOM_VK_PAGE_DOWN          = 0x18;
    public static final int DOM_VK_PAGE_UP            = 0x19;
    public static final int DOM_VK_F1                 = 0x1A;
    public static final int DOM_VK_F2                 = 0x1B;
    public static final int DOM_VK_F3                 = 0x1C;
    public static final int DOM_VK_F4                 = 0x1D;
    public static final int DOM_VK_F5                 = 0x1E;
    public static final int DOM_VK_F6                 = 0x1F;
    public static final int DOM_VK_F7                 = 0x20;
    public static final int DOM_VK_F8                 = 0x21;
    public static final int DOM_VK_F9                 = 0x22;
    public static final int DOM_VK_F10                = 0x23;
    public static final int DOM_VK_F11                = 0x24;
    public static final int DOM_VK_F12                = 0x25;
    public static final int DOM_VK_F13                = 0x26;
    public static final int DOM_VK_F14                = 0x27;
    public static final int DOM_VK_F15                = 0x28;
    public static final int DOM_VK_F16                = 0x29;
    public static final int DOM_VK_F17                = 0x2A;
    public static final int DOM_VK_F18                = 0x2B;
    public static final int DOM_VK_F19                = 0x2C;
    public static final int DOM_VK_F20                = 0x2D;
    public static final int DOM_VK_F21                = 0x2E;
    public static final int DOM_VK_F22                = 0x2F;
    public static final int DOM_VK_F23                = 0x30;
    public static final int DOM_VK_F24                = 0x31;

    public String getOutputString();
    public void setOutputString(String outputString);

    public int getKeyVal();
    public void setKeyVal(int keyVal);

    public int getVirtKeyVal();
    public void setVirtKeyVal(int virtKeyVal);

    public boolean getVisibleOutputGenerated();
    public void setVisibleOutputGenerated(boolean visibleOutputGenerated);

    public boolean getNumPad();
    public void setNumPad(boolean numPad);

    public boolean checkModifier(int modifer);

    public void initTextEvent(String typeArg, 
                              boolean canBubbleArg, 
                              boolean cancelableArg, 
                              AbstractView viewArg, 
                              short detailArg, 
                              String outputStringArg, 
                              int keyValArg, 
                              int virtKeyValArg, 
                              boolean visibleOutputGeneratedArg, 
                              boolean numPadArg);

    public void initModifier(int modifier, 
                             boolean value);



package org.w3c.dom.events;

import org.w3c.dom.Node;

public interface MutationEvent extends Event {
    // attrChangeType
    public static final short MODIFICATION              = 1;
    public static final short ADDITION                  = 2;
    public static final short REMOVAL                   = 3;

    public Node getRelatedNode();

    public String getPrevValue();

    public String getNewValue();

    public String getAttrName();

    public short getAttrChange();

    public void initMutationEvent(String typeArg, 
                                  boolean canBubbleArg, 
                                  boolean cancelableArg, 
                                  Node relatedNodeArg, 
                                  String prevValueArg, 
                                  String newValueArg, 
                                  String attrNameArg, 
                                  short attrChangeArg);