[Lift] JsCmd

2008-11-25 Thread Charles F. Munat

I want to update an attribute on a model object in the database via AJAX 
when a checkbox is clicked on a page. I presume that ajaxCheckbox is for 
this purpose.

Can anyone quickly give me an example of how it works?

If I have an attribute called isActive, how would I create an 
ajaxCheckbox that would call a method on the server when the checkbox is 
clicked to set isActive to true or false, depending on the state of the 
checkbox after the click?

bind(mine, xhtml,
   isActive - SHtml.ajaxCheckbox(thing.isActive, ???)

What about selecting the day of the week from an ajaxSelect and updating 
dayOfWeek. Or, finally, updating a text field on blur and setting the 
user_name.

Examples would really help.

I am pretty desperate to have this done today, and several hours of 
playing with various combinations has left me befuddled. Doesn't help 
that it's 4 AM.

Any and all help very greatly appreciated.

Thanks,
Chas.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JsCmd

2008-11-25 Thread Jorge Ortiz
You're almost there. The second parameter to ajaxCheckbox is a function that
gets called on the server when the checkbox changes:

  SHtml.ajaxCheckbox(thing.isActive, (toggled: Boolean) =
{thing.setActive(toggled); Noop})

The Noop is needed because ajaxCheckbox expects a Boolean = JsCmd function.
(I can't find a good reason for it needing a JsCmd though... Shouldn't it
just be Boolean = Any or better yet Boolean = Unit?) Howver, you can
replace thing.setActive(toggled) with whatever code you want to run when
the checkbox is toggled. Here, toggled contains the state of the checkbox.

Likewise ajaxSelect:

  val daysOfWeek = List(Monday, Tuesday, Wednesday, Thursday,
Friday,
Saturday, Sunday).map(x = (x, x))
  SHtml.ajaxSelect(daysOfWeek, Full(Monday), (opt: String) =
{thing.setDayOfWeek(opt); Noop})

The second parameter is the default value. The opt in the third parameter
will correspond to the selected day.

--j

On Tue, Nov 25, 2008 at 4:11 AM, Charles F. Munat [EMAIL PROTECTED] wrote:


 I want to update an attribute on a model object in the database via AJAX
 when a checkbox is clicked on a page. I presume that ajaxCheckbox is for
 this purpose.

 Can anyone quickly give me an example of how it works?

 If I have an attribute called isActive, how would I create an
 ajaxCheckbox that would call a method on the server when the checkbox is
 clicked to set isActive to true or false, depending on the state of the
 checkbox after the click?

 bind(mine, xhtml,
   isActive - SHtml.ajaxCheckbox(thing.isActive, ???)

 What about selecting the day of the week from an ajaxSelect and updating
 dayOfWeek. Or, finally, updating a text field on blur and setting the
 user_name.

 Examples would really help.

 I am pretty desperate to have this done today, and several hours of
 playing with various combinations has left me befuddled. Doesn't help
 that it's 4 AM.

 Any and all help very greatly appreciated.

 Thanks,
 Chas.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JsCmd

2008-11-25 Thread Jorge Ortiz
And David beat me to it... Oh well :)

On Tue, Nov 25, 2008 at 5:04 AM, Jorge Ortiz [EMAIL PROTECTED] wrote:

 You're almost there. The second parameter to ajaxCheckbox is a function
 that gets called on the server when the checkbox changes:

   SHtml.ajaxCheckbox(thing.isActive, (toggled: Boolean) =
 {thing.setActive(toggled); Noop})

 The Noop is needed because ajaxCheckbox expects a Boolean = JsCmd
 function. (I can't find a good reason for it needing a JsCmd though...
 Shouldn't it just be Boolean = Any or better yet Boolean = Unit?) Howver,
 you can replace thing.setActive(toggled) with whatever code you want to
 run when the checkbox is toggled. Here, toggled contains the state of the
 checkbox.

 Likewise ajaxSelect:

   val daysOfWeek = List(Monday, Tuesday, Wednesday, Thursday,
 Friday,
 Saturday, Sunday).map(x = (x, x))
   SHtml.ajaxSelect(daysOfWeek, Full(Monday), (opt: String) =
 {thing.setDayOfWeek(opt); Noop})

 The second parameter is the default value. The opt in the third parameter
 will correspond to the selected day.

 --j


 On Tue, Nov 25, 2008 at 4:11 AM, Charles F. Munat [EMAIL PROTECTED] wrote:


 I want to update an attribute on a model object in the database via AJAX
 when a checkbox is clicked on a page. I presume that ajaxCheckbox is for
 this purpose.

 Can anyone quickly give me an example of how it works?

 If I have an attribute called isActive, how would I create an
 ajaxCheckbox that would call a method on the server when the checkbox is
 clicked to set isActive to true or false, depending on the state of the
 checkbox after the click?

 bind(mine, xhtml,
   isActive - SHtml.ajaxCheckbox(thing.isActive, ???)

 What about selecting the day of the week from an ajaxSelect and updating
 dayOfWeek. Or, finally, updating a text field on blur and setting the
 user_name.

 Examples would really help.

 I am pretty desperate to have this done today, and several hours of
 playing with various combinations has left me befuddled. Doesn't help
 that it's 4 AM.

 Any and all help very greatly appreciated.

 Thanks,
 Chas.

 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JsCmd

2008-11-25 Thread David Pollak


The return type is JsCmd because 80% of the time the Ajax command causes 
some update top be sent to the browser.  So, the special case is a Noop 
(sometimes I do an implicit Unit - Noop) and the default case is returning 
the code to be rendered in the browser.

On Nov 25, 2008 5:04 AM, Jorge Ortiz [EMAIL PROTECTED] wrote:

You're almost there. The second parameter to ajaxCheckbox is a function that 
gets called on the server when the checkbox changes:

  SHtml.ajaxCheckbox(thing.isActive, (toggled: Boolean) = 
{thing.setActive(toggled); Noop})

The Noop is needed because ajaxCheckbox expects a Boolean = JsCmd function. 
(I can't find a good reason for it needing a JsCmd though... Shouldn't it 
just be Boolean = Any or better yet Boolean = Unit?) Howver, you can 
replace thing.setActive(toggled) with whatever code you want to run when 
the checkbox is toggled. Here, toggled contains the state of the checkbox.

Likewise ajaxSelect:

  val daysOfWeek = List(Monday, Tuesday, Wednesday, Thursday, 
Friday,
Saturday, Sunday).map(x = (x, x))
  SHtml.ajaxSelect(daysOfWeek, Full(Monday), (opt: String) = 
{thing.setDayOfWeek(opt); Noop})

The second parameter is the default value. The opt in the third parameter 
will correspond to the selected day.

--j

On Tue, Nov 25, 2008 at 4:11 AM, Charles F. Munat [EMAIL PROTECTED] wrote:  
  I want to update a...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JsCmd

2008-11-25 Thread David Pollak


Shtml.ajaxCheckbox(thing.isChecked, b = {thing.setChecked(b); JsCmds.Noop})

On Nov 25, 2008 4:12 AM, Charles F. Munat [EMAIL PROTECTED] wrote:


I want to update an attribute on a model object in the database via AJAX
when a checkbox is clicked on a page. I presume that ajaxCheckbox is for
this purpose.

Can anyone quickly give me an example of how it works?

If I have an attribute called isActive, how would I create an
ajaxCheckbox that would call a method on the server when the checkbox is
clicked to set isActive to true or false, depending on the state of the
checkbox after the click?

bind(mine, xhtml,
  isActive - SHtml.ajaxCheckbox(thing.isActive, ???)

What about selecting the day of the week from an ajaxSelect and updating
dayOfWeek. Or, finally, updating a text field on blur and setting the
user_name.

Examples would really help.

I am pretty desperate to have this done today, and several hours of
playing with various combinations has left me befuddled. Doesn't help
that it's 4 AM.

Any and all help very greatly appreciated.

Thanks,
Chas.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] WAS [Lift committers] Re: Adding JPA scaffolding to lift?

2008-11-25 Thread Viktor Klang
Derek, I still humbly suggest writing an implementation of
PropertyAccessorhttp://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.htmlto
map the values between JPA and the Lift business objects.

Then, in the Hibernate-mapping or the Configuration object, just define:

hibernate-mapping
   default-cascade=none
   default-access=*net.liftweb.jpa.LiftFieldAccessor* //Or something else
   package=bahblah


Cheers,
V
-- Forwarded message --
From: Derek Chen-Becker [EMAIL PROTECTED]
Date: Tue, Nov 25, 2008 at 3:54 PM
Subject: [Lift committers] Re: Adding JPA scaffolding to lift?
To: [EMAIL PROTECTED]


I thought about it a bit last night. JPA infers entity members from either
fields or getter/setter pairs. In that sense, I could create a JPA object
like

class MyEntity extends Record[MyEntity] {
  object nameField extends StringField(this,100)

  def name = nameField.value

  def name_=(value : String) = nameField.set(value)
}

But that seems a bit clunky. The other option may be to somehow come up with
a modified Field (JPAField?) trait that can access instance fields, perhaps
via a closure.

Derek


On Tue, Nov 25, 2008 at 2:42 AM, Tim Perrett [EMAIL PROTECTED] wrote:


 Hmm yeah - I wonder if record will need to be some kind of DAO for
 JPA?

 On Nov 24, 11:42 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
  I'm thinking about it. I think the fact that fields on a record are
 defined
  as objects and not members may complicate things a bit, but I'm still
  digesting all of the new stuff.
 
  Derek
 
  On Mon, Nov 24, 2008 at 12:01 PM, Tim Perrett [EMAIL PROTECTED]
 wrote:
 
   How did this go Derek?
 
   Now we have the record stuff in there, are you going to take a bash at
   writing a JPA backend? That would rock!
 
   Cheers, Tim
 
   On Nov 13, 2:17 pm, Derek Chen-Becker [EMAIL PROTECTED] wrote:
Fair enough. I'll check out the Record branch and start looking at
 it.
 
Thanks,
 
Derek
 
On Thu, Nov 13, 2008 at 6:42 AM, Marius [EMAIL PROTECTED]
 wrote:
 
 +1
 
 On Nov 9, 12:56 am, David Pollak [EMAIL PROTECTED]
 wrote:
  I'd rather wait until Marius and I are done with the record/field
   stuff
 and
  do a JPA back-end to that.
 
  On Sat, Nov 8, 2008 at 1:39 PM, TylerWeir [EMAIL PROTECTED]
   wrote:
 
   We may want to also offer an archetype that has the skeleton of
 a
   JPA-
   aware app ready to go.
 
   And +1 for adding this to Lift proper.
 
   On Nov 8, 2:43 pm, Tim Perrett [EMAIL PROTECTED] wrote:
Sounds like a good idea Derek - this is annoying the ass out
 of
   me
right now having to copy and paste the JPA scala wrapper
 files
   from
project to project so, sure, this would be a great idea
 and
   one
welcomed by the majority of lift-jpa users.
 
+1 for including this in lift proper
 
Cheers, Tim
 
On Nov 8, 4:06 pm, Derek Chen-Becker 
 [EMAIL PROTECTED]
 wrote:
 
 I've had several requests to move the JPA.scala source
   (ScalaEntityManager
 and ScalaQuery) out of the demo site and into lift proper
 so
   that
   people can
 just extend instead of copying and pasting code. Would
 anyone
   be
   opposed to
 me making a new lift-jpa module to hold common classes?
 
 Derek
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Collaborative Task Managementhttp://much4.us
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp







-- 
Viktor Klang
Senior Systems Analyst

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA and Record

2008-11-25 Thread Kris Nuttycombe
On Tue, Nov 25, 2008 at 11:24 AM, Derek Chen-Becker
[EMAIL PROTECTED]wrote:

 We just had a bit of a discussion on integrating JPA with the new Record
 stuff over on the committers list and unintentionally got into some
 substance discussion that would be better handled on the main list. Let me
 sum up:
 First off, the new Record stuff looks great! It's lean, it's mean and it's
 clean. There is still some work to do on fleshing out some implementation
 details and maybe fleshing out some of the base Field support (I'm doing a
 BigDecimal-based field for a book example, would people want to see that?),
 but what's there so far is very nice; David and Marius have done a great
 job.


Fields with custom type mappings are pretty important, and unfortunately
they're not in the base JPA spec. Hibernate has its @Type annotation, so
whatever solution we come up with should be extensible to the degree that it
be able to accommodate such extensions.


 The issue with JPA, specifically, is that the way it's designed, it infers
 persistent fields on an instance either via getter/setter pairs or via
 annotations on fields.


Remember that additionally in JPA, a bare unannotated field on an object
will be inferred as persistent unless annotated @Transient (or, in java,
unless it is declared with the transient modifier)


 Record, for reasons that I think are completely legitimate, uses instance
 objects instead for field definition. These two approaches aren't mutually
 exclusive, but it does complicate things a bit from the JPA perspective. The
 simplest approach I can think of is to merely add the appropriate
 getter/setter pairs that delegate to the Record object fields, like this:

 class MyEntity extends Record[MyEntity] {
   object name extends StringField(this,100)

   // getter/setter used only by the JPA provider
   @Column{val name = my_name_}
   def getName() = name.value
   def setName(newVal : String) = name.set(newVal)
 }


I haven't had time to look at Record yet, but could you elaborate on the
reasons for using object for field definitions? It seems like this would
make mapping class hierarchies problematic, although I may be
misunderstanding.

Kris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Best way to learn Lift

2008-11-25 Thread Kris Nuttycombe
I've actually found that building a Lift project is a fairly effective means
of learning Scala, because Lift tends to use a lot of idiomatic Scala that
you don't necessarily see in context when reading the Artima book. It can be
a lot to take on at once, but I've found that being exposed to and forced to
use some of the more unfamiliar language elements (coming from a C/Java/Ruby
background) has accelerated my uptake of those features. Particularly when
things haven't worked quite as expected and I've had to go digging in the
code to figure out what was going on. :)

Kris

On Tue, Nov 25, 2008 at 1:03 PM, Mike Pence [EMAIL PROTECTED] wrote:


 Hey guys,

 Color me another Lift enthusiast from Rails-land. I am wondering if
 anyone who has been through the learning journey has a recommendation
 of how to go about it. I got the Artima book on Scala, and I am loving
 it, but it is a hefty tomb. I don't want to make the mistake I made
 when learning Rails of not learning the foundation language first, but
 I am eager to get my hands on some Lift.

 Advice?

 Best,
 Mike Pence

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Best way to learn Lift

2008-11-25 Thread Derek Chen-Becker
There are also at least two Lift books in the works. You can see the book
that Tyler and I are working on here:
http://github.com/tjweir/liftbook/tree/master

If you want to view the actual book you'll need LyX:

http://www.lyx.org/

Derek

On Tue, Nov 25, 2008 at 3:10 PM, Kris Nuttycombe
[EMAIL PROTECTED]wrote:

 I've actually found that building a Lift project is a fairly effective
 means of learning Scala, because Lift tends to use a lot of idiomatic Scala
 that you don't necessarily see in context when reading the Artima book. It
 can be a lot to take on at once, but I've found that being exposed to and
 forced to use some of the more unfamiliar language elements (coming from a
 C/Java/Ruby background) has accelerated my uptake of those features.
 Particularly when things haven't worked quite as expected and I've had to go
 digging in the code to figure out what was going on. :)

 Kris


 On Tue, Nov 25, 2008 at 1:03 PM, Mike Pence [EMAIL PROTECTED] wrote:


 Hey guys,

 Color me another Lift enthusiast from Rails-land. I am wondering if
 anyone who has been through the learning journey has a recommendation
 of how to go about it. I got the Artima book on Scala, and I am loving
 it, but it is a hefty tomb. I don't want to make the mistake I made
 when learning Rails of not learning the foundation language first, but
 I am eager to get my hands on some Lift.

 Advice?

 Best,
 Mike Pence




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Best way to learn Lift

2008-11-25 Thread Mike Pence

Awesome! I will check the book out and start putting together a Lift
project soon!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: HTTP Authentication Example

2008-11-25 Thread Derek Chen-Becker
I just noticed your commit today with this stuff. Looks great! I like the
hook in LiftRules :)
Derek

On Sat, Nov 22, 2008 at 3:50 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 I like partial functions :) The really nice thing is that you can use
 matching. Looks good!

 Derek


 On Sat, Nov 22, 2008 at 7:47 AM, Tim Perrett [EMAIL PROTECTED] wrote:


 Ok, i've refactored a whole bunch of stuff.

 I used a partial function :-) All a user need to now is something
 like:

 object SimpleBasicAuth extends HttpBasicAuthentication {

  def verified_? = {
case((user, pass, req)) = {
  if(user == tim  pass == badger){
true
  } else {
false
  }
}
  }

 }

 Obviously this would be replaced by a database, or cache lookup or
 something - what you rekon?

 Now I just need to get on to writing the trait for digest processing.

 Feedback appreciated :)

 Cheers, Tim


 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: WAS [Lift committers] Re: Adding JPA scaffolding to lift?

2008-11-25 Thread Viktor Klang
yes, if we resort into using xml configt' really just a matter of providing
implmentations that work with the different JPA providers.

What doyou think Derek?

On Tue, Nov 25, 2008 at 10:12 PM, Derek Chen-Becker
[EMAIL PROTECTED]wrote:

 That's a very interesting idea. It's been a long time since I've touched
 the XML mappings, but JPA definitely supports a newer version of it now. Let
 me look into that.
 Derek


 On Tue, Nov 25, 2008 at 2:55 PM, David Pollak 
 [EMAIL PROTECTED] wrote:



 On Tue, Nov 25, 2008 at 12:35 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 I'll look at PropertyAccessor, but I would prefer something that isn't
 Hibernate specific.


 I agree that Hiberate specific stuff may be less than optimal.

 Is there a way that we can queries the models at start-up time and
 generate XML that does EJB 2.1 style mapping such that we can feed that into
 JPA to do the mapping?



 Thanks,

 Derek


 On Tue, Nov 25, 2008 at 1:24 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 Derek, I still humbly suggest writing an implementation of
 PropertyAccessorhttp://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.htmlto
  map the values between JPA and the Lift business objects.

 Then, in the Hibernate-mapping or the Configuration object, just define:

 hibernate-mapping
default-cascade=none

default-access=*net.liftweb.jpa.LiftFieldAccessor* //Or something else
package=bahblah


 Cheers,
 V
 -- Forwarded message --
 From: Derek Chen-Becker [EMAIL PROTECTED]
 Date: Tue, Nov 25, 2008 at 3:54 PM
 Subject: [Lift committers] Re: Adding JPA scaffolding to lift?
 To: [EMAIL PROTECTED]


 I thought about it a bit last night. JPA infers entity members from
 either fields or getter/setter pairs. In that sense, I could create a JPA
 object like

 class MyEntity extends Record[MyEntity] {
   object nameField extends StringField(this,100)

   def name = nameField.value

   def name_=(value : String) = nameField.set(value)
 }

 But that seems a bit clunky. The other option may be to somehow come up
 with a modified Field (JPAField?) trait that can access instance fields,
 perhaps via a closure.

 Derek


 On Tue, Nov 25, 2008 at 2:42 AM, Tim Perrett [EMAIL PROTECTED]wrote:


 Hmm yeah - I wonder if record will need to be some kind of DAO for
 JPA?

 On Nov 24, 11:42 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
  I'm thinking about it. I think the fact that fields on a record are
 defined
  as objects and not members may complicate things a bit, but I'm still
  digesting all of the new stuff.
 
  Derek
 
  On Mon, Nov 24, 2008 at 12:01 PM, Tim Perrett [EMAIL PROTECTED]
 wrote:
 
   How did this go Derek?
 
   Now we have the record stuff in there, are you going to take a bash
 at
   writing a JPA backend? That would rock!
 
   Cheers, Tim
 
   On Nov 13, 2:17 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
Fair enough. I'll check out the Record branch and start looking
 at it.
 
Thanks,
 
Derek
 
On Thu, Nov 13, 2008 at 6:42 AM, Marius [EMAIL PROTECTED]
 wrote:
 
 +1
 
 On Nov 9, 12:56 am, David Pollak 
 [EMAIL PROTECTED]
 wrote:
  I'd rather wait until Marius and I are done with the
 record/field
   stuff
 and
  do a JPA back-end to that.
 
  On Sat, Nov 8, 2008 at 1:39 PM, TylerWeir 
 [EMAIL PROTECTED]
   wrote:
 
   We may want to also offer an archetype that has the
 skeleton of a
   JPA-
   aware app ready to go.
 
   And +1 for adding this to Lift proper.
 
   On Nov 8, 2:43 pm, Tim Perrett [EMAIL PROTECTED]
 wrote:
Sounds like a good idea Derek - this is annoying the ass
 out of
   me
right now having to copy and paste the JPA scala wrapper
 files
   from
project to project so, sure, this would be a great
 idea and
   one
welcomed by the majority of lift-jpa users.
 
+1 for including this in lift proper
 
Cheers, Tim
 
On Nov 8, 4:06 pm, Derek Chen-Becker 
 [EMAIL PROTECTED]
 wrote:
 
 I've had several requests to move the JPA.scala source
   (ScalaEntityManager
 and ScalaQuery) out of the demo site and into lift
 proper so
   that
   people can
 just extend instead of copying and pasting code. Would
 anyone
   be
   opposed to
 me making a new lift-jpa module to hold common classes?
 
 Derek
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Collaborative Task Managementhttp://much4.us
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp







 --
 Viktor Klang
 Senior Systems Analyst








 --
 Lift, the simply functional web framework http://liftweb.net
 Collaborative Task Management http://much4.us
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp




 



-- 
Viktor Klang
Senior Systems Analyst

--~--~-~--~~~---~--~~
You received this message because you are subscribed 

[Lift] Re: WAS [Lift committers] Re: Adding JPA scaffolding to lift?

2008-11-25 Thread Viktor Klang
On Tue, Nov 25, 2008 at 11:21 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 yes, if we resort into using xml configt' really just a matter of providing
 implmentations that work with the different JPA providers.

 What doyou think Derek?


Sorry, that email turned out to get mangled.

Basically, there are a couple of good solutions available. :)



 On Tue, Nov 25, 2008 at 10:12 PM, Derek Chen-Becker [EMAIL PROTECTED]
  wrote:

 That's a very interesting idea. It's been a long time since I've touched
 the XML mappings, but JPA definitely supports a newer version of it now. Let
 me look into that.
 Derek


 On Tue, Nov 25, 2008 at 2:55 PM, David Pollak 
 [EMAIL PROTECTED] wrote:



 On Tue, Nov 25, 2008 at 12:35 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 I'll look at PropertyAccessor, but I would prefer something that isn't
 Hibernate specific.


 I agree that Hiberate specific stuff may be less than optimal.

 Is there a way that we can queries the models at start-up time and
 generate XML that does EJB 2.1 style mapping such that we can feed that into
 JPA to do the mapping?



 Thanks,

 Derek


 On Tue, Nov 25, 2008 at 1:24 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 Derek, I still humbly suggest writing an implementation of
 PropertyAccessorhttp://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.htmlto
  map the values between JPA and the Lift business objects.

 Then, in the Hibernate-mapping or the Configuration object, just
 define:

 hibernate-mapping
default-cascade=none

default-access=*net.liftweb.jpa.LiftFieldAccessor* //Or something 
 else
package=bahblah


 Cheers,
 V
 -- Forwarded message --
 From: Derek Chen-Becker [EMAIL PROTECTED]
 Date: Tue, Nov 25, 2008 at 3:54 PM
 Subject: [Lift committers] Re: Adding JPA scaffolding to lift?
 To: [EMAIL PROTECTED]


 I thought about it a bit last night. JPA infers entity members from
 either fields or getter/setter pairs. In that sense, I could create a JPA
 object like

 class MyEntity extends Record[MyEntity] {
   object nameField extends StringField(this,100)

   def name = nameField.value

   def name_=(value : String) = nameField.set(value)
 }

 But that seems a bit clunky. The other option may be to somehow come up
 with a modified Field (JPAField?) trait that can access instance fields,
 perhaps via a closure.

 Derek


 On Tue, Nov 25, 2008 at 2:42 AM, Tim Perrett [EMAIL PROTECTED]wrote:


 Hmm yeah - I wonder if record will need to be some kind of DAO for
 JPA?

 On Nov 24, 11:42 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
  I'm thinking about it. I think the fact that fields on a record are
 defined
  as objects and not members may complicate things a bit, but I'm
 still
  digesting all of the new stuff.
 
  Derek
 
  On Mon, Nov 24, 2008 at 12:01 PM, Tim Perrett [EMAIL PROTECTED]
 wrote:
 
   How did this go Derek?
 
   Now we have the record stuff in there, are you going to take a
 bash at
   writing a JPA backend? That would rock!
 
   Cheers, Tim
 
   On Nov 13, 2:17 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
Fair enough. I'll check out the Record branch and start looking
 at it.
 
Thanks,
 
Derek
 
On Thu, Nov 13, 2008 at 6:42 AM, Marius 
 [EMAIL PROTECTED] wrote:
 
 +1
 
 On Nov 9, 12:56 am, David Pollak 
 [EMAIL PROTECTED]
 wrote:
  I'd rather wait until Marius and I are done with the
 record/field
   stuff
 and
  do a JPA back-end to that.
 
  On Sat, Nov 8, 2008 at 1:39 PM, TylerWeir 
 [EMAIL PROTECTED]
   wrote:
 
   We may want to also offer an archetype that has the
 skeleton of a
   JPA-
   aware app ready to go.
 
   And +1 for adding this to Lift proper.
 
   On Nov 8, 2:43 pm, Tim Perrett [EMAIL PROTECTED]
 wrote:
Sounds like a good idea Derek - this is annoying the ass
 out of
   me
right now having to copy and paste the JPA scala wrapper
 files
   from
project to project so, sure, this would be a great
 idea and
   one
welcomed by the majority of lift-jpa users.
 
+1 for including this in lift proper
 
Cheers, Tim
 
On Nov 8, 4:06 pm, Derek Chen-Becker 
 [EMAIL PROTECTED]
 wrote:
 
 I've had several requests to move the JPA.scala source
   (ScalaEntityManager
 and ScalaQuery) out of the demo site and into lift
 proper so
   that
   people can
 just extend instead of copying and pasting code. Would
 anyone
   be
   opposed to
 me making a new lift-jpa module to hold common
 classes?
 
 Derek
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Collaborative Task Managementhttp://much4.us
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp







 --
 Viktor Klang
 Senior Systems Analyst








 --
 Lift, the simply functional web framework http://liftweb.net
 Collaborative Task Management http://much4.us
 Follow me: 

[Lift] Re: HTTP Authentication Example

2008-11-25 Thread Tim Perrett

That was marius's smart idea :)

If you can have a play with the branch, it would be great to get some  
feedback.

Cheers, Tim

On 25 Nov 2008, at 21:55, Derek Chen-Becker wrote:

 I just noticed your commit today with this stuff. Looks great! I  
 like the hook in LiftRules :)

 Derek


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: WAS [Lift committers] Re: Adding JPA scaffolding to lift?

2008-11-25 Thread Derek Chen-Becker
:) I think that we may be able to use the XML approach, but I want to check
to make sure that it's even possible to provide custom XML mappings directly
to a JPA provider. It may be something that we have do a little custom
coding for each vendor, but as long as there was a uniform interface that
wouldn't be an issue.
Derek

On Tue, Nov 25, 2008 at 4:23 PM, Viktor Klang [EMAIL PROTECTED]wrote:



 On Tue, Nov 25, 2008 at 11:21 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 yes, if we resort into using xml configt' really just a matter of
 providing implmentations that work with the different JPA providers.

 What doyou think Derek?


 Sorry, that email turned out to get mangled.

 Basically, there are a couple of good solutions available. :)



 On Tue, Nov 25, 2008 at 10:12 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 That's a very interesting idea. It's been a long time since I've touched
 the XML mappings, but JPA definitely supports a newer version of it now. Let
 me look into that.
 Derek


 On Tue, Nov 25, 2008 at 2:55 PM, David Pollak 
 [EMAIL PROTECTED] wrote:



 On Tue, Nov 25, 2008 at 12:35 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 I'll look at PropertyAccessor, but I would prefer something that isn't
 Hibernate specific.


 I agree that Hiberate specific stuff may be less than optimal.

 Is there a way that we can queries the models at start-up time and
 generate XML that does EJB 2.1 style mapping such that we can feed that 
 into
 JPA to do the mapping?



 Thanks,

 Derek


 On Tue, Nov 25, 2008 at 1:24 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 Derek, I still humbly suggest writing an implementation of
 PropertyAccessorhttp://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.htmlto
  map the values between JPA and the Lift business objects.

 Then, in the Hibernate-mapping or the Configuration object, just
 define:

 hibernate-mapping
default-cascade=none

default-access=*net.liftweb.jpa.LiftFieldAccessor* //Or something 
 else
package=bahblah


 Cheers,
 V
 -- Forwarded message --
 From: Derek Chen-Becker [EMAIL PROTECTED]
 Date: Tue, Nov 25, 2008 at 3:54 PM
 Subject: [Lift committers] Re: Adding JPA scaffolding to lift?
 To: [EMAIL PROTECTED]


 I thought about it a bit last night. JPA infers entity members from
 either fields or getter/setter pairs. In that sense, I could create a JPA
 object like

 class MyEntity extends Record[MyEntity] {
   object nameField extends StringField(this,100)

   def name = nameField.value

   def name_=(value : String) = nameField.set(value)
 }

 But that seems a bit clunky. The other option may be to somehow come
 up with a modified Field (JPAField?) trait that can access instance 
 fields,
 perhaps via a closure.

 Derek


 On Tue, Nov 25, 2008 at 2:42 AM, Tim Perrett [EMAIL PROTECTED]wrote:


 Hmm yeah - I wonder if record will need to be some kind of DAO for
 JPA?

 On Nov 24, 11:42 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
  I'm thinking about it. I think the fact that fields on a record are
 defined
  as objects and not members may complicate things a bit, but I'm
 still
  digesting all of the new stuff.
 
  Derek
 
  On Mon, Nov 24, 2008 at 12:01 PM, Tim Perrett 
 [EMAIL PROTECTED] wrote:
 
   How did this go Derek?
 
   Now we have the record stuff in there, are you going to take a
 bash at
   writing a JPA backend? That would rock!
 
   Cheers, Tim
 
   On Nov 13, 2:17 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
Fair enough. I'll check out the Record branch and start looking
 at it.
 
Thanks,
 
Derek
 
On Thu, Nov 13, 2008 at 6:42 AM, Marius 
 [EMAIL PROTECTED] wrote:
 
 +1
 
 On Nov 9, 12:56 am, David Pollak 
 [EMAIL PROTECTED]
 wrote:
  I'd rather wait until Marius and I are done with the
 record/field
   stuff
 and
  do a JPA back-end to that.
 
  On Sat, Nov 8, 2008 at 1:39 PM, TylerWeir 
 [EMAIL PROTECTED]
   wrote:
 
   We may want to also offer an archetype that has the
 skeleton of a
   JPA-
   aware app ready to go.
 
   And +1 for adding this to Lift proper.
 
   On Nov 8, 2:43 pm, Tim Perrett [EMAIL PROTECTED]
 wrote:
Sounds like a good idea Derek - this is annoying the
 ass out of
   me
right now having to copy and paste the JPA scala
 wrapper files
   from
project to project so, sure, this would be a great
 idea and
   one
welcomed by the majority of lift-jpa users.
 
+1 for including this in lift proper
 
Cheers, Tim
 
On Nov 8, 4:06 pm, Derek Chen-Becker 
 [EMAIL PROTECTED]
 wrote:
 
 I've had several requests to move the JPA.scala
 source
   (ScalaEntityManager
 and ScalaQuery) out of the demo site and into lift
 proper so
   that
   people can
 just extend instead of copying and pasting code.
 Would anyone
   be
   opposed to
 me making a new lift-jpa module to hold common
 classes?
 
 

[Lift] Re: WAS [Lift committers] Re: Adding JPA scaffolding to lift?

2008-11-25 Thread Viktor Klang
On Tue, Nov 25, 2008 at 11:25 PM, Derek Chen-Becker
[EMAIL PROTECTED]wrote:

 :) I think that we may be able to use the XML approach, but I want to check
 to make sure that it's even possible to provide custom XML mappings directly
 to a JPA provider. It may be something that we have do a little custom
 coding for each vendor, but as long as there was a uniform interface that
 wouldn't be an issue.


Spoken by a smart man! :)



 Derek

 On Tue, Nov 25, 2008 at 4:23 PM, Viktor Klang [EMAIL PROTECTED]wrote:



 On Tue, Nov 25, 2008 at 11:21 PM, Viktor Klang [EMAIL PROTECTED]wrote:

 yes, if we resort into using xml configt' really just a matter of
 providing implmentations that work with the different JPA providers.

 What doyou think Derek?


 Sorry, that email turned out to get mangled.

 Basically, there are a couple of good solutions available. :)



 On Tue, Nov 25, 2008 at 10:12 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 That's a very interesting idea. It's been a long time since I've touched
 the XML mappings, but JPA definitely supports a newer version of it now. 
 Let
 me look into that.
 Derek


 On Tue, Nov 25, 2008 at 2:55 PM, David Pollak 
 [EMAIL PROTECTED] wrote:



 On Tue, Nov 25, 2008 at 12:35 PM, Derek Chen-Becker 
 [EMAIL PROTECTED] wrote:

 I'll look at PropertyAccessor, but I would prefer something that isn't
 Hibernate specific.


 I agree that Hiberate specific stuff may be less than optimal.

 Is there a way that we can queries the models at start-up time and
 generate XML that does EJB 2.1 style mapping such that we can feed that 
 into
 JPA to do the mapping?



 Thanks,

 Derek


 On Tue, Nov 25, 2008 at 1:24 PM, Viktor Klang [EMAIL PROTECTED]
  wrote:

 Derek, I still humbly suggest writing an implementation of
 PropertyAccessorhttp://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.htmlto
  map the values between JPA and the Lift business objects.

 Then, in the Hibernate-mapping or the Configuration object, just
 define:

 hibernate-mapping
default-cascade=none

default-access=*net.liftweb.jpa.LiftFieldAccessor* //Or something 
 else
package=bahblah


 Cheers,
 V
 -- Forwarded message --
 From: Derek Chen-Becker [EMAIL PROTECTED]
 Date: Tue, Nov 25, 2008 at 3:54 PM
 Subject: [Lift committers] Re: Adding JPA scaffolding to lift?
 To: [EMAIL PROTECTED]


 I thought about it a bit last night. JPA infers entity members from
 either fields or getter/setter pairs. In that sense, I could create a 
 JPA
 object like

 class MyEntity extends Record[MyEntity] {
   object nameField extends StringField(this,100)

   def name = nameField.value

   def name_=(value : String) = nameField.set(value)
 }

 But that seems a bit clunky. The other option may be to somehow come
 up with a modified Field (JPAField?) trait that can access instance 
 fields,
 perhaps via a closure.

 Derek


 On Tue, Nov 25, 2008 at 2:42 AM, Tim Perrett [EMAIL PROTECTED]wrote:


 Hmm yeah - I wonder if record will need to be some kind of DAO for
 JPA?

 On Nov 24, 11:42 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
  I'm thinking about it. I think the fact that fields on a record
 are defined
  as objects and not members may complicate things a bit, but I'm
 still
  digesting all of the new stuff.
 
  Derek
 
  On Mon, Nov 24, 2008 at 12:01 PM, Tim Perrett 
 [EMAIL PROTECTED] wrote:
 
   How did this go Derek?
 
   Now we have the record stuff in there, are you going to take a
 bash at
   writing a JPA backend? That would rock!
 
   Cheers, Tim
 
   On Nov 13, 2:17 pm, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:
Fair enough. I'll check out the Record branch and start
 looking at it.
 
Thanks,
 
Derek
 
On Thu, Nov 13, 2008 at 6:42 AM, Marius 
 [EMAIL PROTECTED] wrote:
 
 +1
 
 On Nov 9, 12:56 am, David Pollak 
 [EMAIL PROTECTED]
 wrote:
  I'd rather wait until Marius and I are done with the
 record/field
   stuff
 and
  do a JPA back-end to that.
 
  On Sat, Nov 8, 2008 at 1:39 PM, TylerWeir 
 [EMAIL PROTECTED]
   wrote:
 
   We may want to also offer an archetype that has the
 skeleton of a
   JPA-
   aware app ready to go.
 
   And +1 for adding this to Lift proper.
 
   On Nov 8, 2:43 pm, Tim Perrett [EMAIL PROTECTED]
 wrote:
Sounds like a good idea Derek - this is annoying the
 ass out of
   me
right now having to copy and paste the JPA scala
 wrapper files
   from
project to project so, sure, this would be a great
 idea and
   one
welcomed by the majority of lift-jpa users.
 
+1 for including this in lift proper
 
Cheers, Tim
 
On Nov 8, 4:06 pm, Derek Chen-Becker 
 [EMAIL PROTECTED]
 wrote:
 
 I've had several requests to move the JPA.scala
 source
   (ScalaEntityManager
 and ScalaQuery) out of the demo site and into lift
 proper so
   that
   people can
 just extend instead of copying and 

[Lift] Re: HTTP Authentication Example

2008-11-25 Thread Tim Perrett

Awesome - anything you can do would be great.

I've commited an example application into the sites dir of that
branch.

Cheers, Tim

On Nov 25, 10:31 pm, Derek Chen-Becker [EMAIL PROTECTED]
wrote:
 I'll try it out tomorrow if I can open up some time, but I can't promise
 anything.
 Derek


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Best way to learn Lift

2008-11-25 Thread David Pollak
On Tue, Nov 25, 2008 at 5:44 PM, Erick Fleming [EMAIL PROTECTED]wrote:

 I second Kris's suggestion.  I'm new to Lift and Scala, but know Java.  If
 first started converting a Wicket application to Scala.  It's pretty easy to
 write a Java applications using Scala, but you really don't learn anything
 about Scala real capabilities.

 So, after deciding to write my application in Lift instead, my brain
 explodes a little every coding day.


Please send me your address and I'll send some Windex to clean up the brain
bits. :-)




 My typical process is to try something in Lift, fail because I don't
 understand it, study the Lift source code a bit (which is actually pretty
 short in most cases), and match what I see to the Scala Book.

 Then I ask on this list and get an answer in a day if not minutes.  I would
 have given up long ago if not for the mail list.


I'm very glad to hear this.  One of my top-level goals for Lift is to build
a great community.  I'm really glad that there are lots of people on the
list who are helpful and responsive to newbies and JPA code sloggers alike.

Something to give thanks for.






 



-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Lift Record and Object Oriented DB

2008-11-25 Thread Erick Fleming
I'm real interested in using Lift with OODBs (currently using DB4O and
looking and Berkeley).

Is the new Record/Field stuff (I'm ignorant about Rails) concussive for this
type of data access or if it more for relational structures?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---