Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/JBrowserProgressListener.java
/** * No restrictions for this source. * * Author: CA>>> * Site: atomation.ru * Mail: Sashusik_EntXXI@Mail.ru */ package ru.atomation.jbrowser.impl; import static org.mozilla.browser.XPCOMUtils.qi; import javax.swing.SwingUtilities; import org.mozilla.browser.MozillaExecutor; import org.mozilla.interfaces.nsIDOMWindow; import org.mozilla.interfaces.nsIDOMWindowInternal; import org.mozilla.interfaces.nsIRequest; import org.mozilla.interfaces.nsISupports; import org.mozilla.interfaces.nsIURI; import org.mozilla.interfaces.nsIWebNavigation; import org.mozilla.interfaces.nsIWebProgress; import org.mozilla.interfaces.nsIWebProgressListener; import org.mozilla.interfaces.nsIWebProgressListener2; import org.mozilla.xpcom.Mozilla; import ru.atomation.jbrowser.interfaces.JBrowserComponentEvents; /** * @see https://developer.mozilla.org/en/nsIWebProgressListener * @author caiiiycuk */ public class JBrowserProgressListener implements nsIWebProgressListener, nsIWebProgressListener2 { protected JBrowserComponent<?> browserComponent; protected JBrowserComponentEvents events; public JBrowserProgressListener(JBrowserComponent<?> browserComponent) { this.browserComponent = browserComponent; if (!(browserComponent instanceof JBrowserComponentEvents)) { throw new IllegalStateException("JBrowserComponent must implements JBrowserComponentEvents interface"); } this.events = (JBrowserComponentEvents) browserComponent; } @Override public void onStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aStateFlags, long aStatus) { assert MozillaExecutor.isMozillaThread(); // if (mozCanvas.webBrowser==null) return; // if we've got the start flag, emit the signal if ((aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) != 0 && (aStateFlags & nsIWebProgressListener.STATE_START) != 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { events.fireEnableStopButton(true); events.fireLoadingStarted(); } }); } if ((aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) != 0 && (aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) { nsIWebNavigation nav = qi(browserComponent.getWebBrowser(), nsIWebNavigation.class); final boolean isFwd = nav.getCanGoForward(); final boolean isBack = nav.getCanGoBack(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { events.fireEnableForwardButton(isFwd); events.fireEnableBackButton(isBack); events.fireEnableStopButton(false); events.fireEnableReloadButton(true); events.fireLoadingEnded(); } }); contentFinishedLoading(); } } @Override public void onLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) { assert MozillaExecutor.isMozillaThread(); final String uri = aLocation.getSpec(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { events.fireSetUrlbarText(uri); } }); } @Override public void onStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aStatus, final String aMessage) { assert MozillaExecutor.isMozillaThread(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { events.fireSetStatus(aMessage); } }); } @Override public void onProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { events.fireProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); } @Override public void onProgressChange64(nsIWebProgress aWebProgress, nsIRequest aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { events.fireProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); } @Override public boolean onRefreshAttempted(nsIWebProgress arg0, nsIURI arg1, int arg2, boolean arg3) { return false; } @Override public void onSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, long aState) { events.fireSecurityChange(aWebProgress, aRequest, aState); } @Override public nsISupports queryInterface(String uuid) { return Mozilla.queryInterface(this, uuid); } protected void contentFinishedLoading() { if (browserComponent.isBrowserExisist()) { // get the content DOM window for that web browser nsIDOMWindow domWindow = browserComponent.getWebBrowser().getContentDOMWindow(); if (domWindow == null) { //NS_WARNING("no dom window in content finished loading\n"); return; } // resize the content domWindow.sizeToContent(); //if the JFrame size if forced in Example15, the content //is not resized to cover the whole window. Force to resize //it with the +1, -1 trick nsIDOMWindowInternal wini = qi(domWindow, nsIDOMWindowInternal.class); wini.resizeBy(1, 0); wini.resizeBy(-1, 0); // and since we're done loading show the window, assuming that the // visibility flag has been set. boolean visibility = browserComponent.getVisibility(); if (visibility) { browserComponent.setVisibility(true); } } } }
⏎ ru/atomation/jbrowser/impl/JBrowserProgressListener.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, 8575👍, 1💬
Popular Posts:
Java Architecture for XML Binding (JAXB) is a Java API that allows Java developers to map Java class...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...
JDK 11 jdk.aot.jmod is the JMOD file for JDK 11 Ahead-of-Time (AOT) Compiler module. JDK 11 AOT Comp...
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...