Java 类org.w3c.dom.events.EventTarget 实例源码

项目:Push2Display    文件:CSSEngine.java   
/**
 * Removes the event listeners from the document.
 */
protected void removeEventListeners(EventTarget doc) {
    if (isCSSNavigableDocument) {
        CSSNavigableDocument cnd = (CSSNavigableDocument) doc;
        cnd.removeCSSNavigableDocumentListener
            (cssNavigableDocumentListener);
    } else {
        doc.removeEventListener("DOMAttrModified",
                                domAttrModifiedListener,
                                false);
        doc.removeEventListener("DOMNodeInserted",
                                domNodeInsertedListener,
                                false);
        doc.removeEventListener("DOMNodeRemoved",
                                domNodeRemovedListener,
                                false);
        doc.removeEventListener("DOMSubtreeModified",
                                domSubtreeModifiedListener,
                                false);
        doc.removeEventListener("DOMCharacterDataModified",
                                domCharacterDataModifiedListener,
                                false);
    }
}
项目:Push2Display    文件:SVG12BridgeEventSupport.java   
/**
 * Dispatch a DOM 3 Text event.
 */
protected void dispatchTextEvent(GraphicsNodeKeyEvent evt) {
    FocusManager fmgr = context.getFocusManager();
    if (fmgr == null) {
        return;
    }

    Element targetElement = (Element) fmgr.getCurrentEventTarget();
    if (targetElement == null) {
        targetElement = context.getDocument().getDocumentElement();
    }
    DocumentEvent d = (DocumentEvent) targetElement.getOwnerDocument();
    DOMTextEvent textEvt = (DOMTextEvent) d.createEvent("TextEvent");
    textEvt.initTextEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                            "textInput", 
                            true,
                            true,
                            null,
                            String.valueOf(evt.getKeyChar()));

    try {
        ((EventTarget) targetElement).dispatchEvent(textEvt);
    } catch (RuntimeException e) {
        ua.displayError(e);
    }
}
项目:Push2Display    文件:SVG12BridgeEventSupport.java   
public void mouseWheelMoved(GraphicsNodeMouseWheelEvent evt) {
    Document doc = context.getPrimaryBridgeContext().getDocument();
    Element targetElement = doc.getDocumentElement();
    DocumentEvent d = (DocumentEvent) doc;
    SVGOMWheelEvent wheelEvt
        = (SVGOMWheelEvent) d.createEvent("WheelEvent");
    wheelEvt.initWheelEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                              "wheel", 
                              true,
                              true,
                              null,
                              evt.getWheelDelta());

    try {
        ((EventTarget)targetElement).dispatchEvent(wheelEvt);
    } catch (RuntimeException e) {
        ua.displayError(e);
    }
}
项目:Push2Display    文件:DefaultXBLManager.java   
/**
 * Handles the event.
 */
public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMDefinitionElement) {
        // only handle definition elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            defsToBeRemoved.add(target);
        }
    } else if (target instanceof XBLOMImportElement) {
        // only handle import elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            importsToBeRemoved.add(target);
        }
    }

    Node parent = getXblParentNode((Node) target);
    if (parent != null) {
        nodesToBeInvalidated.add(parent);
    }
}
项目:Push2Display    文件:DefaultXBLManager.java   
/**
 * Handles the event.
 */
public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target != evt.getCurrentTarget()) {
        return;
    }

    MutationEvent mevt = (MutationEvent) evt;
    if (mevt.getAttrName().equals(XBL_REF_ATTRIBUTE)) {
        Element defRef = (Element) target;
        removeDefinitionRef(defRef);
        if (mevt.getNewValue().length() == 0) {
            XBLOMDefinitionElement def
                = (XBLOMDefinitionElement) defRef;
            String ns = def.getElementNamespaceURI();
            String ln = def.getElementLocalName();
            addDefinition(ns, ln,
                          (XBLOMDefinitionElement) defRef, null);
        } else {
            addDefinitionRef(defRef);
        }
    }
}
项目:Push2Display    文件:SVG12FocusManager.java   
/**
 * Fires a 'DOMFocusIn' event to the specified target.
 *
 * @param target the newly focussed event target
 * @param relatedTarget the previously focussed event target
 */
protected void fireDOMFocusInEvent(EventTarget target,
                                   EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusIn",
                        true,
                        false,  // canBubbleArg
                        null,   // cancelableArg
                        0);     // detailArg
    int limit = DefaultXBLManager.computeBubbleLimit((Node) relatedTarget,
                                                     (Node) target);
    ((AbstractEvent) uiEvt).setBubbleLimit(limit);
    target.dispatchEvent(uiEvt);
}
项目:Push2Display    文件:SVG12FocusManager.java   
/**
 * Fires a 'DOMFocusOut' event to the specified target.
 *
 * @param target the previously focussed event target
 * @param relatedTarget the newly focussed event target
 */
protected void fireDOMFocusOutEvent(EventTarget target,
                                    EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusOut",
                        true,
                        false,  // canBubbleArg
                        null,   // cancelableArg
                        0);     // detailArg
    int limit = DefaultXBLManager.computeBubbleLimit((Node) target,
                                                     (Node) relatedTarget);
    ((AbstractEvent) uiEvt).setBubbleLimit(limit);
    target.dispatchEvent(uiEvt);
}
项目:Push2Display    文件:BridgeContext.java   
public void removeUIEventListeners(Document doc) {
    EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
    synchronized (eventListenerSet) {
        Iterator i = eventListenerSet.iterator();
        while (i.hasNext()) {
            EventListenerMememto elm = (EventListenerMememto)i.next();
            NodeEventTarget et = elm.getTarget();
            if (et == evtTarget) {
                EventListener el = elm.getListener();
                boolean       uc = elm.getUseCapture();
                String        t  = elm.getEventType();
                boolean       n  = elm.getNamespaced();
                if (et == null || el == null || t == null) {
                    continue;
                }
                if (n) {
                    String ns = elm.getNamespaceURI();
                    et.removeEventListenerNS(ns, t, el, uc);
                } else {
                    et.removeEventListener(t, el, uc);
                }
            }
        }
    }
}
项目:Push2Display    文件:SVGImageElementBridge.java   
public void handleEvent(Event e) {
    DOMMouseEvent evt = (DOMMouseEvent) e;
    DOMMouseEvent newMouseEvent = (DOMMouseEvent)
        // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
        ((DocumentEvent)imgElement.getOwnerDocument()).createEvent("MouseEvents");

    newMouseEvent.initMouseEventNS
        (XMLConstants.XML_EVENTS_NAMESPACE_URI,
         evt.getType(),
         evt.getBubbles(),
         evt.getCancelable(),
         evt.getView(),
         evt.getDetail(),
         evt.getScreenX(),
         evt.getScreenY(),
         evt.getClientX(),
         evt.getClientY(),
         evt.getButton(),
         (EventTarget)imgElement,
         evt.getModifiersString());
    ((EventTarget)imgElement).dispatchEvent(newMouseEvent);
}
项目:javify    文件:DomIterator.java   
/**
 * Constructs and initializes an iterator.
 */
protected DomIterator(Node root,
                      int whatToShow,
                      NodeFilter filter,
                      boolean entityReferenceExpansion)
{
  if (!root.isSupported("MutationEvents", "2.0"))
    {
      throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
                      "Iterator needs mutation events", root, 0);
    }

  this.root = root;
  this.whatToShow = whatToShow;
  this.filter = filter;
  this.expandEntityReferences = entityReferenceExpansion;

  // start condition:  going right, seen nothing yet.
  reference = null;
  right = true;

  EventTarget target = (EventTarget) root;
  target.addEventListener("DOMNodeRemoved", this, false);
}
项目:jvm-stm    文件:DomIterator.java   
/**
 * Constructs and initializes an iterator.
 */
protected DomIterator(Node root,
                      int whatToShow,
                      NodeFilter filter,
                      boolean entityReferenceExpansion)
{
  if (!root.isSupported("MutationEvents", "2.0")) 
    {
      throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
                      "Iterator needs mutation events", root, 0);
    }

  this.root = root;
  this.whatToShow = whatToShow;
  this.filter = filter;
  this.expandEntityReferences = entityReferenceExpansion;

  // start condition:  going right, seen nothing yet.
  reference = null;
  right = true;

  EventTarget   target = (EventTarget) root;
  target.addEventListener("DOMNodeRemoved", this, false);
}
项目:feathers-sdk    文件:SVGImageElementBridge.java   
public void handleEvent(Event e) {
    DOMMouseEvent evt = (DOMMouseEvent) e;
    DOMMouseEvent newMouseEvent = (DOMMouseEvent)
        // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
        ((DocumentEvent)imgElement.getOwnerDocument()).createEvent("MouseEvents");

    newMouseEvent.initMouseEventNS
        (XMLConstants.XML_EVENTS_NAMESPACE_URI,
         evt.getType(),
         evt.getBubbles(),
         evt.getCancelable(),
         evt.getView(),
         evt.getDetail(),
         evt.getScreenX(),
         evt.getScreenY(),
         evt.getClientX(),
         evt.getClientY(),
         evt.getButton(),
         (EventTarget)imgElement,
         evt.getModifiersString());
    ((EventTarget)imgElement).dispatchEvent(newMouseEvent);
}
项目:lab_browser    文件:BrowserView.java   
@Override
public void changed (ObservableValue<? extends State> ov, State oldState, State newState) {
    if (newState == Worker.State.SUCCEEDED) {
        EventListener listener = event -> {
            final String href = ((Element)event.getTarget()).getAttribute(HTML_LINK);
            if (href != null) {
                String domEventType = event.getType();
                if (domEventType.equals(EVENT_CLICK)) {
                    showPage(href);
                } else if (domEventType.equals(EVENT_MOUSEOVER)) {
                    showStatus(href);
                } else if (domEventType.equals(EVENT_MOUSEOUT)) {
                    showStatus(BLANK);
                }
            }
        };
        Document doc = myPage.getEngine().getDocument();
        NodeList nodes = doc.getElementsByTagName("a");
        for (int i = 0; i < nodes.getLength(); i++) {
            EventTarget node = (EventTarget)nodes.item(i);
            node.addEventListener(EVENT_CLICK, listener, false);
            node.addEventListener(EVENT_MOUSEOVER, listener, false);
            node.addEventListener(EVENT_MOUSEOUT, listener, false);
        }
    }
}
项目:Push2Display    文件:CSSEngine.java   
/**
 * Removes the event listeners from the document.
 */
protected void removeEventListeners(EventTarget doc) {
    if (isCSSNavigableDocument) {
        CSSNavigableDocument cnd = (CSSNavigableDocument) doc;
        cnd.removeCSSNavigableDocumentListener
            (cssNavigableDocumentListener);
    } else {
        doc.removeEventListener("DOMAttrModified",
                                domAttrModifiedListener,
                                false);
        doc.removeEventListener("DOMNodeInserted",
                                domNodeInsertedListener,
                                false);
        doc.removeEventListener("DOMNodeRemoved",
                                domNodeRemovedListener,
                                false);
        doc.removeEventListener("DOMSubtreeModified",
                                domSubtreeModifiedListener,
                                false);
        doc.removeEventListener("DOMCharacterDataModified",
                                domCharacterDataModifiedListener,
                                false);
    }
}
项目:feathers-sdk    文件:SVG12FocusManager.java   
/**
 * Fires a 'DOMFocusOut' event to the specified target.
 *
 * @param target the previously focussed event target
 * @param relatedTarget the newly focussed event target
 */
protected void fireDOMFocusOutEvent(EventTarget target,
                                    EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusOut",
                        true,
                        false,  // canBubbleArg
                        null,   // cancelableArg
                        0);     // detailArg
    int limit = DefaultXBLManager.computeBubbleLimit((Node) target,
                                                     (Node) relatedTarget);
    ((AbstractEvent) uiEvt).setBubbleLimit(limit);
    target.dispatchEvent(uiEvt);
}
项目:feathers-sdk    文件:SVG12FocusManager.java   
/**
 * Fires a 'DOMFocusIn' event to the specified target.
 *
 * @param target the newly focussed event target
 * @param relatedTarget the previously focussed event target
 */
protected void fireDOMFocusInEvent(EventTarget target,
                                   EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusIn",
                        true,
                        false,  // canBubbleArg
                        null,   // cancelableArg
                        0);     // detailArg
    int limit = DefaultXBLManager.computeBubbleLimit((Node) relatedTarget,
                                                     (Node) target);
    ((AbstractEvent) uiEvt).setBubbleLimit(limit);
    target.dispatchEvent(uiEvt);
}
项目:feathers-sdk    文件:CSSEngine.java   
/**
 * Removes the event listeners from the document.
 */
protected void removeEventListeners(EventTarget doc) {
    if (isCSSNavigableDocument) {
        CSSNavigableDocument cnd = (CSSNavigableDocument) doc;
        cnd.removeCSSNavigableDocumentListener
            (cssNavigableDocumentListener);
    } else {
        doc.removeEventListener("DOMAttrModified",
                                domAttrModifiedListener,
                                false);
        doc.removeEventListener("DOMNodeInserted",
                                domNodeInsertedListener,
                                false);
        doc.removeEventListener("DOMNodeRemoved",
                                domNodeRemovedListener,
                                false);
        doc.removeEventListener("DOMSubtreeModified",
                                domSubtreeModifiedListener,
                                false);
        doc.removeEventListener("DOMCharacterDataModified",
                                domCharacterDataModifiedListener,
                                false);
    }
}
项目:Push2Display    文件:DefaultXBLManager.java   
/**
 * Handles the event.
 */
public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMDefinitionElement) {
        // only handle definition elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            defsToBeRemoved.add(target);
        }
    } else if (target instanceof XBLOMImportElement) {
        // only handle import elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            importsToBeRemoved.add(target);
        }
    }

    Node parent = getXblParentNode((Node) target);
    if (parent != null) {
        nodesToBeInvalidated.add(parent);
    }
}
项目:Push2Display    文件:SVG12FocusManager.java   
/**
 * Fires a 'DOMFocusOut' event to the specified target.
 *
 * @param target the previously focussed event target
 * @param relatedTarget the newly focussed event target
 */
protected void fireDOMFocusOutEvent(EventTarget target,
                                    EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusOut",
                        true,
                        false,  // canBubbleArg
                        null,   // cancelableArg
                        0);     // detailArg
    int limit = DefaultXBLManager.computeBubbleLimit((Node) target,
                                                     (Node) relatedTarget);
    ((AbstractEvent) uiEvt).setBubbleLimit(limit);
    target.dispatchEvent(uiEvt);
}
项目:feathers-sdk    文件:DefaultXBLManager.java   
/**
 * Handles the event.
 */
public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMDefinitionElement) {
        // only handle definition elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            defsToBeRemoved.add(target);
        }
    } else if (target instanceof XBLOMImportElement) {
        // only handle import elements in document-level scope
        if (getXblBoundElement((Node) target) == null) {
            importsToBeRemoved.add(target);
        }
    }

    Node parent = getXblParentNode((Node) target);
    if (parent != null) {
        nodesToBeInvalidated.add(parent);
    }
}
项目:Push2Display    文件:SVGImageElementBridge.java   
public void handleEvent(Event e) {
    DOMMouseEvent evt = (DOMMouseEvent) e;
    DOMMouseEvent newMouseEvent = (DOMMouseEvent)
        // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
        ((DocumentEvent)imgElement.getOwnerDocument()).createEvent("MouseEvents");

    newMouseEvent.initMouseEventNS
        (XMLConstants.XML_EVENTS_NAMESPACE_URI,
         evt.getType(),
         evt.getBubbles(),
         evt.getCancelable(),
         evt.getView(),
         evt.getDetail(),
         evt.getScreenX(),
         evt.getScreenY(),
         evt.getClientX(),
         evt.getClientY(),
         evt.getButton(),
         (EventTarget)imgElement,
         evt.getModifiersString());
    ((EventTarget)imgElement).dispatchEvent(newMouseEvent);
}
项目:marathonv5    文件:HyperlinkRedirectListener.java   
@Override public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
    if (State.SUCCEEDED.equals(newValue)) {
        Document document = webView.getEngine().getDocument();
        NodeList anchors = document.getElementsByTagName(ANCHOR_TAG);
        for (int i = 0; i < anchors.getLength(); i++) {
            Node node = anchors.item(i);
            EventTarget eventTarget = (EventTarget) node;
            eventTarget.addEventListener(CLICK_EVENT, this, false);
        }
    }
}
项目:educational-plugin    文件:StudyBrowserWindow.java   
private void addListenerToAllHyperlinkItems(EventListener listener) {
  final Document doc = myEngine.getDocument();
  if (doc != null) {
    final NodeList nodeList = doc.getElementsByTagName("a");
    for (int i = 0; i < nodeList.getLength(); i++) {
      ((EventTarget)nodeList.item(i)).addEventListener(EVENT_TYPE_CLICK, listener, false);
    }
  }
}
项目:waterrower-workout    文件:HyperlinkRedirectListener.java   
@Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
    if (SUCCEEDED.equals(newValue)) {
        Document document = webView.getEngine().getDocument();
        NodeList anchors = document.getElementsByTagName(ANCHOR_TAG);
        for (int i = 0; i < anchors.getLength(); i++) {
            Node node = anchors.item(i);
            EventTarget eventTarget = (EventTarget) node;
            eventTarget.addEventListener(CLICK_EVENT, this, false);
        }
    }
}
项目:Push2Display    文件:CSSEngine.java   
/**
 * Adds event listeners to the document to track CSS changes.
 */
protected void addEventListeners(EventTarget doc) {
    if (isCSSNavigableDocument) {
        cssNavigableDocumentListener = new CSSNavigableDocumentHandler();
        CSSNavigableDocument cnd = (CSSNavigableDocument) doc;
        cnd.addCSSNavigableDocumentListener(cssNavigableDocumentListener);
    } else {
        domAttrModifiedListener = new DOMAttrModifiedListener();
        doc.addEventListener("DOMAttrModified",
                             domAttrModifiedListener,
                             false);
        domNodeInsertedListener = new DOMNodeInsertedListener();
        doc.addEventListener("DOMNodeInserted",
                             domNodeInsertedListener,
                             false);
        domNodeRemovedListener = new DOMNodeRemovedListener();
        doc.addEventListener("DOMNodeRemoved",
                             domNodeRemovedListener,
                             false);
        domSubtreeModifiedListener = new DOMSubtreeModifiedListener();
        doc.addEventListener("DOMSubtreeModified",
                             domSubtreeModifiedListener,
                             false);
        domCharacterDataModifiedListener =
            new DOMCharacterDataModifiedListener();
        doc.addEventListener("DOMCharacterDataModified",
                             domCharacterDataModifiedListener,
                             false);
    }
}
项目:Push2Display    文件:CSSEngine.java   
/**
 * Disposes the CSSEngine and all the attached resources.
 */
public void dispose() {
    setCSSEngineUserAgent(null);
    disposeStyleMaps(document.getDocumentElement());
    if (document instanceof EventTarget) {
        // Detach the mutation events listeners.
        removeEventListeners((EventTarget) document);
    }
}
项目:Push2Display    文件:BridgeEventSupport.java   
/**
 * Calls storeEventListener on the given BridgeContext.
 */
protected static void storeEventListener(BridgeContext ctx,
                                         EventTarget e,
                                         String t,
                                         EventListener l,
                                         boolean c) {
    ctx.storeEventListener(e, t, l, c);
}
项目:Push2Display    文件:BridgeEventSupport.java   
/**
 * Calls storeEventListenerNS on the given BridgeContext.
 */
protected static void storeEventListenerNS(BridgeContext ctx,
                                           EventTarget e,
                                           String n,
                                           String t,
                                           EventListener l,
                                           boolean c) {
    ctx.storeEventListenerNS(e, n, t, l, c);
}
项目:Push2Display    文件:BridgeEventSupport.java   
/**
 * Dispatch a DOM 2 Draft Key event.
 */
protected void dispatchKeyEvent(String eventType,
                                GraphicsNodeKeyEvent evt) {
    FocusManager fmgr = context.getFocusManager();
    if (fmgr == null) return;

    Element targetElement = (Element)fmgr.getCurrentEventTarget();
    if (targetElement == null) {
        targetElement = context.getDocument().getDocumentElement();
    }
    DocumentEvent d = (DocumentEvent)targetElement.getOwnerDocument();
    DOMKeyEvent keyEvt = (DOMKeyEvent)d.createEvent("KeyEvents");
    keyEvt.initKeyEvent(eventType,
                        true,
                        true,
                        evt.isControlDown(),
                        evt.isAltDown(),
                        evt.isShiftDown(),
                        evt.isMetaDown(),
                        mapKeyCode(evt.getKeyCode()),
                        evt.getKeyChar(),
                        null);

    try {
        ((EventTarget)targetElement).dispatchEvent(keyEvt);
    } catch (RuntimeException e) {
        ua.displayError(e);
    }
}
项目:Push2Display    文件:FocusManager.java   
public void handleEvent(Event evt) {
    EventTarget newTarget = evt.getTarget();
    if (lastFocusEventTarget != null && 
        lastFocusEventTarget != newTarget) {
        fireDOMFocusOutEvent(lastFocusEventTarget, newTarget);
    }
    lastFocusEventTarget = evt.getTarget();
}
项目:Push2Display    文件:FocusManager.java   
/**
 * Fires a 'DOMFocusIn' event to the specified target.
 *
 * @param target the newly focussed event target
 * @param relatedTarget the previously focussed event target
 */
protected void fireDOMFocusInEvent(EventTarget target,
                                   EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusIn",
                        true,    // canBubbleArg
                        false,   // cancelableArg
                        null,    // viewArg
                        0);      // detailArg
    target.dispatchEvent(uiEvt);
}
项目:Push2Display    文件:FocusManager.java   
/**
 * Fires a 'DOMFocusOut' event to the specified target.
 *
 * @param target the previously focussed event target
 * @param relatedTarget the newly focussed event target
 */
protected void fireDOMFocusOutEvent(EventTarget target,
                                    EventTarget relatedTarget) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMFocusOut",
                        true,    // canBubbleArg
                        false,   // cancelableArg
                        null,    // viewArg
                        0);      // detailArg
    target.dispatchEvent(uiEvt);
}
项目:Push2Display    文件:FocusManager.java   
/**
 * Fires a 'DOMActivate' event to the specified target.
 *
 * @param target the event target
 * @param detailArg the detailArg parameter of the event
 */
protected void fireDOMActivateEvent(EventTarget target, int detailArg) {
    DocumentEvent docEvt = 
        (DocumentEvent)((Element)target).getOwnerDocument();
    DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
    uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                        "DOMActivate",
                        true,    // canBubbleArg
                        true,    // cancelableArg
                        null,    // viewArg
                        0);      // detailArg
    target.dispatchEvent(uiEvt);
}
项目:Push2Display    文件:SVG12BridgeContext.java   
/**
 * Adds EventListeners to the input document to handle the cursor 
 * property.
 * This is not done in the addDOMListeners method because 
 * addDOMListeners is only used for dynamic content whereas 
 * cursor support is provided for all content.
 * Also note that it is very important that the listeners be
 * registered for the capture phase as the 'default' behavior
 * for cursors is handled by the BridgeContext during the 
 * capture phase and the 'custom' behavior (handling of 'auto'
 * on anchors, for example), is handled during the bubbling phase.
 */
public void addUIEventListeners(Document doc) {
    EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
    AbstractNode n = (AbstractNode) evtTarget;
    XBLEventSupport evtSupport
        = (XBLEventSupport) n.initializeEventSupport();

    EventListener domMouseOverListener
        = new EventListenerWrapper(new DOMMouseOverEventListener());
    evtSupport.addImplementationEventListenerNS
        (XMLConstants.XML_EVENTS_NAMESPACE_URI,
         SVGConstants.SVG_EVENT_MOUSEOVER,
         domMouseOverListener, true);
    storeImplementationEventListenerNS
        (evtTarget,
         XMLConstants.XML_EVENTS_NAMESPACE_URI,
         SVGConstants.SVG_EVENT_MOUSEOVER,
         domMouseOverListener, true);

    EventListener domMouseOutListener
        = new EventListenerWrapper(new DOMMouseOutEventListener());
    evtSupport.addImplementationEventListenerNS
        (XMLConstants.XML_EVENTS_NAMESPACE_URI,
         SVGConstants.SVG_EVENT_MOUSEOUT,
         domMouseOutListener, true);
    storeImplementationEventListenerNS
        (evtTarget,
         XMLConstants.XML_EVENTS_NAMESPACE_URI,
         SVGConstants.SVG_EVENT_MOUSEOUT,
         domMouseOutListener, true);
}
项目:Push2Display    文件:SVG12BridgeContext.java   
/**
 * Adds to the eventListenerSet the specified implementation event
 * listener registration.
 */
protected void storeImplementationEventListenerNS(EventTarget t,
                                                  String ns,
                                                  String s,
                                                  EventListener l,
                                                  boolean b) {
    synchronized (eventListenerSet) {
        ImplementationEventListenerMememto m
            = new ImplementationEventListenerMememto(t, ns, s, l, b, this);
        eventListenerSet.add(m);
    }
}
项目:Push2Display    文件:SVG12BridgeContext.java   
/**
 * Starts mouse capture.
 */
public void startMouseCapture(EventTarget target, boolean sendAll,
                              boolean autoRelease) {
    mouseCaptureTarget = target;
    mouseCaptureSendAll = sendAll;
    mouseCaptureAutoRelease = autoRelease;
}
项目:Push2Display    文件:SVG12BridgeContext.java   
/**
 * Creates a new ImplementationEventListenerMememto.
 */
public ImplementationEventListenerMememto(EventTarget t,
                                          String s,
                                          EventListener l,
                                          boolean b,
                                          BridgeContext c) {
    super(t, s, l, b, c);
}
项目:Push2Display    文件:SVG12BridgeContext.java   
/**
 * Creates a new ImplementationEventListenerMememto.
 */
public ImplementationEventListenerMememto(EventTarget t,
                                          String n,
                                          String s,
                                          EventListener l,
                                          boolean b,
                                          BridgeContext c) {
    super(t, n, s, l, b, c);
}
项目:Push2Display    文件:SVG12BridgeEventSupport.java   
/**
 * Dispatch a DOM 3 Keyboard event.
 */
protected void dispatchKeyboardEvent(String eventType,
                                     GraphicsNodeKeyEvent evt) {
    FocusManager fmgr = context.getFocusManager();
    if (fmgr == null) {
        return;
    }

    Element targetElement = (Element) fmgr.getCurrentEventTarget();
    if (targetElement == null) {
        targetElement = context.getDocument().getDocumentElement();
    }
    DocumentEvent d = (DocumentEvent) targetElement.getOwnerDocument();
    DOMKeyboardEvent keyEvt
        = (DOMKeyboardEvent) d.createEvent("KeyboardEvent");
    String modifiers
        = DOMUtilities.getModifiersList(evt.getLockState(),
                                        evt.getModifiers());
    keyEvt.initKeyboardEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                               eventType, 
                               true,
                               true,
                               null,
                               mapKeyCodeToIdentifier(evt.getKeyCode()),
                               mapKeyLocation(evt.getKeyLocation()),
                               modifiers);

    try {
        ((EventTarget)targetElement).dispatchEvent(keyEvt);
    } catch (RuntimeException e) {
        ua.displayError(e);
    }
}
项目:Push2Display    文件:DefaultXBLManager.java   
/**
 * Handles the event.
 */
public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMDefinitionElement) {
        XBLOMDefinitionElement def = (XBLOMDefinitionElement) target;
        addDefinition(def.getElementNamespaceURI(),
                      def.getElementLocalName(),
                      def,
                      importElement);
    }
}