Author: rony
Date: Mon Sep 11 15:34:53 2006
New Revision: 442377
URL: http://svn.apache.org/viewvc?view=rev&rev=442377
Log:
20060912 00:33 Removed 'samples/jsp', 'samples/jsplike',
'samples/multiplication_test' as they need the Windows OLE/ActiveX scripting,
which is not supported on BSF 2.* anymore.
Added:
jakarta/bsf/trunk/samples/scriptedui/ui.jacl (with props)
jakarta/bsf/trunk/samples/scriptedui/ui.py (with props)
jakarta/bsf/trunk/samples/scriptedui/ui.rex (with props)
Removed:
jakarta/bsf/trunk/samples/calc/TestCalc.jss
jakarta/bsf/trunk/samples/calc/TestCalc.pls
jakarta/bsf/trunk/samples/calc/TestCalc.vbs
jakarta/bsf/trunk/samples/jsp/
jakarta/bsf/trunk/samples/jsplike/
jakarta/bsf/trunk/samples/multiplication_test/
Modified:
jakarta/bsf/trunk/samples/calc/TestCalc.java
jakarta/bsf/trunk/samples/calc/TestCalc.rex
jakarta/bsf/trunk/samples/scriptedui/ScriptedUI.java
Modified: jakarta/bsf/trunk/samples/calc/TestCalc.java
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/calc/TestCalc.java?view=diff&rev=442377&r1=442376&r2=442377
==============================================================================
--- jakarta/bsf/trunk/samples/calc/TestCalc.java (original)
+++ jakarta/bsf/trunk/samples/calc/TestCalc.java Mon Sep 11 15:34:53 2006
@@ -8,34 +8,16 @@
public class TestCalc extends Frame {
- static final protected Hashtable extensionmap= new Hashtable();
- static
- {
- extensionmap.put("pl", "perlscript");
- extensionmap.put("vbs", "vbscript");
- extensionmap.put("js", "jscript");
- }
- static final String languageFromExtension( String s) throws Exception
- {
- int dot= s.lastIndexOf('.');
- if(dot != -1) s= s.substring( dot+1);
- String lang= (String) extensionmap.get(s);
- if(null == lang) throw new BSFException(BSFException.REASON_OTHER_ERROR,
"File extension " + s + " unknown language!");
-
- return lang;
-
- }
-
public TestCalc (String fileName) throws Exception {
BSFManager manager = new BSFManager ();
manager.declareBean("frame", this, this.getClass());
try
{
- manager.exec(manager.getLangFromFilename(fileName), fileName, 0, 0,
+ manager.exec(manager.getLangFromFilename(fileName), fileName, 0, 0,
IOUtils.getStringFromReader(new FileReader(fileName)));
}catch(BSFException e )
{
-
+
System.out.println("exception: " + e.getMessage());
Throwable oe= e.getTargetException();
if(null != oe) System.out.println("\nOriginal Exception:"+
oe.getMessage());
Modified: jakarta/bsf/trunk/samples/calc/TestCalc.rex
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/calc/TestCalc.rex?view=diff&rev=442377&r1=442376&r2=442377
==============================================================================
--- jakarta/bsf/trunk/samples/calc/TestCalc.rex (original)
+++ jakarta/bsf/trunk/samples/calc/TestCalc.rex Mon Sep 11 15:34:53 2006
@@ -1,14 +1,4 @@
-/* to be placed in "samples/calc/TestCalc-oo.rxj"; Object Rexx version
-
-add the following line to "samples/calc/TestCalc.java" in
-the static method where the extensionmap is defined:
-
- extensionmap.put("rex", "rexx");
- extensionmap.put("rxj", "rexx");
-
----rgf, 2001-05-02 (on the way back home from the 12th Int'l Rexx Symposium
----rgf, 2003-01-23 (on the way back home from Augsburg by train), ---rgf,
2003-05-10
-
+/*
------------------------ Apache Version 2.0 license
-------------------------
Copyright (C) 2001-2006 Rony G. Flatscher
@@ -26,18 +16,6 @@
-----------------------------------------------------------------------------
*/
-if rxFuncQuery("BSF") then /* no bsf4rexx support available yet, hence load
Java */
-do
- call rxFuncAdd "BsfLoadFuncs", "BSF4Rexx", "BsfLoadFuncs"
- call BsfLoadFuncs /* load all BSF-functions */
- call BsfLoadJava /* load the JVM and set up BSF4Rexx-support */
-end
-
-if BsfInvokedBy()=1 then say "This Rexx program was invoked by Java!"
-else if BsfInvokedBy()=2 then say "This Rexx program was invoked by Rexx, JVM
loaded by Rexx!"
-else say "No JVM present, we got troubles ..."
-
-
/*********************************************************
* A simple four function calculator, written in REXX *
*********************************************************/
@@ -70,8 +48,7 @@
/* *** Place everything in the frame */
frame = .bsf~bsf.lookupBean("frame")
frame~~setTitle("Object Rexx Calc") ~~resize(130, 200)
-frame~~add("North", res) ~~add("Center", panel)
-frame~~validate ~~show
+frame~~add("North", res) ~~add("Center", panel) ~~validate ~~show
frame~bsf.addEventListener("window", "windowClosing", "call bsf 'exit'")
/* *** Initialize the state of the calculator */
@@ -128,3 +105,4 @@
return
::requires BSF.CLS -- add Object Rexx proxy support
+
Modified: jakarta/bsf/trunk/samples/scriptedui/ScriptedUI.java
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/scriptedui/ScriptedUI.java?view=diff&rev=442377&r1=442376&r2=442377
==============================================================================
--- jakarta/bsf/trunk/samples/scriptedui/ScriptedUI.java (original)
+++ jakarta/bsf/trunk/samples/scriptedui/ScriptedUI.java Mon Sep 11 15:34:53
2006
@@ -25,6 +25,7 @@
f.add ("South", new Button ("South Button"));
mgr.registerBean ("centerPanel", p);
+ mgr.registerBean ("parentFrame", f); // --rgf, 2006-08-08: to allow Jacl
to get to frame ...
// exec script engine code to do its thing for this
try {
@@ -45,7 +46,7 @@
f.pack ();
f.show ();
}
-
+
public static void main (String[] args) throws Exception {
if (args.length != 1) {
System.err.println ("Usage: java ScriptedUI filename");
Added: jakarta/bsf/trunk/samples/scriptedui/ui.jacl
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/scriptedui/ui.jacl?view=auto&rev=442377
==============================================================================
--- jakarta/bsf/trunk/samples/scriptedui/ui.jacl (added)
+++ jakarta/bsf/trunk/samples/scriptedui/ui.jacl Mon Sep 11 15:34:53 2006
@@ -0,0 +1,29 @@
+# A silly little calculator implemented in Jacl using
+# Java components for the UI.
+# Rony G. Flatscher, 2006-08-08
+
+package require java
+
+set p [bsf lookupBean "centerPanel"]
+$p setLayout [java::new java.awt.BorderLayout]
+
+$p add "Center" [java::new java.awt.Label "Middle from Jacl"]
+$p add "North" [java::new java.awt.TextField "north text from Jacl"]
+$p add "South" [java::new java.awt.TextField "south text from Jacl"]
+$p add "East" [java::new java.awt.Button "inner east from Jacl"]
+$p add "West" [java::new java.awt.Button "inner west from Jacl"]
+
+$p setBackground [java::field java.awt.Color pink]
+
+set f [$p getParent]
+
+# needed, because the getParent() returns a "java.awt.Container" not
"java.awt.Frame"
+# in the Jacl engine! The following does not hint at the Java class (other than
+# java.lang.Object) such that the Jacl engine *seems* to start reflection at
the
+# class from which the object got created from
+
+set f [bsf lookupBean "parentFrame"]
+
+$f setTitle "Hello from Jacl (title reset from Jacl)"
+
+
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.jacl
------------------------------------------------------------------------------
svn:executable = *
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.jacl
------------------------------------------------------------------------------
svn:keywords = Author Date Rev Id URL
Added: jakarta/bsf/trunk/samples/scriptedui/ui.py
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/scriptedui/ui.py?view=auto&rev=442377
==============================================================================
--- jakarta/bsf/trunk/samples/scriptedui/ui.py (added)
+++ jakarta/bsf/trunk/samples/scriptedui/ui.py Mon Sep 11 15:34:53 2006
@@ -0,0 +1,23 @@
+"""\
+A silly little calculator implemented in JPython using
+Java components for the UI.
+Rony G. Flatscher, 2006-08-08
+"""
+
+import java
+from java import awt
+
+p = bsf.lookupBean('centerPanel')
+p.setLayout ( awt.BorderLayout () )
+
+p.add ("Center", java.awt.Label ("Middle from Jython"))
+p.add ("North", java.awt.TextField ("north text from Jython"))
+p.add ("South", java.awt.TextField ("south text from Jython"))
+p.add ("East", java.awt.Button ("inner east from Jython"))
+p.add ("West", java.awt.Button ("inner west from Jython"))
+
+p.setBackground (java.awt.Color.orange)
+
+f = p.getParent ()
+f.setTitle ("Hello from Jython (title reset from Jython)")
+
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.py
------------------------------------------------------------------------------
svn:keywords = Author Date Rev Id URL
Added: jakarta/bsf/trunk/samples/scriptedui/ui.rex
URL:
http://svn.apache.org/viewvc/jakarta/bsf/trunk/samples/scriptedui/ui.rex?view=auto&rev=442377
==============================================================================
--- jakarta/bsf/trunk/samples/scriptedui/ui.rex (added)
+++ jakarta/bsf/trunk/samples/scriptedui/ui.rex Mon Sep 11 15:34:53 2006
@@ -0,0 +1,41 @@
+/* pick up the center panel bean, Object Rexx program modelled after ui.nrx */
+/*
+ ------------------------ Apache Version 2.0 license
-------------------------
+ Copyright (C) 2003-2006 Rony G. Flatscher
+
+ Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
-----------------------------------------------------------------------------
+*/
+
+p = .bsf~bsf.lookupBean("centerPanel") -- reference the entry in BSF
registry, put there by
+ -- the Java program "ScriptedUI.class"
+
+/* set the layout manager to border */
+p~setLayout(.bsf~new("java.awt.BorderLayout"))
+
+/* add a few things */
+p~add("Center", .bsf~new("java.awt.Label", "Middle from Object Rexx"))
+p~add("North", .bsf~new("java.awt.TextField", "North text from Object Rexx"))
+p~add("South", .bsf~new("java.awt.TextField", "South text from Object Rexx"))
+p~add("East", .bsf~new("java.awt.Button", "Inner east text from Object
Rexx"))
+p~add("West", .bsf~new("java.awt.Button", "Inner west text from Object
Rexx"))
+
+/* configure p a bit */
+p~setBackground(.bsf~bsf.getStaticValue("java.awt.Color", "green"))
+
+/* configure the frame that p is in */
+f=p~getParent
+f~setTitle("Hello from Object REXX (title reset from Object Rexx)")
+
+::requires BSF.CLS -- get Object Rexx wrapper support for BSF
+
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.rex
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.rex
------------------------------------------------------------------------------
svn:executable = *
Propchange: jakarta/bsf/trunk/samples/scriptedui/ui.rex
------------------------------------------------------------------------------
svn:keywords = Author Date Rev Id URL
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]