本文整理汇总了Java中org.w3c.dom.events.Event.getCurrentTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getCurrentTarget方法的具体用法?Java Event.getCurrentTarget怎么用?Java Event.getCurrentTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.events.Event
的用法示例。
在下文中一共展示了Event.getCurrentTarget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.w3c.dom.events.Event; //导入方法依赖的package包/类
/**
* 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_REF_ATTRIBUTE)) {
Element defRef = (Element) target;
removeDefinitionRef(defRef);
if (mevt.getNewValue().length() == 0) {
XBLOMDefinitionElement def
= (XBLOMDefinitionElement) defRef;
String ns = def.getElementNamespaceURI();
String ln = def.getElementLocalName();
addDefinition(ns, ln,
(XBLOMDefinitionElement) defRef, null);
} else {
addDefinitionRef(defRef);
}
}
}
示例2: 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));
}
示例3: 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();
}
}
示例4: 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();
}
示例5: handleEvent
import org.w3c.dom.events.Event; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
HTMLAnchorElement anchorElement = (HTMLAnchorElement)event.getCurrentTarget();
String href = anchorElement.getHref();
if (isDesktopSupported()) {
openLinkInSystemBrowser(href);
} else {
Log.warn(APPLICATION, "OS does not support desktop operations like browsing. Cannot open link '"+href+"'!");
}
event.preventDefault();
}
示例6: handleEvent
import org.w3c.dom.events.Event; //导入方法依赖的package包/类
/**
* Runs the script.
*/
public void handleEvent(Event evt) {
Element elt = (Element)evt.getCurrentTarget();
// Evaluate the script
String script = elt.getAttributeNS(null, attribute);
if (script.length() == 0)
return;
DocumentLoader dl = bridgeContext.getDocumentLoader();
SVGDocument d = (SVGDocument)elt.getOwnerDocument();
int line = dl.getLineNumber(elt);
final String desc = Messages.formatMessage
(EVENT_SCRIPT_DESCRIPTION,
new Object [] {d.getURL(), attribute, new Integer(line)});
// Find the scripting language
Element e = elt;
while (e != null &&
(!SVGConstants.SVG_NAMESPACE_URI.equals
(e.getNamespaceURI()) ||
!SVGConstants.SVG_SVG_TAG.equals(e.getLocalName()))) {
e = SVGUtilities.getParentElement(e);
}
if (e == null)
return;
String lang = e.getAttributeNS
(null, SVGConstants.SVG_CONTENT_SCRIPT_TYPE_ATTRIBUTE);
runEventHandler(script, evt, lang, desc);
}
示例7: handleEvent
import org.w3c.dom.events.Event; //导入方法依赖的package包/类
/**
* Runs the script.
*/
public void handleEvent(Event evt) {
Element elt = (Element)evt.getCurrentTarget();
// Evaluate the script
String script = handlerElement.getTextContent();
if (script.length() == 0)
return;
DocumentLoader dl = bridgeContext.getDocumentLoader();
AbstractDocument d
= (AbstractDocument) handlerElement.getOwnerDocument();
int line = dl.getLineNumber(handlerElement);
final String desc = Messages.formatMessage
(HANDLER_SCRIPT_DESCRIPTION,
new Object [] {d.getDocumentURI(),
eventNamespaceURI,
eventType,
new Integer(line)});
// Find the scripting language
String lang = handlerElement.getAttributeNS
(null, SVGConstants.SVG_CONTENT_SCRIPT_TYPE_ATTRIBUTE);
if (lang.length() == 0) {
Element e = elt;
while (e != null &&
(!SVGConstants.SVG_NAMESPACE_URI.equals
(e.getNamespaceURI()) ||
!SVGConstants.SVG_SVG_TAG.equals(e.getLocalName()))) {
e = SVGUtilities.getParentElement(e);
}
if (e == null)
return;
lang = e.getAttributeNS
(null, SVGConstants.SVG_CONTENT_SCRIPT_TYPE_ATTRIBUTE);
}
runEventHandler(script, evt, lang, desc);
}
示例8: handleEvent
import org.w3c.dom.events.Event; //导入方法依赖的package包/类
public void handleEvent(Event evt) {
//
// Only modify the cursor if the current target's (i.e., the <use>) cursor
// property is *not* 'auto'.
//
Element currentTarget = (Element)evt.getCurrentTarget();
if (!CSSUtilities.isAutoCursor(currentTarget)) {
Cursor cursor;
cursor = CSSUtilities.convertCursor(currentTarget, ctx);
if (cursor != null) {
ctx.getUserAgent().setSVGCursor(cursor);
}
}
}