You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Charles Monteiro <ch...@gmail.com> on 2017/02/24 18:09:10 UTC

[GroovyFX] Hybrid FXML / builder approach

Hi, new to this list, please enroll me.

I would like to use FXML and builders in conjunction i.e. build the general
UI with SceneBuilder but for dynamic aspects e.g building tables based on a
target RDMS table , I would like to use GroovyFX  builders e.g. iterate
over column specs retrieved from an RDMS and generate via GroovyFX builder
syntax the corresponding TableColumns which would then be set on the
TableView.

Is this possible? , can somebody point me to an example and/or to spots in
docs or code that could shed insights into this scenario.

Btw, the assumption is that I would have had a reference to the tableView
via a @FXML annotation e.g.

@FXML
TableView<RDMSColumn> tableView

maybe

tableView.with {

tableColumn(editable: true, property: "name", text: "Name", prefWidth: 150,
    onEditCommit: { event ->
        Person item = event.tableView.items.get(event.tablePosition.row)
        item.name = event.newValue
    }
)
tableColumn(editable: true, property: "age", text: "Age", prefWidth:
50, type: Integer,
    onEditCommit: { event ->
        Person item = event.tableView.items.get(event.tablePosition.row)
        item.age = Integer.valueOf(event.newValue)
    }
)


}

just a wild guess, thought I ask before I start chasing my own tail.

thanks

-Charles

Re: [GroovyFX] Hybrid FXML / builder approach

Posted by Charles Monteiro <ch...@gmail.com>.
thanks Andres

On Fri, Feb 24, 2017 at 1:27 PM, Andres Almiray <aa...@gmail.com> wrote:

> Hi Charles,
>
> Yes, it's possible to build a hybrid view with both FXML injected fields
> and GroovyFX.
> Have a look at http://griffon-framework.org/tutorials/4_javafx_views.html#
> _tutorial_4_6
> Even though it's not a "pure" GroovyFX example it shows that your goal is
> attainable.
>
> Cheers,
> Andres
>
> -------------------------------------------
> Java Champion; Groovy Enthusiast
> http://andresalmiray.com
> http://www.linkedin.com/in/aalmiray
> --
> What goes up, must come down. Ask any system administrator.
> There are 10 types of people in the world: Those who understand binary,
> and those who don't.
> To understand recursion, we must first understand recursion.
>
> On Fri, Feb 24, 2017 at 7:09 PM, Charles Monteiro <
> charles.monteiro@gmail.com> wrote:
>
>> Hi, new to this list, please enroll me.
>>
>> I would like to use FXML and builders in conjunction i.e. build the
>> general UI with SceneBuilder but for dynamic aspects e.g building tables
>> based on a target RDMS table , I would like to use GroovyFX  builders e.g.
>> iterate over column specs retrieved from an RDMS and generate via GroovyFX
>> builder syntax the corresponding TableColumns which would then be set on
>> the TableView.
>>
>> Is this possible? , can somebody point me to an example and/or to spots
>> in docs or code that could shed insights into this scenario.
>>
>> Btw, the assumption is that I would have had a reference to the tableView
>> via a @FXML annotation e.g.
>>
>> @FXML
>> TableView<RDMSColumn> tableView
>>
>> maybe
>>
>> tableView.with {
>>
>> tableColumn(editable: true, property: "name", text: "Name", prefWidth: 150,
>>     onEditCommit: { event ->
>>         Person item = event.tableView.items.get(event.tablePosition.row)
>>         item.name = event.newValue
>>     }
>> )
>> tableColumn(editable: true, property: "age", text: "Age", prefWidth: 50, type: Integer,
>>     onEditCommit: { event ->
>>         Person item = event.tableView.items.get(event.tablePosition.row)
>>         item.age = Integer.valueOf(event.newValue)
>>     }
>> )
>>
>>
>> }
>>
>> just a wild guess, thought I ask before I start chasing my own tail.
>>
>> thanks
>>
>> -Charles
>>
>>
>>
>


-- 
Charles A. Monteiro
www.monteirosfusion.com
sent from the road

Re: [GroovyFX] Hybrid FXML / builder approach

Posted by Andres Almiray <aa...@gmail.com>.
Hi Charles,

Yes, it's possible to build a hybrid view with both FXML injected fields
and GroovyFX.
Have a look at
http://griffon-framework.org/tutorials/4_javafx_views.html#_tutorial_4_6
Even though it's not a "pure" GroovyFX example it shows that your goal is
attainable.

Cheers,
Andres

-------------------------------------------
Java Champion; Groovy Enthusiast
http://andresalmiray.com
http://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and
those who don't.
To understand recursion, we must first understand recursion.

On Fri, Feb 24, 2017 at 7:09 PM, Charles Monteiro <
charles.monteiro@gmail.com> wrote:

> Hi, new to this list, please enroll me.
>
> I would like to use FXML and builders in conjunction i.e. build the
> general UI with SceneBuilder but for dynamic aspects e.g building tables
> based on a target RDMS table , I would like to use GroovyFX  builders e.g.
> iterate over column specs retrieved from an RDMS and generate via GroovyFX
> builder syntax the corresponding TableColumns which would then be set on
> the TableView.
>
> Is this possible? , can somebody point me to an example and/or to spots in
> docs or code that could shed insights into this scenario.
>
> Btw, the assumption is that I would have had a reference to the tableView
> via a @FXML annotation e.g.
>
> @FXML
> TableView<RDMSColumn> tableView
>
> maybe
>
> tableView.with {
>
> tableColumn(editable: true, property: "name", text: "Name", prefWidth: 150,
>     onEditCommit: { event ->
>         Person item = event.tableView.items.get(event.tablePosition.row)
>         item.name = event.newValue
>     }
> )
> tableColumn(editable: true, property: "age", text: "Age", prefWidth: 50, type: Integer,
>     onEditCommit: { event ->
>         Person item = event.tableView.items.get(event.tablePosition.row)
>         item.age = Integer.valueOf(event.newValue)
>     }
> )
>
>
> }
>
> just a wild guess, thought I ask before I start chasing my own tail.
>
> thanks
>
> -Charles
>
>
>