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


Java MutationEventImpl类代码示例

本文整理汇总了Java中org.apache.xerces.dom.events.MutationEventImpl的典型用法代码示例。如果您正苦于以下问题:Java MutationEventImpl类的具体用法?Java MutationEventImpl怎么用?Java MutationEventImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MutationEventImpl类属于org.apache.xerces.dom.events包,在下文中一共展示了MutationEventImpl类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkContextNode

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
protected void checkContextNode(Node contextNode) {
	if (shouldReset(contextNode)) {
		// reset the cache
		xpathApi = new CachedXPathAPI();
		resetCache();
		Document doc = contextNode instanceof Document ? (Document) contextNode : contextNode.getOwnerDocument();
		if (doc instanceof DocumentImpl) {
			lastDocument = (DocumentImpl) doc;
			lastDocument.addEventListener(MutationEventImpl.DOM_SUBTREE_MODIFIED, this, false);
			lastDocument.addEventListener(MutationEventImpl.DOM_NODE_INSERTED, this, false);
			lastDocument.addEventListener(MutationEventImpl.DOM_NODE_REMOVED, this, false);
			lastDocument.addEventListener(MutationEventImpl.DOM_ATTR_MODIFIED, this, false);
			lastDocument.addEventListener(MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED, this, false);
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:17,代码来源:TwsCachedXPathAPI.java

示例2: createEvent

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
/**
 * Introduced in DOM Level 2. Optional. <p>
 * Create and return Event objects.
 *
 * @param type The eventType parameter specifies the type of Event
 * interface to be created.  If the Event interface specified is supported
 * by the implementation this method will return a new Event of the
 * interface type requested. If the Event is to be dispatched via the
 * dispatchEvent method the appropriate event init method must be called
 * after creation in order to initialize the Event's values.  As an
 * example, a user wishing to synthesize some kind of Event would call
 * createEvent with the parameter "Events". The initEvent method could then
 * be called on the newly created Event to set the specific type of Event
 * to be dispatched and set its context information.
 * @return Newly created Event
 * @exception DOMException NOT_SUPPORTED_ERR: Raised if the implementation
 * does not support the type of Event interface requested
 * @since WD-DOM-Level-2-19990923
 */
public Event createEvent(String type) throws DOMException {
    if (type.equalsIgnoreCase("Events") || 
            "Event".equals(type)) {
        return new EventImpl();
    }
    else if (type.equalsIgnoreCase("MutationEvents") ||
            "MutationEvent".equals(type)) {
        return new MutationEventImpl();
    }
    else if (type.equalsIgnoreCase("UIEvents") ||
            "UIEvent".equals(type)) {
        return new UIEventImpl();
    }
    else if (type.equalsIgnoreCase("MouseEvents") ||
            "MouseEvent".equals(type)) {
        return new MouseEventImpl();
    }
    else {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null);
        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:42,代码来源:DocumentImpl.java

示例3: mutationEventsModifiedCharacterData

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
private void mutationEventsModifiedCharacterData(NodeImpl node, String oldvalue, String value, boolean replace) {
    if (!replace) {
        // MUTATION POST-EVENTS:
        LCount lc =
            LCount.lookup(MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED);
        if (lc.total > 0) {
            MutationEvent me = new MutationEventImpl();
            me.initMutationEvent(
                            MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED,
                                true, false, null,
                                oldvalue, value, null, (short) 0);
            dispatchEvent(node, me);
        }
    
        // Subroutine: Transmit DOMAttrModified and DOMSubtreeModified,
        // if required. (Common to most kinds of mutation)
        dispatchAggregateEvents(node, savedEnclosingAttr);
    } // End mutation postprocessing
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:DocumentImpl.java

示例4: mutationEventsRemovedAttrNode

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
private void mutationEventsRemovedAttrNode(AttrImpl attr, NodeImpl oldOwner, String name) {
    // If we have to send DOMAttrModified (determined earlier),
    // do so.
    LCount lc = LCount.lookup(MutationEventImpl.DOM_ATTR_MODIFIED);
    if (lc.total > 0) {
        MutationEventImpl me= new MutationEventImpl();
        me.initMutationEvent(MutationEventImpl.DOM_ATTR_MODIFIED,
                             true, false, attr,
                             attr.getNodeValue(), null, name,
                             MutationEvent.REMOVAL);
        dispatchEvent(oldOwner, me);
    }

    // We can hand off to process DOMSubtreeModified, though.
    // Note that only the Element needs to be informed; the
    // Attr's subtree has not been changed by this operation.
    dispatchAggregateEvents(oldOwner, null, null, (short) 0);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:19,代码来源:DocumentImpl.java

示例5: resetCache

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
public void resetCache() {
	if (lastDocument != null) {
		lastDocument.removeEventListener(MutationEventImpl.DOM_SUBTREE_MODIFIED, this, false);
		lastDocument.removeEventListener(MutationEventImpl.DOM_NODE_INSERTED, this, false);
		lastDocument.removeEventListener(MutationEventImpl.DOM_NODE_REMOVED, this, false);
		lastDocument.removeEventListener(MutationEventImpl.DOM_ATTR_MODIFIED, this, false);
		lastDocument.removeEventListener(MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED, this, false);
		lastDocument = null;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:11,代码来源:TwsCachedXPathAPI.java

示例6: saveEnclosingAttr

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
/**
 * NON-DOM INTERNAL: Pre-mutation context check, in
 * preparation for later generating DOMAttrModified events.
 * Determines whether this node is within an Attr
 * @param node node to get enclosing attribute for
 */
protected void saveEnclosingAttr(NodeImpl node) {
    savedEnclosingAttr = null;
    // MUTATION PREPROCESSING AND PRE-EVENTS:
    // If we're within the scope of an Attr and DOMAttrModified 
    // was requested, we need to preserve its previous value for
    // that event.
    LCount lc = LCount.lookup(MutationEventImpl.DOM_ATTR_MODIFIED);
    if (lc.total > 0) {
        NodeImpl eventAncestor = node;
        while (true) {
            if (eventAncestor == null)
                return;
            int type = eventAncestor.getNodeType();
            if (type == Node.ATTRIBUTE_NODE) {
                EnclosingAttr retval = new EnclosingAttr();
                retval.node = (AttrImpl) eventAncestor;
                retval.oldvalue = retval.node.getNodeValue();
                savedEnclosingAttr = retval;
                return;
            }
            else if (type == Node.ENTITY_REFERENCE_NODE)
                eventAncestor = eventAncestor.parentNode();
            else if (type == Node.TEXT_NODE)
                eventAncestor = eventAncestor.parentNode();
            else
                return;
            // Any other parent means we're not in an Attr
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:37,代码来源:DocumentImpl.java

示例7: Html5DocumentImpl

import org.apache.xerces.dom.events.MutationEventImpl; //导入依赖的package包/类
/**
 * Constructs new instance of the HTML Document according to Html5 specification.
 * 
 * @param browsingContext Associated browsing context to which belongs this instance of the Document.
 * @param address Address of the Document.
 * @param sandboxingFlagSet Sandboxing flag set associated with the document.
 * @param referrer Referrer address.
 * @param createWindow Window of which instance is re-used for this Document.
 * @param contentType Content-Type of which is this Document.
 * @param parser Associated parser, which will parse, or parsed, or is parsing this Document.
 * 
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/dom.html#document">HTML5 document</a>
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/dom.html#the-document%27s-address">The document's address</a>
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/dom.html#the-document%27s-referrer">The document's referrer</a>
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing-flag-set">A sandboxing flag set </a>
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/syntax.html#html-parser">HTML parser</a>
 * @see <a href="http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#concept-document-content-type">Content type</a>
 */
protected Html5DocumentImpl(BrowsingContext browsingContext, URL address, Set<SandboxingFlag> sandboxingFlagSet, String referrer, boolean createWindow, String contentType, Html5DocumentParser parser) {	
	listeners = new HashSet<Html5DocumentEventListener>();
	
	_salvageableFlag = true;
	_firedUnloadFlag = false;
	_pageShowingFlag = false;
	_ignoreDestructiveWritesCounter = 0;
	
	_browsingContext = browsingContext;
	_address = address;
	_referrer = referrer;
	_contentType = contentType;
	_documentReadiness = (parser == null)? DocumentReadyState.COMPLETE : DocumentReadyState.LOADING;
	_activeSandboxingFlagSet = new HashSet<SandboxingFlag>();
	_parser = parser;
	
	if (sandboxingFlagSet != null) {
		_activeSandboxingFlagSet.addAll(sandboxingFlagSet);
	}
	
	DocumentOrigin documentOrigin = null;
	DocumentOrigin effectiveScriptOrigin = null;
	
	if (_activeSandboxingFlagSet.contains(SandboxingFlag.ORIGIN_BROWSING_CONTEXT_FLAG)) {
		documentOrigin = DocumentOrigin.createUnique(this);
		effectiveScriptOrigin = DocumentOrigin.create(this, documentOrigin);
	} else if (address != null && (SERVER_BASED_SCHEMES.contains(address.getProtocol()) || address.getProtocol().equals(JAVASCRIPT_SCHEME_NAME))) {
		UrlOrigin addressOrigin = new UrlOrigin(address);
		documentOrigin = DocumentOrigin.create(this, addressOrigin);
		effectiveScriptOrigin = DocumentOrigin.create(this, documentOrigin);
	} else if (address != null && address.getProtocol().equals(DATA_SCHEME_NAME)) {
		// TODO: If a Document was generated from a data: URL found in another Document or in a script
	} else if (address != null && address.equals(DEFAULT_URL)) {
		Html5DocumentImpl creatorDocument = browsingContext.getCreatorDocument();
		if (creatorDocument != null) {
			OriginContainer<?> originContainer = creatorDocument.getOriginContainer();
			documentOrigin = DocumentOrigin.create(this, originContainer.getOrigin());
			effectiveScriptOrigin = DocumentOrigin.create(this, originContainer.getEffectiveScriptOrigin());
		} else {
			documentOrigin = DocumentOrigin.createUnique(this);
			effectiveScriptOrigin = DocumentOrigin.create(this, documentOrigin);
		}
	} 
	/*
	 * TODO:
	 * else if a Document is an iframe srcdoc document
	 * else if a Document was obtained in some other manner
	 */

	_originContainer = new OriginContainer<DocumentOrigin>(documentOrigin, effectiveScriptOrigin);
	
	if (_browsingContext != null) {
		if (createWindow) {
			_window = new Window(this);
		}
		
		_history = new History(this);
		_location = new Location(this);
	}
			
	addEventListener(MutationEventImpl.DOM_NODE_INSERTED, documentEventListener);
	addEventListener(MutationEventImpl.DOM_ATTR_MODIFIED, documentEventListener);
}
 
开发者ID:ITman1,项目名称:ScriptBox,代码行数:82,代码来源:Html5DocumentImpl.java


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