author=ashuk

Bug=50282,44330,53397
r=a=edburns


git-svn-id: svn://10.0.0.236/trunk@82252 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ashuk%eng.sun.com
2000-11-03 01:27:47 +00:00
parent b3387c11cd
commit 49ef0e6172
4 changed files with 133 additions and 23 deletions

View File

@@ -103,23 +103,18 @@ public void findInPage(String stringToFind, boolean forward, boolean matchCase)
ParameterCheck.nonNull(stringToFind);
myFactory.throwExceptionIfNotInitialized();
/* synchronized(myBrowserControl) {
synchronized(myBrowserControl) {
nativeFindInPage(nativeWebShell, stringToFind, forward, matchCase);
}*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::findInPage is not implemented in Webclient release 0.9\n");
}
}
public void findNextInPage(boolean forward)
{
myFactory.throwExceptionIfNotInitialized();
/* synchronized(myBrowserControl) {
synchronized(myBrowserControl) {
nativeFindNextInPage(nativeWebShell, forward);
}*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::findNextInPage is not implemented in Webclient release 0.9\n");
}
}
public String getCurrentURL()
@@ -216,11 +211,9 @@ public void resetFind()
{
myFactory.throwExceptionIfNotInitialized();
/* synchronized(myBrowserControl) {
synchronized(myBrowserControl) {
nativeResetFind(nativeWebShell);
}*/
throw new UnimplementedException("\nUnimplementedException -----\n API Function CurrentPage::resetFind is not implemented in Webclient release 0.9\n");
}
}
public void selectAll()
@@ -268,7 +261,7 @@ public static void main(String [] args)
Assert.setEnabled(true);
Log.setApplicationName("CurrentPageImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.9 2000-11-02 23:33:12 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.10 2000-11-03 01:26:59 ashuk%eng.sun.com Exp $");
}

View File

@@ -76,7 +76,12 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
}
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_QueryInterface(contentViewer));
rv = contentViewerEdit->CopySelection();
if (initContext->initComplete) {
wsCopySelectionEvent * actionEvent = new wsCopySelectionEvent(contentViewerEdit);
PLEvent * event = (PLEvent*) *actionEvent;
::util_PostEvent(initContext, event);
}
}
@@ -107,8 +112,8 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
if (initContext->docShell != nsnull) {
nsCOMPtr<nsIInterfaceRequestor> interfaceRequestor(do_QueryInterface(initContext->docShell));
nsCOMPtr<nsIURI> url = nsnull;
// PENDING(edburns): commented out for 52883
// rv = initContext->docShell->GetCurrentURI(getter_AddRefs(url));
rv = initContext->webNavigation->GetCurrentURI(getter_AddRefs(url));
if (NS_FAILED(rv) || nsnull == url) {
::util_ThrowExceptionToJava(env, "Exception: NULL URL passed to Find call");
return;
@@ -169,7 +174,12 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
// Pass searchContext to findComponent for the actual find call
PRBool found = PR_TRUE;
findComponent->FindNext(srchcontext, &found);
if (initContext->initComplete) {
wsFindEvent * actionEvent = new wsFindEvent(findComponent, srchcontext);
PLEvent * event = (PLEvent*) *actionEvent;
::util_PostEvent(initContext, event);
}
// Save in initContext struct for future findNextInPage calls
initContext->searchContext = srchcontext;
@@ -212,7 +222,12 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
// Pass searchContext to findComponent for the actual find call
PRBool found = PR_TRUE;
findComponent->FindNext(searchContext, &found);
if (initContext->initComplete) {
wsFindEvent * actionEvent = new wsFindEvent(findComponent, searchContext);
PLEvent * event = (PLEvent*) *actionEvent;
::util_PostEvent(initContext, event);
}
}
@@ -348,8 +363,11 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
initContext->searchContext = nsnull;
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeSelectAll
@@ -369,8 +387,10 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImp
}
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_QueryInterface(contentViewer));
rv = contentViewerEdit->SelectAll();
if (NS_FAILED(rv)) {
::util_ThrowExceptionToJava(env, "Exception: can't do SelectAll through contentViewerEdit");
}
if (initContext->initComplete) {
wsSelectAllEvent * actionEvent = new wsSelectAllEvent(contentViewerEdit);
PLEvent * event = (PLEvent*) *actionEvent;
::util_PostEvent(initContext, event);
}
}

View File

@@ -39,6 +39,9 @@
#include "nsIURI.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebNavigation.h"
#include "nsIFindComponent.h"
#include "nsISearchContext.h"
#include "nsIContentViewerEdit.h"
#include "ns_util.h"
@@ -751,5 +754,65 @@ wsDeallocateInitContextEvent::handleEvent ()
} // handleEvent()
void *
wsFindEvent::handleEvent ()
{
void *result = nsnull;
if (mFindComponent && mSearchContext) {
PRBool found = PR_TRUE;
nsresult rv = mFindComponent->FindNext(mSearchContext, &found);
result = (void *) rv;
}
return result;
}
wsFindEvent::wsFindEvent(nsIFindComponent * findcomponent, nsISearchContext * srchcontext) :
nsActionEvent(),
mFindComponent(findcomponent),
mSearchContext(srchcontext)
{
}
void *
wsSelectAllEvent::handleEvent ()
{
void *result = nsnull;
if (mContentViewerEdit) {
nsresult rv = mContentViewerEdit->SelectAll();
result = (void *) rv;
}
return result;
}
wsSelectAllEvent::wsSelectAllEvent(nsIContentViewerEdit * contentViewerEdit) :
nsActionEvent(),
mContentViewerEdit(contentViewerEdit)
{
}
void *
wsCopySelectionEvent::handleEvent ()
{
void *result = nsnull;
if (mContentViewerEdit) {
nsresult rv = mContentViewerEdit->CopySelection();
result = (void *) rv;
}
return result;
}
wsCopySelectionEvent::wsCopySelectionEvent(nsIContentViewerEdit * contentViewerEdit) :
nsActionEvent(),
mContentViewerEdit(contentViewerEdit)
{
}
// EOF

View File

@@ -41,6 +41,9 @@
#include "nsISHistory.h"
#include "nsIBaseWindow.h"
#include "nsIWebNavigation.h"
#include "nsIFindComponent.h"
#include "nsISearchContext.h"
#include "nsIContentViewerEdit.h"
#include "nsString.h"
#include "plevent.h"
@@ -356,6 +359,37 @@ protected:
WebShellInitContext *mInitContext;
};
class wsFindEvent : public nsActionEvent {
public:
wsFindEvent(nsIFindComponent *findComponent,
nsISearchContext * srchcontext);
void * handleEvent (void);
protected:
nsIFindComponent * mFindComponent;
nsISearchContext * mSearchContext;
};
class wsSelectAllEvent : public nsActionEvent {
public:
wsSelectAllEvent(nsIContentViewerEdit * contentViewerEdit);
void * handleEvent (void);
protected:
nsIContentViewerEdit * mContentViewerEdit;
};
class wsCopySelectionEvent : public nsActionEvent {
public:
wsCopySelectionEvent(nsIContentViewerEdit * contentViewerEdit);
void * handleEvent (void);
protected:
nsIContentViewerEdit * mContentViewerEdit;
};
#endif /* nsActions_h___ */