2963102 |
Convert API to use var args and remove the many overloaded Dispatch
diff --git a/jacob/samples/com/jacob/samples/applet/AppTest.java b/jacob/samples/com/jacob/samples/applet/AppTest.java
deleted file mode 100644
index ca9cc82..0000000
--- a/jacob/samples/com/jacob/samples/applet/AppTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.jacob.samples.applet;
-
-import java.applet.Applet;
-import java.awt.Button;
-import java.awt.FlowLayout;
-import java.awt.TextField;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import com.jacob.activeX.ActiveXComponent;
-import com.jacob.com.Dispatch;
-import com.jacob.com.Variant;
-
-/**
- * Applet test case
- */
-public class AppTest extends Applet implements ActionListener {
- /**
- * unique identifier added by Eclipse because this class is serializable
- */
- private static final long serialVersionUID = -6676420357823607065L;
-
- TextField in;
-
- TextField out;
-
- Button calc;
-
- ActiveXComponent sC = null;
-
- /**
- * startup method
- */
- public void init() {
- setLayout(new FlowLayout());
- add(in = new TextField("1+1", 16));
- add(out = new TextField("?", 16));
- add(calc = new Button("Calculate"));
- calc.addActionListener(this);
-
- }
-
- /**
- * action method that receives button actions
- *
- * @param ev
- * the event
- */
- public void actionPerformed(ActionEvent ev) {
- if (sC == null) {
- String lang = "VBScript";
- sC = new ActiveXComponent("ScriptControl");
- Dispatch.put(sC, "Language", lang);
- }
- Variant v = Dispatch.call(sC, "Eval", in.getText());
- out.setText(v.toString());
- }
-}
diff --git a/jacob/samples/com/jacob/samples/applet/Applet.html b/jacob/samples/com/jacob/samples/applet/Applet.html
new file mode 100644
index 0000000..0c2f6b2
--- /dev/null
+++ b/jacob/samples/com/jacob/samples/applet/Applet.html
@@ -0,0 +1,20 @@
+
+
+ Jacob Test Applet
+
+
+
+
+
diff --git a/jacob/samples/com/jacob/samples/applet/Applet.jnlp b/jacob/samples/com/jacob/samples/applet/Applet.jnlp
new file mode 100644
index 0000000..9b25bef
--- /dev/null
+++ b/jacob/samples/com/jacob/samples/applet/Applet.jnlp
@@ -0,0 +1,27 @@
+
+
+
+
+ Jacob Test Applet
+ ttreeck, nepatec GmbH & Co. KG
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jacob/samples/com/jacob/samples/applet/JacobTestApplet.java b/jacob/samples/com/jacob/samples/applet/JacobTestApplet.java
new file mode 100644
index 0000000..6e7b4d3
--- /dev/null
+++ b/jacob/samples/com/jacob/samples/applet/JacobTestApplet.java
@@ -0,0 +1,88 @@
+package com.jacob.samples.applet;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.FlowLayout;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import com.jacob.activeX.ActiveXComponent;
+import com.jacob.com.Dispatch;
+import com.jacob.com.Variant;
+
+/**
+ * Example applet to demonstrate:
+ * 1. The use of jacob from an applet
+ * 2. To show how to distribute the jacob native lib with the applet (also works with webstart)
+ *
+ * Comment on 2.:
+ * The way shown here is quite straight forward and it is not necessary to use
+ * a mechanism like the "DLLFromJARClassLoader" or something similar...
+ *
+ * @author ttreeck, www.nepatec.de
+ *
+ */
+
+public class JacobTestApplet extends Applet implements ActionListener {
+
+ private static final long serialVersionUID = 4492492907986849158L;
+
+ TextField in;
+ TextField out;
+ Button calc;
+ ActiveXComponent sC = null;
+
+ /**
+ * startup method
+ */
+ @Override
+ public void init() {
+ setLayout(new FlowLayout());
+ add(this.in = new TextField("1+1", 16));
+ add(this.out = new TextField("?", 16));
+ add(this.calc = new Button("Calculate"));
+ this.calc.addActionListener(this);
+
+ }
+
+ /**
+ * Returns information about this applet.
+ * According to the java spec:
+ * "An applet should override this method to return a String containing information about the author, version, and copyright of the applet."
+ *
+ * @return information about the applet.
+ */
+ @Override
+ public String getAppletInfo() {
+ return "Jacob Test Applet. Written by ttreeck, nepatec GmbH & Co. KG.\nhttp://www.nepatec.de";
+ }
+
+ /**
+ * Returns information about the parameters that are understood by this applet.
+ * According to the java spec:
+ * "An applet should override this method to return an array of Strings describing these parameters."
+ *
+ * @return array with a set of three Strings containing the name, the type, and a description.
+ */
+
+ @Override
+ public String[][] getParameterInfo(){
+ return new String[][]{};
+ }
+
+ /**
+ * action method that receives button actions
+ *
+ * @param ev the event
+ */
+ public void actionPerformed(ActionEvent ev) {
+ if (this.sC == null) {
+ String lang = "VBScript";
+ this.sC = new ActiveXComponent("ScriptControl");
+ Dispatch.put(this.sC, "Language", lang);
+ }
+ Variant v = Dispatch.call(this.sC, "Eval", this.in.getText());
+ this.out.setText(v.toString());
+ }
+}
\ No newline at end of file
diff --git a/jacob/samples/com/jacob/samples/applet/Readme.txt b/jacob/samples/com/jacob/samples/applet/Readme.txt
new file mode 100644
index 0000000..2347c72
--- /dev/null
+++ b/jacob/samples/com/jacob/samples/applet/Readme.txt
@@ -0,0 +1,59 @@
+There is an easy and elegant way to load DLLs from Applets and JavaWebStart Applications.
+
+Both JavaWebStart and Applets support JNLP (Applets since 1.6.0_10 aka plugin2).
+Within a jnlp file it is possible to specify a nativelib and that's it!
+So what do you need to do?
+
+1.) package the jacob-1.XX-xXX.dll into a jar file (root level of the jar, not into a subfolder) and put it into your applications lib folder next to your other libs (e.g. jacob.jar)
+2.) Specify all your libraries in your jnlp file like this:
+
+
+
+
+
+ My cool Application or Applet
+ nepatec GmbH & Co. KG
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ some crazy arguments
+
+
+
+3.) Sign all the jars or set up a policy file (cp. Applet Security below)
+4.) Deploy your application and start it via webstart or as an applet (from an webpage)
+
+
+General comments:
+
+- If you sign the jar files you need the tag - when using a policy file it can be removed
+- furthermore it is recommended that all libs are signed with an official certificate (e.g. from verisign, thawte etc) so that the browser doesn't pop a warning stating 'untrusted' application...
+- to check the validity of your jnlp file the tool JaNeLA (link cp. sources below) is recommended.
+
+[Sources]
+New Applet: https://jdk6.dev.java.net/plugin2/
+Applet JNLP: https://jdk6.dev.java.net/plugin2/jnlp/
+Applet Security: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html
+JNLP API: http://www.oracle.com/technetwork/java/javase/index-141367.html
+JNLP Verifier: http://pscode.org/janela/
\ No newline at end of file
diff --git a/jacob/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java b/jacob/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java
index a41f220..df04e4d 100644
Binary files a/jacob/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java and b/jacob/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java differ
|