Moved to OJI.

Added  AWT support.
Added some classes


git-svn-id: svn://10.0.0.236/trunk@47982 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
1999-09-17 18:41:34 +00:00
parent 0da3025819
commit c3a4459049
27 changed files with 819 additions and 140 deletions

View File

@@ -0,0 +1,73 @@
/*
* 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.
*/
#include "PlugletTagInfo2.h"
jclass PlugletTagInfo2::clazz = NULL;
jmethodID PlugletTagInfo2::initMID = NULL;
void PlugletTagInfo2::Initialize(JNIEnv *env) {
clazz = env->FindClass("org/mozilla/pluglet/mozilla/PlugletTagInfo2Impl");
if (!clazz) {
env->ExceptionDescribe();
return;
}
clazz = (jclass) env->NewGlobalRef(clazz);
initMID = env->GetMethodID(clazz,"<init>","(J)V");
if (!initMID) {
env->ExceptionDescribe();
clazz = NULL;
return;
}
}
void PlugletTagInfo2::Destroy(JNIEnv *env) {
//nb who gonna cal it?
if(clazz) {
env->DeleteGlobalRef(clazz);
}
}
jobject PlugletTagInfo2::GetJObject(JNIEnv *env, const nsIPluginTagInfo2 *info) {
jobject res = NULL;
if(!clazz) {
Initialize(env);
if (! clazz) {
return NULL;
}
}
res = env->NewObject(clazz,initMID,(jlong)info);
if (!res) {
env->ExceptionDescribe();
}
return res;
}

View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
#ifndef __PlugletTagInfo2_h__
#define __PlugletTagInfo2_h__
#include "nsIPluginTagInfo2.h"
#include "jni.h"
class PlugletTagInfo2 {
public:
static jobject GetJObject(JNIEnv* env,const nsIPluginTagInfo2 *info);
private:
static void Initialize(JNIEnv* env);
static void Destroy(JNIEnv *env);
static jclass clazz;
static jmethodID initMID;
};
#endif /* __PlugletTagInfo2__h__ */

View File

@@ -31,7 +31,7 @@ OBJS = \
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletInputStream.obj \
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletOutputStream.obj \
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletInstancePeerImpl.obj \
.\$(ONJDIR)\org_mozilla_pluglet_mozilla_PlugletManagerImpl.obj \
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletManagerImpl.obj \
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl.obj \
.\$(OBJDIR)\PlugletTagInfo2.obj \
.\$(OBJDIR)\PlugletOutputStream.obj \

View File

@@ -0,0 +1,250 @@
/*
* 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.
*/
#include "nsIPluginTagInfo2.h"
#include "org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl.h"
static jfieldID peerFID = NULL;
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAttributes
* Signature: ()Ljava/util/Properties;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAttributes
(JNIEnv *, jobject) {
//nb Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAttributes
return NULL;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAttribute
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAttribute
(JNIEnv *env, jobject jthis, jstring _name) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char * name = NULL;
if (!(name = env->GetStringUTFChars(_name,NULL))) {
return NULL;
}
const char * result = NULL;
if (NS_FAILED(info->GetParameter(name,&result))) {
env->ReleaseStringUTFChars(_name,name);
return NULL;
}
env->ReleaseStringUTFChars(_name,name);
return env->NewStringUTF(result);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getTagType
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getTagType
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char * res = "Unknown";
nsPluginTagType type;
if (NS_FAILED(info->GetTagType(&type))) {
return env->NewStringUTF(res);
}
switch (type) {
case nsPluginTagType_Embed:
res = "EMBED";
break;
case nsPluginTagType_Object:
res = "OBJECT";
break;
case nsPluginTagType_Applet:
res = "APPLET";
break;
default:
res = "UNKNOWN";
break;
}
return env->NewStringUTF(res);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getTagText
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getTagText
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char *text = NULL;
if(NS_FAILED(info->GetTagText(&text))) {
return NULL;
}
return env->NewStringUTF(text);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getDocumentBase
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getDocumentBase
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char *base = NULL;
if(NS_FAILED(info->GetDocumentBase(&base))) {
return NULL;
}
return env->NewStringUTF(base);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getDocumentEncoding
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getDocumentEncoding
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char *encoding = NULL;
if(NS_FAILED(info->GetDocumentEncoding(&encoding))) {
return NULL;
}
return env->NewStringUTF(encoding);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAlignment
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAlignment
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
const char *aligment = NULL;
if(NS_FAILED(info->GetAlignment(&aligment))) {
return NULL;
}
return env->NewStringUTF(aligment);
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getWidth
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getWidth
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
PRUint32 res;
if(NS_FAILED(info->GetWidth(&res))) {
return 0;
}
return res;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getHeight
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getHeight
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
PRUint32 res;
if(NS_FAILED(info->GetHeight(&res))) {
return 0;
}
return res;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getBorderVertSpace
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getBorderVertSpace
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
PRUint32 res;
if(NS_FAILED(info->GetBorderVertSpace(&res))) {
return 0;
}
return res;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getBorderHorizSpace
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getBorderHorizSpace
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
PRUint32 res;
if(NS_FAILED(info->GetBorderHorizSpace(&res))) {
return 0;
}
return res;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getUniqueID
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getUniqueID
(JNIEnv *env, jobject jthis) {
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
PRUint32 res;
if(NS_FAILED(info->GetUniqueID(&res))) {
return 0;
}
return res;
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: nativeFinalize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_nativeFinalize
(JNIEnv *env, jobject jthis) {
/* nb do as in java-dom stuff */
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
if(info) {
NS_RELEASE(info);
}
}
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: nativeInitialize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_nativeInitialize
(JNIEnv *env, jobject jthis) {
if(!peerFID) {
peerFID = env->GetFieldID(env->GetObjectClass(jthis),"peer","J");
if (!peerFID) {
return;
}
}
nsIPluginTagInfo2 * info = (nsIPluginTagInfo2*)env->GetLongField(jthis, peerFID);
if (info) {
info->AddRef();
}
}

View File

@@ -0,0 +1,140 @@
/*
* 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.
*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl */
#ifndef _Included_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
#define _Included_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAttributes
* Signature: ()Ljava/util/Properties;
*/
JNIEXPORT jobject JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAttributes
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAttribute
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAttribute
(JNIEnv *, jobject, jstring);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getTagType
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getTagType
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getTagText
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getTagText
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getDocumentBase
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getDocumentBase
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getDocumentEncoding
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getDocumentEncoding
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getAlignment
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getAlignment
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getWidth
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getWidth
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getHeight
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getHeight
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getBorderVertSpace
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getBorderVertSpace
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getBorderHorizSpace
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getBorderHorizSpace
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: getUniqueID
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_getUniqueID
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: nativeFinalize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_nativeFinalize
(JNIEnv *, jobject);
/*
* Class: org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl
* Method: nativeInitialize
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl_nativeInitialize
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif