Skip to content

feat: restore tab reorder on drag-drop, add split-on-edge zones#3762

Merged
kasemir merged 1 commit intoControlSystemStudio:masterfrom
emilioheredia-source:tab_reordering
Apr 2, 2026
Merged

feat: restore tab reorder on drag-drop, add split-on-edge zones#3762
kasemir merged 1 commit intoControlSystemStudio:masterfrom
emilioheredia-source:tab_reordering

Conversation

@emilioheredia-source
Copy link
Copy Markdown

Restore tab reorder on drag-drop, add split-on-edge zones

Summary

Follow-up to #3759 (split DockPane on edge drag-and-drop).

PR #3759 introduced capture-phase addEventFilter(DRAG_DROPPED) on DockPane so that edge-zone splits could intercept drops before child nodes consumed them. A side-effect was that DockItem's existing name_tab drag handlers — which implement same-pane tab reorder (swap) and cross-pane tab-on-tab insert with green-border / green-text visual feedback — were blocked from ever receiving events.

This PR restores tab reorder by letting those original DockItem handlers work again, without removing the split-on-edge functionality.


What changed

Only DockPane.java is modified (56 insertions, 36 deletions). DockItem.java is unmodified — the tab-on-tab reorder uses the original upstream implementation as-is.

Approach

DockPane's capture-phase DRAG_OVER filter now does not consume the event when the pointer is inside the tab header strip (y ≤ tab_bar_bottom). This lets the event continue to DockItem's bubble-phase handlers on name_tab, which:

  • Accept the transfer mode and show a green border + green text on the target tab (visual feedback).
  • On drop, swap tab positions (same pane) or insert after the target tab (cross-pane).

For all other positions (pane body, empty tab-bar space, edge zones), the filter consumes as before and DockPane handles:

  • Centre zone → merge tab into this pane (append).
  • Edge zones → split the pane and place the tab in the new half.

The DRAG_DROPPED capture filter uses a lightweight isOverTabNode() helper (walks up from the pick result looking for a .tab CSS class — typically 3–5 parent nodes) to decide whether to delegate to DockItem or handle the drop itself.


Behaviour summary

Drop target Visual feedback Action
On a tab header (same pane) Green border + green text on target tab Tabs swap positions
On a tab header (different pane) Green border + green text on target tab Tab inserted after target
Empty tab-bar space or pane body Green border around pane Tab appended to pane
Left/right/top/bottom edge Blue line on that edge Pane splits; tab placed in new half

Known issues

Window focus loss after cross-pane drag-and-drop (pre-existing)

After completing a cross-pane tab drag, the target window can appear to lose OS-level focus — the title-bar close button may not respond to hover until the user clicks once inside the window. This is a pre-existing upstream issue present in the official Phoebus 5.0.2 release (tested on KDE/X11 with JavaFX 21).

JavaFX internally reports focused=true while the X11 window manager disagrees, so Window.requestFocus(), Stage.toFront(), and similar workarounds have no effect. This PR does not attempt to fix it to avoid adding fragile platform-specific hacks.

Let DockItem's original name_tab handlers manage tab-on-tab drops
(same-pane swap and cross-pane insert-after) by not consuming
DRAG_OVER events in the tab header strip.  DockPane's capture-phase
filters now only consume events below the tab bar, where they handle
centre-zone merge and edge-zone split.

Follow-up to ControlSystemStudio#3759 (split DockPane on edge drag-and-drop).
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

@kasemir kasemir merged commit fbfb5ea into ControlSystemStudio:master Apr 2, 2026
4 checks passed
@kasemir
Copy link
Copy Markdown
Collaborator

kasemir commented Apr 2, 2026

In first tests it works very well, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants