Re: Scala, dependency injection and wicket

2009-11-11 Thread nino martinez wael
I agree on Jeremy on this one. I actually don't know much about ajax (migth
be an understatement), but with wicket I've been able todo alot of ajax
integrations.

Heres something to read (if you want to know the inner workings):
http://ninomartinez.wordpress.com/2008/09/09/apache-wicket-javascript-integration/
http://blog.jayway.com/2008/09/26/wicket-javascript-internals-dissected/

Otherwise just see the examples and see how easy it are todo ajax with
wicket:
http://wicketstuff.org/wicket14/ajax/

regards Nino

2009/11/10 Jeremy Thomerson jer...@wickettraining.com

 On Tue, Nov 10, 2009 at 12:42 PM, Ashley Aitken mrhat...@mac.com wrote:

 
  On 08/10/2009, at 4:42 AM, Alex Rass wrote:
 
And so far: ajax is a pain in the ass that
  requires explicit work even for a simple form verification (bad
  architecture
  there).
 
 
  Is this true?
 
  One of my attractions to Wicket was that, hopefully, AJAX was easy (or at
  least easier) than other frameworks.


 No - it's not true.  AJAX is simpler in Wicket than I've seen in ANY other
 application framework.  You just have to know how to use it.  It's also
 very
 easy to do custom AJAX things in Wicket.




 --
 Jeremy Thomerson
 http://www.wickettraining.com



Re: Scala, dependency injection and wicket

2009-11-10 Thread Ashley Aitken


On 08/10/2009, at 4:42 AM, Alex Rass wrote:


 And so far: ajax is a pain in the ass that
requires explicit work even for a simple form verification (bad  
architecture

there).


Is this true?

One of my attractions to Wicket was that, hopefully, AJAX was easy (or  
at least easier) than other frameworks.



And this other problem with url formation.


What is that problem exactly?

Thanks,
Ashley.

--
Ashley Aitken
Perth, Western Australia
mrhatken at mac dot com
Skype Name: MrHatken (GMT + 8 Hours!)








-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-11-10 Thread Jeremy Thomerson
On Tue, Nov 10, 2009 at 12:42 PM, Ashley Aitken mrhat...@mac.com wrote:


 On 08/10/2009, at 4:42 AM, Alex Rass wrote:

   And so far: ajax is a pain in the ass that
 requires explicit work even for a simple form verification (bad
 architecture
 there).


 Is this true?

 One of my attractions to Wicket was that, hopefully, AJAX was easy (or at
 least easier) than other frameworks.


No - it's not true.  AJAX is simpler in Wicket than I've seen in ANY other
application framework.  You just have to know how to use it.  It's also very
easy to do custom AJAX things in Wicket.




--
Jeremy Thomerson
http://www.wickettraining.com


Re: Scala, dependency injection and wicket

2009-10-12 Thread Haim Ashkenazi

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi jan,

On Oct 8, 2009, at 6:47 AM, Jan Kriesten wrote:



Hi Haim,

Yes, I remember seeing that. How would you add it to wicket? by  
adding
ServiceInjector trait to the Application class or using the wicket- 
guice way
(addComponentInstantiationListener(new  
GuiceComponentInjector(this));)?


the Injector is just a trait, so anywhere it's needed, I just add it  
to the
corresponding class - whether it's a Wicket component or not doesn't  
matter. So

you have

class MyWebPage extends WebPage with Injector {
 @Inject val domainRepo: DomainRepo = domainRepo
}

class DomainRepo extends Repo with Injector {
 @Inject val customerRepo: CustomerRep = customerRepo
}

This is a general approach, so no need to add a intantiation listener.
I've started testing this approach and I'm a little stuck. I can  
easily inject objects like that for running the application, but how  
do I inject mock objects for testing? The module used by the injector  
(in the article's example) is hard-coded into the InjectorService  
object.


Thanks
- --
Haim
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkrS4QwACgkQhwMtGgRKzT12UwCfRPCcLKumJDVT1PGHH7Q6JvvK
qmEAmwfI2P2rN1Z+UdzN001EtlW/6F88
=H3rt
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-10-12 Thread Jan Kriesten

Hi,

 I've started testing this approach and I'm a little stuck. I can easily
 inject objects like that for running the application, but how do I
 inject mock objects for testing? The module used by the injector (in the
 article's example) is hard-coded into the InjectorService object.

you could use modules depending on environment settings e.g.

Shouldn't be too hard.

--- Jan.



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-10-12 Thread Haim Ashkenazi

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi

On Oct 12, 2009, at 10:01 AM, Jan Kriesten wrote:



Hi,

I've started testing this approach and I'm a little stuck. I can  
easily

inject objects like that for running the application, but how do I
inject mock objects for testing? The module used by the injector  
(in the

article's example) is hard-coded into the InjectorService object.


you could use modules depending on environment settings e.g.

Shouldn't be too hard.

I'll try it :)

Thanks
- --
Haim
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkrS5cUACgkQhwMtGgRKzT29DwCfY5FlXHzWZHMmA66ZPqwKR0zg
Jd8AoIyFntvM+UAI+0DTOuwEt1oa3juu
=bzB0
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-10-08 Thread Haim Ashkenazi

Hi jan,

On Oct 8, 2009, at 6:47 AM, Jan Kriesten wrote:



Hi Haim,

Yes, I remember seeing that. How would you add it to wicket? by  
adding
ServiceInjector trait to the Application class or using the wicket- 
guice way
(addComponentInstantiationListener(new  
GuiceComponentInjector(this));)?


the Injector is just a trait, so anywhere it's needed, I just add it  
to the
corresponding class - whether it's a Wicket component or not doesn't  
matter. So

you have

class MyWebPage extends WebPage with Injector {
 @Inject val domainRepo: DomainRepo = domainRepo
}

class DomainRepo extends Repo with Injector {
 @Inject val customerRepo: CustomerRep = customerRepo
}

This is a general approach, so no need to add a intantiation listener.
This is an interesting approach. From what I remember from guice, you  
can use it to overcome the problem of having to start all your object  
by injection (classes that initiated by new can not use the injector  
anymore). But does it preserve the ability to know at startup if all  
your injections are resolved?


BTW, to test it I need to supply a custom Module since I can not  
invoke the class without injection. am I right?




One more question though, In the example you're only using  
constructor

injection. Any reason not to use field injection?


Actually, I use field injection most of the time, see above.

Best regards, --- Jan.

One more question about injections in wicket. How can I handle the  
session object. Do I have to use the getSession method, or can I  
inject the session object as well?


Thanks for your help
--
Haim

PGP.sig
Description: This is a digitally signed message part


Re: Scala, dependency injection and wicket

2009-10-07 Thread Jan Kriesten

Hi Haim,

I think you read the article from Jonas Bonér about DI with Scala [1]?

In the paragraph about Guice you'll stumble over my name and my preferred way to
DI with Wicket.

Best regards, --- Jan.


[1] 
http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-10-07 Thread Haim Ashkenazi
Hi Jan,

On Wed, Oct 7, 2009 at 4:59 PM, Jan Kriesten kries...@mail.footprint.dewrote:


 Hi Haim,

 I think you read the article from Jonas Bonér about DI with Scala [1]?

yes of course :)



 In the paragraph about Guice you'll stumble over my name and my preferred
 way to
 DI with Wicket.

Yes, I remember seeing that. How would you add it to wicket? by adding
ServiceInjector trait to the Application class or using the wicket-guice way
(addComponentInstantiationListener(new GuiceComponentInjector(this));)?

One more question though, In the example you're only using constructor
injection. Any reason not to use field injection? In java the reason is to
allow final variables, but I think I read somewhere that in scala you can
inject to lazy vals.

Thanks for the help
-- 
Haim


RE: Scala, dependency injection and wicket

2009-10-07 Thread Alex Rass
This is similar problem to one I'm trying to solve.
Mine's: having several html files have the same java class controlling them.
(sounds simple, right?)

So far the only reasonable thing came from Martin and that's to override
getAssociatedMarkupStream in your own Page class.

Which also implies rewriting cache useage etc.

Wanna do it together or smth?

I'm new to wicket myself. And so far: ajax is a pain in the ass that
requires explicit work even for a simple form verification (bad architecture
there). And this other problem with url formation. Just hoping they didn't
go nuts making stuff final, like apache usually does ;)

-Original Message-
From: Haim Ashkenazi [mailto:haim.ashken...@gmail.com] 
Sent: Wednesday, October 07, 2009 10:51 AM
To: users@wicket.apache.org
Subject: Scala, dependency injection and wicket

Hi

I've started a test project on which I use scala, wicket and couchdb (I'm
new to all of them, which should make it fun :) ).

Until now I was dealing with the writing sample data access code, and I was
reading a lot of articles about DI in scala. I more or less went with what
is suggested in the Programing in scala book, that is using traits with
self type annotations and lazy vals (for calling modules). It's very easy to
construct object/classes for testing this way. Now I reached the web part
(wicket) and I came to a problem. In wicket the class name *has* to match
the html file (e.g. package/HomePage.html must have a corresponding
package.HomePage.class). This makes it (I think) impossible to use the above
method for DI.

One solution is to use DI framework like guice, but I was wondering if
someone hear has other idea?

Thanks in advance
-- 
Haim


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Scala, dependency injection and wicket

2009-10-07 Thread Haim Ashkenazi
Hi Alex,

Wow, I just realized something...

I've sent this to the wrong list :) I've meant to send it to the scala
mailing list (this may explain why I explain the way wicket works).

On Wed, Oct 7, 2009 at 10:42 PM, Alex Rass a...@itbsllc.com wrote:

 This is similar problem to one I'm trying to solve.
 Mine's: having several html files have the same java class controlling
 them.
 (sounds simple, right?)

I remember this thread :)



 So far the only reasonable thing came from Martin and that's to override
 getAssociatedMarkupStream in your own Page class.

 Which also implies rewriting cache useage etc.

 Wanna do it together or smth?

Actually this is not much of a problem for me. I just wanted to know if I
overlook something. I perfectly willing to use guice.

Thanks
-- 
Haim


Re: Scala, dependency injection and wicket

2009-10-07 Thread Jan Kriesten

Hi Haim,

 Yes, I remember seeing that. How would you add it to wicket? by adding
 ServiceInjector trait to the Application class or using the wicket-guice way
 (addComponentInstantiationListener(new GuiceComponentInjector(this));)?

the Injector is just a trait, so anywhere it's needed, I just add it to the
corresponding class - whether it's a Wicket component or not doesn't matter. So
you have

class MyWebPage extends WebPage with Injector {
  @Inject val domainRepo: DomainRepo = domainRepo
}

class DomainRepo extends Repo with Injector {
  @Inject val customerRepo: CustomerRep = customerRepo
}

This is a general approach, so no need to add a intantiation listener.

 One more question though, In the example you're only using constructor
 injection. Any reason not to use field injection?

Actually, I use field injection most of the time, see above.

Best regards, --- Jan.



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org