|
Hi all,
I was excited about the release of Grails 1.1 and wanted to test it's workings with Wicket. I have two questions concerning this: 1. The Wicket plugin installation fails with Grails 1.1, (works OK with 1.0.4) is this already known? 2. Wicket pages under Grails are groovy files, is it not possible to use Java files so that existing wicket applications can be incorporated in the Grails tree? I did discover a WicketBuilder to help integrating Wicket under Grails and am trying to learn it's workings and I haven't been able to find too much documentation on this :-( Any pointers/help appreciated Colin |
|
The Wicket plugin needs updating for 1.1, I decided to progress too
much further with it until Groovy supports anonymous inner classes and nested classes A builder could be written, but again we have other priorities, but if someone in the community wants to work on this integration we're happy to provide help/support Cheers On Thu, Mar 26, 2009 at 12:04 PM, Colin Chalmers <[hidden email]> wrote: > Hi all, > > I was excited about the release of Grails 1.1 and wanted to test it's > workings with Wicket. > I have two questions concerning this: > > 1. The Wicket plugin installation fails with Grails 1.1, (works OK with > 1.0.4) is this already known? > 2. Wicket pages under Grails are groovy files, is it not possible to use > Java files so that existing wicket applications can be incorporated in the > Grails tree? > I did discover a WicketBuilder to help integrating Wicket under Grails and > am trying to learn it's workings and I haven't been able to find too much > documentation on this :-( > > Any pointers/help appreciated > > Colin > -- Graeme Rocher Head of Grails Development SpringSource - Weapons for the War on Java Complexity http://www.springsource.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi Greme,
Thx for your response, any idea when Groovy is planned to support anonymous inner classes? And apparantly a wicketbuilder already seems to exist, just a little light on the documentation as yet Colin 2009/3/26 Graeme Rocher <[hidden email]> The Wicket plugin needs updating for 1.1, I decided to progress too |
|
On Thu, Mar 26, 2009 at 12:59 PM, Colin Chalmers <[hidden email]> wrote:
> Hi Greme, > > Thx for your response, any idea when Groovy is planned to support anonymous > inner classes? Groovy 1.7 > > And apparantly a wicketbuilder already seems to exist, just a little light > on the documentation as yet Yeh it exists, but I don't believe it has been maintained and currently doesn't work with Groovy 1.6 Cheers > > Colin > > 2009/3/26 Graeme Rocher <[hidden email]> >> >> The Wicket plugin needs updating for 1.1, I decided to progress too >> much further with it until Groovy supports anonymous inner classes and >> nested classes >> >> A builder could be written, but again we have other priorities, but if >> someone in the community wants to work on this integration we're happy >> to provide help/support >> >> Cheers >> >> On Thu, Mar 26, 2009 at 12:04 PM, Colin Chalmers <[hidden email]> >> wrote: >> > Hi all, >> > >> > I was excited about the release of Grails 1.1 and wanted to test it's >> > workings with Wicket. >> > I have two questions concerning this: >> > >> > 1. The Wicket plugin installation fails with Grails 1.1, (works OK with >> > 1.0.4) is this already known? >> > 2. Wicket pages under Grails are groovy files, is it not possible to use >> > Java files so that existing wicket applications can be incorporated in >> > the >> > Grails tree? >> > I did discover a WicketBuilder to help integrating Wicket under Grails >> > and >> > am trying to learn it's workings and I haven't been able to find too >> > much >> > documentation on this :-( >> > >> > Any pointers/help appreciated >> > >> > Colin >> > >> >> >> >> -- >> Graeme Rocher >> Head of Grails Development >> SpringSource - Weapons for the War on Java Complexity >> http://www.springsource.com >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > > -- Graeme Rocher Head of Grails Development SpringSource - Weapons for the War on Java Complexity http://www.springsource.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Graeme Rocher-3
I started using the wicket plugin 0.6 since grails 1.0.*, and have kept along with the latest wicket version by replacing the jars inside the plugin's lib directory. Upgrading to Grails 1.1.1, and subsequently to wicket 1.4.1 didn't cause any problem other than what is mandated (method signatures for IModel), so far. However it's important to note that Grails 1.1 requires grails-app/conf/BuildConfig to point to the legacy structure if you wish to keep it:
grails.project.plugins.dir="./plugins" Regarding the use of anonymous classes, I have been able to live with the restrictions, and create my anonymous classes from a java utility class. I don't know enough about configuring plugins, so there is likely a better way. JF
|
|
In reply to this post by Graeme Rocher-3
Hi
I'm new to Groovy/Grails. As a Java developer with Wicket experience, I was able to integrate Wicket and Grails but as many have noted, lack of support for "anonymous inner classes" makes coding with Wicket significantly less fun using Groovy (but I do want all the GORM magic from Grails). I was wondering with the recent Grails support for Groovy 1.7 which does "anonymous inner classes" if there are any plans on the road-map to update the the wicket plugin for Grails to support "anonymous inner classes". On a side-note: As a Java developer really frustrated with coding in J2EE & looking around for a good alternative to develop a production-strength shopping website, support in Grails for Wicket was the single biggest reason for me to buy books on Grails, spend weekends reading them and setting up the environment etc. I've been blown away so far and I would love it even more if there was more support for people using Wicket like me. hopefully as I become more well-versed in Groovy/Grails I could contribute to the plugin myself. Thanks!
|
|
Ok. I came up with a work-around for the wicket plugin not supporting "anonymous inner classes" just yet. The approach is to use a helper class that subclasses all wicket components and passing a Closure as a method argument.
Someone(I can't backtrace who) mentioned in a forum that they worked around the problem by creating a helper/utility class and thinking about how they did it got me to the below solution I'm going to plough through for now to see how far I can get with Wicket + Grails before I give up on it. Code: public class HomePage extends WebPage { public HomePage(final PageParameters parameters) { // TODO Add your page's components here Closure c = {String a -> System.out.println(a) } WicketLink l = new WicketLink("test", c, "CALLING CLOSURE PARAM!!") add(l) } } --------------------------------------------------- class WicketUtils { } class WicketLink extends Link{ Closure c String closureParam public WicketLink(String id, Closure c,String closureParam ){ super(id) this.c = c this.closureParam = closureParam } @Override public void onClick(){ c.call(closureParam) } -------------------------------------------------- }
|
|
Hi,
I've had a quick go at upgrading the wicket plugin for Grails 1.3 (which has inner class support thanks to Groovy 1.7). I could release a snapshot version of it if you'd like to give it a try.
cheers Lee
On 21 June 2010 05:16, NLogan <[hidden email]> wrote:
|
|
Hi Lee
Thanks for taking a look! I would love to try out the snapshot version. Let me know Thanks Naren
|
|
No worries, I should have some time on Thursday to spend on it so will email you and the list after that,
thanks Lee On 21 June 2010 11:01, NLogan <[hidden email]> wrote:
|
|
In reply to this post by NLogan
Hi Naren,
version 1.3.0-SNAPSHOT has been released. I got a basic test page with subcomponents, properties, css and ajax working (put all your wicket code under grails-app/pages).
I haven't got to trying to get easier injection of spring beans but you can wire in services (TestService in this example) using: @SpringBean(name="testService")
def testService I noticed Wicket's love of serialization doesn't always play nicely with proxies or Groovy's Reference class so I had to change some final variable to transient fields instead.
I was thinking about getting involved in the WicketBuilder that was started a while ago however now that you can do all your pages in Groovy (including anon inner classes) I'm not sure how much benefit the builder would add - thoughts?
Testing is another area that needs thinking about. Hopefully we can still use Wickets test classes (e.g. WicketTester) along with some of the Mock classes Grails provides to mock out the domain methods etc.
cheers Lee
On 21 June 2010 11:01, NLogan <[hidden email]> wrote:
|
|
I think the builder would still be a neater, more concise syntax personally
Cheers On 30 Jun 2010, at 04:37, Lee Butts wrote: Hi Naren, |
|
In reply to this post by Lee Butts
Lee
Thanks a bunch for releasing the snapshot. I was in the process of using closures all over the place for my existing project. I gave your release a quick run... anonymous inner classes work great! so I'm able to write syntax like this instead of using closure It makes wicket development a whole lot easier. Link l = new Link("test"){ public void onClick(){ println "NEW LINK USING ANON CLASS " } } add(l) But I ran into a Serialization exception when I try to access a variable from the outer class even though the value is printed out properly.. for example: int i=2535 Link l = new Link("test"){ public void onClick(){ println "NEW LINK USING ANON CLASS " + i } } add(l) OUTPUT: NEW LINK USING ANON CLASS 3245 2010-06-30 08:50:08,556 [http-8080-1] ERROR lang.Objects - Error serializing object class HomePage [object=[Page class = HomePage, id = 1, version = 0]] org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: groovy.lang.Reference Field hierarchy is: 1 [class=HomePage, path=1] private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;] java.lang.Object org.apache.wicket.Component.data[1] [class=HomePage$1, path=1:test] public groovy.lang.Reference HomePage$1.i [class=groovy.lang.Reference] <----- field that is not serializable I will try some more in the evening when I get home.
On Tue, Jun 29, 2010 at 10:37 PM, Lee Butts <[hidden email]> wrote: Hi Naren, |
|
Hi,
I hit the same thing. It seems to be related to the way that Groovy implements final variables inside methods. The way I got around it was to change it to a final field but that doesn't seem like a good long term solution.
If one of the groovy core guys see's this I'd appreciate some info on the internals of final variables and how we can overcome the issue. cheers
Lee
On 1 July 2010 00:53, Narender Loganathan <[hidden email]> wrote: Lee |
|
In reply to this post by Graeme Rocher-3
The builder would make the nesting of components clearer and more consice. Maybe we could come up with some kind of convention so that every page/component doesn't have to define a WicketBuilder and could just provide a closure that is somehow called by convention inside the constructor of any classes extending Wicket's base component/page classes. I'm not quite sure how to achieve that with metaClass trickery though.
Maybe a dynamic "assemble" method added to a wicket base class would be the simplest thing.
cheers Lee On 30 June 2010 19:59, Graeme Rocher <[hidden email]> wrote:
|
|
Lee
Couple of observations 1) Yes. using final to access outer class variable is the correct way(now I remember). But I still get a serialization exception on the final variable even though value is printed out correctly.I'm not sure if this is Groovy/Wicket-plugin complaining. 2) I haven't tested the new wicket plugin on a live project with services yet. When I upgraded a live project with a multiple wicket components I got the below error. I will look at it again this evening. Unexpected RuntimeException
3) I checked out the WicketBuilder . I realize that the original purpose was to work around lack of anonymous inner classes in previous versions of Groovy. Now with Groovy 1.7 I'm not sure how much value it adds. Especially as a wicket developer I would have to mentally convert the syntax from Wicket into WicketBuilder as well as making the code slightly difficult to read for other Wicket developers (or Java-Wicket developers). Also using WicketBuilder will affect migration of existing code from Java-wicket to Groovy-Wicket. http://wicketstuff.org/confluence/display/STUFFWIKI/WicketBuilder On Wed, Jun 30, 2010 at 10:18 PM, Lee Butts <[hidden email]> wrote: The builder would make the nesting of components clearer and more consice. Maybe we could come up with some kind of convention so that every page/component doesn't have to define a WicketBuilder and could just provide a closure that is somehow called by convention inside the constructor of any classes extending Wicket's base component/page classes. I'm not quite sure how to achieve that with metaClass trickery though. |
|
Hi,
not sure what that error is about. One thing I've had to add to my test applications is an OpenSessionInView filter. Do you think the plugin should do this by default?
The tricky part about porting an existing application with services (I presume you are injecting them using spring?) is merging any existing spring application contexts with the grails context. The best way I found was to use importBeans statements in resources.groovy e.g. beans = { importBeans("classpath*:/spring/myOldApplicationContext.xml")
cheers Lee On 2 July 2010 00:32, Narender Loganathan <[hidden email]> wrote: Lee |
|
Hi Lee
I will have to read more about OpenSessionInView before I can reply. I haven't figured out how to wire my services to be injected yet....right now I'm using the "new" keyword. Yep! starting out from a really beginner level. Thanks for the tip on migrating spring services. About the error with WebMarkupContainer, I noticed it happens only for an existing project..so not sure if my existing settings are causing the problem since a brand new project did not throw any such error for the same component. I'll have to delve into this more to track this down.. a starting point for me is that I see the below downloads happening when I run "grails clean" and that is the jar that is mentioned in the error...I tried excluding the javadoc in wicket dependencies..no luck for now Resolving dependencies... Downloading: http://repo1.maven.org/maven2/org/apache/wicket/wicket/1.4.9/wicket-1.4.9-javadoc.jar ... Download complete. Downloading: http://repo1.maven.org/maven2/org/apache/wicket/wicket/1.4.9/wicket-1.4.9-javadoc.jar.sha1 ... On Thu, Jul 1, 2010 at 11:43 PM, Lee Butts <[hidden email]> wrote: Hi, |
|
Ok I solved the error with wicket-1.4.9-javadoc.jar by removing it from ivy and commenting it out in the ivy xml & properties files
I think it was a case of bad HTML in the javadoc interfering during runtime.
Ideally I think this dependency should be removed in the plugin itself. My code works beautifully now with anonymous inner classes + services. Now onto the other items in the list : Serialization error, service injection and OpenSessionInView.. yay!
~/.ivy2/cache/org.apache.wicket/wicket/javadocs$ rm wicket-1.4.9-javadoc.jar ~/.ivy2/cache/org.apache.wicket/wicket ivy-1.4.9.xml : <publications>
<artifact name="wicket" type="jar" ext="jar" conf="master"/> <artifact name="wicket" type="source" ext="jar" conf="sources" m:classifier="sources"/>
<!--artifact name="wicket" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/-->
</publications> On Fri, Jul 2, 2010 at 8:46 AM, Narender Loganathan <[hidden email]> wrote: Hi Lee |
|
Strange, I don't get that error with the javadoc jar.
Unfortunately it doesn't look like you can exclude stuff based on classifier using BuildConfig.groovy. There might be an Ivy setting to turn off downloading sources and javadoc?
On 7 July 2010 00:35, Narender Loganathan <[hidden email]> wrote: Ok I solved the error with wicket-1.4.9-javadoc.jar by removing it from ivy and commenting it out in the ivy xml & properties files |
| Powered by Nabble | Edit this page |
