public HiddenSplitPaneSample() { String hidingSplitPaneCss = HiddenSplitPaneSample.class.getResource("HiddenSplitPane.css").toExternalForm(); final SplitPane splitPane = SplitPaneBuilder.create().id("hiddenSplitter").items( RegionBuilder.create().styleClass("rounded").build(), RegionBuilder.create().styleClass("rounded").build(), RegionBuilder.create().styleClass("rounded").build()).dividerPositions(new double[]{0.33, 0.66}).build(); splitPane.getStylesheets().add(hidingSplitPaneCss); getChildren().add(splitPane); }
@Override public void handlePerspective(final IAction<Event, Object> action, final PerspectiveLayout perspectiveLayout) { if (action.getLastMessage().equals(MessageUtil.INIT)) { final SplitPane mainLayout = SplitPaneBuilder.create() .styleClass("vsplitpane").orientation(Orientation.VERTICAL) .prefHeight(600).prefWidth(800).build(); mainLayout.setDividerPosition(0, 0.50f); // create left button menu final GridPane top = GridPaneBuilder.create() .alignment(Pos.TOP_CENTER).build(); GridPane.setHgrow(top, Priority.ALWAYS); GridPane.setVgrow(top, Priority.ALWAYS); // create main content Top final GridPane bottom = GridPaneBuilder.create() .alignment(Pos.BOTTOM_CENTER).build(); GridPane.setHgrow(bottom, Priority.ALWAYS); GridPane.setVgrow(bottom, Priority.ALWAYS); GridPane.setVgrow(mainLayout, Priority.ALWAYS); GridPane.setHgrow(mainLayout, Priority.ALWAYS); mainLayout.getItems().addAll(top, bottom); // Register root component perspectiveLayout.registerRootComponent(mainLayout); // register left menu perspectiveLayout.registerTargetLayoutComponent("PTop", top); // register main content perspectiveLayout.registerTargetLayoutComponent("PBottom", bottom); } }