Copy constructors
Tom Schindl
tom.schindl at bestsolution.at
Mon Sep 10 09:49:24 PDT 2012
So how do image the FXML to look like? You need something like a
for-loop in FXML which makes it a JSP like thing which is not good IMHO
- I'm even not 100% sold on the new binding syntax but - having for, if,
... is IMHO going to be a disaster.
If something needs logic and expressions, then express it in a
programming language like Java, ... but not in a markup one.
Tom
Am 10.09.12 16:47, schrieb Werner Lehmann:
> I am not sure how an include would help much here. Consider this scenario:
>
> <fx:define>
> <GridPane fx:id="gp">...</GridPane>
> </fx:define>
>
> <VBox fx:id="vbox"/>
>
> Now, if I wanted to add N gridpanes much like the one from the define
> block as children of the vbox - in code, in a for loop, with some
> adjustments... how would I do this with fx:include?
>
> Obviously an fx:include instead of fx:define does not help. It would not
> be dynamic. I could also put the define in a separate fxml and load that
> one 10 times. Certainly doable and does not need fx:include. Hardly
> elegant though, and I'd like to keep it in one file anyway.
>
> Thinking about it, there is not really even a need for a copy
> constructor which would deep-copy an otherwise useless template
> instance. It would be even better if the instantantion of the fx:define
> piece could be delayed, and would be repeatable in a loop:
>
> @FXML private VBox vbox;
>
> for (item: list) {
> GridPane gp = loader.instantiate("gp");
> customze(gp);
> vbox.getChildren().add(gp);
> }
>
> I realize that chances to get this are slim. However, at least in my
> code it is somehow a pattern on several occasions, forcing me to leave
> FXML for dynamic content.
>
> Thanks...
>
> Werner
>
> On 10.09.2012 13:15, Greg Brown wrote:
>> I don't know if there are any plans to add copy constructors, but you
>> might be able to do something similar with includes (e.g. instead of
>> defining your template in a define block, you could define it in an
>> external FXML file and include it where needed).
--
B e s t S o l u t i o n . a t EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833
http://www.BestSolution.at phone ++43 512 935834
More information about the openjfx-dev
mailing list