Re: Tapestry w Scala

Alex Kotchnev <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAMw2Hgd99fi_4pmm_aVmALxXTYZn0BJgJ9Zd6Qotscgbru=Hpw@mail.gmail.com>
John,
  I thought I had more than this, but when I looked , all I had was
this module for this specific conversion for Lists (it does do the
job) . You can probably add this to your own module or use this module
and include it in your module.

object TapestryScalaModule {

  def contributeTypeCoercer(configuration:
Configuration[CoercionTuple[List[AnyRef], JList[AnyRef]]]) = {
    val coercion = new Coercion[List[AnyRef], JList[AnyRef]]() {
      def coerce(input: List[AnyRef]) = ListBuffer[AnyRef](input: _*)
    };

    configuration.add(new CoercionTuple[List[AnyRef],
JList[AnyRef]](classOf[List[AnyRef]], classOf[JList[AnyRef]],
coercion));
  }
}

Cheers - Alex K

On Mon, Dec 19, 2016 at 12:23 PM, Thiago H. de Paula Figueiredo
<[email protected]> wrote:
> Yep, as Alex said, you can solve this issue by contributing a coercion from
> Scala collection/list/etc to the corresponding Java type. There's an
> explanation with examples here:
> https://tapestry.apache.org/type-coercion.html.
>
> On Mon, Dec 19, 2016 at 11:59 AM, Alex Kotchnev <[email protected]> wrote:
>
>> John - I've been running Tapestry and Scala  for a few years now (e.g.
>> www.zadachite.com on AppEngine, and a few internal apps), and it's
>> been working pretty well. About the specific issue of the collection
>> conversions - it bugged me for a little while, and I'm pretty sure I
>> have a project somewhere on my workstation that contributes a few
>> coercions that do this conversion automatically (otherwise, you can
>> probably just use the scala.collections.JavaConversions to get this
>> done on each page). I'll see if I can hunt down what I do use and post
>> it somewhere for you to use.
>>
>> Cheers -
>>
>> On Fri, Dec 16, 2016 at 1:31 PM, Qbyte Consulting
>> <[email protected]> wrote:
>> > Thank you Thiago.
>> >
>> > I found that project and it has been very useful for creating my own.
>> >
>> > The only trouble I've had so far is delivering Scala collections back to
>> pages for loop components. I ended up using Java collections in the Scala
>> and that works fine.
>> >
>> > Sent from my iPhone
>> >
>> >> On 16 Dec 2016, at 18:11, Thiago H. de Paula Figueiredo <
>> [email protected]> wrote:
>> >>
>> >> On Fri, Dec 16, 2016 at 6:53 AM, Qbyte Consulting <
>> [email protected]
>> >>> wrote:
>> >>
>> >>> Hi,
>> >>>
>> >> Hi!
>> >>
>> >>
>> >>> Has anyone implemented a T5.4 site with Scala, or are there any
>> kickstart
>> >>> type Scala projects out there for T5.4 please? I'd like to see how it's
>> >>> done.
>> >>>
>> >>
>> >> Not me, but yes. Christian Köberl wrote a blog post about it,
>> >> https://derkoe.wordpress.com/2011/11/18/tapestry-in-scala/, and also a
>> demo
>> >> project, https://github.com/derkoe/tapestry-scala-demo. It uses
>> Tapestry
>> >> 5.3, but changing the pom.xml to use 5.4.1 should work.
>> >>
>> >> Tapestry works on class files, not Java sources, so it should just work
>> >> with whatever JVM language as long as it generates class files. It has
>> been
>> >> reported with working with Groovy as well, for example.
>> >>
>> >> --
>> >> Thiago
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> --
> Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.