Thanks Dave, but still getting this error:
/home/wacky/NetBeansProjects/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51:
error: value lotValue is not a member of Long
override def _toForm = Full(<p>{Order.this.lots *
Order.this.marketPlace.lotValue}</p>)
What is the explanation for this behavior?
thanks
>
>
> On Sun, Jun 21, 2009 at 6:38 AM, Tobias Daub <[email protected]
> <mailto:[email protected]>> wrote:
>
>
> I'm stucked again with the simple things....
>
> I've a trait that extends BaseLongKeyedMapper and I wanna add a field
> (currentCost) that does some calculation. Nothing special. Here's
> the code:
>
> /*
> * Order.scala
> *
> * To change this template, choose Tools | Template Manager
> * and open the template in the editor.
> */
>
> package org.tobster.model
>
> import net.liftweb._
> import mapper._
> import http._
> import SHtml._
> import util._
> import model._
>
> /* Describes a general order. */
> trait Order extends BaseLongKeyedMapper{
>
> /* The number of lots this order has */
> object lots extends MappedInt(this.asInstanceOf[MapperType])
>
> /* The person who owns the order */
> object owner extends
> MappedLongForeignKey(this.asInstanceOf[MapperType], User){
>
> // hides this field in the CRUDify list/create forms
> override def dbDisplay_? = false
>
> //set the default value to the current logged in user (at
> creation time)
> override def defaultValue = User.currentUser.map(_.id.is
> <http://id.is>) openOr 0L
> }
>
> /* The market place where the order belongs to */
> object marketPlace extends
> MappedLongForeignKey(this.asInstanceOf[MapperType],
> MarketPlaceMetaObj){
> override def _toForm = Full(SHtml.selectObj[MarketPlace](
> MarketPlaceMetaObj.findAll.map(mp
> => (mp, mp.name.is <http://mp.name.is>)),
> obj,
> (mp: MarketPlace) => apply(mp)))
> }
>
> /* The basic trade types are: BUY and SELL */
> object tradeType extends
> MappedLongForeignKey(this.asInstanceOf[MapperType], TradeTypeMetaObj){
> override def _toForm = Full(SHtml.selectObj[TradeType](
> TradeTypeMetaObj.findAll.map(t => (t, t.name.is
> <http://t.name.is>)),
> obj,
> (t: TradeType) => apply(t)))
> }
>
>
> object currentCost extends
> MappedInt(this.asInstanceOf[MapperType]){
> override def _toForm = Full(<p>{this.lots *
> this.marketPlace.lotValue}</p>)
>
>
>
> Try:
> override def _toForm = Full(<p>{Order.this.lots *
> Order.this.marketPlace.lotValue}</p>)
>
>
>
>
> }
>
> }
>
> I get the following compiler error:
>
> [WARNING]
>
> /home/wacky/workspace_VirtuelleBoerse/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51:
> error: value lots is not a member of Int
> [WARNING] override def _toForm = Full(<p>{this.lots *
> this.marketPlace.lotValue}</p>)
> [WARNING] ^
> [WARNING] one error found
>
> The field marketPlace.lotValue is of type MappedInt as well as the
> field
> lots.
>
> I tried things like "this.lots.is <http://this.lots.is>" or
> "this.lots.i_is_!" but without
> success. I ran out of ideas...
>
>
> thanks.
>
>
>
>
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---