当前位置: 首页>>代码示例>>Java>>正文


Java EventTarget.addEventListener方法代码示例

本文整理汇总了Java中org.w3c.dom.events.EventTarget.addEventListener方法的典型用法代码示例。如果您正苦于以下问题:Java EventTarget.addEventListener方法的具体用法?Java EventTarget.addEventListener怎么用?Java EventTarget.addEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.events.EventTarget的用法示例。


在下文中一共展示了EventTarget.addEventListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DomIterator

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:27,代码来源:DomIterator.java

示例2: DomIterator

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:27,代码来源:DomIterator.java

示例3: changed

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
@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);
        }
    }
}
 
开发者ID:duke-compsci308-fall2015,项目名称:lab_browser,代码行数:27,代码来源:BrowserView.java

示例4: changed

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
@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);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:HyperlinkRedirectListener.java

示例5: changed

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
@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);
        }
    }
}
 
开发者ID:tbressler,项目名称:waterrower-workout,代码行数:13,代码来源:HyperlinkRedirectListener.java

示例6: addEventListeners

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:33,代码来源:CSSEngine.java

示例7: addDomMutationListeners

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * Registers DOM Mutation Listener on the given document.
 *
 * @param doc
 *            The given document
 */
protected void addDomMutationListeners(Document doc) {
    EventTarget target = (EventTarget) doc;
    nodeInsertion = new NodeInsertionHandler();
    target.addEventListener(NODE_INSERTED, nodeInsertion, true);
    nodeRemoval = new NodeRemovalHandler();
    target.addEventListener(NODE_REMOVED, nodeRemoval, true);
    attrModification = new AttributeModificationHandler();
    target.addEventListener(ATTRIBUTE_MODIFIED, attrModification,
            true);
    charDataModification = new CharDataModificationHandler();
    target.addEventListener(CHAR_DATA_MODIFIED,
            charDataModification, true);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:DOMViewer.java

示例8: changed

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
@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);
        }
    }
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:13,代码来源:HyperlinkRedirectListener.java

示例9: addMediaElementEventListeners

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
static void addMediaElementEventListeners(
        EventTarget target, MediaModel media) {
    // To play the media with SmilPlayer, we should add them
    // as EventListener into an EventTarget.
    target.addEventListener(SMIL_MEDIA_START_EVENT, media, false);
    target.addEventListener(SMIL_MEDIA_END_EVENT, media, false);
    target.addEventListener(SMIL_MEDIA_PAUSE_EVENT, media, false);
    target.addEventListener(SMIL_MEDIA_SEEK_EVENT, media, false);
}
 
开发者ID:moezbhatti,项目名称:qksms,代码行数:10,代码来源:SmilHelper.java

示例10: addParElementEventListeners

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
static void addParElementEventListeners(
        EventTarget target, SlideModel slide) {
    // To play the slide with SmilPlayer, we should add it
    // as EventListener into an EventTarget.
    target.addEventListener(SMIL_SLIDE_START_EVENT, slide, false);
    target.addEventListener(SMIL_SLIDE_END_EVENT, slide, false);
}
 
开发者ID:moezbhatti,项目名称:qksms,代码行数:8,代码来源:SmilHelper.java

示例11: enableStop

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * Enable capturing of 'mousemove' and 'mouseup' events.
 */
protected void enableStop() {
  EventTarget targ = svgp.getDocument().getRootElement();
  targ.addEventListener(SVGConstants.SVG_EVENT_MOUSEMOVE, this, false);
  targ.addEventListener(SVGConstants.SVG_EVENT_MOUSEUP, this, false);
  // FIXME: listen on the background object!
  targ.addEventListener(SVGConstants.SVG_EVENT_MOUSEOUT, this, false);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:11,代码来源:DragableArea.java

示例12: addEventListener

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * Add an event listener to the Element.
 *
 * @param tag Element to add the listener
 * @param truedim Tool number for the Element
 */
private void addEventListener(final Element tag, final int truedim) {
  EventTarget targ = (EventTarget) tag;
  targ.addEventListener(SVGConstants.SVG_EVENT_CLICK, new EventListener() {
    @Override
    public void handleEvent(Event evt) {
      proj.toggleDimInverted(truedim);
      context.visChanged(proj);
    }
  }, false);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:17,代码来源:ParallelAxisVisualization.java

示例13: addEventListener

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
/**
 * Add an event listener to the Element
 *
 * @param tag Element to add the listener
 * @param axis Axis number (including hidden axes)
 */
private void addEventListener(final Element tag, final int axis) {
  EventTarget targ = (EventTarget) tag;
  targ.addEventListener(SVGConstants.SVG_EVENT_CLICK, new EventListener() {
    @Override
    public void handleEvent(Event evt) {
      if(proj.getVisibleDimensions() > 2) {
        proj.toggleAxisVisible(axis);
        context.visChanged(proj);
      }
    }
  }, false);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:19,代码来源:AxisVisibilityVisualization.java

示例14: fullRedraw

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
@Override
public void fullRedraw() {
  setupCanvas();
  setupCSS(svgp);
  final StyleLibrary style = context.getStyleLibrary();
  double dotsize = style.getLineWidth(StyleLibrary.PLOT);

  for(DBIDIter id = sample.getSample().iter(); id.valid(); id.advance()) {
    double[] v = proj.fastProjectDataToRenderSpace(rel.get(id));
    if(v[0] != v[0] || v[1] != v[1]) {
      continue; // NaN!
    }
    Element tooltip = makeTooltip(id, v[0], v[1], dotsize);
    SVGUtil.addCSSClass(tooltip, TOOLTIP_HIDDEN);

    // sensitive area.
    Element area = svgp.svgRect(v[0] - dotsize, v[1] - dotsize, 2 * dotsize, 2 * dotsize);
    SVGUtil.addCSSClass(area, TOOLTIP_AREA);

    EventTarget targ = (EventTarget) area;
    targ.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, hoverer, false);
    targ.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, hoverer, false);
    targ.addEventListener(SVGConstants.SVG_CLICK_EVENT_TYPE, hoverer, false);

    // NOTE: do not change the sequence in which these are inserted!
    layer.appendChild(area);
    layer.appendChild(tooltip);
  }
}
 
开发者ID:elki-project,项目名称:elki,代码行数:30,代码来源:AbstractTooltipVisualization.java

示例15: attachTo

import org.w3c.dom.events.EventTarget; //导入方法依赖的package包/类
protected void attachTo(Element e) {
    EventTarget et = (EventTarget) e;
    // Node{Inserted,Removed} is fired *before* the change. This is better;
    // fired *after* it has taken effect.
    et.addEventListener("DOMSubtreeModified", this, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ElementLook.java


注:本文中的org.w3c.dom.events.EventTarget.addEventListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。