Browse Source

Merge pull request #3454 in DESIGN/design from final/10.0 to persist/10.0

* commit '7dd051b0d35dec8dcf782e177222796628d3a89d':
  REPORT-44666 fix 无用import
  REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕
  REPORT-47258 打开多个模板,切换远程时右侧面板可能出现异常
persist/10.0
superman 4 years ago
parent
commit
78b3c06b1d
  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. 20
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 1
      designer-base/src/main/java/com/fr/design/style/background/image/ExpandFileChooser.java
  6. 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) { public void chooseEnv(final String envName) {
final EnvListPane envListPane = new EnvListPane(); final EnvListPane envListPane = new EnvListPane();
final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); final BasicDialog envListDialog = envListPane.showWindow(DesignerContext.getDesignerFrame());
envListPane.populateEnvManager(envName); envListPane.populateEnvManager(envName);
envListDialog.addDialogActionListener(new DialogActionAdapter() { 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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.function.TIME; import com.fr.function.TIME;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -168,6 +169,7 @@ public class PreviewTablePane extends BasicPane {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER); this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) { if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame()); 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) { progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() { 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(); 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) { if (resultPos.x > maxX) {
resultPos.x = maxX; resultPos.x = maxX;
} }

20
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -47,6 +47,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.NameSeparator; import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -79,7 +80,6 @@ import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.util.ArrayList; import java.util.ArrayList;
@ -340,30 +340,18 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) { public void refreshResource(FILE file) {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
setTargetByFile(file); setTargetByFile(file);
return null; UIUtil.invokeLaterIfNeeded(new Runnable() {
}
@Override @Override
public void done() { public void run() {
try {
get();
// 先移除旧的。 // 先移除旧的。
removeCenterPane(); removeCenterPane();
// 加入新的 // 加入新的
addCenterPane(); addCenterPane();
refreshToolArea(); refreshToolArea();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} });
}.execute();
} }

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

@ -85,6 +85,7 @@ public class ExpandFileChooser extends JFileChooser {
@Override @Override
public int showDialog(Component parent, String approveButtonText) { public int showDialog(Component parent, String approveButtonText) {
dialog.setModal(true); dialog.setModal(true);
GUICoreUtils.centerWindow(parent, dialog);
dialog.setVisible(true); dialog.setVisible(true);
return retVal; 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; 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()在有多个显示器也只能获取到主屏的大小 // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小
// getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标
Rectangle rectangle = win.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 screenSize = rectangle.getSize();
Dimension winSize = win.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); win.setLocation(rectangle.x + (screenSize.width - winSize.width) / 2, rectangle.y + (screenSize.height - winSize.height) / 2 - WINDOW_GAP);
} }
/** /**
* Gets window/frame to screen center. * Gets window/frame to screen center.
* @param owerWin 父窗口 * @param owerWin 父窗口

Loading…
Cancel
Save