本文整理汇总了Java中org.w3c.dom.events.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.w3c.dom.events包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(final Event evt) {
try {
getLock().write(new Runnable() {
public void run() {
Document d = (Document)evt.getCurrentTarget();
Document old = (Document)getValueNonBlocking();
assert old == null || old == d;
logger.log(Level.FINEST, "DomSupport got DOM event {0} on {1}, inIsolatingChange={2}", new Object[] {evt, ph, inIsolatingChange ? Boolean.TRUE : Boolean.FALSE});
if (!inIsolatingChange) {
try {
setDocument(d);
} catch (IOException e) {
assert false : e;
}
} else {
madeIsolatedChanges = true;
}
}
});
} catch (RuntimeException e) {
// Xerces ignores them.
e.printStackTrace();
}
}
示例2: dispatchingEventToSubtree
import org.w3c.dom.events.Event; //导入依赖的package包/类
/**
* Dispatches event to the target node's descendents recursively
*
* @param n node to dispatch to
* @param e event to be sent to that node and its subtree
*/
protected void dispatchingEventToSubtree(Node n, Event e) {
if (n==null)
return;
// ***** Recursive implementation. This is excessively expensive,
// and should be replaced in conjunction with optimization
// mentioned above.
((NodeImpl) n).dispatchEvent(e);
if (n.getNodeType() == Node.ELEMENT_NODE) {
NamedNodeMap a = n.getAttributes();
for (int i = a.getLength() - 1; i >= 0; --i)
dispatchingEventToSubtree(a.item(i), e);
}
dispatchingEventToSubtree(n.getFirstChild(), e);
dispatchingEventToSubtree(n.getNextSibling(), e);
}
示例3: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(final Event evt) {
Runnable runnable = new Runnable() {
public void run() {
MutationEvent mevt = (MutationEvent) evt;
Element targetElement = (Element) mevt.getTarget();
// Repaint the target node
DefaultTreeModel model = (DefaultTreeModel) tree
.getModel();
model.nodeChanged(findNode(tree, targetElement));
attributePanel.updateOnDocumentChange(mevt.getType(),
targetElement);
}
};
refreshGUI(runnable);
registerDocumentChange((MutationEvent) evt);
}
示例4: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(Event evt) {
MutationEvent me = (MutationEvent) evt;
Attr a = (Attr) me.getRelatedNode();
Element e = (Element) evt.getTarget();
if (e instanceof XBLOMContentElement) {
String ans = a.getNamespaceURI();
String aln = a.getLocalName();
if (aln == null) {
aln = a.getNodeName();
}
if (ans == null && XBLConstants.XBL_INCLUDES_ATTRIBUTE.equals(aln)
|| "http://xml.apache.org/batik/ext".equals(ans)
&& "selectorLanguage".equals(aln)) {
selectors.remove(e);
update(false);
}
}
}
示例5: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
/**
* Handles the event.
*/
public void handleEvent(Event evt) {
Node n = (Node) evt.getTarget();
while (n != null && !(n instanceof XBLOMDefinitionElement)) {
n = n.getParentNode();
}
DefinitionRecord defRec
= (DefinitionRecord) definitions.get(n, importElement);
if (defRec == null) {
return;
}
rebind(defRec.namespaceURI, defRec.localName,
document.getDocumentElement());
}
示例6: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(Event e)
{
MutationEvent mutation = (MutationEvent) e;
Node related = mutation.getRelatedNode();
// XXX if it's got children ... check all kids too, they
// will invalidate our saved index
if (related.getNodeType() != Node.ELEMENT_NODE ||
related.getNodeName() != elementName ||
related.getNamespaceURI() != elementURI)
{
return;
}
if (current != null)
current.detach();
current = null;
}
示例7: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(Event evt) {
if (!(evt instanceof AbstractEvent)) return;
final AbstractEvent ae = (AbstractEvent)evt;
List l = ae.getDefaultActions();
if (l != null) {
Iterator i = l.iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof AnchorDefaultActionable)
return; // only one anchor in default list...
}
}
SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
ae.addDefaultAction(new AnchorDefaultActionable
(elt, userAgent, holder));
}
示例8: createDocumentEventSupport
import org.w3c.dom.events.Event; //导入依赖的package包/类
/**
* Creates an DocumentEventSupport object suitable for use with
* this implementation.
*/
public DocumentEventSupport createDocumentEventSupport() {
DocumentEventSupport result = super.createDocumentEventSupport();
result.registerEventFactory("WheelEvent",
new DocumentEventSupport.EventFactory() {
public Event createEvent() {
return new SVGOMWheelEvent();
}
});
result.registerEventFactory("ShadowTreeEvent",
new DocumentEventSupport.EventFactory() {
public Event createEvent() {
return new XBLOMShadowTreeEvent();
}
});
return result;
}
示例9: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
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);
}
示例10: createDocumentEventSupport
import org.w3c.dom.events.Event; //导入依赖的package包/类
/**
* Creates an DocumentEventSupport object suitable for use with
* this implementation.
*/
public DocumentEventSupport createDocumentEventSupport() {
DocumentEventSupport result = new DocumentEventSupport();
result.registerEventFactory("SVGEvents",
new DocumentEventSupport.EventFactory() {
public Event createEvent() {
return new SVGOMEvent();
}
});
result.registerEventFactory("TimeEvent",
new DocumentEventSupport.EventFactory() {
public Event createEvent() {
return new DOMTimeEvent();
}
});
return result;
}
示例11: documentLoadingCompleted
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
NodeEventTarget root
= (NodeEventTarget) e.getSVGDocument().getRootElement();
root.addEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
SVGConstants.SVG_SVGZOOM_EVENT_TYPE,
new EventListener() {
public void handleEvent(Event evt) {
if (!(evt.getTarget() instanceof SVGSVGElement))
return;
// assert(evt.getType() ==
// SVGConstants.SVG_SVGZOOM_EVENT_TYPE);
SVGSVGElement svg = (SVGSVGElement) evt.getTarget();
scaleChange(svg.getCurrentScale());
} // handleEvent()
}, false, null);
}
示例12: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public void handleEvent(Event evt) {
// XXX for some reason, sometimes if refactoring is done while an XML phadhail is
// expanded, some infinite loop occurs and this method is called repeatedly
try {
Element parent = (Element)evt.getCurrentTarget();
if (logger.isLoggable(Level.FINER)) {
logger.log(Level.FINER, "ElementLook: event on {0}: {1}; co={2}", new Object[] {parent.getTagName(), evt, getChildObjects(parent, null)});
}
fireChange(parent, Look.GET_CHILD_OBJECTS | Look.GET_DISPLAY_NAME);
} catch (RuntimeException e) {
e.printStackTrace();
}
}
示例13: handleEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
@Override public void handleEvent(Event event) {
HTMLAnchorElement anchorElement = (HTMLAnchorElement) event.getCurrentTarget();
String href = anchorElement.getHref();
if (Desktop.isDesktopSupported()) {
openLinkInSystemBrowser(href);
} else {
LOGGER.warning("OS does not support desktop operations like browsing. Cannot open link '{" + href + "}'.");
}
event.preventDefault();
}
示例14: createEvent
import org.w3c.dom.events.Event; //导入依赖的package包/类
public Event createEvent(String eventType) throws DOMException {
if ("Event".equals(eventType)) {
return new EventImpl();
} else {
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Not supported interface");
}
}
示例15: beginElement
import org.w3c.dom.events.Event; //导入依赖的package包/类
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;
}