This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208768

Summary: Provide special indenting for JavaFX builders
Product: javafx Reporter: Alexander Kouznetsov <mrkam>
Component: EditorAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: ENHANCEMENT Exception Reporter:

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...