Initial checkin of Java Util classes and the Java Wrapper to WebShell

Util docs:  http://www.mozilla.org/projects/blackwood/java-util/
Java Wrapper to WebShell docs: http://www.mozilla.org/projects/blackwood/webclient/


git-svn-id: svn://10.0.0.236/trunk@41569 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
1999-07-30 01:03:12 +00:00
parent cab1eacb84
commit 186006f8a6
34 changed files with 6956 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are Copyright (C) 1999 Sun
# Microsystems, Inc. All Rights Reserved.
DEPTH=..\..\..
IGNORE_MANIFEST=1
MAKE_OBJ_TYPE = DLL
DLLNAME = webclient
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MODULE=webclient
OBJS = \
.\$(OBJDIR)\nsActions.obj \
.\$(OBJDIR)\BrowserControlMozillaShim.obj \
$(NULL)
LINCS = \
$(NULL)
LCFLAGS = \
$(NULL)
LLIBS = \
$(DIST)\lib\raptorweb.lib \
$(DIST)\lib\raptorbasewidget_s.lib \
$(DIST)\lib\raptorwidget.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\raptorgfxwin.lib \
$(DIST)\lib\nsreg.lib \
$(DIST)\lib\netlib.lib \
$(DIST)\lib\nspr3.lib \
$(DIST)\lib\plds3.lib \
$(DEPTH)\xpfe\bootstrap\WIN32_D.OBJ\nsSetupRegistry.obj \
$(NULL)
# $(DIST)\lib\raptorbase.lib \
# $(DIST)\lib\xpcom32.lib\
# $(DIST)\lib\xpcomds_s.lib\
WIN_LIBS = \
version.lib
include <$(DEPTH)\config\rules.mak>
include <..\config\localdefs.mak>
!CMDSWITCHES -S
# generate the jni header
export:: BrowserControlMozillaShim.h
BrowserControlMozillaShim.h:
@echo Assuming class org.mozilla.webclient.BrowserControlMozillaShim is in $(JAVAH_FLAGS)
$(JAVAH) $(JAVAH_FLAGS) -o $@ org.mozilla.webclient.BrowserControlMozillaShim
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
@echo +++ Creating .\$(OBJDIR)\runem.bat. Use this to run the test browser.
@echo $(JAVA) -Djava.library.path=$(MOZ_SRC)\mozilla\dist\WIN32_D.OBJ\bin -classpath $(JAVAC_CLASSPATH) org.mozilla.webclient.test.EmbeddedMozilla %1% > .\$(OBJDIR)\runem.bat
clobber_all:: clobber
clobber::
rm -f $(DIST)\bin\$(DLLNAME).dll
rm -f BrowserControlMozillaShim.h
rm -f .\$(OBJDIR)\runem.bat

View File

@@ -0,0 +1,589 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The original code is RaptorCanvas
*
* The Initial Developer of the Original Code is Kirk Baker <kbaker@eb.com> and * Ian Wilkinson <iw@ennoble.com
*/
/*
* nsActions.cpp
*/
#include "nsActions.h"
void * handleEvent (PLEvent * event);
void destroyEvent (PLEvent * event);
void *
handleEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
void * result = nsnull;
if (actionEvent != NULL) {
actionEvent->setResult(result = actionEvent->handleEvent());
actionEvent->setComplete(PR_TRUE);
}
return result;
} // handleEvent()
void
destroyEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
if (actionEvent != NULL) {
if (!actionEvent->isSynchronous()) {
// Only delete if non-synchronous. Synchronous events are deleted by the event poster.
actionEvent->destroyEvent();
}
}
} // destroyEvent()
/*
* nsActionEvent
*/
nsActionEvent::nsActionEvent (PRBool synchronous)
{
PL_InitEvent(&mEvent, this,
(PLHandleEventProc ) ::handleEvent,
(PLDestroyEventProc) ::destroyEvent);
mSynchronous = synchronous;
mComplete = PR_FALSE;
mResult = nsnull;
}
PRBool
nsActionEvent::isComplete (void)
{
if (mSynchronous) {
return mComplete;
}
else {
return PR_TRUE;
}
} // isComplete()
/*
* wsResizeEvent
*/
wsResizeEvent::wsResizeEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mLeft(x),
mBottom(y),
mWidth(w),
mHeight(h)
{
}
void *
wsResizeEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(resize) x = %d y = %d w = %d h = %d\n", mLeft, mBottom, mWidth, mHeight);
nsresult rv = mWebShell->SetBounds(mLeft, mBottom, mWidth, mHeight);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsLoadURLEvent
*/
wsLoadURLEvent::wsLoadURLEvent(nsIWebShell* webShell, PRUnichar * urlString) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mURL(nsnull)
{
mURL = new nsString1(urlString);
}
void *
wsLoadURLEvent::handleEvent ()
{
if (mWebShell && mURL) {
printf("handleEvent(loadURL)\n");
nsresult rv = mWebShell->LoadURL(mURL->GetUnicode());
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
wsLoadURLEvent::~wsLoadURLEvent ()
{
if (mURL != nsnull)
delete mURL;
}
/*
* wsStopEvent
*/
wsStopEvent::wsStopEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
{
}
void *
wsStopEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Stop)\n");
nsresult rv = mWebShell->Stop();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsShowEvent
*/
wsShowEvent::wsShowEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
{
}
void *
wsShowEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Show)\n");
nsresult rv = mWebShell->Show();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsHideEvent
*/
wsHideEvent::wsHideEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
{
}
void *
wsHideEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Hide)\n");
nsresult rv = mWebShell->Hide();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsMoveToEvent
*/
wsMoveToEvent::wsMoveToEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mX(x),
mY(y)
{
}
void *
wsMoveToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(MoveTo(%ld, %ld)\n", mX, mY);
nsresult rv = mWebShell->MoveTo(mX, mY);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsSetFocusEvent
*/
wsSetFocusEvent::wsSetFocusEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
{
}
void *
wsSetFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(SetFocus()\n");
nsresult rv = mWebShell->SetFocus();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsRemoveFocusEvent
*/
wsRemoveFocusEvent::wsRemoveFocusEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
{
}
void *
wsRemoveFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(RemoveFocus()\n");
nsresult rv = mWebShell->RemoveFocus();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsRepaintEvent
*/
wsRepaintEvent::wsRepaintEvent(nsIWebShell* webShell, PRBool forceRepaint) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mForceRepaint(forceRepaint)
{
}
void *
wsRepaintEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Repaint(%d)\n", mForceRepaint);
nsresult rv = mWebShell->Repaint(mForceRepaint);
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
/*
* wsCanBackEvent
*/
wsCanBackEvent::wsCanBackEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsCanBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanBack()\n");
nsresult rv = mWebShell->CanBack();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsCanForwardEvent
*/
wsCanForwardEvent::wsCanForwardEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsCanForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanForward()\n");
nsresult rv = mWebShell->CanForward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsBackEvent
*/
wsBackEvent::wsBackEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Back()\n");
nsresult rv = mWebShell->Back();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsForwardEvent
*/
wsForwardEvent::wsForwardEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Forward()\n");
nsresult rv = mWebShell->Forward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsGoToEvent
*/
wsGoToEvent::wsGoToEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(PR_TRUE),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
void *
wsGoToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(GoTo(%ld)\n", mHistoryIndex);
nsresult rv = mWebShell->GoTo(mHistoryIndex);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
} // handleEvent()
/*
* wsGetHistoryLengthEvent
*/
wsGetHistoryLengthEvent::wsGetHistoryLengthEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsGetHistoryLengthEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryLengthEvent()\n");
PRInt32 historyLength = 0;
nsresult rv = mWebShell->GetHistoryLength(historyLength);
printf("result = %lx\n", rv);
return (void *) historyLength;
}
return NULL;
} // handleEvent()
/*
* wsGetHistoryIndexEvent
*/
wsGetHistoryIndexEvent::wsGetHistoryIndexEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
{
}
void *
wsGetHistoryIndexEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryIndexEvent()\n");
PRInt32 historyIndex = 0;
nsresult rv = mWebShell->GetHistoryIndex(historyIndex);
printf("result = %lx\n", rv);
return (void *) historyIndex;
}
return NULL;
} // handleEvent()
/*
* wsGetURLEvent
*/
wsGetURLEvent::wsGetURLEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(PR_TRUE),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
void *
wsGetURLEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetURLEvent(%ld)\n", mHistoryIndex);
const PRUnichar * url = nsnull;
// returns PRUninchar * URL in <url>. No need to delete. References internal buffer of an nsString
nsresult rv = mWebShell->GetURL(mHistoryIndex, &url);
printf("result = %lx, url = %lx\n", rv, url);
return (void *) url;
}
return NULL;
} // handleEvent()
// EOF

View File

@@ -0,0 +1,251 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The original code is RaptorCanvas
*
* The Initial Developer of the Original Code is Kirk Baker <kbaker@eb.com> and * Ian Wilkinson <iw@ennoble.com
*/
/*
* nsActions.h
*/
#ifndef nsActions_h___
#define nsActions_h___
#include <windows.h>
#include "nsIWebShell.h"
#include "nsString.h"
#include "plevent.h"
class nsActionEvent {
public:
nsActionEvent (PRBool synchronous);
virtual ~nsActionEvent () {};
virtual void * handleEvent (void) { return NULL;};
void destroyEvent (void) { delete this; };
operator PLEvent* () { return &mEvent; };
PRBool isSynchronous (void) { return mSynchronous; };
PRBool isComplete (void);
void setComplete (PRBool complete) { mComplete = complete; };
void * getResult (void) { return mResult; };
void setResult (void * result) { mResult = result; };
protected:
PLEvent mEvent;
void * mResult;
PRBool mSynchronous;
PRBool mComplete;
};
class wsResizeEvent : public nsActionEvent {
public:
wsResizeEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mLeft;
PRInt32 mBottom;
PRInt32 mWidth;
PRInt32 mHeight;
};
class wsLoadURLEvent : public nsActionEvent {
public:
wsLoadURLEvent (nsIWebShell* webShell, PRUnichar * urlString);
~wsLoadURLEvent ();
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsString1 * mURL;
};
class wsStopEvent : public nsActionEvent {
public:
wsStopEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsShowEvent : public nsActionEvent {
public:
wsShowEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsHideEvent : public nsActionEvent {
public:
wsHideEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsMoveToEvent : public nsActionEvent {
public:
wsMoveToEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mX;
PRInt32 mY;
};
class wsSetFocusEvent : public nsActionEvent {
public:
wsSetFocusEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsRemoveFocusEvent : public nsActionEvent {
public:
wsRemoveFocusEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsRepaintEvent : public nsActionEvent {
public:
wsRepaintEvent (nsIWebShell* webShell, PRBool forceRepaint);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRBool mForceRepaint;
};
class wsCanBackEvent : public nsActionEvent {
public:
wsCanBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsCanForwardEvent : public nsActionEvent {
public:
wsCanForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsBackEvent : public nsActionEvent {
public:
wsBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsForwardEvent : public nsActionEvent {
public:
wsForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGoToEvent : public nsActionEvent {
public:
wsGoToEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
class wsGetHistoryLengthEvent : public nsActionEvent {
public:
wsGetHistoryLengthEvent
(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGetHistoryIndexEvent : public nsActionEvent {
public:
wsGetHistoryIndexEvent
(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
};
class wsGetURLEvent : public nsActionEvent {
public:
wsGetURLEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
#endif /* nsActions_h___ */
// EOF