[Bugfix] 修复右上角按钮和对话框图层相对位置错误的问题#6194
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for a custom overlay pane in JFXDialog, allowing dialogs to be rendered on a separate overlay container. The feedback highlights critical areas for improvement, including adding null checks to the overlayPaneProperty listener to prevent NullPointerExceptions, ensuring that the dialog content and overlay pane are properly made visible when showing a dialog without animations, and defaulting the overlay pane to the dialog itself if set to null to avoid errors elsewhere in the class.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for a custom overlay pane in JFXDialog. It adds a new constructor accepting an overlayPane and updates visibility, opacity, and transition animations to target the contentHolder and the custom overlayPane instead of the dialog itself. Decorator and DecoratorSkin are updated to manage this overlay pane, and DialogUtils is adjusted to pass it during dialog creation. Feedback on these changes suggests adding defensive null checks in the overlayPaneProperty listener of JFXDialog to prevent potential NullPointerExceptions, and directly utilizing the new 5-parameter constructor in DialogUtils to avoid redundant layout configurations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for custom overlay panes in JFXDialog by adding an overlayPane property and updating the dialog display and animation logic to target the overlay pane and content holder separately. It also updates DialogUtils and Decorator to support this new overlay pane. The review feedback suggests removing commented-out dead code in JFXDialog.java and restoring a removed show method overload in DialogUtils.java to prevent breaking backward compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
CC @Glavo can merge |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a customizable overlayPane property to JFXDialog, allowing the dialog to use a separate overlay pane instead of itself, and updates DialogUtils and the window decorator to support this. However, the feedback highlights that removing visibility controls from JFXDialog itself breaks its lifecycle and state tracking. It is recommended to restore the visibility updates on JFXDialog during initialization, showing, closing, and resetting properties to ensure proper behavior.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| private void initialize() { | ||
| this.setVisible(false); | ||
| this.getStyleClass().add(DEFAULT_STYLE_CLASS); |
There was a problem hiding this comment.
移除 this.setVisible(false) 会导致 JFXDialog 自身的 visible 属性默认为 true 且在整个生命周期中保持为 true。这会破坏 DialogUtils.handleDialogShown 中的逻辑,导致 onDialogShown() 和 requestFocus() 在对话框还未真正开始显示/渲染时就被立即调用(因为 dialog.isVisible() 始终为 true,不会走 else 分支的监听器逻辑)。这可能会导致焦点请求失败以及生命周期事件触发过早的问题。\n\n建议恢复对 JFXDialog 自身 visible 属性的初始化设置。
| private void initialize() { | |
| this.setVisible(false); | |
| this.getStyleClass().add(DEFAULT_STYLE_CLASS); | |
| private void initialize() { | |
| this.setVisible(false); | |
| this.getStyleClass().add(DEFAULT_STYLE_CLASS); |
| } else { | ||
| setVisible(true); | ||
| setOpacity(1); | ||
| contentHolder.setVisible(true); | ||
| contentHolder.setOpacity(1); | ||
| getOverlayPane().setVisible(true); | ||
| getOverlayPane().setOpacity(1); | ||
| Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED)); | ||
| } |
There was a problem hiding this comment.
在没有动画直接显示对话框时,需要同步将 JFXDialog 自身的可见性设为 true,以确保 visible 属性状态正确。
} else {
this.setVisible(true);
contentHolder.setVisible(true);
contentHolder.setOpacity(1);
getOverlayPane().setVisible(true);
getOverlayPane().setOpacity(1);
Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED));
}| } else { | ||
| setOpacity(0); | ||
| setVisible(false); | ||
| contentHolder.setOpacity(0); | ||
| contentHolder.setVisible(false); | ||
| getOverlayPane().setOpacity(0); | ||
| getOverlayPane().setVisible(false); | ||
| closeDialog(); | ||
| } |
| private void resetProperties() { | ||
| this.setVisible(false); | ||
| contentHolder.setVisible(false); | ||
| getOverlayPane().setVisible(false); |
There was a problem hiding this comment.
重置属性时,需要将 JFXDialog 自身的可见性重置为 false。
| private void resetProperties() { | |
| this.setVisible(false); | |
| contentHolder.setVisible(false); | |
| getOverlayPane().setVisible(false); | |
| private void resetProperties() { | |
| this.setVisible(false); | |
| contentHolder.setVisible(false); | |
| getOverlayPane().setVisible(false); |
现在对话框在右上角三个按钮之上,而阴影背景在三个按钮之下,所以遮挡关系是正确的且能正常点击按钮
Fixes #5796 Fixes #5122 Fixes #6192