diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCore.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCore.java index 5cb3e8c92ae..2121e3c8636 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCore.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlCore.java @@ -24,7 +24,7 @@ package org.mozilla.webclient; * BrowserControlCore Defines the core methods for browsing * - * @version $Id: BrowserControlCore.java,v 1.1 1999-07-30 01:03:04 edburns%acm.org Exp $ + * @version $Id: BrowserControlCore.java,v 1.2 1999-09-03 19:28:44 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlExtended @@ -47,6 +47,11 @@ public boolean back() throws Exception; public boolean forward() throws Exception; +// added by Mark Goddard OTMP 9/2/1999 +public boolean refresh() throws Exception; + public int getNativeWebShell(); } // end of interface BrowserControlCore + + diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java index cf1a9ecc2df..c180b0bb8c1 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlImpl.java @@ -31,7 +31,7 @@ import java.awt.Rectangle; * * Lifetime And Scope
* - * @version $Id: BrowserControlImpl.java,v 1.1 1999-07-30 01:03:05 edburns%acm.org Exp $ + * @version $Id: BrowserControlImpl.java,v 1.2 1999-09-03 19:28:44 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControl * @@ -202,6 +202,14 @@ public String getURL (int historyIndex) throws Exception return BrowserControlMozillaShim.webShellGetURL(nativeWebShell, historyIndex); } +/** + * Added by Mark Goddard OTMP 9/2/1999 + */ +public boolean refresh() throws Exception +{ + return BrowserControlMozillaShim.webShellRefresh(nativeWebShell); +} + /** * */ @@ -236,7 +244,7 @@ public static void main(String [] args) // BrowserControlImpl me = new BrowserControlImpl(); Log.setApplicationName("BrowserControlImpl"); Log.setApplicationVersion("0.0"); - Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.1 1999-07-30 01:03:05 edburns%acm.org Exp $"); + Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.2 1999-09-03 19:28:44 edburns%acm.org Exp $"); } diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlMozillaShim.java b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlMozillaShim.java index 4446def5405..9af175199b8 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlMozillaShim.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/BrowserControlMozillaShim.java @@ -38,7 +38,7 @@ import java.awt.*; * There is one instance of this class and all of the exposed methods * are static. - * @version $Id: BrowserControlMozillaShim.java,v 1.2 1999-08-10 03:59:04 mark.lin%eng.sun.com Exp $ + * @version $Id: BrowserControlMozillaShim.java,v 1.3 1999-09-03 19:28:45 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlImpl @@ -485,6 +485,21 @@ public static String webShellGetURL(int webShellPtr, } } +/** + * Added by Mark Goddard OTMP 9/2/1999 + */ + +public static boolean webShellRefresh(int webShellPtr) throws Exception +{ + synchronized(lock) { + if (initialized) { + return instance.nativeWebShellRefresh(webShellPtr); + } + else { + throw new Exception("instance is not initialized."); + } + } +} // // Native interfaces // @@ -553,6 +568,11 @@ private native int nativeWebShellGetHistoryLength (int webShellPtr) throws Exce private native int nativeWebShellGetHistoryIndex (int webShellPtr) throws Exception; private native String nativeWebShellGetURL (int webShellPtr, int aHistoryIndex) throws Exception; +/** + * Added by Mark Goddard OTMP 9/2/1999 + */ +private native boolean nativeWebShellRefresh (int webShellPtr) throws Exception; + // // General Methods // @@ -569,7 +589,7 @@ public static void main(String [] args) BrowserControlMozillaShim me = new BrowserControlMozillaShim(); Log.setApplicationName("BrowserControlMozillaShim"); Log.setApplicationVersion("0.0"); - Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.2 1999-08-10 03:59:04 mark.lin%eng.sun.com Exp $"); + Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.3 1999-09-03 19:28:45 edburns%acm.org Exp $"); } diff --git a/mozilla/java/webclient/classes/org/mozilla/webclient/test/EmbeddedMozilla.java b/mozilla/java/webclient/classes/org/mozilla/webclient/test/EmbeddedMozilla.java index d64816bf789..a58c29149be 100644 --- a/mozilla/java/webclient/classes/org/mozilla/webclient/test/EmbeddedMozilla.java +++ b/mozilla/java/webclient/classes/org/mozilla/webclient/test/EmbeddedMozilla.java @@ -32,7 +32,7 @@ import org.mozilla.webclient.*; * This is a test application for using the BrowserControl. * - * @version $Id: EmbeddedMozilla.java,v 1.1 1999-07-30 01:03:07 edburns%acm.org Exp $ + * @version $Id: EmbeddedMozilla.java,v 1.2 1999-09-03 19:28:45 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlCanvasFactory @@ -85,6 +85,7 @@ public class EmbeddedMozilla extends Frame implements ActionListener { makeItem(buttonsPanel, "Back", 0, 0, 1, 1, 0.0, 0.0); makeItem(buttonsPanel, "Forward", 1, 0, 1, 1, 0.0, 0.0); makeItem(buttonsPanel, "Stop", 2, 0, 1, 1, 0.0, 0.0); + makeItem(buttonsPanel, "Refresh", 3, 0, 1, 1, 0.0, 0.0); // Create the control panel controlPanel = new Panel(); @@ -148,6 +149,9 @@ public class EmbeddedMozilla extends Frame implements ActionListener { else if (command.equals("Stop")) { browserControl.stop(); } + else if (command.equals("Refresh")) { + browserControl.refresh(); + } else { browserControl.loadURL(urlField.getText()); } diff --git a/mozilla/java/webclient/src/BrowserControlMozillaShim.cpp b/mozilla/java/webclient/src/BrowserControlMozillaShim.cpp index ea302e257ca..9f4ee40b1fe 100644 --- a/mozilla/java/webclient/src/BrowserControlMozillaShim.cpp +++ b/mozilla/java/webclient/src/BrowserControlMozillaShim.cpp @@ -1788,6 +1788,41 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL ( return urlString; } // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL() +// added my Mark Goddard OTMP 9/2/1999 +/* + * Class: org_mozilla_webclient_BrowserControlMozillaShim + * Method: nativeWebShellRefresh + * Signature: (I)V + */ +JNIEXPORT jboolean JNICALL + Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRefresh ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + JNIEnv * pEnv = env; + jobject jobj = obj; + void * voidResult = nsnull; + + WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr; + + if (initContext == nsnull) { + ::ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellRefresh"); + return JNI_FALSE; + } + + if (initContext->initComplete) { + wsRefreshEvent * actionEvent = new wsRefreshEvent(initContext->webShell); + PLEvent * event = (PLEvent*) *actionEvent; + + voidResult = ::PostSynchronousEvent(initContext, event); + + return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE; + } + + return JNI_FALSE; +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack() + #ifdef XP_UNIX /* diff --git a/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp b/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp index 980869e8e7e..da0485d8e77 100644 --- a/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp +++ b/mozilla/java/webclient/src/motif/BrowserControlMozillaShimStub.cpp @@ -71,6 +71,8 @@ jboolean (* nativeWebShellGoTo) (JNIEnv *, jobject, jint, jint); jint (* nativeWebShellGetHistoryLength) (JNIEnv *, jobject, jint); jint (* nativeWebShellGetHistoryIndex) (JNIEnv *, jobject, jint); jstring (* nativeWebShellGetURL) (JNIEnv *, jobject, jint, jint); +// added by Mark Goddard OTMP 9/2/1999 +jboolean (* nativeWebShellRefresh)(JNIEnv *, jobject, jint); void (* processNativeEventQueue) (JNIEnv *, jobject, jint); @@ -211,6 +213,13 @@ void locateBrowserControlStubFunctions(void * dll) { if (!nativeWebShellGetURL) { printf("got dlsym error %s\n", dlerror()); } + + // added by Mark Goddard OTMP 9/2/1999 + nativeWebShellRefresh = (jboolean (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRefresh"); + if (!nativeWebShellRefresh) { + printf("got dlsym error %s\n", dlerror()); + } + processNativeEventQueue = (void (*) (JNIEnv *, jobject, jint)) dlsym(dll, "Java_org_mozilla_webclient_motif_MozillaEventThread_processNativeEventQueue"); if (!processNativeEventQueue) { printf("got dlsym error %s\n", dlerror()); @@ -793,6 +802,20 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL ( return (* nativeWebShellGetURL) (env, obj, webShellPtr, historyIndex); } // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL() +// added by Mark Goddard OTMP 9/2/1999 +/* + * Class: MozWebShellMozillaShim + * Method: raptorWebShellRefresh + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRefresh ( + JNIEnv * env, + jobject obj, + jint webShellPtr) +{ + return (* nativeWebShellRefresh) (env, obj, webShellPtr); +} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRefresh() // EOF diff --git a/mozilla/java/webclient/src/nsActions.cpp b/mozilla/java/webclient/src/nsActions.cpp index 3bbebc62ee3..30fd6fa4788 100644 --- a/mozilla/java/webclient/src/nsActions.cpp +++ b/mozilla/java/webclient/src/nsActions.cpp @@ -564,6 +564,35 @@ wsGetURLEvent::handleEvent () return NULL; } // handleEvent() +// Added by Mark Goddard OTMP 9/2/1999 + +/* + * wsRefreshEvent + */ + +wsRefreshEvent::wsRefreshEvent(nsIWebShell* webShell) : + nsActionEvent(), + mWebShell(webShell) +{ +} + + +void * +wsRefreshEvent::handleEvent () +{ + if (mWebShell) { + + printf("handleEvent(Refresh())\n"); + + nsresult rv = mWebShell->Reload(nsIChannel::LOAD_NORMAL); + + printf("result = %lx\n", rv); + + return (void *) rv; + } + return NULL; +} // handleEvent() + // EOF diff --git a/mozilla/java/webclient/src/nsActions.h b/mozilla/java/webclient/src/nsActions.h index d7b0e6cb600..fb956d8fa66 100644 --- a/mozilla/java/webclient/src/nsActions.h +++ b/mozilla/java/webclient/src/nsActions.h @@ -237,6 +237,16 @@ protected: PRInt32 mHistoryIndex; }; +// added by Mark Goddard OTMP 9/2/1999 +class wsRefreshEvent : public nsActionEvent { +public: + wsRefreshEvent (nsIWebShell* webShell); + void * handleEvent (void); + +protected: + nsIWebShell * mWebShell; +}; + #endif /* nsActions_h___ */