Browse Source

Pull request #3446: REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit 'c785ac8c20094cb3fc1a8d1e4011db97042524f3':
  REPORT-44666 fix 无用import
  REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕
feature/big-screen
jeo 4 years ago
parent
commit
2ca8793f7f
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  4. 1
      designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java
  5. 26
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

2
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -437,7 +437,7 @@ public class EnvChangeEntrance {
public void chooseEnv(final String envName) {
final EnvListPane envListPane = new EnvListPane();
final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
final BasicDialog envListDialog = envListPane.showWindow(DesignerContext.getDesignerFrame());
envListPane.populateEnvManager(envName);
envListDialog.addDialogActionListener(new DialogActionAdapter() {

2
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -26,6 +26,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
@ -168,6 +169,7 @@ public class PreviewTablePane extends BasicPane {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame());
GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog);
}
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {

2
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -247,7 +247,7 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
resultPos.x = listPos.x + nameableList.getParent().getWidth();
}
// 如果右侧显示不下,可以向左移动
int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE;
int maxX = frame.getLocationOnScreen().x + frame.getWidth() - popupEditDialog.getWidth() - EDIT_RANGE;
if (resultPos.x > maxX) {
resultPos.x = maxX;
}

1
designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java

@ -85,6 +85,7 @@ public class ExpandFileChooser extends JFileChooser {
@Override
public int showDialog(Component parent, String approveButtonText) {
dialog.setModal(true);
GUICoreUtils.centerWindow(parent, dialog);
dialog.setVisible(true);
return retVal;
}

26
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -292,6 +292,24 @@ public final class GUICoreUtils {
return button;
}
/**
* 将独立弹窗设置在中间位置 适应多屏 跟随设计器主界面
* 可从父界面获取弹窗应该所在的矩形范围
*
* @param parent 独立弹窗的父窗口
* @param win 弹窗自身
*/
public static void centerWindow(Component parent, Window win) {
Rectangle rectangle;
if (parent == null) {
rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds();
} else {
rectangle = parent.getGraphicsConfiguration().getBounds();
}
centerWindow(win, rectangle);
}
/**
* 设置一个窗口
*
@ -301,7 +319,14 @@ public final class GUICoreUtils {
// Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小
// getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标
Rectangle rectangle = win.getGraphicsConfiguration().getBounds();
centerWindow(win, rectangle);
}
/**
* @param win
* @param rectangle 窗口所在的一个矩形范围
*/
public static void centerWindow(Window win, Rectangle rectangle) {
Dimension screenSize = rectangle.getSize();
Dimension winSize = win.getSize();
@ -315,6 +340,7 @@ public final class GUICoreUtils {
win.setLocation(rectangle.x + (screenSize.width - winSize.width) / 2, rectangle.y + (screenSize.height - winSize.height) / 2 - WINDOW_GAP);
}
/**
* Gets window/frame to screen center.
* @param owerWin 父窗口

Loading…
Cancel
Save