2010-10-22 58 views
1

问候错误:未发现:价值拍卖(LiftActor)

我有下面的类

package org.developerworks.comet 

import net.liftweb.http._ 
import net.liftweb.common.Full 
import net.liftweb.http.S._ 
import net.liftweb.http.SHtml._ 
import net.liftweb.http.js.JsCmd 
import net.liftweb.http.js.JsCmds._ 
import net.liftweb.http.js.JE._ 
import net.liftweb.util.Helpers._ 
import net.liftweb.util._ 
import scala.xml.NodeSeq 
import org.developerworks.model._ 
import org.developerworks.actor._ 
import java.lang.Long 


class AuctionActor extends CometActor { 


    var highBid : TheCurrentHighBid = null 

    override def defaultPrefix = Full("auction") 

    val itemId = S.param("itemId").map(Long.parseLong(_)).openOr(0L) 


    def render = { 

    def itemView: NodeSeq = { 

     val item = if (itemId > 0) 
     ItemMetaData.findByKey(itemId).openOr(ItemMetaData.create) 
     else ItemMetaData.create 
     val currBid = item.highBid 
     val bidAmt = if (currBid.user.isEmpty) 0L else currBid.amount.is 
     highBid = TheCurrentHighBid(bidAmt, currBid.user.obj.openOr(User.currentUser.open_!)) 
     val minNewBid = highBid.amount + 1L 
     val button = <button type="button">{S.?("Bid Now!")}</button> % 
     ("onclick" -> ajaxCall(JsRaw("$('#newBid').attr('value')"), bid _)) 
     (<div> 
      <strong>{item.name}</strong> 
      <br/> 
      <div> 
      Current Bid: ${highBid.amount} by {highBid.user.niceName} 
      </div> 
      <div> 
      New Bid (min: ${minNewBid}) : 
      <input type="text" id="newBid"/> 
      {button} 
      </div> 
      {item.description}<br/> 
     </div>) 
    } 

    bind("foo" -> <div>{itemView}</div>) 

    } 


    def bid(s:String): JsCmd = { 

    val user = User.currentUser.open_! 
    Auctioneer ! BidOnItem(itemId, Long.parseLong(s), user) 

    } 


    override def localSetup { 

    Auctioneer !? AddListener(this, this.itemId) match { 

     case Success(true) => println("Listener added") 
     case _ => println("Other ls") 

    } 

    } 


    override def localShutdown { 

    Auctioneer ! RemoveListener(this, this.itemId) 

    } 


    override def lowPriority : PartialFunction[Any, Unit] = { 

    case TheCurrentHighBid(a,u) => { 
     highBid = TheCurrentHighBid(a,u) 
     reRender(false) 
     } 
    case _ => println("Other lp") 

    } 


} 

当使用Maven编译送我以下错误:

[错误] AuctionActor.scala :64:错误:找不到:价格拍卖人 [INFO]拍卖师! BidOnItem(的itemId,的Long.parseLong(S),用户) [INFO]^ [错误] AuctionActor.scala:71:错误:未发现:价值拍卖 [INFO]拍卖!?的addListener(此,this.itemId)匹配{ [INFO]^ [ERROR] AuctionActor.scala:83:错误:未找到:值拍卖 [INFO]拍卖!的removeListener(这一点,this.itemId)

拍卖类(LiftActor),调用与线:

进口org.developerworks.actor._

人知道我在做什么错

请帮助

回答

1

Auctioneer定义为一类,而不是一个对象?在这种情况下,您需要先实例化actor,然后才能使用它。