/** * <b>DOM</b>: Implements * {@link org.w3c.dom.events.EventTarget#dispatchEvent(Event)}. */ public boolean dispatchEvent(Event evt) throws EventException { if (eventSupport == null) { initializeEventSupport(); } return eventSupport.dispatchEvent(this, evt); }
/** * Creates an EventException. Overrides this method if you need to * create your own RangeException subclass. * @param code the exception code * @param key the resource key * @param args arguments to use when formatting the message */ protected EventException createEventException(short code, String key, Object[] args) { try { AbstractDocument doc = (AbstractDocument) node.getOwnerDocument(); return new EventException(code, doc.formatMessage(key, args)); } catch (Exception e) { return new EventException(code, key); } }
public boolean dispatchEvent(Event evt) throws EventException { return mEventTarget.dispatchEvent(evt); }
public boolean dispatchEvent(Event evt) throws EventException { // We need to use the internal APIs to modify and access the event status EventImpl eventImpl = (EventImpl)evt; if (!eventImpl.isInitialized()) { throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR, "Event not initialized"); } else if ((eventImpl.getType() == null) || eventImpl.getType().equals("")) { throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR, "Unspecified even type"); } // Initialize event status eventImpl.setTarget(mNodeTarget); // TODO: At this point, to support event capturing and bubbling, we should // establish the chain of EventTargets from the top of the tree to this // event's target. // TODO: CAPTURING_PHASE skipped // Handle AT_TARGET // Invoke handleEvent of non-capturing listeners on this EventTarget. eventImpl.setEventPhase(Event.AT_TARGET); eventImpl.setCurrentTarget(mNodeTarget); if (!eventImpl.isPropogationStopped() && (mListenerEntries != null)) { for (int i = 0; i < mListenerEntries.size(); i++) { EventListenerEntry listenerEntry = mListenerEntries.get(i); if (!listenerEntry.mUseCapture && listenerEntry.mType.equals(eventImpl.getType())) { try { listenerEntry.mListener.handleEvent(eventImpl); } catch (Exception e) { // Any exceptions thrown inside an EventListener will // not stop propagation of the event Log.w(TAG, "Catched EventListener exception", e); } } } } if (eventImpl.getBubbles()) { // TODO: BUBBLING_PHASE skipped } return eventImpl.isPreventDefault(); }
/** * This method allows the dispatch of events into the implementation's * event model. The event target of the event is the * <code>EventTarget</code> object on which <code>dispatchEvent</code> * is called. * @param evt The event to be dispatched. * @return Indicates whether any of the listeners which handled the * event called <code>Event.preventDefault()</code>. If * <code>Event.preventDefault()</code> was called the returned value * is <code>false</code>, else it is <code>true</code>. * @exception EventException * UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event.type</code> * was not specified by initializing the event before * <code>dispatchEvent</code> was called. Specification of the * <code>Event.type</code> as <code>null</code> or an empty string * will also trigger this exception. * <br> DISPATCH_REQUEST_ERR: Raised if the <code>Event</code> object is * already being dispatched. * @exception DOMException * NOT_SUPPORTED_ERR: Raised if the <code>Event</code> object has not * been created using <code>DocumentEvent.createEvent()</code>. * <br> INVALID_CHARACTER_ERR: Raised if <code>Event.type</code> is not * an <a href='http://www.w3.org/TR/2004/REC-xml-names11-20040204/#NT-NCName'>NCName</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-names11-20040204/'>XML Namespaces 1.1</a>] * . * @version DOM Level 3 */ boolean dispatchEvent(Event evt) throws EventException, DOMException;
/** * Dispatch event. * * @param arg0 * the arg0 * @return true, if successful * @throws EventException * the event exception */ public boolean dispatchEvent(Event arg0) throws EventException { // TODO Auto-generated method stub return false; }