Discussion:
[jruby-user] [ANN] Profligacy 0.4 Utu Koolaid Acid Test
(too old to reply)
Zed A. Shaw
2007-07-08 00:47:31 UTC
Permalink
I'm totally blown away by Profligacy right now. It's so wrong.

Take a look at my first prototype for the Utu chat client:

http://pastie.caboo.se/76960

That 110 lines of code produces a FULL user interface for the prototype including:

* Menubars
* Toolbars
* Text and lists with scrollbars
* Buttons in sub-component layouts
* Multiple configurable layouts for differing tastes.
* Total time to write this 2.5 hours, including learning all the swing components used and hacking the Profligacy lib a bit.

You can see screenshots here:

Loading Image...
http://ihate.rubyforge.org/profligacy/images/chat_proto_right.png
Loading Image...

Or you can simply install the latest Profligacy:

JRUBY_HOME/bin/gem install profligacy

And run that file.

== Changes

This little release solves a problem where Profligacy was creating the component being built but sometimes you need to modify it with add Java calls before it's done. The build methods for Swing::Build and Swing::LEL now take a block and pass in the container you're building. You can then modify it before it's packed and shown. See how the main frame is built in the above GUI to see why it's needed.

Enjoy!
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Stephen Bannasch
2007-07-08 05:18:30 UTC
Permalink
Here's the results of testing Profligacy 0.4 on MacOS 10.4.10 using
Java 1.5.0_07.

I downloaded and extracted:

http://dist.codehaus.org/jruby/jruby-bin-1.0.tar.gz

I added this shell script (setpaths.sh):

#!/bin/sh
export JRUBY_HOME=`pwd`
export PATH=`pwd`/bin:$PATH
export JRUBY_OPTS=-rubygems

Which I execute like this ('.' is the same command as 'source':

. setpaths.sh

Installing the gem now worked fine -- I selected the 0.4 version.

sudo gem install profligacy

Examples: swing1.rb through swing8.rb worked fine however I wasn't
able to see the rollover event displayed in swing7.rb.

Running: prefuse_sample.rb produced this error:

/Users/stephen/dev/jruby-1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in
`require': no such file to load -- prefuse (LoadError)
from examples/prefuse_sample.rb:3

Runnning swing8_lel.rb and layout_test.rb produced this type of error
(do I need Java 6?):

$ jruby examples/swing8_lel.rb
Exception in thread "main" java.lang.UnsupportedClassVersionError:
Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.jruby.javasupport.JavaSupport.loadJavaClass(JavaSupport.java:79)
at org.jruby.javasupport.JavaClass.forName(JavaClass.java:906)
at org.jruby.javasupport.JavaClass.for_name(JavaClass.java:911)
at
org.jruby.javasupport.JavaClassInvokerSfor_name1.call(Unknown Source)
at
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:49)
at
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:81)
at
org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:568)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:207)
at
org.jruby.evaluator.EvaluationState.returnNode(EvaluationState.java:1587)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:354)
at
org.jruby.evaluator.EvaluationState.rescueNode(EvaluationState.java:1518)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:350)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at
org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:135)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at
org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:568)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:207)
at
org.jruby.evaluator.EvaluationState.localAsgnNode(EvaluationState.java:1234)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:286)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at org.jruby.runtime.Block.yield(Block.java:220)
at org.jruby.runtime.Block.yield(Block.java:186)
at org.jruby.RubyEnumerable$6.call(RubyEnumerable.java:217)
at org.jruby.runtime.CallBlock.yield(CallBlock.java:93)
at org.jruby.runtime.CallBlock.yield(CallBlock.java:66)
at org.jruby.RubyArray.each(RubyArray.java:1278)
at org.jruby.RubyArrayInvokereach0.call(Unknown Source)
at
org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49)
at
org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:78)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at org.jruby.RubyObject.callMethod(RubyObject.java:564)
at org.jruby.RubyObject.callMethod(RubyObject.java:576)
at org.jruby.RubyEnumerable.callEach(RubyEnumerable.java:88)
at org.jruby.RubyEnumerable.detect(RubyEnumerable.java:214)
at org.jruby.RubyEnumerableInvokerSdetectxx1.call(Unknown Source)
at
org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49)
at
org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:78)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at
org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:581)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:207)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:270)
at
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:531)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at
org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:135)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at org.jruby.RubyObject.callMethod(RubyObject.java:564)
at org.jruby.RubyObject.callMethod(RubyObject.java:445)
at org.jruby.RubyObject.callMethod(RubyObject.java:584)
at org.jruby.RubyModule.getConstantInner(RubyModule.java:864)
at org.jruby.RubyModule.getConstantFrom(RubyModule.java:878)
at
org.jruby.evaluator.EvaluationState.colon2Node(EvaluationState.java:738)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:219)
at
org.jruby.evaluator.EvaluationState.colon2Node(EvaluationState.java:736)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:219)
at
org.jruby.evaluator.EvaluationState.setupArgs(EvaluationState.java:2190)
at
org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1007)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:253)
at
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:531)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
at
org.jruby.evaluator.EvaluationState.evalClassDefinitionBody(EvaluationState.java:1879)
at
org.jruby.evaluator.EvaluationState.classNode(EvaluationState.java:686)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:211)
at
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:531)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
at
org.jruby.evaluator.EvaluationState.evalClassDefinitionBody(EvaluationState.java:1879)
at
org.jruby.evaluator.EvaluationState.moduleNode(EvaluationState.java:1291)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:296)
at
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:531)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
at
org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1609)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:356)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at org.jruby.Ruby.loadScript(Ruby.java:1185)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:53)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:307)
at org.jruby.runtime.load.LoadService.require(LoadService.java:333)
at org.jruby.RubyKernel.require(RubyKernel.java:715)
at org.jruby.RubyKernelInvokerSrequire1.call(Unknown Source)
at
org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49)
at
org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:78)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:71)
at
org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1023)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:253)
at
org.jruby.evaluator.EvaluationState.rescueNode(EvaluationState.java:1518)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:350)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at
org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:135)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at
org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1023)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:253)
at
org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:531)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:201)
at
org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1609)
at
org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:356)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:164)
at org.jruby.Ruby.eval(Ruby.java:287)
at org.jruby.Ruby.compileOrFallbackAndRun(Ruby.java:315)
at org.jruby.Main.runInterpreter(Main.java:228)
at org.jruby.Main.runInterpreter(Main.java:173)
at org.jruby.Main.run(Main.java:120)
at org.jruby.Main.main(Main.java:95)
Zed A. Shaw
2007-07-08 06:12:22 UTC
Permalink
On Sun, 8 Jul 2007 01:18:30 -0400
Post by Stephen Bannasch
Here's the results of testing Profligacy 0.4 on MacOS 10.4.10 using
Java 1.5.0_07.
I'm using:

java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)

Good old "write once, run anywhere" eh? Also, the prefuse example require's the prefuse library. Try any of the other ones since they don't use the LEL parser (which is what's blowing up in your setup).

And I'll have to build this on a mac since apple can't be bothered to upgrade it's tech. Thanks for testing this.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Raphaël Valyi
2007-07-08 12:17:44 UTC
Permalink
Guys,

I suspect this type of error (exception in thread "main"
java.lang.UnsupportedClassVersionError: Bad version number in .class
file) might occur if you don't specify something like target="1.4" as
an attribute of the javac task in your Ant file if building with ant.
Anyaway, whatever the tool you use, there must be somewhere you should
tell javac that your binary should be compatible with java 1.4 or 1.5.
This is worth a check, hope this helps.

Raphaël Valyi.
Post by Zed A. Shaw
On Sun, 8 Jul 2007 01:18:30 -0400
Post by Stephen Bannasch
Here's the results of testing Profligacy 0.4 on MacOS 10.4.10 using
Java 1.5.0_07.
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)
Good old "write once, run anywhere" eh? Also, the prefuse example require's
the prefuse library. Try any of the other ones since they don't use the LEL
parser (which is what's blowing up in your setup).
And I'll have to build this on a mac since apple can't be bothered to
upgrade it's tech. Thanks for testing this.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Chris Nelson
2007-07-08 15:40:43 UTC
Permalink
In this case it would get you by the
java.lang.UnsupportedClassVersionErrorbut I think you would still have
a problem: unless I am mistaken GroupLayout
is only available with Java 6. So I think you'll need to be using Java 6 to
use profligacy, at least the LEL part, as it generates GroupLayouts.
Correct me if I'm wrong in this, Zed.

--Chris
Post by Raphaël Valyi
Guys,
I suspect this type of error (exception in thread "main"
java.lang.UnsupportedClassVersionError: Bad version number in .class
file) might occur if you don't specify something like target="1.4" as
an attribute of the javac task in your Ant file if building with ant.
Anyaway, whatever the tool you use, there must be somewhere you should
tell javac that your binary should be compatible with java 1.4 or 1.5.
This is worth a check, hope this helps.
Raphaël Valyi.
Post by Zed A. Shaw
On Sun, 8 Jul 2007 01:18:30 -0400
Post by Stephen Bannasch
Here's the results of testing Profligacy 0.4 on MacOS 10.4.10 using
Java 1.5.0_07.
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)
Good old "write once, run anywhere" eh? Also, the prefuse example
require's
Post by Zed A. Shaw
the prefuse library. Try any of the other ones since they don't use the
LEL
Post by Zed A. Shaw
parser (which is what's blowing up in your setup).
And I'll have to build this on a mac since apple can't be bothered to
upgrade it's tech. Thanks for testing this.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Erik van Oosten
2007-07-08 17:00:07 UTC
Permalink
You can get the original (now demoted to 'backport') from swing labs
(http://swinglabs.org/projects.jsp).

A more stable alternative would be the excellent FormLayout
(http://www.jgoodies.com/freeware/forms/). Much nicer to program with
anyway.

Erik.
Post by Chris Nelson
In this case it would get you by the
java.lang.UnsupportedClassVersionError but I think you would still
have a problem: unless I am mistaken GroupLayout is only available
with Java 6. So I think you'll need to be using Java 6 to use
profligacy, at least the LEL part, as it generates GroupLayouts.
Correct me if I'm wrong in this, Zed.
--Chris
--
Erik van Oosten
http://2008.rubyenrails.nl/
http://day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Zed A. Shaw
2007-07-09 04:46:25 UTC
Permalink
On Sun, 08 Jul 2007 19:00:07 +0200
Post by Erik van Oosten
You can get the original (now demoted to 'backport') from swing labs
(http://swinglabs.org/projects.jsp).
A more stable alternative would be the excellent FormLayout
(http://www.jgoodies.com/freeware/forms/). Much nicer to program with
anyway.
So, I'm taking it nobody has Java 6 (or whatever version they call it these days)? It looks like best approach is for me to just dump grouplayout and use gridbaglayout. The effect should be the same, I just thought that grouplayout was the king these days.

Let me hack on this and see what I can come up with. Also, I'll probably be able to dynamically compile the .java files so it won't matter what VM version you have. It uses the com.sun.tool.Java.compile stuff though. How extensive is that?
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Tor Norbye
2007-07-09 06:06:08 UTC
Permalink
Post by Zed A. Shaw
On Sun, 08 Jul 2007 19:00:07 +0200
Post by Erik van Oosten
You can get the original (now demoted to 'backport') from swing labs
(http://swinglabs.org/projects.jsp).
A more stable alternative would be the excellent FormLayout
(http://www.jgoodies.com/freeware/forms/). Much nicer to program with
anyway.
So, I'm taking it nobody has Java 6 (or whatever version they call
it these days)?
There's no* Java 6 on the Mac, which seems to be a pretty popular
platform for Ruby people. (There's a pre-release you can get from
Apple but it's really buggy).
Post by Zed A. Shaw
It looks like best approach is for me to just dump grouplayout and
use gridbaglayout. The effect should be the same, I just thought
that grouplayout was the king these days.
GroupLayout is available for JDK 5 too (it was developed before Java
1.6 came out); see

https://swing-layout.dev.java.net/

When you use the NetBeans GUI builder and your target platform is set
to Java 1.5 instead of 1.6, it will bundle your application with a
1.5-compatible version of group layout instead of the JDK one, so
that might be an easy way to get the bits and see the different
package names.

-- Tor


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Zed A. Shaw
2007-07-09 15:27:55 UTC
Permalink
On Sun, 08 Jul 2007 23:06:08 -0700
Post by Tor Norbye
There's no* Java 6 on the Mac, which seems to be a pretty popular
platform for Ruby people. (There's a pre-release you can get from
Apple but it's really buggy).
Yeah, and that's a prime target for the Utu client, so I'll have to make everything work there too. I'm going to try out getting the .java stuff to compile on the fly when the gem installs. That'll solve most of the JVM version problems.
Post by Tor Norbye
GroupLayout is available for JDK 5 too (it was developed before Java
1.6 came out); see
https://swing-layout.dev.java.net/
Ok, that'll work with the dynamic compile thing (if it works) too. If you're on Java 5 then it compiles the above, and on Java 6 then it just leaves it alone.

Thanks for the info, I should have a release of this out today.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Charles Oliver Nutter
2007-07-09 15:33:31 UTC
Permalink
Post by Zed A. Shaw
Post by Tor Norbye
GroupLayout is available for JDK 5 too (it was developed before Java
1.6 came out); see
https://swing-layout.dev.java.net/
Ok, that'll work with the dynamic compile thing (if it works) too. If you're on Java 5 then it compiles the above, and on Java 6 then it just leaves it alone.
You could also just include the pre-Java6-GroupLayout and conditionally
use it if the javax.swing version isn't present.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Erik van Oosten
2007-07-09 06:38:43 UTC
Permalink
Zed,

You really should take a look at Form Layout from jgoodies.

GridBagLayout will give quite different results. FormLayout and
GroupLayout have lots of stuff in them to get rid of undesired
whitespace and layout everything consistently. If you want a good
looking GUI these little things are essential.

If you want to get up to speed with Form Layout within an hour, you
should try ('evaluate') JFormDesigner. It generates crisp Java code that
you can study.

Regards,
Erik.
Post by Zed A. Shaw
On Sun, 08 Jul 2007 19:00:07 +0200
Post by Erik van Oosten
You can get the original (now demoted to 'backport') from swing labs
(http://swinglabs.org/projects.jsp).
A more stable alternative would be the excellent FormLayout
(http://www.jgoodies.com/freeware/forms/). Much nicer to program with
anyway.
So, I'm taking it nobody has Java 6 (or whatever version they call it these days)? It looks like best approach is for me to just dump grouplayout and use gridbaglayout. The effect should be the same, I just thought that grouplayout was the king these days.
Let me hack on this and see what I can come up with. Also, I'll probably be able to dynamically compile the .java files so it won't matter what VM version you have. It uses the com.sun.tool.Java.compile stuff though. How extensive is that?
--
Erik van Oosten
http://2008.rubyenrails.nl/
http://www.day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email
Loading...