Browse Source

Pull request #7368: REPORT-62611 远程设计websocket断开提示优化-toast弹窗在设计器界面居左后显示异常

Merge in DESIGN/design from ~HENRY.WANG/design:release/11.0 to release/11.0

* commit '84b7e492dd7e441bf1e2721fa79941c672b390d3':
  REPORT-62611 远程设计websocket断开提示优化-toast弹窗在设计器界面居左后显示异常
bugfix/11.0
Henry.Wang 3 years ago
parent
commit
63640d4752
  1. 11
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  2. 6
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

11
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.toast;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -51,12 +52,16 @@ public class ToastMsgDialog extends UIDialog {
hide_height = dimension.height; hide_height = dimension.height;
setSize(new Dimension(dimension.width, 0)); setSize(new Dimension(dimension.width, 0));
contentPane.setSize(dimension); contentPane.setSize(dimension);
setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame()); setRelativeLocation(dimension);
int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10;
setLocation((DesignerContext.getDesignerFrame().getWidth() - dimension.width) / 2, positionY);
addMouseEvent(contentPane); addMouseEvent(contentPane);
} }
private void setRelativeLocation(Dimension dimension) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
int positionX = designerFrame.getLocationOnScreen().x + (designerFrame.getWidth() - dimension.width) / 2;
int positionY = designerFrame.getContentFrame().getLocationOnScreen().y + 10;
this.setLocation(positionX, positionY);
}
private Dimension calculatePreferSize() { private Dimension calculatePreferSize() {
Dimension contentDimension = contentPane.getPreferredSize(); Dimension contentDimension = contentPane.getPreferredSize();

6
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -206,11 +206,8 @@ public class DesignerSocketIO {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
if (dialog == null) { if (dialog == null || !dialog.isShow()) {
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent()); dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent());
}
if (!dialog.isShow()) {
dialog.setVisible(true); dialog.setVisible(true);
} }
} }
@ -294,6 +291,7 @@ public class DesignerSocketIO {
interface PrintEventLog { interface PrintEventLog {
void printThrowable(Throwable throwable); void printThrowable(Throwable throwable);
void print(String s, Object... object); void print(String s, Object... object);
} }

Loading…
Cancel
Save