[GroovyFX] Hybrid FXML / builder approach

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[GroovyFX] Hybrid FXML / builder approach

Charles Monteiro-2
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


Reply | Threaded
Open this post in threaded view
|

Re: [GroovyFX] Hybrid FXML / builder approach

Andres Almiray
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 <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

Re: [GroovyFX] Hybrid FXML / builder approach

Charles Monteiro-2
thanks Andres

On Fri, Feb 24, 2017 at 1:27 PM, Andres Almiray <[hidden email]> 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 <[hidden email]> 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