Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -8,8 +9,8 @@
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;

/**
Expand All @@ -27,7 +28,7 @@ public StageBuilding(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.
Expand All @@ -38,15 +39,17 @@ public StageBuilding(Bento bento) {
*
* @return Newly created stage.
*/
public DragDropStage newStageForDockable(Scene sourceScene, DockContainer source, Dockable dockable) {
public DragDropStage newStageForDockable(Scene sourceScene, DockContainerLeaf source, Dockable dockable) {
Region sourceRegion = source.asRegion();
Comment thread
Col-E marked this conversation as resolved.
double width = sourceRegion.getWidth();
double height = sourceRegion.getHeight();
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.,
* Create a new stage for the given dockable.
*
* @param sourceScene
* Original scene to copy state from.
Expand All @@ -56,18 +59,30 @@ public DragDropStage newStageForDockable(Scene sourceScene, DockContainer source
* 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.
*/
public DragDropStage newStageForDockable(@Nullable Scene sourceScene, Dockable dockable, double width, double height) {
public DragDropStage newStageForDockable(@Nullable Scene sourceScene,
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.,
* Create a new stage for the given dockable.
*
* @param sourceScene
* Original scene to copy state from.
Expand Down
Loading