2010-10-22 100 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,然後才能使用它。