You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Antony Stubbs <an...@gmail.com> on 2009/07/14 01:38:33 UTC

Wicket-Scala extensions

I've been playing around with the idea of creating some wicket  
extensions in Scala for developing wicket with Scala...

For example, taking advantage of Scala's functional language, we can  
mixin the following function and class to make models easier:
def f(gtr: => String):Fodel = new Fodel(gtr, null)
implicit def func2Fodel1(gtr: => String):Fodel = new Fodel(gtr, null)
implicit def func2Fodel2(gtr: () => String):Fodel = new Fodel(gtr(),  
null)

/**
  * @see http://technically.us/code/x/the-escape-hatch
  * @author Nathan Hamblen
  * @author Antony Stubbs
  */
class Fodel(value: => String, x:(String) => Unit) extends  
Model[String] {
   override def getObject:String = value
   override def setObject(s:String):Unit = x(s)
}

And then we can substitute read only models with:
form.add(new Label("helloworld", f(name)))
or
form.add(new Label("helloworld3", ()=> name ))

or read/write models with:
form.add(new TextField("name", f(name, name = _) ) )

name = _
is short hand for
x => name = x

and if we want something even easier, with a simple custom component:
class SLabel(id:String, gtr: => String) extends Label[String](id, new  
Fodel(gtr, null))

we can write:
form.add(new SLabel("helloworld2", name))
instead of
form.add(new Label("helloworld", new PropertyModel[String](this,  
"name")))

All the inline single statement functions you see here can also be  
used for longer code blocks as well.
Is there any interest in things like this? I was thinking about  
putting it up on git-hub.

I'm very interested in people's suggestions of otherways of taking  
advantage of Scala to make Wicket programming easier.

One thing I'd love to solve, but don't think you with Scala - there's  
no concept of properties yet unfortunately, so there's no nice read/ 
write model solution.

Regards,
Antony Stubbs

Talk to me about Wicket, Spring, Maven consulting, small scale  
outsourcing to Australasia and India and Open Source development!

Check out the Spring Modules fork at http://wiki.github.com/astubbs/spring-modules 
  ! We've just done the first release of the project in over a year!

Website: http://sharca.com
Blog: http://stubbisms.wordpress.com
Linked In: http://www.linkedin.com/in/antonystubbs
Podcast: http://www.illegalargument.com


Re: Wicket-Scala extensions

Posted by Sam Stainsby <sa...@sustainablesoftware.com.au>.
Done. Here is the code:

http://uniscala.svn.sourceforge.net/viewvc/uniscala/trunk/

The overall aim of the project is to produce a web framework like Zope 
but for Scala instead of Python. That framework is in the 'unsicala-
granite' module. The parts I was discussing were in the modules 'uniscala-
view' and 'uniscala-view-wicket'. The 'uniscala-wicket' module currently 
just has an implicit model and is not that interesting (yet). There is 
also an example identity management application in its infancy in 
'uniscala-topaz' - this uses the 'views' modules so might be a good place 
to look to see it in action.  Not much doco yet - it will be a bit like 
walking into someone's laboratory and trying to guess what experiments 
they were doing. Some modules are purely experimental/playing. It's pre-
alpha - I make no apologies :-)

Cheers,
Sam.

On Tue, 14 Jul 2009 03:09:54 +0000, Sam Stainsby wrote:

> No problem. I'll let you know when its available. Its just one of those
> things I haven't gotten around to yet.
> 
> On Tue, 14 Jul 2009 14:01:51 +1200, Antony Stubbs wrote:
>> I'm much more interested in reading the source code, than reading the
>> scaladoc :)
>> you could put it up on git hub privately if you want?
>> 
>> On 14/07/2009, at 1:10 PM, Sam Stainsby wrote:
>> 
>>> Not yet, but I can make it available if there is interest.
>>>
>>> Antony Stubbs wrote:
>>>> Just a quick note, is the source available for all this?
> 
> 
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional
> commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Sam Stainsby <sa...@sustainablesoftware.com.au>.
No problem. I'll let you know when its available. Its just one of those 
things I haven't gotten around to yet.

On Tue, 14 Jul 2009 14:01:51 +1200, Antony Stubbs wrote:
> I'm much more interested in reading the source code, than reading the
> scaladoc :)
> you could put it up on git hub privately if you want?
> 
> On 14/07/2009, at 1:10 PM, Sam Stainsby wrote:
> 
>> Not yet, but I can make it available if there is interest.
>>
>> Antony Stubbs wrote:
>>> Just a quick note, is the source available for all this?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Odd behavior

Posted by Russell Simpkins <ru...@hotmail.com>.
Thanks Igor.
I was using add() to add properties that were already set - if I really wanted to do that, I think I should be using put() instead.
Russ

> From: igor.vaynberg@gmail.com
> Date: Mon, 13 Jul 2009 20:43:56 -0700
> Subject: Re: Odd behavior
> To: users@wicket.apache.org
> 
> its not a reference to a string, its a reference to a string *array*,
> notice the [ in the beginning. can happen if you add the same key
> twice to the valuemap - it will create an array.
> 
> -igor
> 
> On Mon, Jul 13, 2009 at 7:43 PM, Russell
> Simpkins<ru...@hotmail.com> wrote:
> >
> > All,
> > Every now and then my for ends up displaying
> > [Ljava.lang.String;@7cd46bea
> >
> > instead of displaying my string value. There is no rhyme or reason, just going back and forth through my application and eventually I see that value dumped out in lieu of my actual string value.
> >
> >
> > ValueMap properties;add(new RequiredTextField("toStreetAddress1", new PropertyModel(properties, "toStreetAddress1")));
> > The properties ValueMap is getting populated on posts and held during the session. Where should I look first to figure out why only sometimes do I see the reference of the string instead of the string value.
> > Thanks,
> > Russ
> > _________________________________________________________________
> > Hotmail® has ever-growing storage! Don’t worry about storage limits.
> > http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

Re: Odd behavior

Posted by Igor Vaynberg <ig...@gmail.com>.
its not a reference to a string, its a reference to a string *array*,
notice the [ in the beginning. can happen if you add the same key
twice to the valuemap - it will create an array.

-igor

On Mon, Jul 13, 2009 at 7:43 PM, Russell
Simpkins<ru...@hotmail.com> wrote:
>
> All,
> Every now and then my for ends up displaying
> [Ljava.lang.String;@7cd46bea
>
> instead of displaying my string value. There is no rhyme or reason, just going back and forth through my application and eventually I see that value dumped out in lieu of my actual string value.
>
>
> ValueMap properties;add(new RequiredTextField("toStreetAddress1", new PropertyModel(properties, "toStreetAddress1")));
> The properties ValueMap is getting populated on posts and held during the session. Where should I look first to figure out why only sometimes do I see the reference of the string instead of the string value.
> Thanks,
> Russ
> _________________________________________________________________
> Hotmail® has ever-growing storage! Don’t worry about storage limits.
> http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Odd behavior

Posted by Russell Simpkins <ru...@hotmail.com>.
All,
Every now and then my for ends up displaying 
[Ljava.lang.String;@7cd46bea

instead of displaying my string value. There is no rhyme or reason, just going back and forth through my application and eventually I see that value dumped out in lieu of my actual string value. 


ValueMap properties;add(new RequiredTextField("toStreetAddress1", new PropertyModel(properties, "toStreetAddress1")));
The properties ValueMap is getting populated on posts and held during the session. Where should I look first to figure out why only sometimes do I see the reference of the string instead of the string value.
Thanks,
Russ
_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits. 
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Re: Wicket-Scala extensions

Posted by Antony Stubbs <an...@gmail.com>.
I'm much more interested in reading the source code, than reading the  
scaladoc :)
you could put it up on git hub privately if you want?

On 14/07/2009, at 1:10 PM, Sam Stainsby wrote:

> Not yet, but I can make it available if there is interest.
>
> Antony Stubbs wrote:
>> Just a quick note, is the source available for all this?
>>
>> all I see is svn checkout
>> file:///home/sam/work/svn_repository/uniscala/trunk uniscala
>> on http://uniscala.net/source-repository.html
>>
>> On 14/07/2009, at 12:46 PM, Sam Stainsby wrote:
>>
>>> On Tue, 14 Jul 2009 11:38:33 +1200, Antony Stubbs wrote:
>>>
>>>> I'm very interested in people's suggestions of otherways of taking
>>>> advantage of Scala to make Wicket programming easier.
>>>
>>> We are using Scala and Wicket intensively (and the DB4O object  
>>> database
>>> as well). One thing we are working on is Wicket form generation,  
>>> which
>>> touches on ideas that are similar to those you have discussed.
>>>
>>> This is what we can do today: consider this domain class:
>>>
>>> class MyRectangle(var width:Int, var height:Int) extends  
>>> Serializable {
>>> def area:Double = width*height
>>> }
>>>
>>> we can then do:
>>>
>>> class MyRectangleSchema extends SimpleFieldsSchema[MyRectangle](
>>> ReadWriteFieldSchema("width", _.width, _.width = _:Int),
>>> ReadWriteFieldSchema("height", _.height, _.height = _:Int),
>>> ReadOnlyFieldSchema("area", _.area)
>>> )
>>>
>>> Above we are defining the accessors and mutators for each field  
>>> except
>>> the last which just has an accessor. We could probably use  
>>> introspection
>>> to make this much more succinct, and will likely provide this as an
>>> option at some stage. As you see we don't use the JavaBeans  
>>> conventions
>>> as we find they are not very scala-ish, and so fully automatic
>>> introspection is problematic.
>>>
>>> Creating a rectangle and schema first:
>>>
>>> val rectangle = new MyRectangle(width, height)
>>> val schema = new MyRectangleSchema()
>>>
>>> we use a 'builder' object to create Wicket components:
>>>
>>> val builder = new ViewBuilder { }
>>>
>>> We can then create a simple 'view' thus:
>>>
>>> builder.createView("panel1", schema, rectangle)
>>>
>>> and a simple form like this:
>>>
>>> builder.createFormView("panel2", schema, rectangle,
>>> new Button("submit") {
>>>   override def onSubmit = // .. do something ...
>>> }
>>> )
>>>
>>> Note that the above is completely type-safe. You can also mix and  
>>> match
>>> fields from different schemas, and create schemas for aggregate  
>>> objects
>>> by embedding (sub-)schemas inside other schemas. Builders can be
>>> overridden to provider custom components for any fields that need  
>>> them.
>>>
>>> This part of the project is still half-formed and fairly raw and
>>> undocumented. Really only text fields are catered for. The javadoc  
>>> is
>>> here:
>>>
>>> http://uniscala.net/uniscala-view/scaladocs/index.html
>>> http://uniscala.net/uniscala-view-wicket/scaladocs/index.html
>>>
>>> and is part of a larger project:
>>>
>>> http://uniscala.net/
>>>
>>> Apologies for lack of cross-linking between modules in the  
>>> scaladoc - I
>>> haven't worked out how to do this yet.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>
>
> -- 
> Sam Stainsby  -  Managing Director
> Sustainable Software Pty Ltd
> "open knowledge :: social conscience"
> ABN:     32 117 186 286
> WWW:     http://sustainablesoftware.com.au/
> E-mail:  sam@sustainablesoftware.com.au
> Jabber:  sjstainsby@jabber.org
> Tel/Fax: +61 7 3289 5491    Mobile: +61 405 380 844


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Sam Stainsby <sa...@sustainablesoftware.com.au>.
Not yet, but I can make it available if there is interest.

Antony Stubbs wrote:
> Just a quick note, is the source available for all this?
> 
> all I see is svn checkout
> file:///home/sam/work/svn_repository/uniscala/trunk uniscala
> on http://uniscala.net/source-repository.html
> 
> On 14/07/2009, at 12:46 PM, Sam Stainsby wrote:
> 
>> On Tue, 14 Jul 2009 11:38:33 +1200, Antony Stubbs wrote:
>>
>>> I'm very interested in people's suggestions of otherways of taking
>>> advantage of Scala to make Wicket programming easier.
>>
>> We are using Scala and Wicket intensively (and the DB4O object database
>> as well). One thing we are working on is Wicket form generation, which
>> touches on ideas that are similar to those you have discussed.
>>
>> This is what we can do today: consider this domain class:
>>
>> class MyRectangle(var width:Int, var height:Int) extends Serializable {
>>  def area:Double = width*height
>> }
>>
>> we can then do:
>>
>> class MyRectangleSchema extends SimpleFieldsSchema[MyRectangle](
>>  ReadWriteFieldSchema("width", _.width, _.width = _:Int),
>>  ReadWriteFieldSchema("height", _.height, _.height = _:Int),
>>  ReadOnlyFieldSchema("area", _.area)
>> )
>>
>> Above we are defining the accessors and mutators for each field except
>> the last which just has an accessor. We could probably use introspection
>> to make this much more succinct, and will likely provide this as an
>> option at some stage. As you see we don't use the JavaBeans conventions
>> as we find they are not very scala-ish, and so fully automatic
>> introspection is problematic.
>>
>> Creating a rectangle and schema first:
>>
>> val rectangle = new MyRectangle(width, height)
>> val schema = new MyRectangleSchema()
>>
>> we use a 'builder' object to create Wicket components:
>>
>> val builder = new ViewBuilder { }
>>
>> We can then create a simple 'view' thus:
>>
>> builder.createView("panel1", schema, rectangle)
>>
>> and a simple form like this:
>>
>> builder.createFormView("panel2", schema, rectangle,
>>  new Button("submit") {
>>    override def onSubmit = // .. do something ...
>>  }
>> )
>>
>> Note that the above is completely type-safe. You can also mix and match
>> fields from different schemas, and create schemas for aggregate objects
>> by embedding (sub-)schemas inside other schemas. Builders can be
>> overridden to provider custom components for any fields that need them.
>>
>> This part of the project is still half-formed and fairly raw and
>> undocumented. Really only text fields are catered for. The javadoc is
>> here:
>>
>> http://uniscala.net/uniscala-view/scaladocs/index.html
>> http://uniscala.net/uniscala-view-wicket/scaladocs/index.html
>>
>> and is part of a larger project:
>>
>> http://uniscala.net/
>>
>> Apologies for lack of cross-linking between modules in the scaladoc - I
>> haven't worked out how to do this yet.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> 


-- 
Sam Stainsby  -  Managing Director
Sustainable Software Pty Ltd
"open knowledge :: social conscience"
ABN:     32 117 186 286
WWW:     http://sustainablesoftware.com.au/
E-mail:  sam@sustainablesoftware.com.au
Jabber:  sjstainsby@jabber.org
Tel/Fax: +61 7 3289 5491    Mobile: +61 405 380 844

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Antony Stubbs <an...@gmail.com>.
Just a quick note, is the source available for all this?

all I see is svn checkout file:///home/sam/work/svn_repository/uniscala/trunk 
  uniscala
on http://uniscala.net/source-repository.html

On 14/07/2009, at 12:46 PM, Sam Stainsby wrote:

> On Tue, 14 Jul 2009 11:38:33 +1200, Antony Stubbs wrote:
>
>> I'm very interested in people's suggestions of otherways of taking
>> advantage of Scala to make Wicket programming easier.
>
> We are using Scala and Wicket intensively (and the DB4O object  
> database
> as well). One thing we are working on is Wicket form generation, which
> touches on ideas that are similar to those you have discussed.
>
> This is what we can do today: consider this domain class:
>
> class MyRectangle(var width:Int, var height:Int) extends  
> Serializable {
>  def area:Double = width*height
> }
>
> we can then do:
>
> class MyRectangleSchema extends SimpleFieldsSchema[MyRectangle](
>  ReadWriteFieldSchema("width", _.width, _.width = _:Int),
>  ReadWriteFieldSchema("height", _.height, _.height = _:Int),
>  ReadOnlyFieldSchema("area", _.area)
> )
>
> Above we are defining the accessors and mutators for each field except
> the last which just has an accessor. We could probably use  
> introspection
> to make this much more succinct, and will likely provide this as an
> option at some stage. As you see we don't use the JavaBeans  
> conventions
> as we find they are not very scala-ish, and so fully automatic
> introspection is problematic.
>
> Creating a rectangle and schema first:
>
> val rectangle = new MyRectangle(width, height)
> val schema = new MyRectangleSchema()
>
> we use a 'builder' object to create Wicket components:
>
> val builder = new ViewBuilder { }
>
> We can then create a simple 'view' thus:
>
> builder.createView("panel1", schema, rectangle)
>
> and a simple form like this:
>
> builder.createFormView("panel2", schema, rectangle,
>  new Button("submit") {
>    override def onSubmit = // .. do something ...
>  }
> )
>
> Note that the above is completely type-safe. You can also mix and  
> match
> fields from different schemas, and create schemas for aggregate  
> objects
> by embedding (sub-)schemas inside other schemas. Builders can be
> overridden to provider custom components for any fields that need  
> them.
>
> This part of the project is still half-formed and fairly raw and
> undocumented. Really only text fields are catered for. The javadoc is
> here:
>
> http://uniscala.net/uniscala-view/scaladocs/index.html
> http://uniscala.net/uniscala-view-wicket/scaladocs/index.html
>
> and is part of a larger project:
>
> http://uniscala.net/
>
> Apologies for lack of cross-linking between modules in the scaladoc  
> - I
> haven't worked out how to do this yet.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Sam Stainsby <sa...@sustainablesoftware.com.au>.
On Tue, 14 Jul 2009 11:38:33 +1200, Antony Stubbs wrote:

> I'm very interested in people's suggestions of otherways of taking
> advantage of Scala to make Wicket programming easier.

We are using Scala and Wicket intensively (and the DB4O object database 
as well). One thing we are working on is Wicket form generation, which 
touches on ideas that are similar to those you have discussed. 

This is what we can do today: consider this domain class:

class MyRectangle(var width:Int, var height:Int) extends Serializable {
  def area:Double = width*height
}

we can then do:

class MyRectangleSchema extends SimpleFieldsSchema[MyRectangle](
  ReadWriteFieldSchema("width", _.width, _.width = _:Int),
  ReadWriteFieldSchema("height", _.height, _.height = _:Int),
  ReadOnlyFieldSchema("area", _.area)
)

Above we are defining the accessors and mutators for each field except 
the last which just has an accessor. We could probably use introspection 
to make this much more succinct, and will likely provide this as an 
option at some stage. As you see we don't use the JavaBeans conventions 
as we find they are not very scala-ish, and so fully automatic 
introspection is problematic.

Creating a rectangle and schema first:

val rectangle = new MyRectangle(width, height)
val schema = new MyRectangleSchema()

we use a 'builder' object to create Wicket components:

val builder = new ViewBuilder { }

We can then create a simple 'view' thus:

builder.createView("panel1", schema, rectangle)

and a simple form like this:

builder.createFormView("panel2", schema, rectangle, 
  new Button("submit") {
    override def onSubmit = // .. do something ...
  }
)

Note that the above is completely type-safe. You can also mix and match 
fields from different schemas, and create schemas for aggregate objects 
by embedding (sub-)schemas inside other schemas. Builders can be 
overridden to provider custom components for any fields that need them.

This part of the project is still half-formed and fairly raw and 
undocumented. Really only text fields are catered for. The javadoc is 
here:

http://uniscala.net/uniscala-view/scaladocs/index.html
http://uniscala.net/uniscala-view-wicket/scaladocs/index.html

and is part of a larger project:

http://uniscala.net/

Apologies for lack of cross-linking between modules in the scaladoc - I 
haven't worked out how to do this yet.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Eelco Hillenius <ee...@gmail.com>.
Sweet!

Eelco

On Fri, Aug 14, 2009 at 9:56 AM, Antony Stubbs<an...@gmail.com> wrote:
> Ok for those following this thread - Wicket-Scala Extensions is out!
> Announcement here:
> http://www.nabble.com/Announcing:-Scala-Wicket-Extensions-Project-ts24975011.html
>
> Cheers,
> Antony Stubbs,
>
> sharca.com
>
> On 14/07/2009, at 11:34 AM, Antony Stubbs wrote:
>
>> omgosh - http://www.footprint.de/fcc/2009/02/london-wicket-presentation/
>> I've met you! haha. haaaa... Isn't the internet nutty?!
>>
>> On 14/07/2009, at 7:14 PM, Jan Kriesten wrote:
>>
>>>
>>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by francisco treacy <fr...@gmail.com>.
Great news!

I'll check it out later - I might have stuff to contribute.

Br's,

Francisco

2009/8/14 Antony Stubbs <an...@gmail.com>:
> Ok for those following this thread - Wicket-Scala Extensions is out!
> Announcement here:
> http://www.nabble.com/Announcing:-Scala-Wicket-Extensions-Project-ts24975011.html
>
> Cheers,
> Antony Stubbs,
>
> sharca.com
>
> On 14/07/2009, at 11:34 AM, Antony Stubbs wrote:
>
>> omgosh - http://www.footprint.de/fcc/2009/02/london-wicket-presentation/
>> I've met you! haha. haaaa... Isn't the internet nutty?!
>>
>> On 14/07/2009, at 7:14 PM, Jan Kriesten wrote:
>>
>>>
>>> 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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Sam Stainsby <sa...@sustainablesoftware.com.au>.
Looks good - I have some form-generation wicket-scala material that I'm 
trying to get out. Fodels look interesting - I have something similar but 
maybe not as general.

On Fri, 14 Aug 2009 18:56:09 +0200, Antony Stubbs wrote:

> Ok for those following this thread - Wicket-Scala Extensions is out!
> Announcement here:
> http://www.nabble.com/Announcing:-Scala-Wicket-Extensions-Project-
ts24975011.html
> 
> Cheers,
> Antony Stubbs,
> 
> sharca.com
> 
> On 14/07/2009, at 11:34 AM, Antony Stubbs wrote:
> 
>> omgosh -
>> http://www.footprint.de/fcc/2009/02/london-wicket-presentation/ I've
>> met you! haha. haaaa... Isn't the internet nutty?!
>>
>> On 14/07/2009, at 7:14 PM, Jan Kriesten wrote:
>>
>>
>>> 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: users-unsubscribe@wicket.apache.org For
>>> additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
> 
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional
> commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Antony Stubbs <an...@gmail.com>.
Ok for those following this thread - Wicket-Scala Extensions is out!  
Announcement here:
http://www.nabble.com/Announcing:-Scala-Wicket-Extensions-Project-ts24975011.html

Cheers,
Antony Stubbs,

sharca.com

On 14/07/2009, at 11:34 AM, Antony Stubbs wrote:

> omgosh - http://www.footprint.de/fcc/2009/02/london-wicket-presentation/
> I've met you! haha. haaaa... Isn't the internet nutty?!
>
> On 14/07/2009, at 7:14 PM, Jan Kriesten wrote:
>
>>
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Antony Stubbs <an...@gmail.com>.
omgosh - http://www.footprint.de/fcc/2009/02/london-wicket-presentation/
I've met you! haha. haaaa... Isn't the internet nutty?!

On 14/07/2009, at 7:14 PM, Jan Kriesten wrote:

>
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Scala extensions

Posted by Jan Kriesten <kr...@mail.footprint.de>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org