Added Mark Goddard from OMTP's changes to add "Refresh" to API and implementation.

Also added Refresh button to EmbeddedMozilla.


git-svn-id: svn://10.0.0.236/trunk@45913 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
1999-09-03 19:28:47 +00:00
parent 01b35cfe60
commit 19cc7f8d9d
8 changed files with 140 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ package org.mozilla.webclient;
* <B>BrowserControlCore</B> 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

View File

@@ -31,7 +31,7 @@ import java.awt.Rectangle;
*
* <B>Lifetime And Scope</B> <P>
*
* @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 $");
}

View File

@@ -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 $");
}

View File

@@ -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());
}

View File

@@ -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
/*

View File

@@ -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

View File

@@ -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

View File

@@ -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___ */