[Lift] Re: CometActor and JQuery Effects

2008-10-10 Thread David Pollak
Mrinal,

Do you mean when the page is initially rendered or do you mean on updates?

If you mean on updates, see the partialUpdate(js: JsCmd) method on
CometActor:
http://scala-tools.org/mvnsites/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometActor.html

You can send arbitrary JavaScript to the client to do redrawing, effects,
etc.

Also, keep in mind that you can chain JsCmd together:

val j1: JsCmd = ...
val j2: JsCmd = ...
val j3 = j1  j2

And you can take a List[JsCmd] and turn it into a JsCmd:

val js: JsCmd = jsList.foldLeft[JsCmd](Noop)(_  _)

Thanks,

David

On Fri, Oct 10, 2008 at 6:42 AM, Mrinal Wadhwa [EMAIL PROTECTED]wrote:


 Hi Everyone,

 Has anyone tried adding a jQuery effect to the content a CometActor
 puts on a page .. if so then how to do that?

 Thank you
 With regards,
 Mirnal

 



-- 
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] Re: Progress on JPADemo and JTA

2008-10-10 Thread Kris Nuttycombe

I'm happy to test on Glassfish this weekend. Just let me know what
branch to pull from.

Kris

On Fri, Oct 10, 2008 at 3:14 PM, Derek Chen-Becker
[EMAIL PROTECTED] wrote:
 Well, I have it all working under Jetty using Atomikos as the underlying JTA
 provider. I'd like to test it out under JBoss and/or Glassfish before
 committing it to head, but would people be interested in testing on a branch
 version?

 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: SnippetFailure

2008-10-10 Thread Derek Chen-Becker
It means that the dispatch function on whatever Stateful Snippet is being
called isn't matching what you're asking it to provide. For instance, if
your snippet tag looks like

lift:MySnippet.add

Then the dispatchPf in the MySnippet stateful snippet has to have a dispatch
function like:

val dispatch: DispatchIt = {
case add = some function here _
  }

See
http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/index.htmlfor
more details.

I also know that David has recently *strongly* recommended not putting
.html on the ends of things.

Derek

On Fri, Oct 10, 2008 at 3:15 PM, Charles F. Munat [EMAIL PROTECTED] wrote:


 What exactly does this mean? I get a lot of these.

 WARN - Snippet Failure: SnippetFailure(/admin/users/add.html -
   ParsePath(List(admin, users, add),html,true,false),
   Full(Menu.link),
   Stateful Snippet: Dispatch Not Matched)

 What is failing here and what are the probable causes?

 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: Progress on JPADemo and JTA

2008-10-10 Thread Derek Chen-Becker
OK, I think I know how to create a new branch, but being a Git newb I really
don't want to nuke anything. Do I just do a git branch my new branch
name in my local repo?

Thanks,

Derek

On Fri, Oct 10, 2008 at 3:21 PM, Kris Nuttycombe
[EMAIL PROTECTED]wrote:


 I'm happy to test on Glassfish this weekend. Just let me know what
 branch to pull from.

 Kris

 On Fri, Oct 10, 2008 at 3:14 PM, Derek Chen-Becker
 [EMAIL PROTECTED] wrote:
  Well, I have it all working under Jetty using Atomikos as the underlying
 JTA
  provider. I'd like to test it out under JBoss and/or Glassfish before
  committing it to head, but would people be interested in testing on a
 branch
  version?
 
  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: Progress on JPADemo and JTA

2008-10-10 Thread Kris Nuttycombe

You can do either that, or

git checkout -b my_new_branch

which will both create and switch to the new branch; you'll then need to do

git push origin my_new_branch

to get it up on central. For when you want to subsequently pull from
that branch, you should probably add something like this to your
.git/config:


[branch my_new_branch]
  remote = origin
  merge = refs/heads/my_new_branch

There's some git command that will do this for you, but I can't
remember it at the moment as I usually just do it by hand.

Kris

On Fri, Oct 10, 2008 at 3:37 PM, Derek Chen-Becker
[EMAIL PROTECTED] wrote:
 OK, I think I know how to create a new branch, but being a Git newb I really
 don't want to nuke anything. Do I just do a git branch my new branch
 name in my local repo?

 Thanks,

 Derek

 On Fri, Oct 10, 2008 at 3:21 PM, Kris Nuttycombe [EMAIL PROTECTED]
 wrote:

 I'm happy to test on Glassfish this weekend. Just let me know what
 branch to pull from.

 Kris

 On Fri, Oct 10, 2008 at 3:14 PM, Derek Chen-Becker
 [EMAIL PROTECTED] wrote:
  Well, I have it all working under Jetty using Atomikos as the underlying
  JTA
  provider. I'd like to test it out under JBoss and/or Glassfish before
  committing it to head, but would people be interested in testing on a
  branch
  version?
 
  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: Progress on JPADemo and JTA

2008-10-10 Thread Martin Ellis

On Fri, Oct 10, 2008 at 10:37 PM, Derek Chen-Becker
[EMAIL PROTECTED] wrote:
 OK, I think I know how to create a new branch, but being a Git newb I really
 don't want to nuke anything. Do I just do a git branch my new branch
 name in my local repo?

I think you want: git checkout -b branchName

git branch on it's own won't switch to the new branch.

Martin

--~--~-~--~~~---~--~~
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: Progress on JPADemo and JTA

2008-10-10 Thread Derek Chen-Becker
OK, if I do git checkout do I need to backup my changed files somewhere
else? I've already made a lot of changes and I don't want to lose them.

Thanks for the advice!

Derek

On Fri, Oct 10, 2008 at 3:43 PM, Martin Ellis [EMAIL PROTECTED] wrote:


 On Fri, Oct 10, 2008 at 10:37 PM, Derek Chen-Becker
 [EMAIL PROTECTED] wrote:
  OK, I think I know how to create a new branch, but being a Git newb I
 really
  don't want to nuke anything. Do I just do a git branch my new branch
  name in my local repo?

 I think you want: git checkout -b branchName

 git branch on it's own won't switch to the new branch.

 Martin

 


--~--~-~--~~~---~--~~
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: Progress on JPADemo and JTA

2008-10-10 Thread Derek Chen-Becker
OK, if I've done this correctly, there are only a few things that you need
to do to get this working in a JEE container:


   1. Edit persistence.xml to:
  1. Set the proper dialect
  2. Remove or set the proper hibernate.transaction.manager_lookup_class
  property. I think that Hibernate is smart enough to figure this
out inside a
  container, but it was really pissed if I didn't use this in Jetty
   2. Set up the matching datasource

There are definitely some things I'm not sure about:


   1. How to properly bind the JPA module into JNDI. The code in Model.scala
   assumes that it will be located in java:comp/env/module name, and I think
   that I have the persistence-ref set up correctly in web.xml, but I'm not
   100% positive
   2. How Glassfish plays with Hibernate. We had to use the Hibernate
   annotations in order to get an Enumeration type. I searched and searched but
   couldn't find anything concrete for TopLink.

Please let me know if you run into any difficulties and hopefully we'll get
this sorted out.

Derek

On Fri, Oct 10, 2008 at 4:04 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 OK, done: http://github.com/dpp/liftweb/tree/wip-dcb-jpa-jta

 I'll have to figure out the merge settings.

 Thanks!

 Derek


 On Fri, Oct 10, 2008 at 3:58 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 OK, if I do git checkout do I need to backup my changed files somewhere
 else? I've already made a lot of changes and I don't want to lose them.

 Thanks for the advice!

 Derek


 On Fri, Oct 10, 2008 at 3:43 PM, Martin Ellis [EMAIL PROTECTED]wrote:


 On Fri, Oct 10, 2008 at 10:37 PM, Derek Chen-Becker
 [EMAIL PROTECTED] wrote:
  OK, I think I know how to create a new branch, but being a Git newb I
 really
  don't want to nuke anything. Do I just do a git branch my new branch
  name in my local repo?

 I think you want: git checkout -b branchName

 git branch on it's own won't switch to the new branch.

 Martin

 




--~--~-~--~~~---~--~~
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: Progress on JPADemo and JTA

2008-10-10 Thread Kris Nuttycombe

I should be able to sort out any glassfish/hibernate issues with the
demo, as my Lift/JPA/JTA/Hibernate/Glassfish app is running happily
and going into production on Tuesday. In general, I haven't run into
any issues whatsoever; all you need is the
providerorg.hibernate.ejb.HibernatePersistence/provider entry in
the declaration of your persistence unit in persistence.xml.

Kris


On Fri, Oct 10, 2008 at 4:18 PM, Derek Chen-Becker
[EMAIL PROTECTED] wrote:
 OK, if I've done this correctly, there are only a few things that you need
 to do to get this working in a JEE container:

 Edit persistence.xml to:

 Set the proper dialect
 Remove or set the proper hibernate.transaction.manager_lookup_class
 property. I think that Hibernate is smart enough to figure this out inside a
 container, but it was really pissed if I didn't use this in Jetty

 Set up the matching datasource

 There are definitely some things I'm not sure about:

 How to properly bind the JPA module into JNDI. The code in Model.scala
 assumes that it will be located in java:comp/env/module name, and I think
 that I have the persistence-ref set up correctly in web.xml, but I'm not
 100% positive
 How Glassfish plays with Hibernate. We had to use the Hibernate annotations
 in order to get an Enumeration type. I searched and searched but couldn't
 find anything concrete for TopLink.

 Please let me know if you run into any difficulties and hopefully we'll get
 this sorted out.

 Derek

 On Fri, Oct 10, 2008 at 4:04 PM, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:

 OK, done: http://github.com/dpp/liftweb/tree/wip-dcb-jpa-jta

 I'll have to figure out the merge settings.

 Thanks!

 Derek

 On Fri, Oct 10, 2008 at 3:58 PM, Derek Chen-Becker [EMAIL PROTECTED]
 wrote:

 OK, if I do git checkout do I need to backup my changed files somewhere
 else? I've already made a lot of changes and I don't want to lose them.

 Thanks for the advice!

 Derek

 On Fri, Oct 10, 2008 at 3:43 PM, Martin Ellis [EMAIL PROTECTED]
 wrote:

 On Fri, Oct 10, 2008 at 10:37 PM, Derek Chen-Becker
 [EMAIL PROTECTED] wrote:
  OK, I think I know how to create a new branch, but being a Git newb I
  really
  don't want to nuke anything. Do I just do a git branch my new branch
  name in my local repo?

 I think you want: git checkout -b branchName

 git branch on it's own won't switch to the new branch.

 Martin






 


--~--~-~--~~~---~--~~
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: SnippetFailure

2008-10-10 Thread Charles F. Munat

Thanks, Derek. Actually, I don't use .html or even add (all my html 
files are called index.html -- I use directories to sort them). This 
error came when I was experimenting to see if that made a difference.

That said, I get the error all the time. I don't have val dispatch... in 
my snippets. But that's because I copied the JPADemo over, and your 
AuthorOps and BookOps don't have the val dispatch either. But the 
JPADemo doesn't get this error.

Also, my edit functions don't work -- the forms are not populated 
properly. I thought I had it working a minute ago, and now it isn't again.

I switched the snippets around a bit and dropped the bind (because I 
wanted to color code alternate rows and wasn't sure how to do it 
otherwise). Here is an example:

snippet/Category.scala:

import scala.xml.{NodeSeq,Text}

import net.liftweb.http.{RequestVar,S,SHtml}
import net.liftweb.util.Helpers
import S._
import Helpers._

import Model._

class CategoryOps {
   val formatter = new java.text.SimpleDateFormat(dd MMM )

   def getRowClass(r: Int) = {
 if (r % 2 == 0) even else odd
   }

   def list: NodeSeq = {
 tr valign=top align=left
   th class=textName/th
   th class=integerLinks/th
   th class=blank /th
   th class=blank /th
 /tr ::
 
Model.createNamedQuery[Category](findAllCategories).getResultList().toList.zipWithIndex.flatMap(c
 
= tr valign=top class={getRowClass(c._2)}
   td class=text{c._1.name}/td
   td class=integer{SHtml.link(/links/search/, {() =
  WeblinkOps.resultVar(Model.createNamedQuery[Weblink](
   findWeblinksByCategory, id - category.id).getResultList().toList)
 }, Text(category.weblinks.size().toString))}/td
   td class=edit{SHtml.link(editor, () = 
categoryVar(category), Text(Edit))}/td
   td class=delete /td
 /tr)
   }

   object categoryVar extends RequestVar(new Category())
   def category = categoryVar.is

   def editor (xhtml : NodeSeq) : NodeSeq = {
 def addOrUpdate () = {
   if (category.name.length == 0) {
error(emptyCategory, The category's name cannot be blank)
   } else {
Model.merge(category)
redirectTo(/admin/categories/)
   }
 }

 val currentId = category.id

 form method=POST action=
   table class=editor border=0 cellpadding=3 cellspacing=0
 tr valign=top align=left
   thName/th
   td{SHtml.text(category.name, category.name = _)}/td
 /tr
 tr valign=top align=left
   th{SHtml.hidden({category.id = currentId})} /th
   td{SHtml.submit(Save, addOrUpdate)}/td
 /tr
   /table
 /form
   }
}

webapp/admin/categories/editor/index.html:

lift:surround with=default at=content
   h2Categories/h2
   table class=list
 lift:CategoryOps.list/
   /table
/lift:surround

And in Boot.scala:

Menu(Loc(categories, List(admin, categories, index),
 Categories, LocGroup(admin)),
   Menu(Loc(categories_add, List(admin, categories, editor,
 index), Add a New Category, Hidden))
),

ANY suggestions for how to do any of this better greatly appreciated. Do 
I need to add the val dispatch... part? If so, why is this different 
from the JPADemo?

Thanks!
Chas.


Derek Chen-Becker wrote:
 It means that the dispatch function on whatever Stateful Snippet is 
 being called isn't matching what you're asking it to provide. For 
 instance, if your snippet tag looks like
 
 lift:MySnippet.add
 
 Then the dispatchPf in the MySnippet stateful snippet has to have a 
 dispatch function like:
 
 val dispatch: DispatchIt = {
 case add = some function here _
   }
 
 See 
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/index.html
  
 for more details.
 
 I also know that David has recently /strongly/ recommended not putting 
 .html on the ends of things.
 
 Derek
 
 On Fri, Oct 10, 2008 at 3:15 PM, Charles F. Munat [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 What exactly does this mean? I get a lot of these.
 
 WARN - Snippet Failure: SnippetFailure(/admin/users/add.html -
   ParsePath(List(admin, users, add),html,true,false),
   Full(Menu.link),
   Stateful Snippet: Dispatch Not Matched)
 
 What is failing here and what are the probable causes?
 
 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: SnippetFailure

2008-10-10 Thread Charles F. Munat

Sorry. Too lazy to cleanse I just left the package off. There is one, 
and a model._ import, too.

BTW, the snippet is responding, it just gives that snippet error and the 
edit doesn't bind the object's values to the form fields. The list and 
add abilities work just fine. That's what's so confusing. I can't see 
what's all that different from the JPADemo one except Derek's works and 
mine doesn't.

Chas.

David Pollak wrote:
 You have to define a package for Category.scala
 
 On Fri, Oct 10, 2008 at 4:00 PM, Charles F. Munat [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 Thanks, Derek. Actually, I don't use .html or even add (all my html
 files are called index.html -- I use directories to sort them). This
 error came when I was experimenting to see if that made a difference.
 
 That said, I get the error all the time. I don't have val dispatch... in
 my snippets. But that's because I copied the JPADemo over, and your
 AuthorOps and BookOps don't have the val dispatch either. But the
 JPADemo doesn't get this error.
 
 Also, my edit functions don't work -- the forms are not populated
 properly. I thought I had it working a minute ago, and now it isn't
 again.
 
 I switched the snippets around a bit and dropped the bind (because I
 wanted to color code alternate rows and wasn't sure how to do it
 otherwise). Here is an example:
 
 snippet/Category.scala:
 
 import scala.xml.{NodeSeq,Text}
 
 import net.liftweb.http.{RequestVar,S,SHtml}
 import net.liftweb.util.Helpers
 import S._
 import Helpers._
 
 import Model._
 
 class CategoryOps {
   val formatter = new java.text.SimpleDateFormat(dd MMM )
 
   def getRowClass(r: Int) = {
 if (r % 2 == 0) even else odd
   }
 
   def list: NodeSeq = {
 tr valign=top align=left
   th class=textName/th
   th class=integerLinks/th
   th class=blank /th
   th class=blank /th
 /tr ::
 
 
 Model.createNamedQuery[Category](findAllCategories).getResultList().toList.zipWithIndex.flatMap(c
 = tr valign=top class={getRowClass(c._2)}
   td class=text{c._1.name http://1.name}/td
   td class=integer{SHtml.link(/links/search/, {() =
  WeblinkOps.resultVar(Model.createNamedQuery[Weblink](
   findWeblinksByCategory, id - category.id
 http://category.id).getResultList().toList)
 }, Text(category.weblinks.size().toString))}/td
   td class=edit{SHtml.link(editor, () =
 categoryVar(category), Text(Edit))}/td
   td class=delete /td
 /tr)
   }
 
   object categoryVar extends RequestVar(new Category())
   def category = categoryVar.is
 
   def editor (xhtml : NodeSeq) : NodeSeq = {
 def addOrUpdate () = {
   if (category.name.length == 0) {
error(emptyCategory, The category's name cannot be blank)
   } else {
Model.merge(category)
redirectTo(/admin/categories/)
   }
 }
 
 val currentId = category.id http://category.id
 
 form method=POST action=
   table class=editor border=0 cellpadding=3 cellspacing=0
 tr valign=top align=left
   thName/th
   td{SHtml.text(category.name http://category.name,
 category.name http://category.name = _)}/td
 /tr
 tr valign=top align=left
   th{SHtml.hidden({category.id http://category.id =
 currentId})} /th
   td{SHtml.submit(Save, addOrUpdate)}/td
 /tr
   /table
 /form
   }
 }
 
 webapp/admin/categories/editor/index.html:
 
 lift:surround with=default at=content
   h2Categories/h2
   table class=list
 lift:CategoryOps.list/
   /table
 /lift:surround
 
 And in Boot.scala:
 
 Menu(Loc(categories, List(admin, categories, index),
 Categories, LocGroup(admin)),
   Menu(Loc(categories_add, List(admin, categories, editor,
 index), Add a New Category, Hidden))
 ),
 
 ANY suggestions for how to do any of this better greatly appreciated. Do
 I need to add the val dispatch... part? If so, why is this different
 from the JPADemo?
 
 Thanks!
 Chas.
 
 
 Derek Chen-Becker wrote:
   It means that the dispatch function on whatever Stateful Snippet is
   being called isn't matching what you're asking it to provide. For
   instance, if your snippet tag looks like
  
   lift:MySnippet.add
  
   Then the dispatchPf in the MySnippet stateful snippet has to have a
   dispatch function like:
  
   val dispatch: DispatchIt = {
   case add = some function here _
 }
  
   See
  
 
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/index.html
   for more details.
  
   I also know that David has 

[Lift] Re: SnippetFailure

2008-10-10 Thread Charles F. Munat

For example, here is what I get when I go to the categories list page 
(which lists them just beautifully):

Hibernate: select category0_.id as id2_, category0_.CREATED_AT as
   CREATED2_2_, category0_.name as name2_, category0_.UPDATED_AT as
   UPDATED4_2_ from CATEGORIES category0_ order by category0_.name
WARN - Snippet Failure: SnippetFailure(/admin/categories/ -
   ParsePath(List(admin, categories,
   index),,true,true),Full(Menu.link),Stateful Snippet: Dispatch Not
   Matched)
WARN - Snippet Failure: SnippetFailure(/admin/categories/ -
   ParsePath(List(admin, categories,
   index),,true,true),Full(Menu.link),Stateful Snippet: Dispatch Not
   Matched)
INFO - Service request (GET) /admin/categories/ took 28 Milliseconds
INFO - Service request (GET) /ajax_request/liftAjax.js took 1
   Milliseconds

So there are two warnings for each page view.

Chas.

David Pollak wrote:
 You have to define a package for Category.scala
 
 On Fri, Oct 10, 2008 at 4:00 PM, Charles F. Munat [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 Thanks, Derek. Actually, I don't use .html or even add (all my html
 files are called index.html -- I use directories to sort them). This
 error came when I was experimenting to see if that made a difference.
 
 That said, I get the error all the time. I don't have val dispatch... in
 my snippets. But that's because I copied the JPADemo over, and your
 AuthorOps and BookOps don't have the val dispatch either. But the
 JPADemo doesn't get this error.
 
 Also, my edit functions don't work -- the forms are not populated
 properly. I thought I had it working a minute ago, and now it isn't
 again.
 
 I switched the snippets around a bit and dropped the bind (because I
 wanted to color code alternate rows and wasn't sure how to do it
 otherwise). Here is an example:
 
 snippet/Category.scala:
 
 import scala.xml.{NodeSeq,Text}
 
 import net.liftweb.http.{RequestVar,S,SHtml}
 import net.liftweb.util.Helpers
 import S._
 import Helpers._
 
 import Model._
 
 class CategoryOps {
   val formatter = new java.text.SimpleDateFormat(dd MMM )
 
   def getRowClass(r: Int) = {
 if (r % 2 == 0) even else odd
   }
 
   def list: NodeSeq = {
 tr valign=top align=left
   th class=textName/th
   th class=integerLinks/th
   th class=blank /th
   th class=blank /th
 /tr ::
 
 
 Model.createNamedQuery[Category](findAllCategories).getResultList().toList.zipWithIndex.flatMap(c
 = tr valign=top class={getRowClass(c._2)}
   td class=text{c._1.name http://1.name}/td
   td class=integer{SHtml.link(/links/search/, {() =
  WeblinkOps.resultVar(Model.createNamedQuery[Weblink](
   findWeblinksByCategory, id - category.id
 http://category.id).getResultList().toList)
 }, Text(category.weblinks.size().toString))}/td
   td class=edit{SHtml.link(editor, () =
 categoryVar(category), Text(Edit))}/td
   td class=delete /td
 /tr)
   }
 
   object categoryVar extends RequestVar(new Category())
   def category = categoryVar.is
 
   def editor (xhtml : NodeSeq) : NodeSeq = {
 def addOrUpdate () = {
   if (category.name.length == 0) {
error(emptyCategory, The category's name cannot be blank)
   } else {
Model.merge(category)
redirectTo(/admin/categories/)
   }
 }
 
 val currentId = category.id http://category.id
 
 form method=POST action=
   table class=editor border=0 cellpadding=3 cellspacing=0
 tr valign=top align=left
   thName/th
   td{SHtml.text(category.name http://category.name,
 category.name http://category.name = _)}/td
 /tr
 tr valign=top align=left
   th{SHtml.hidden({category.id http://category.id =
 currentId})} /th
   td{SHtml.submit(Save, addOrUpdate)}/td
 /tr
   /table
 /form
   }
 }
 
 webapp/admin/categories/editor/index.html:
 
 lift:surround with=default at=content
   h2Categories/h2
   table class=list
 lift:CategoryOps.list/
   /table
 /lift:surround
 
 And in Boot.scala:
 
 Menu(Loc(categories, List(admin, categories, index),
 Categories, LocGroup(admin)),
   Menu(Loc(categories_add, List(admin, categories, editor,
 index), Add a New Category, Hidden))
 ),
 
 ANY suggestions for how to do any of this better greatly appreciated. Do
 I need to add the val dispatch... part? If so, why is this different
 from the JPADemo?
 
 Thanks!
 Chas.
 
 
 Derek Chen-Becker wrote:
   It means that the dispatch function on whatever Stateful Snippet is
   being called isn't matching what you're asking it to provide. For
   instance, if 

[Lift] Re: SnippetFailure - solved

2008-10-10 Thread Charles F. Munat

Ah, silly me. I just assumed that the problem was with the primary 
snippet for the page. I forgot that I've written my own Menu snippet, 
and a Misc snippet and that there are multiple calls to snippets on 
every page. Turns out I added some links at the bottom of default.html 
using lift:Menu.link instead of lift:Menu.item .

Whoops. Learn something new every five minutes.

Sorry for bothering the list.

Chas.

Charles F. Munat wrote:
 Sorry. Too lazy to cleanse I just left the package off. There is one, 
 and a model._ import, too.
 
 BTW, the snippet is responding, it just gives that snippet error and the 
 edit doesn't bind the object's values to the form fields. The list and 
 add abilities work just fine. That's what's so confusing. I can't see 
 what's all that different from the JPADemo one except Derek's works and 
 mine doesn't.
 
 Chas.
 
 David Pollak wrote:
 You have to define a package for Category.scala

 On Fri, Oct 10, 2008 at 4:00 PM, Charles F. Munat [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:


 Thanks, Derek. Actually, I don't use .html or even add (all my html
 files are called index.html -- I use directories to sort them). This
 error came when I was experimenting to see if that made a difference.

 That said, I get the error all the time. I don't have val dispatch... in
 my snippets. But that's because I copied the JPADemo over, and your
 AuthorOps and BookOps don't have the val dispatch either. But the
 JPADemo doesn't get this error.

 Also, my edit functions don't work -- the forms are not populated
 properly. I thought I had it working a minute ago, and now it isn't
 again.

 I switched the snippets around a bit and dropped the bind (because I
 wanted to color code alternate rows and wasn't sure how to do it
 otherwise). Here is an example:

 snippet/Category.scala:

 import scala.xml.{NodeSeq,Text}

 import net.liftweb.http.{RequestVar,S,SHtml}
 import net.liftweb.util.Helpers
 import S._
 import Helpers._

 import Model._

 class CategoryOps {
   val formatter = new java.text.SimpleDateFormat(dd MMM )

   def getRowClass(r: Int) = {
 if (r % 2 == 0) even else odd
   }

   def list: NodeSeq = {
 tr valign=top align=left
   th class=textName/th
   th class=integerLinks/th
   th class=blank /th
   th class=blank /th
 /tr ::

 
 Model.createNamedQuery[Category](findAllCategories).getResultList().toList.zipWithIndex.flatMap(c
 = tr valign=top class={getRowClass(c._2)}
   td class=text{c._1.name http://1.name}/td
   td class=integer{SHtml.link(/links/search/, {() =
  WeblinkOps.resultVar(Model.createNamedQuery[Weblink](
   findWeblinksByCategory, id - category.id
 http://category.id).getResultList().toList)
 }, Text(category.weblinks.size().toString))}/td
   td class=edit{SHtml.link(editor, () =
 categoryVar(category), Text(Edit))}/td
   td class=delete /td
 /tr)
   }

   object categoryVar extends RequestVar(new Category())
   def category = categoryVar.is

   def editor (xhtml : NodeSeq) : NodeSeq = {
 def addOrUpdate () = {
   if (category.name.length == 0) {
error(emptyCategory, The category's name cannot be blank)
   } else {
Model.merge(category)
redirectTo(/admin/categories/)
   }
 }

 val currentId = category.id http://category.id

 form method=POST action=
   table class=editor border=0 cellpadding=3 cellspacing=0
 tr valign=top align=left
   thName/th
   td{SHtml.text(category.name http://category.name,
 category.name http://category.name = _)}/td
 /tr
 tr valign=top align=left
   th{SHtml.hidden({category.id http://category.id =
 currentId})} /th
   td{SHtml.submit(Save, addOrUpdate)}/td
 /tr
   /table
 /form
   }
 }

 webapp/admin/categories/editor/index.html:

 lift:surround with=default at=content
   h2Categories/h2
   table class=list
 lift:CategoryOps.list/
   /table
 /lift:surround

 And in Boot.scala:

 Menu(Loc(categories, List(admin, categories, index),
 Categories, LocGroup(admin)),
   Menu(Loc(categories_add, List(admin, categories, editor,
 index), Add a New Category, Hidden))
 ),

 ANY suggestions for how to do any of this better greatly appreciated. Do
 I need to add the val dispatch... part? If so, why is this different
 from the JPADemo?

 Thanks!
 Chas.


 Derek Chen-Becker wrote:
   It means that the dispatch function on whatever Stateful Snippet is
   being called isn't matching what you're asking it to provide. For
   instance, if your snippet tag looks like