org.w3c.dom.events.Event类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中org.w3c.dom.events.Event类的一些代码示例,展示了Event类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event类的具体详情如下:
包路径:org.w3c.dom.events.Event
类名称:Event

Event介绍

[英]The Event interface is used to provide contextual information about an event to the handler processing the event. An object which implements the Event interface is generally passed as the first parameter to an event handler. More specific context information is passed to event handlers by deriving additional interfaces from Event which contain information directly relating to the type of event they accompany. These derived interfaces are also implemented by the object passed to the event listener.

See also the Document Object Model (DOM) Level 2 Events Specification.
[中]Event接口用于向处理事件的处理程序提供有关事件的上下文信息。实现Event接口的对象通常作为第一个参数传递给事件处理程序。更具体的上下文信息通过从Event派生其他接口传递给事件处理程序,这些接口包含与它们伴随的事件类型直接相关的信息。这些派生接口也由传递给事件侦听器的对象实现。
另见Document Object Model (DOM) Level 2 Events Specification

代码示例

代码示例来源:origin: xalan/xalan

/**
 * @see org.w3c.dom.events.EventListener#handleEvent(Event)
 */
public void handleEvent(Event event) {
  
  if (event.getType().equals("DOMSubtreeModified")) {
    // invalidate the iterator
    m_isInvalidIteratorState = true;
    
    // deregister as a listener to reduce computational load
    removeEventListener();
  }
}

代码示例来源:origin: org.apache.xmlgraphics/batik-bridge

public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMContentElement) {
      removedNode = (Node) evt.getTarget();
    }
  }
}

代码示例来源:origin: stackoverflow.com

public void handleEvent(Event evt) {
  Element target = (Element)evt.getCurrentTarget();
  ...
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

/**
 * Handle the hover events.
 *
 * @param evt Event.
 */
protected void handleHoverEvent(Event evt) {
 if(evt.getTarget() instanceof Element) {
  Element e = (Element) evt.getTarget();
  Node next = e.getNextSibling();
  if(next instanceof Element) {
   toggleTooltip((Element) next, evt.getType());
  }
  else {
   LoggingUtil.warning("Tooltip sibling not found.");
  }
 }
 else {
  LoggingUtil.warning("Got event for non-Element?!?");
 }
}

代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.rt.svg.client

@Override
public void handleEvent(Event evt) {
 if (matchLastToolTipEvent(evt.getTimeStamp(), evt.getTarget())) {
  return;
 setLastToolTipEvent(evt.getTimeStamp(), evt.getTarget());
 EventTarget prvLastTarget = lastTarget;
 if (SVGConstants.SVG_EVENT_MOUSEOVER.equals(evt.getType())) {
  lastTarget = evt.getTarget();
 else if (SVGConstants.SVG_EVENT_MOUSEOUT.equals(evt.getType())) {
  MouseEvent e = ((MouseEvent) evt);
  lastTarget = e.getRelatedTarget();

代码示例来源:origin: elki-project/elki

@Override
public void handleEvent(Event evt) {
 if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEDOWN)) {
  SVGPoint dragPoint = getCoordinates(evt);
  if (startDrag(dragPoint, evt)) {
   enableStop();
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEMOVE)) {
  if (startDragPoint != null) {
   SVGPoint dragPoint = getCoordinates(evt);
   if (!duringDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEUP)) {
  if (startDragPoint != null) {
   SVGPoint dragPoint = getCoordinates(evt);
   if (endDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEOUT)) {
  if (startDragPoint != null && evt.getTarget() == evt.getCurrentTarget()) {

代码示例来源:origin: org.apache.xmlgraphics/batik-bridge

/**
   * 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_BINDINGS_ATTRIBUTE)) {
      Element imp = (Element) target;
      removeImport(imp);
      addImport(imp);
    }
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

public void handleEvent(Event evt) {
  if (evt instanceof MouseEvent) {
    MouseEvent mouseEvent = (MouseEvent) evt;
    SVGOMPoint point = SVGUtil.screenToDocument((SVGLocatable)evt.getTarget(),
        new SVGOMPoint(mouseEvent.getClientX(), mouseEvent.getClientY()));
    graphElement.getEventManager().mouseMoved(graphElement, mouseEvent.getButton(),
        mouseEvent.getAltKey(), mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
        (int) point.getX(), (int) point.getY(),
        mouseEvent.getScreenX(), mouseEvent.getScreenY());
    evt.stopPropagation();
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
   * Invoked to resolve an event-like timing specifier into an instance time.
   */
  public void resolve(Event e) {
    float time = owner.getRoot().convertEpochTime(e.getTimeStamp());
    InstanceTime instance = new InstanceTime(this, time + offset, true);
    owner.addInstanceTime(instance, isBegin);
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

public void handleEvent(Event evt) {
    if (isInteractive()) {
      path.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "white");
      evt.stopPropagation();
    }
  }
}, false);

代码示例来源:origin: elki-project/elki

/**
 * Handle the hover events.
 *
 * @param evt Event.
 */
protected void handleHoverEvent(Event evt) {
 if(evt.getTarget() instanceof Element) {
  Element e = (Element) evt.getTarget();
  Node next = e.getNextSibling();
  if(next instanceof Element) {
   toggleTooltip((Element) next, evt.getType());
  }
  else {
   LoggingUtil.warning("Tooltip sibling not found.");
  }
 }
 else {
  LoggingUtil.warning("Got event for non-Element?!?");
 }
}

代码示例来源:origin: apache/batik

if (matchLastToolTipEvent(evt.getTimeStamp(), evt.getTarget())) {
  return;
setLastToolTipEvent(evt.getTimeStamp(), evt.getTarget());
EventTarget prevLastTarget = lastTarget;
if (SVGConstants.SVG_EVENT_MOUSEOVER.equals(evt.getType())) {
  lastTarget = evt.getTarget();
} else if (SVGConstants.SVG_EVENT_MOUSEOUT.equals(evt.getType())) {

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

@Override
public void handleEvent(Event evt) {
 if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEDOWN)) {
  SVGPoint dragPoint = getCoordinates(evt);
  if (startDrag(dragPoint, evt)) {
   enableStop();
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEMOVE)) {
  if (startDragPoint != null) {
   SVGPoint dragPoint = getCoordinates(evt);
   if (!duringDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEUP)) {
  if (startDragPoint != null) {
   SVGPoint dragPoint = getCoordinates(evt);
   if (endDrag(startDragPoint, dragPoint, evt, evt.getTarget() == element)) {
 } else if (evt.getType().equals(SVGConstants.SVG_EVENT_MOUSEOUT)) {
  if (startDragPoint != null && evt.getTarget() == evt.getCurrentTarget()) {

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
   * 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_BINDINGS_ATTRIBUTE)) {
      Element imp = (Element) target;
      removeImport(imp);
      addImport(imp);
    }
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

public void handleEvent(Event evt) {
  if (evt instanceof MouseEvent) {
    MouseEvent mouseEvent = (MouseEvent) evt;
    SVGOMPoint point = SVGUtil.screenToDocument((SVGLocatable)evt.getTarget(),
        new SVGOMPoint(mouseEvent.getClientX(), mouseEvent.getClientY()));
    graphElement.getEventManager().mouseClicked(graphElement, mouseEvent.getButton(),
        mouseEvent.getAltKey(), mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
        (int) point.getX(), (int) point.getY(),
        mouseEvent.getScreenX(), mouseEvent.getScreenY());
    evt.stopPropagation();
  }
}

代码示例来源:origin: org.apache.xmlgraphics/batik-anim

/**
   * Invoked to resolve an event-like timing specifier into an instance time.
   */
  public void resolve(Event e) {
    float time = owner.getRoot().convertEpochTime(e.getTimeStamp());
    InstanceTime instance = new InstanceTime(this, time + offset, true);
    owner.addInstanceTime(instance, isBegin);
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-components/graph-model

public void handleEvent(Event evt) {
    if (isInteractive()) {
      deleteButton.setAttribute(CSSConstants.CSS_VISIBILITY_PROPERTY,
          CSSConstants.CSS_VISIBLE_VALUE);
      path.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "red");
      evt.stopPropagation();
    }
  }
}, false);

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public void handleEvent(Event evt) {
    EventTarget target = evt.getTarget();
    if (target instanceof XBLOMContentElement) {
      removedNode = (Node) evt.getTarget();
    }
  }
}

代码示例来源:origin: org.wso2.wsdl.validator/wsdl-validator

if (mutationEvent.getTarget() instanceof Node)
 Node node = (Node)mutationEvent.getTarget();
 while (node.getNodeType() != Node.ELEMENT_NODE)
  if (listener != null)
   if (event.getType().equals("DOMNodeRemoved")) //$NON-NLS-1$
    deletionNode = (Node)event.getTarget();

代码示例来源:origin: org.apache.xmlgraphics/batik-swing

if (matchLastToolTipEvent(evt.getTimeStamp(), evt.getTarget())) {
  return;
setLastToolTipEvent(evt.getTimeStamp(), evt.getTarget());
EventTarget prevLastTarget = lastTarget;
if (SVGConstants.SVG_EVENT_MOUSEOVER.equals(evt.getType())) {
  lastTarget = evt.getTarget();
} else if (SVGConstants.SVG_EVENT_MOUSEOUT.equals(evt.getType())) {

相关文章