Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JBrowser Source Code Files
JBrowser Source Code Files are provided in the
source package file.
You can download JBrowser source package as described in the previous tutorial and go to the "src" sub-folder to view Source Code files.
You can also browse JBrowser Source Code files below:
✍: FYIcenter
⏎ ru/atomation/jbrowser/impl/ContextMenuObject.java
package ru.atomation.jbrowser.impl;
import java.net.MalformedURLException;
import java.net.URL;
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import ru.atomation.jbrowser.interfaces.BrowserClipboardManager;
import ru.atomation.jbrowser.interfaces.ContextMenuFlags.ContextMenuFlag;
public class ContextMenuObject {
private final ContextMenuFlag contextMenuFlag;
private final JBrowserComponent<?> browser;
private final BrowserClipboardManager browserClipboardManager;
private boolean link;
private String linkUrl;
private int absoluteX;
private int absoluteY;
public ContextMenuObject(JBrowserComponent<?> browser, ContextMenuFlag contextMenuFlag,
BrowserClipboardManager browserClipboardManager, nsIDOMEvent aEvent,
nsIDOMNode aNode) {
super();
this.browser = browser;
this.contextMenuFlag = contextMenuFlag;
this.browserClipboardManager = browserClipboardManager;
getXY(aEvent);
checkForLink(aNode);
}
private void getXY(nsIDOMEvent aEvent) {
nsIDOMMouseEvent domMouseEvent = (nsIDOMMouseEvent) aEvent.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
if (domMouseEvent != null) {
absoluteX = domMouseEvent.getScreenX();
absoluteY = domMouseEvent.getScreenY();
} else {
absoluteX = -1;
absoluteY = -1;
}
}
private void checkForLink(nsIDOMNode aNode) {
linkUrl = null;
link = aNode != null && aNode.getNodeName().toLowerCase().equals("a") &&
(contextMenuFlag.equals(ContextMenuFlag.LINK) ||
contextMenuFlag.equals(ContextMenuFlag.IMAGE_LINK));
if (link) {
nsIDOMNamedNodeMap attributes = aNode.getAttributes();
if (attributes != null) {
for (int i=0; i<attributes.getLength(); i++) {
nsIDOMNode item = attributes.item(i);
if ("href".equals(item.getNodeName().toLowerCase())) {
try {
linkUrl = new URL(new URL(browser.getUrl()), item.getNodeValue()).toString();
} catch (MalformedURLException e) {
link = false;
linkUrl = null;
}
return;
}
}
}
link = false;
}
}
public boolean canCopyImageContents() {
if (contextMenuFlag.equals(ContextMenuFlag.IMAGE) || contextMenuFlag.equals(ContextMenuFlag.IMAGE_LINK)) {
return browserClipboardManager.canCopyImageContents();
}
return false;
}
public void copyImageContents() {
browserClipboardManager.copyImageContents();
}
public boolean canCopyImageLocation() {
if (contextMenuFlag.equals(ContextMenuFlag.IMAGE) || contextMenuFlag.equals(ContextMenuFlag.IMAGE_LINK)) {
return browserClipboardManager.canCopyImageLocation();
}
return false;
}
public void copyImageLocation() {
browserClipboardManager.copyImageLocation();
}
public boolean canCopyLinkLocation() {
if (contextMenuFlag.equals(ContextMenuFlag.LINK) || contextMenuFlag.equals(ContextMenuFlag.IMAGE_LINK)) {
return browserClipboardManager.canCopyLinkLocation();
}
return false;
}
public void copyLinkLocation() {
browserClipboardManager.copyLinkLocation();
}
public boolean canCopySelection() {
return browserClipboardManager.canCopySelection();
}
public void copySelection() {
browserClipboardManager.copySelection();
}
public boolean canCutSelection() {
return browserClipboardManager.canCutSelection();
}
public void cutSelection() {
browserClipboardManager.cutSelection();
}
public boolean canPaste() {
return browserClipboardManager.canPaste();
}
public void paste() {
browserClipboardManager.paste();
}
@Override
public String toString() {
return
"canCopyImageContents#" +
canCopyImageContents()+
"\ncanCopyImageLocation#"+
canCopyImageLocation()+
"\ncanCopyLinkLocation#"+
canCopyLinkLocation()+
"\ncanCopySelection#"+
canCopySelection()+
"\ncanCutSelection()#"+
canCutSelection()+
"\ncanPaste#"+
canPaste();
}
public ContextMenuFlag getContextMenuFlag() {
return contextMenuFlag;
}
public boolean hasLink() {
return link;
}
public String getLinkUrl() {
return linkUrl;
}
public int getAbsoluteX() {
return absoluteX;
}
public int getAbsoluteY() {
return absoluteY;
}
}
⏎ ru/atomation/jbrowser/impl/ContextMenuObject.java
Or download all of them as a single archive file:
File name: jbrowser-1.9-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇐ Download and Install JBrowser Source Package
2017-07-17, ≈26🔥, 1💬
Popular Posts:
jTDS JDBC Driver Source Code Files are provided in the source package file, jtds-1.3.1-fyi.zip. You ...
JDK 17 jdk.jdeps.jmod is the JMOD file for JDK 17 JDeps tool, which can be invoked by the "jdeps" co...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
Where to get the Java source code for Connector/J 8.0 Protocol Impl module? Java source code files f...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....