Proposal: Avoiding nested views with a merge tag
Richard Bair
richard.bair at oracle.com
Mon Dec 17 08:42:02 PST 2012
I see, basically what you want is a fragment in some secondary XML file, and since XML requires a root, you want a root which isn't a node so as to make XML happy. Is that right?
On Dec 17, 2012, at 8:28 AM, Yennick Trevels <yennick.trevels at gmail.com> wrote:
> ListView isn't what I'm looking for. It's more about a general way to reduce the number of levels in the scene graph (which I called display list). The blog post I mentioned describes quite clearly what I'm aiming it.
>
> For example when you have the following:
> <?xml version="1.0" encoding="UTF-8"?>
> <VBox xmlns:fx="http://javafx.com/fxml">
> <children>
> <MyComponent />
> </children>
> </VBox>
>
>
>
> MyComponent.fxml:
> <?xml version="1.0" encoding="UTF-8"?>
> <VBox xmlns:fx="http://javafx.com/fxml">
> <children>
> <TextField />
> <Button />
> </children>
> </VBox>
>
> This would create the following tree in the scene graph:
> VBox
> |---->VBox
> |----->TextField
> |----->Button
>
> So basically the child VBox is unnecessary and only creates an extra level in the scene graph without adding any functionality because the TextField and Button would already be aligned vertically by the top VBox. That's where the merge tag comes in which could replace the VBox tag in the MyComponent.fxml view. Then the tree would look like this:
>
> VBox
> |----->TextField
> |----->Button
>
>
> I hope this explains it somewhat clearly :)
>
>
> On Mon, Dec 17, 2012 at 4:43 PM, Richard Bair <richard.bair at oracle.com> wrote:
>> In fx there is not a display list, and nodes cannot be repeated in the scene graph, so you have to have the duplicate hbox.
>>
>> ListView is a powerful tool for doing virtualized views, maybe that is what you need? What is the use case?
>>
>> On Dec 17, 2012, at 7:03 AM, Yennick Trevels <yennick.trevels at gmail.com> wrote:
>>
>> > But if I understand this tag correctly it will still create an instance of
>> > HBox? So this root tag will still create a container (which will be added
>> > as a Node to the displaylist), which may be unnecessary.
>> > Is it possible with this tag to not create a node in the displaylist, so
>> > that elements defined under the root tag are added to the container in
>> > which the fxml view is being used?
>> >
>> >
>> > On Mon, Dec 17, 2012 at 3:45 PM, Tom Schindl <tom.schindl at bestsolution.at>wrote:
>> >
>> >> Isn't that what
>> >>
>> >> <fx:root xmlns:fx="http://javafx.com/fxml" type="HBox">
>> >> </fx:root>
>> >>
>> >> is good for?
>> >>
>> >> Tom
>> >>
>> >> Am 17.12.12 15:40, schrieb Yennick Trevels:
>> >>> One of the most common performance problems in RIA frameworks is having a
>> >>> deeply nested component tree. One of the reasons is the use of xml for
>> >>> declaring the layout (fxml in case of JavaFx). The problem with xml is
>> >> that
>> >>> when you want to group multiple components in a separate fxml for reuse
>> >>> purposes, you have to define a root tag, which in most frameworks will
>> >>> create an extra (potentially unnecessary) node in the displaylist.
>> >>>
>> >>> The way Android has solved this is by using a <merge> tag, which doesn't
>> >>> create an extra node in the displayList. A good overview of this tag can
>> >> be
>> >>> found here:
>> >> http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html
>> >>>
>> >>> Imo such a tag is something which can also be very useful for JavaFx
>> >> since
>> >>> it's also node-based, certainly since performance is key in RIA
>> >>> applications.
>> >>>
>> >>> Is something like this already in development and if not, what are your
>> >>> thoughts about this?
>> >>>
>> >>>
>> >>> Greetz,
>> >>> Yennick
>> >>
>> >>
>> >> --
>> >> 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