From b193b30093d414e0247c481cef6c6f62e3e935b8 Mon Sep 17 00:00:00 2001 From: Phil Bryant Date: Wed, 15 Apr 2026 14:01:27 -0500 Subject: [PATCH 1/3] BENTO-17: * Modify `DragDropStage` to mirror the previous `DockContainerLeaf`'s `DockContainerLeafMenuFactory` and `Side` values. --- .../coley/bentofx/building/StageBuilding.java | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java index fd558f0a..30310b56 100644 --- a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java +++ b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java @@ -1,5 +1,6 @@ package software.coley.bentofx.building; +import javafx.geometry.Side; import javafx.scene.Scene; import javafx.scene.layout.Region; import javafx.stage.Stage; @@ -11,6 +12,7 @@ import software.coley.bentofx.dockable.Dockable; import software.coley.bentofx.layout.DockContainer; import software.coley.bentofx.layout.container.DockContainerLeaf; +import software.coley.bentofx.layout.container.DockContainerLeafMenuFactory; import software.coley.bentofx.layout.container.DockContainerRootBranch; /** @@ -44,7 +46,13 @@ public DragDropStage newStageForDockable(@NonNull Scene sourceScene, @NonNull Do Region sourceRegion = source.asRegion(); double width = sourceRegion.getWidth(); double height = sourceRegion.getHeight(); - return newStageForDockable(sourceScene, dockable, width, height); + if(source instanceof final DockContainerLeaf leaf) { + final DockContainerLeafMenuFactory leafMenuFactory = leaf.getMenuFactory(); + final Side side = leaf.getSide(); + return newStageForDockable(sourceScene, dockable, width, height, leafMenuFactory, side); + } else { + return newStageForDockable(sourceScene, dockable, width, height); + } } /** @@ -115,7 +123,41 @@ public DragDropStage newStageForDockable(@Nullable Scene sourceScene, return stage; } - /** + /** + * Create a new stage for the given dockable., + * + * @param sourceScene + * Original scene to copy state from. + * @param dockable + * Dockable to place into the newly created stage. + * @param width + * Preferred stage width. + * @param height + * Preferred stage height. + * @param leafMenuFactory + * DockContainerLeafMenuFactory for creating leaf menus + * @param side + * Side of this container to place {@code Header} displays on. + * {@code null} to not display any headers. + * + * @return Newly created stage. + */ + @NonNull + public DragDropStage newStageForDockable(@Nullable Scene sourceScene, + @NonNull Dockable dockable, + double width, + double height, + @Nullable DockContainerLeafMenuFactory leafMenuFactory, + @Nullable Side side) { + DockBuilding builder = bento.dockBuilding(); + DockContainerRootBranch root = builder.root(); + DockContainerLeaf leaf = builder.leaf(); + leaf.setMenuFactory(leafMenuFactory); + leaf.setSide(side); + return newStageForDockable(sourceScene, root, leaf, dockable, width, height); + } + + /** * Copy attributes from the source scene/stage housing a dockable * to the new scene/stage the dockable will be moved to. * From 74702059b704dc9956a1e8c94fa5c64ad288c04f Mon Sep 17 00:00:00 2001 From: Phil Bryant Date: Wed, 15 Apr 2026 14:45:01 -0500 Subject: [PATCH 2/3] BENTO-17: * Apply code style. --- .../coley/bentofx/building/StageBuilding.java | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java index 30310b56..0bfa30e5 100644 --- a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java +++ b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java @@ -46,13 +46,13 @@ public DragDropStage newStageForDockable(@NonNull Scene sourceScene, @NonNull Do Region sourceRegion = source.asRegion(); double width = sourceRegion.getWidth(); double height = sourceRegion.getHeight(); - if(source instanceof final DockContainerLeaf leaf) { + if (source instanceof final DockContainerLeaf leaf) { final DockContainerLeafMenuFactory leafMenuFactory = leaf.getMenuFactory(); final Side side = leaf.getSide(); return newStageForDockable(sourceScene, dockable, width, height, leafMenuFactory, side); - } else { + } else { return newStageForDockable(sourceScene, dockable, width, height); - } + } } /** @@ -123,41 +123,41 @@ public DragDropStage newStageForDockable(@Nullable Scene sourceScene, return stage; } - /** - * Create a new stage for the given dockable., - * - * @param sourceScene - * Original scene to copy state from. - * @param dockable - * Dockable to place into the newly created stage. - * @param width - * Preferred stage width. - * @param height - * Preferred stage height. - * @param leafMenuFactory - * DockContainerLeafMenuFactory for creating leaf menus - * @param side - * Side of this container to place {@code Header} displays on. - * {@code null} to not display any headers. - * - * @return Newly created stage. - */ - @NonNull - public DragDropStage newStageForDockable(@Nullable Scene sourceScene, - @NonNull Dockable dockable, - double width, - double height, - @Nullable DockContainerLeafMenuFactory leafMenuFactory, - @Nullable Side side) { - DockBuilding builder = bento.dockBuilding(); - DockContainerRootBranch root = builder.root(); - DockContainerLeaf leaf = builder.leaf(); - leaf.setMenuFactory(leafMenuFactory); - leaf.setSide(side); - return newStageForDockable(sourceScene, root, leaf, dockable, width, height); - } - - /** + /** + * Create a new stage for the given dockable., + * + * @param sourceScene + * Original scene to copy state from. + * @param dockable + * Dockable to place into the newly created stage. + * @param width + * Preferred stage width. + * @param height + * Preferred stage height. + * @param leafMenuFactory + * DockContainerLeafMenuFactory for creating leaf menus + * @param side + * Side of this container to place {@code Header} displays on. + * {@code null} to not display any headers. + * + * @return Newly created stage. + */ + @NonNull + public DragDropStage newStageForDockable(@Nullable Scene sourceScene, + @NonNull Dockable dockable, + double width, + double height, + @Nullable DockContainerLeafMenuFactory leafMenuFactory, + @Nullable Side side) { + DockBuilding builder = bento.dockBuilding(); + DockContainerRootBranch root = builder.root(); + DockContainerLeaf leaf = builder.leaf(); + leaf.setMenuFactory(leafMenuFactory); + leaf.setSide(side); + return newStageForDockable(sourceScene, root, leaf, dockable, width, height); + } + + /** * Copy attributes from the source scene/stage housing a dockable * to the new scene/stage the dockable will be moved to. * From d3158d3b2fe66aa796c59955be6748d8b846f6c7 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 17 Apr 2026 11:25:51 -0400 Subject: [PATCH 3/3] Simplify stage building with assumption Dockable parent will always be a leaf --- .../coley/bentofx/building/StageBuilding.java | 41 ++++--------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java index 0bfa30e5..680a106d 100644 --- a/core/src/main/java/software/coley/bentofx/building/StageBuilding.java +++ b/core/src/main/java/software/coley/bentofx/building/StageBuilding.java @@ -10,7 +10,6 @@ import software.coley.bentofx.Bento; import software.coley.bentofx.control.DragDropStage; import software.coley.bentofx.dockable.Dockable; -import software.coley.bentofx.layout.DockContainer; import software.coley.bentofx.layout.container.DockContainerLeaf; import software.coley.bentofx.layout.container.DockContainerLeafMenuFactory; import software.coley.bentofx.layout.container.DockContainerRootBranch; @@ -30,7 +29,7 @@ public StageBuilding(@NonNull Bento bento) { } /** - * Create a new stage for the given dockable., + * Create a new stage for the given dockable. * * @param sourceScene * Original scene to copy state from. @@ -42,43 +41,17 @@ public StageBuilding(@NonNull Bento bento) { * @return Newly created stage. */ @NonNull - public DragDropStage newStageForDockable(@NonNull Scene sourceScene, @NonNull DockContainer source, @NonNull Dockable dockable) { + public DragDropStage newStageForDockable(@NonNull Scene sourceScene, @NonNull DockContainerLeaf source, @NonNull Dockable dockable) { Region sourceRegion = source.asRegion(); double width = sourceRegion.getWidth(); double height = sourceRegion.getHeight(); - if (source instanceof final DockContainerLeaf leaf) { - final DockContainerLeafMenuFactory leafMenuFactory = leaf.getMenuFactory(); - final Side side = leaf.getSide(); - return newStageForDockable(sourceScene, dockable, width, height, leafMenuFactory, side); - } else { - return newStageForDockable(sourceScene, dockable, width, height); - } + final DockContainerLeafMenuFactory leafMenuFactory = source.getMenuFactory(); + final Side side = source.getSide(); + return newStageForDockable(sourceScene, dockable, width, height, leafMenuFactory, side); } /** - * Create a new stage for the given dockable., - * - * @param sourceScene - * Original scene to copy state from. - * @param dockable - * Dockable to place into the newly created stage. - * @param width - * Preferred stage width. - * @param height - * Preferred stage height. - * - * @return Newly created stage. - */ - @NonNull - public DragDropStage newStageForDockable(@Nullable Scene sourceScene, @NonNull Dockable dockable, double width, double height) { - DockBuilding builder = bento.dockBuilding(); - DockContainerRootBranch root = builder.root(); - DockContainerLeaf leaf = builder.leaf(); - return newStageForDockable(sourceScene, root, leaf, dockable, width, height); - } - - /** - * Create a new stage for the given dockable., + * Create a new stage for the given dockable. * * @param sourceScene * Original scene to copy state from. @@ -124,7 +97,7 @@ public DragDropStage newStageForDockable(@Nullable Scene sourceScene, } /** - * Create a new stage for the given dockable., + * Create a new stage for the given dockable. * * @param sourceScene * Original scene to copy state from.