You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Clint Gilbert <cl...@hms.harvard.edu> on 2011/01/05 07:20:01 UTC
Scala "DSL" (was Re: [pivot] are there any tools to convert bxml
to Java?)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Sandro,
I finally got my Scala wrapper in a not-too-embarrassing state. You'll
find it attached to this message.
I must stress that I'm not a Scala or Pivot expert, just an average dev
with a decent-sized hobby project that uses Pivot, a bias against XML,
and a love of static typing. The Scala abstractions could undoubtedly
be better, and the lib encodes many simplifying assumptions that are ok
for my app, will not be for others.
Still, I hope it's useful to someone. The ScalaPivot object is
executable, and the Main class shows how things work:
> val window = new Window
>
> import Implicits._
>
> val text = label("Here's a label!")
>
> text onMouseOver {
> println("You moused over the label")
> }
>
> text onMouseOut {
> println("You moused out of the label")
> }
>
> val pane = horizontal(
> text,
> button("Here's a button") {
> println("You pushed the button!")
> });
>
> val list = listView("A value", "Another value", "Yet another value") { (index: Int, value: String) =>
> println("You selected '" + value + "' (position " + index + ")")
> }
>
> val input = textInput { self: TextInput =>
> println("So far, you typed '" + self.getText + "'")
> }
>
> window.setContent(vertical(pane, horizontal(list), horizontal(input)))
>
> window.open(display)
This grew out of my need to solve certain small problems while porting
my hobby app from Java to Scala class-by-class. It wraps the tiny slice
of Pivot that the UI part of my app uses most frequently. A more
general, declarative DSL, perhaps similar to Scala's collection
"literal" syntax is possible with a little effort.
On 12/21/2010 04:46 AM, Sandro Martini wrote:
>
> Hi Clint,
> I think your code could be really useful even to others (and to me, I like
> very much Scala :-) but too little time to make something real at the
> moment). If you want to post it here, probably it's the best place until
> we'll enable a pivot-contrib project or something similar.
>
> Or if you are interested, for this or for other things (maybe later), we
> have some project on GoogleCode, so we can enable you to commit there, for
> example pivot-scala, pivot-stuff, etc ...
>
> Thank you very much,
> Sandro
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk0kDYoACgkQ0GFaTS4nYxtZwwCcDQHFy09mk22qrsrlZxiPHLcc
aX8AoKEvoSBcZwjEt4WP1gLNt9/eJc5y
=DFZM
-----END PGP SIGNATURE-----
Re: unsubscribe
Posted by Greg Brown <gk...@verizon.net>.
Send a message to user-unsubscribe@pivot.apache.org.
On Jan 6, 2011, at 10:08 AM, Marco.Hostos wrote:
> Please how unsuscribe??
>
>
unsubscribe
Posted by "Marco.Hostos" <ma...@aditiva.com>.
Please how unsuscribe??
unsubscribe
Posted by Felix Eckhardt <Fe...@starfinanz.de>.
Re: Scala "DSL" (was Re: [pivot] are there any tools to convert
bxml to Java?)
Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
@Calatus:
I think we really need some cases like yours to improve some parts of Pivot
... very good.
A simple way to manage fast a typical CRUD application is a great feature
to have.
@Clint:
thanks for the sample, I'll try to look as soon as possible (but with my
slow timings :-) ), and don't worry I'm a Scala newbie, and you have already
do much than me with Pivot and Scala ... but it's definitely an area that I
(and Greg, and maybe others here) want to improve.
My problem here is that at the moment I haven't a real application to do
with Scala and Pivot, I hope to start to make something real with both in
the near future.
Greg, what do you think on grant Clint as committer (if he wants) on
Pivot-Scala (currently here: http://code.google.com/p/pivot-scala/ ) ?
So maybe we can start to define some elements to put there (what and how, as
a structure) ... or at least use these as a starting point (if Clint is not
against this).
Bye,
Sandro
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/pivot-are-there-any-tools-to-convert-bxml-to-Java-tp2118284p2197512.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.