Hi Antony,

great to see Scala and Wicket getting more popular. :-)

I've been using them together quite a while now and am convinced that there are
lots of benefits in it!

I created a dynamic component (like wicket:component which isn't officially
supported) which also works with Ajax. There's also a 'VarModel' which is
similar to your Fodel. You'll find the sources here:
http://www.footprint.de/fcc/2008/11/some-wicket-scala/

I also use Scala's mixin capabilities to abstract layout information out of the
pages/components. E.g. to define cell styles of datatable columns or to format
cell output, I have something like:

  trait Centered[T] extends IStyledColumn[T] {
    abstract override def getCssClass: String = {
      val style = super.getCssClass

      if( style==null ) "columnCentered"
      else style + " " + "columnCentered"
    }
  }

  trait DateFormat[T] extends PropertyColumn[T] {
    override protected def createLabelModel( embeddedModel: IModel[T] ):
IModel[_] = {
      val m = super.createLabelModel( embeddedModel )
      m.getObject match {
        case dt: DateTime => VarModel( dt.toString( dateFormatter.withLocale(
getLocale ) ) )
        case _ => m
      }
    }
  }

To create/apply a cell to use this style I just have to apply this trait:

val col1 = new PropertyColumn[M]( new Model( "Date" ), COL_DATE, "reg_date" )
with Centered[M] with DateFormat[M]


Scala's just great to abstract more between logic and layout.

Best regards, --- Jan.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to