Proposal: Avoiding nested views with a merge tag

Richard Bair richard.bair at oracle.com
Mon Dec 17 13:15:21 PST 2012


Nodes definitely have a cost, but the occasional VBox isn't going to be a problem. If this happens a lot though, you're going to notice on embedded.

Richard

On Dec 17, 2012, at 12:24 PM, Daniel Zwolenski <zonski at gmail.com> wrote:

> Just curious, is there really any significant performance hit to the extra
> Node, even on a limited device?
> 
> I was under the impression that we had heaps of Nodes within Nodes all over
> the place (e.g. Controls/Skins) and this wasn't seen as something to be
> avoided. An extra VBox would seem quite light to me and this merging idea
> seems a little complex by comparison (e.g. what happens to CSS styles
> applied at the root level)?
> 
> I'm not overly fussed though, just interested in knowing more about the
> performance costs.
> 
> 
> 
> On Tue, Dec 18, 2012 at 7:01 AM, Yennick Trevels
> <yennick.trevels at gmail.com>wrote:
> 
>> @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