protected void controllerDidLoadFxml()

in app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java [1042:1155]


    protected void controllerDidLoadFxml() {
        
        assert libraryPanelHost != null;
        assert librarySearchPanelHost != null;
        assert hierarchyPanelHost != null;
        assert infoPanelHost != null;
        assert contentPanelHost != null;
        assert inspectorPanelHost != null;
        assert inspectorSearchPanelHost != null;
        assert messageBarHost != null;
        assert mainSplitPane != null;
        assert mainSplitPane.getItems().size() == 2;
        assert leftRightSplitPane != null;
        assert leftRightSplitPane.getItems().size() == 3;
        assert libraryDocumentSplitPane != null;
        assert libraryDocumentSplitPane.getItems().size() == 2;
        assert documentAccordion != null;
        assert !documentAccordion.getPanes().isEmpty();
        assert libraryViewAsList != null;
        assert libraryViewAsSections != null;
        assert libraryReveal != null;
        assert libraryMenuButton != null;
        assert libraryImportSelection != null;
        assert customLibraryMenu != null;
        
        // Add a border to the Windows app, because of the specific window decoration on Windows.
        if (EditorPlatform.IS_WINDOWS) {
            getRoot().getStyleClass().add("windows-document-decoration");//NOI18N
        }
        
        mainSplitPane.addEventFilter(KeyEvent.KEY_PRESSED, mainKeyEventFilter);
        
        // Insert the menu bar
        assert getRoot() instanceof VBox;
        final VBox rootVBox = (VBox) getRoot();
        rootVBox.getChildren().add(0, menuBarController.getMenuBar());
        
        libraryPanelHost.getChildren().add(libraryPanelController.getPanelRoot());
        librarySearchPanelHost.getChildren().add(librarySearchController.getPanelRoot());
        hierarchyPanelHost.getChildren().add(hierarchyPanelController.getPanelRoot());
        infoPanelHost.getChildren().add(infoPanelController.getPanelRoot());
        contentPanelHost.getChildren().add(contentPanelController.getPanelRoot());
        inspectorPanelHost.getChildren().add(inspectorPanelController.getPanelRoot());
        inspectorSearchPanelHost.getChildren().add(inspectorSearchController.getPanelRoot());
        messageBarHost.getChildren().add(messageBarController.getPanelRoot());
        
        messageBarController.getSelectionBarHost().getChildren().add(
                selectionBarController.getPanelRoot());
        
        inspectorSearchController.textProperty().addListener((ChangeListener<String>) (ov, oldStr, newStr) -> inspectorPanelController.setSearchPattern(newStr));
        
        librarySearchController.textProperty().addListener((ChangeListener<String>) (ov, oldStr, newStr) -> libraryPanelController.setSearchPattern(newStr));
        
        bottomSplitController = new SplitController(mainSplitPane, SplitController.Target.LAST);
        leftSplitController = new SplitController(leftRightSplitPane, SplitController.Target.FIRST);
        rightSplitController = new SplitController(leftRightSplitPane, SplitController.Target.LAST);
        librarySplitController = new SplitController(libraryDocumentSplitPane, SplitController.Target.FIRST);
        documentSplitController = new SplitController(libraryDocumentSplitPane, SplitController.Target.LAST);
        
        messageBarHost.heightProperty().addListener((InvalidationListener) o -> {
            final double h = messageBarHost.getHeight();
            contentPanelHost.setPadding(new Insets(h, 0.0, 0.0, 0.0));
        });
        
        documentAccordion.setExpandedPane(documentAccordion.getPanes().get(0));
        
        // Monitor the status of the document to set status icon accordingly in message bar
        getEditorController().getJobManager().revisionProperty().addListener((ChangeListener<Number>) (ov, t, t1) -> messageBarController.setDocumentDirty(isDocumentDirty()));
        
        // Setup title of the Library Reveal menu item according the underlying o/s.
        final String revealMenuKey;
        if (EditorPlatform.IS_MAC) {
            revealMenuKey = "menu.title.reveal.mac";
        } else if (EditorPlatform.IS_WINDOWS) {
            revealMenuKey = "menu.title.reveal.win";
        } else {
            assert EditorPlatform.IS_LINUX;
            revealMenuKey = "menu.title.reveal.linux";
        }
        libraryReveal.setText(I18N.getString(revealMenuKey));
        
        // We need to tune the content of the library menu according if there's
        // or not a selection likely to be dropped onto Library panel.
        libraryMenuButton.showingProperty().addListener((ChangeListener<Boolean>) (ov, t, t1) -> {
            if (t1) {
                AbstractSelectionGroup asg = getEditorController().getSelection().getGroup();
                libraryImportSelection.setDisable(true);

                if (asg instanceof ObjectSelectionGroup) {
                    if (((ObjectSelectionGroup)asg).getItems().size() >= 1) {
                        libraryImportSelection.setDisable(false);
                    }
                }
                
                // DTL-6439. The custom library menu shall be enabled only
                // in the case there is a user library directory on disk.
                Library lib = getEditorController().getLibrary();
                if (lib instanceof UserLibrary) {
                    File userLibDir = new File(((UserLibrary)lib).getPath());
                    if (userLibDir.canRead()) {
                        customLibraryMenu.setDisable(false);
                    } else {
                        customLibraryMenu.setDisable(true);
                    }
                }
            }
        });
        
        libraryLabel.textProperty().bind(Bindings.createStringBinding(() -> {

            return SceneBuilderApp.getSingleton().getUserLibrary().isExploring() ? I18N.getString("library.exploring") : I18N.getString("library");

        }, SceneBuilderApp.getSingleton().getUserLibrary().exploringProperty()));
    }