Lisez-moi S.V.P. 

13 novembre 2000

Annexe B : La liaison avec le langage Java

Cette annexe contient les liaisons Java [Java] complètes pour le modèle objet de document niveau 2 Events.

Les fichiers Java sont également disponibles sous la forme suivante : http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/java-binding.zip La documentation dans les fichiers sources Java n'avait pas de contenu pour les méthodes set*. Ce nouveau fichier zip devrait corriger les problèmes.

org/w3c/dom/events/EventException.java:

package org.w3c.dom.events;

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

}

org/w3c/dom/events/EventTarget.java:

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;

}

org/w3c/dom/events/EventListener.java:

package org.w3c.dom.events;

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

}

org/w3c/dom/events/Event.java:

package org.w3c.dom.events;

public interface Event {
    // Type de phase
    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);

}

org/w3c/dom/events/DocumentEvent.java:

package org.w3c.dom.events;

import org.w3c.dom.DOMException;

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

}

org/w3c/dom/events/UIEvent.java:

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

}

org/w3c/dom/events/MouseEvent.java:

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

}

org/w3c/dom/events/MutationEvent.java:

package org.w3c.dom.events;

import org.w3c.dom.Node;

public interface MutationEvent extends Event {
    // Type attrChange
    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);

}