pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gk_br...@verizon.net>
Subject Re: [pivot] are there any tools to convert bxml to Java?
Date Tue, 21 Dec 2010 13:06:41 GMT
OK, now I get it. Groovy allows you to do something similar. However, I believe this approach
requires creating "builder" classes, correct? BXML offers a similar capability, but without
the need for builders:

<Window>
  <BoxPane>
    <Label text="here's a Label inside a BoxPane inside a Window"/>
  </BoxPane>
</Window>

You can also define event listeners in BXML.

However, I see value in both approaches, I think a Scala builder library would be a great
addition to the platform. By all means, please consider submitting it if you would like.

On Dec 21, 2010, at 12:42 AM, Gilbert, Clint wrote:

> 
> ________________________________________
> 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