On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn <[email protected]>wrote:
>
> Hello,
>
> I have created a simple test application to play around with comet.
> it's a "live CRUD table" the comet updates its clients with every
> change to the records( There is no database, just a List[Game] in the
> Game object). I have three questions about this:
>
> 1.I know that Comets won't work with GAE-J, but which application
> servers can i use?
Anything except GAE.
> Or is there one that's "recommended"?
Jetty is my favorite. Glassfish will do particularly well once the Servlet
3.0 spec is baked into a production version.
> Since i had
> JBOSS 4.2.3AG already on my system i tried this, but without succes...
>
What's the failure? Does the Lift examples/example app run okay on JBoss?
What happens in Firebug?
> 2.Is the way i'am using JQuery right way? or maybe, is there a better
> way to this?
>
Looks reasonable to me.
> 3. The three case classes: NewGame(g: Game),RemoveGame(g:
> Game),UpdateGame(g: Game) all extend GameMsg. In the partial function
> highPriority i have tried to match: NewGame(g), RemoveGame(g) and
> UpdateGame(g) that doesn't seem to work, but why?
>
Because you're not matching UpdateGame(g), you're matching (g: Game,
NewGame()) => ...
>
> Cheers,
>
> Michel
>
> class GameList extends CometActor with CometListenee{
> override def defaultPrefix = Full("entry")
> override def parentTag = <tbody></tbody>
> override def devMode = false
> override def hasOuter = false
>
> protected def registerWith = Game
> override def render = new RenderOut( (Game.getGames.flatMap
> (bindGameRow(_))).toSeq )
>
> override def highPriority: PartialFunction[Any,Unit] = {
> case (g:Game, NewGame()) => partialUpdate(PrependHtml
> (this.uniqueId,bindGameRow(g)))
> case (g:Game, RemoveGame()) => partialUpdate(RemoveById
> (""+g.gid))
> case (g:Game, UpdateGame()) =>
> partialUpdate(ReplaceWithById
> (""+g.gid, bindGameRow(g)))
> }
>
> private def bindGameRow(g:Game) =
> <tr id={""+g.gid}>
> {bind("id" -> g.gid,
> "name" -> SHtml.link("/game", () =>
> CurrentGame(Full(g)),
> Text(g.gname)),
> "players" -> g.playerStatus,
> "owner" -> g.creator,
> "timestamp" -> <b>{g.createdOn.toString}</b>,
> "joinlink" -> SHtml.ajaxButton("Delete game!",
>
> {() => Game ! Game.DeleteGame(g);Noop}))
> }
> </tr>
>
> }
>
> //some javascript stuff
> object RemoveById {
> def apply(uid: String) = new RemoveById(uid)
> }
>
> class RemoveById(val uid: String) extends JsCmd {
> def toJsCmd = "try{jQuery("+ ("#"+uid).encJs + ").remove();} catch
> (e) {}"
> }
>
> object ReplaceWithById {
> def apply(uid: String, nsq: NodeSeq) = new ReplaceWithById(uid,
> nsq.toString)
> }
>
> class ReplaceWithById(val uid: String, val content:String) extends
> JsCmd {
> def toJsCmd = "try{jQuery("+("#"+uid).encJs+").replaceWith($('"+
> content.encJs +"'));} catch (e) {}"
> }
>
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---