diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index b7f62e5644..0d3a757f32 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -95,7 +95,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane this.doLayout(); this.validate(); this.repaint(); - previewDialog.setImage(getPreviewImage(shareWidget)); + previewDialog.setImage(getPreviewImage(shareWidget), widgetPane.getLocationOnScreen()); //展示弹出框 service.schedule(new Runnable() { @Override @@ -114,6 +114,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane if (!CarouselStateManger.getInstance().isSuspend()) { showCurrentLoadBlock(integer, widgetPane); } else { + previewDialog.setVisible(false); pollingCarouselState(integer, widgetPane); } } @@ -130,6 +131,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane return; } if (!CarouselStateManger.getInstance().isSuspend()) { + previewDialog.setVisible(true); showCurrentLoadBlock(integer, widgetPane); service.shutdown(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java index 086f4d2bd5..3ef29c8cb6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/PreviewDialog.java @@ -6,35 +6,33 @@ import com.fr.design.mainframe.EastRegionContainerPane; import javax.swing.ImageIcon; import javax.swing.JDialog; +import java.awt.Dimension; import java.awt.Image; +import java.awt.Point; /** * Created by kerry on 2021/10/22 */ public class PreviewDialog extends JDialog { + private static final int OFFSET_Y = 9; public PreviewDialog() { super(DesignerContext.getDesignerFrame()); setUndecorated(true); - setSize(300, 300); - adjustLocation(); this.setVisible(false); } - public void setImage(Image image) { + public void setImage(Image image, Point point) { this.getContentPane().removeAll(); this.getContentPane().add(new UILabel(new ImageIcon(image))); + int width = image.getWidth(null); + this.setSize(width, image.getHeight(null)); + this.setLocation(point.x - width, point.y + OFFSET_Y); this.doLayout(); + this.validate(); this.repaint(); } - public void adjustLocation() { - - this.setLocation( - EastRegionContainerPane.getInstance().getX() - 300, - 20 - ); - } }