Bug 208768 - Provide special indenting for JavaFX builders
Provide special indenting for JavaFX builders
Status: NEW
Product: javafx
Classification: Unclassified
Component: Editor
7.1
PC Windows 7 x64
: P3 with 2 votes (vote)
: TBD
Assigned To: Svata Dedic
issues@javafx
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-22 20:16 UTC by Alexander Kouznetsov
Modified: 2013-09-04 13:46 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kouznetsov 2012-02-22 20:16:58 UTC
JavaFX has Fluent API that support creation of multiple objects as a chain of method calls. It is really needed to have NetBeans to automatically format these chains as in the following example:

            setGraphic(HBoxBuilder.create()
                    .children(
                        ImageViewBuilder.create()
                            .build(),
                        VBoxBuilder.create()
                            .children(
                                HBoxBuilder.create()
                                    .children(
                                        LabelBuilder.create()
                                            .text("Presentation Title")
                                            .build(),
                                        new PresentationListCell.Spacer(),
                                        LabelBuilder.create()
                                            .text("60:07")
                                            .build()
                                    )
                                    .build(),
                                LabelBuilder.create()
                                    .text("Presentation Description")
                                    .build(),
                                HBoxBuilder.create()
                                    .spacing(19)
                                    .id("presentation-labels")
                                    .children(
                                        LabelBuilder.create()
                                            .text("Presentation Authors")
                                            .build(),
                                        new PresentationListCell.Spacer(),
                                        new PresentationListCell.StarsSection(),
                                        LabelBuilder.create()
                                            .id("downloads-label")
                                            .text("76")
                                            .build(),
                                        LabelBuilder.create()
                                            .id("watches-label")
                                            .text("2119")
                                            .build(),
                                        LabelBuilder.create()
                                            .id("comments-label")
                                            .text("0")
                                            .build()
                                    )
                                    .build()
                            )
                            .build()
                    )
                    .build());
Comment 1 Alexander Kouznetsov 2012-02-22 20:18:26 UTC
This affects JavaFX adoption.

Anton Chechel wrote previously:
In fact current NetBeans java language formatter already supports formatting of "chained method calls" (Menu-Tools-Options-Editor-Formatting-Java-Wrapping). So, answering your question, yes, I think we could support formatting of builder patter. Moreover it could be useful not even for FX code. We just need to determine some rules...


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo