Skip to content

Commit 7605185

Browse files
committed
Use DragAndDropUtils and initialize dragAndDropContext via factory method
1 parent a024dbf commit 7605185

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

shellfx-layout/src/main/java/com/techsenger/shellfx/layout/dockhost/DockHostFxView.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
import com.techsenger.shellfx.core.tab.TabFxView;
2727
import static com.techsenger.shellfx.layout.dockhost.DockConstants.ONE_HALF;
2828
import static com.techsenger.shellfx.layout.dockhost.DockConstants.ONE_THIRD;
29+
import com.techsenger.shellfx.layout.dockhost.DockHostFxView.Composer;
2930
import com.techsenger.shellfx.layout.style.LayoutIcons;
3031
import com.techsenger.shellfx.layout.tabhost.TabHostFxView;
3132
import com.techsenger.shellfx.material.icon.FontIconView;
3233
import com.techsenger.tabpanepro.core.TabPanePro;
3334
import com.techsenger.tabpanepro.core.skin.DragAndDropContext;
35+
import com.techsenger.tabpanepro.core.skin.DragAndDropUtils;
3436
import com.techsenger.tabpanepro.core.skin.TabPaneProSkin;
3537
import com.techsenger.tabpanepro.core.skin.TabPaneProSkin.TabHeaderArea;
3638
import com.techsenger.toolkit.core.Pair;
@@ -84,7 +86,6 @@
8486
import javafx.scene.layout.StackPane;
8587
import javafx.scene.layout.VBox;
8688
import javafx.scene.shape.Rectangle;
87-
import javafx.scene.transform.Rotate;
8889
import javafx.stage.Popup;
8990
import org.slf4j.Logger;
9091
import org.slf4j.LoggerFactory;
@@ -197,17 +198,7 @@ public DragAndDropHandler(DockHostFxView<?> dockHost) {
197198
}
198199

199200
protected Node createTabDragContent(TabPaneProSkin.TabHeaderSkin tabHeader) {
200-
var tabParams = new SnapshotParameters();
201-
WritableImage tabImage = tabHeader.snapshot(tabParams, null);
202-
ImageView dragView = new ImageView(tabImage);
203-
var tab = tabHeader.getContext().getTab();
204-
if (tab.getTabPane().getSide() == Side.BOTTOM) {
205-
Rotate rotate = new Rotate(180, tabImage.getWidth() / 2, tabImage.getHeight() / 2);
206-
dragView.getTransforms().add(rotate);
207-
}
208-
var container = new VBox(dragView);
209-
//container.getStyleClass().add("tab-drag-content");
210-
return container;
201+
return DragAndDropUtils.createTabDragContent(tabHeader);
211202
}
212203

213204
protected Node createTabDockDragContent(TabPaneProSkin.TabHeaderArea tabHeaderArea) {
@@ -3065,7 +3056,7 @@ private ReadOnlyObjectWrapper<SideBarFxView<?>> resolveBarWrapper(Side side) {
30653056
*/
30663057
private final BorderPane node = new BorderPane();
30673058

3068-
private final DragAndDropContext dragAndDropContext = new DragAndDropContext();
3059+
private final DragAndDropContext dragAndDropContext = createDragAndDropContext();
30693060

30703061
private final Transformer transformer = new Transformer(this);
30713062

@@ -3106,6 +3097,13 @@ protected DragAndDropHandler createDragAndDropHandler() {
31063097
return new DragAndDropHandler(this);
31073098
}
31083099

3100+
/**
3101+
* Creates the {@code DragAndDropContext} used by this {@link DockHostFxView}.
3102+
*/
3103+
protected DragAndDropContext createDragAndDropContext() {
3104+
return new DragAndDropContext();
3105+
}
3106+
31093107
@Override
31103108
protected void build() {
31113109
super.build();

0 commit comments

Comments
 (0)