pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilbert, Clint" <Clint_Gilb...@hms.harvard.edu>
Subject RE: [pivot] are there any tools to convert bxml to Java?
Date Tue, 21 Dec 2010 05:42:57 GMT

________________________________________
From: Greg Brown [gk_brown@verizon.net]
Sent: Monday, December 20, 2010 8:54 PM
To: calathus
Cc: user@pivot.apache.org
Subject: Re: [pivot] are there any tools to convert bxml to Java?

> Also if we may really have declarative GUI design, using Scala may be more attractive
way. Scala would allow declaring GUI in equivalent code side as BXML.

I'm not sure how this would work. Scala is conceptually more akin to Java than markup. Could
you elaborate?


I've been moving a Pivot project of mine bit-by-bit from Java to Scala, so I think I know
what he's getting at here.  Scala makes nice-looking, declarative DSLs possible.  I'm not
familiar with BXML, but I'm guessing you can declare things like: "here's a window and here's
what it contains".  A Scala DSL for this might look like

val window = Window {
  BoxPane { 
    new Label("here's a Label inside a BoxPane inside a Window")
 }
}

I have a very small Scala lib to allow syntax like:

val component = new Button("Hello")

button onClick {
  println("You clicked the button!")
}

and 

val container = new BoxPane

container += new Label("A label")

and 


val label = new Label("A label")
val widget = new SomeWidget

container ++ (label, widget)

etc.

It's extremely rudimentary, but if anyone's interested I can share it with the list.

Mime
View raw message