Proposal: Avoiding nested views with a merge tag

Yennick Trevels yennick.trevels at gmail.com
Mon Dec 17 12:01:49 PST 2012


@Werner An XML document can have only one root node, so that's indeed the
problem :)
@Knut,Tom Why not implement it "the android way" (see article I linked in
my first post). Then the fxml processor can just skip the "merge" tag and
add its children to the parent; and you can still use the view multiple
times just like any other custom view.



On Mon, Dec 17, 2012 at 8:03 PM, Tom Schindl <tom.schindl at bestsolution.at>wrote:

> Yes that would be an idea, the problem is however is that this syntax only
> allows to "merge" in 1 subfxml, unless we'd allow to reference multiple
> fxmls there separated through e.g. ",".
>
> Tom
>
> Von meinem iPhone gesendet
>
> Am 17.12.2012 um 19:57 schrieb Knut Arne Vedaa <
> knut.arne.vedaa at broadpark.no>:
>
> > Wild suggestion:
> >
> > host.fxml:
> >
> > <VBox fx:include="morecontrols.fxml">
> > <TextField/>
> > <ComboBox/>
> > </VBox>
> >
> > morecontrols.fxml:
> >
> > <fx:root type="VBox">
> >  <Label/>
> > </fx:root>
> >
> > I.e. a kind of "mixin" or "partial nodes" syntax. Parser should ensure
> that the root type (or "self type") of morecontrols.fxml is (in this case)
> VBox.
> >
> > So what you end up with is:
> >
> > <VBox>
> > <TextField/>
> > <ComboBox/>
> > <Label/>
> > </VBox>
> >
> >
> > Knut Arne Vedaa
>


More information about the openjfx-dev mailing list