/** * 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); } }
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); } }
/** * 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); }
/** * 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); }
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); }
public boolean beginElement() { DocumentEvent doc = (DocumentEvent) SmilParElementImpl.this.getOwnerDocument(); Event startEvent = doc.createEvent("Event"); startEvent.initEvent(SMIL_SLIDE_START_EVENT, false, false); dispatchEvent(startEvent); return true; }
public void invokeScriptEvent(String eventName) { SVGElement eventElement = getElement(SvgElementType.Event); if (eventElement != null) { eventElement.setTextContent(eventName); DocumentEvent de = (DocumentEvent) doc; MutationEvent ev = (MutationEvent) de.createEvent("MutationEvents"); ev.initMutationEvent("DOMCharacterDataModified", true, // canBubbleArg false, // cancelableArg null, // relatedNodeArg null, // prevValueArg null, // newValueArg null, // attrNameArg ev.ADDITION); EventTarget t = (EventTarget) eventElement; t.dispatchEvent(ev); } }
public boolean endElement() { DocumentEvent doc = (DocumentEvent) SmilParElementImpl.this.getOwnerDocument(); Event endEvent = doc.createEvent("Event"); endEvent.initEvent(SMIL_SLIDE_END_EVENT, false, false); dispatchEvent(endEvent); return true; }
private Event createEvent(String eventType) { DocumentEvent doc = (DocumentEvent)SmilMediaElementImpl.this.getOwnerDocument(); Event event = doc.createEvent("Event"); event.initEvent(eventType, false, false); if (LOCAL_LOGV) { Log.v(TAG, "Dispatching 'begin' event to " + SmilMediaElementImpl.this.getTagName() + " " + SmilMediaElementImpl.this.getSrc() + " at " + System.currentTimeMillis()); } return event; }
private Event createEvent(String eventType, int seekTo) { DocumentEvent doc = (DocumentEvent)SmilMediaElementImpl.this.getOwnerDocument(); EventImpl event = (EventImpl) doc.createEvent("Event"); event.initEvent(eventType, false, false, seekTo); if (LOCAL_LOGV) { Log.v(TAG, "Dispatching 'begin' event to " + SmilMediaElementImpl.this.getTagName() + " " + SmilMediaElementImpl.this.getSrc() + " at " + System.currentTimeMillis()); } return event; }
/** * 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); } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); } }
/** * Fires a ShadowTreeEvent of the given type on this element. */ protected void fireShadowTreeEvent(BindableElement elt, String type, XBLShadowTreeElement e) { DocumentEvent de = (DocumentEvent) elt.getOwnerDocument(); ShadowTreeEvent evt = (ShadowTreeEvent) de.createEvent("ShadowTreeEvent"); evt.initShadowTreeEventNS(XBL_NAMESPACE_URI, type, true, false, e); elt.dispatchEvent(evt); }
/** * Fires a ShapeChange event on the element this bridge is managing. */ protected void fireShapeChangeEvent() { DocumentEvent d = (DocumentEvent) e.getOwnerDocument(); AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents"); evt.initEventNS(SVG_NAMESPACE_URI, "shapechange", true, false); try { ((EventTarget) e).dispatchEvent(evt); } catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); } }
/** * Fires an svg:bboxchange event on the element. */ protected void fireBBoxChangeEvent() { DocumentEvent d = (DocumentEvent) e.getOwnerDocument(); AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents"); evt.initEventNS(SVG_NAMESPACE_URI, "RenderedBBoxChange", true, false); try { ((EventTarget) e).dispatchEvent(evt); } catch (RuntimeException ex) { ctx.getUserAgent().displayError(ex); } }
protected void dispatchSVGDocEvent(String eventType) { SVGSVGElement root = (SVGSVGElement)document.getDocumentElement(); // Event is dispatched on outermost SVG element. EventTarget t = root; DocumentEvent de = (DocumentEvent)document; AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents"); ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, eventType, false, false); t.dispatchEvent(ev); }
/** * Fires a {@link TimeEvent} on the given {@link EventTarget}. */ public static void fireTimeEvent(EventTarget target, String eventType, Calendar time, int detail) { DocumentEvent de = (DocumentEvent) ((Node) target).getOwnerDocument(); DOMTimeEvent evt = (DOMTimeEvent) de.createEvent("TimeEvent"); evt.initTimeEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, eventType, null, detail); evt.setTimestamp(time.getTime().getTime()); target.dispatchEvent(evt); }
public synchronized void init(ElementTime root) { mRoot = root; mAllEntries = getTimeline(mRoot, 0, Long.MAX_VALUE); mMediaTimeUpdatedEvent = ((DocumentEvent) mRoot).createEvent("Event"); mMediaTimeUpdatedEvent.initEvent(MEDIA_TIME_UPDATED_EVENT, false, false); mActiveElements = new ArrayList<>(); }
private Event createEvent(String eventType) { DocumentEvent doc = (DocumentEvent)SmilMediaElementImpl.this.getOwnerDocument(); Event event = doc.createEvent("Event"); event.initEvent(eventType, false, false); if (LOCAL_LOGV) Log.v(TAG, "Dispatching 'begin' event to " + SmilMediaElementImpl.this.getTagName() + " " + SmilMediaElementImpl.this.getSrc() + " at " + System.currentTimeMillis()); return event; }
private Event createEvent(String eventType, int seekTo) { DocumentEvent doc = (DocumentEvent)SmilMediaElementImpl.this.getOwnerDocument(); EventImpl event = (EventImpl) doc.createEvent("Event"); event.initEvent(eventType, false, false, seekTo); if (LOCAL_LOGV) Log.v(TAG, "Dispatching 'begin' event to " + SmilMediaElementImpl.this.getTagName() + " " + SmilMediaElementImpl.this.getSrc() + " at " + System.currentTimeMillis()); return event; }