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. 13
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  2. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

13
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();
@ -106,7 +111,7 @@ public class ToastMsgDialog extends UIDialog {
Dimension dimension = ToastMsgDialog.this.getSize(); Dimension dimension = ToastMsgDialog.this.getSize();
ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5)); ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5));
} }
}, 0,50, TimeUnit.MILLISECONDS); }, 0, 50, TimeUnit.MILLISECONDS);
} }
}, 5000, TimeUnit.MILLISECONDS); }, 5000, TimeUnit.MILLISECONDS);

10
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);
} }
} }
@ -284,7 +281,7 @@ public class DesignerSocketIO {
private static void printLog(Object[] objects, PrintEventLog printEventLog, String prefix) { private static void printLog(Object[] objects, PrintEventLog printEventLog, String prefix) {
for (Object object : objects) { for (Object object : objects) {
if (object instanceof Throwable) { if (object instanceof Throwable) {
Throwable throwable = (Throwable) object; Throwable throwable = (Throwable) object;
printEventLog.printThrowable(throwable); printEventLog.printThrowable(throwable);
} else { } else {
printEventLog.print(prefix, object); printEventLog.print(prefix, object);
@ -294,7 +291,8 @@ 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);
} }
enum PrintEventLogImpl implements PrintEventLog { enum PrintEventLogImpl implements PrintEventLog {

Loading…
Cancel
Save