tags:

views:

30

answers:

1

Greetings

I have the following class

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")

  }


}

When compiling with maven sent me the following error:

[ERROR] AuctionActor.scala:64: error: not found: value Auctioneer [INFO] Auctioneer ! BidOnItem(itemId, Long.parseLong(s), user) [INFO] ^ [ERROR] AuctionActor.scala:71: error: not found: value Auctioneer [INFO] Auctioneer !? AddListener(this, this.itemId) match { [INFO] ^ [ERROR] AuctionActor.scala:83: error: not found: value Auctioneer [INFO] Auctioneer ! RemoveListener(this, this.itemId)

Auctioneer class (LiftActor), call with the line:

import org.developerworks.actor._

anyone know what I'm doing wrong

please help

+1  A: 

Is Auctioneer defined as a class rather than an object? In this case, you'll need to instantiate the actor before you can use it.

Aaron Novstrup