diff --git a/designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java b/designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java index aac7461c33..e64133eea4 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java @@ -37,6 +37,17 @@ public class InformationWarnPane extends JPanel{ public void show() { showWindow(SwingUtilities.getWindowAncestor(this)).setVisible(true); } + + public void showOnFront() { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + AlertDialog dialog = showWindow(SwingUtilities.getWindowAncestor(InformationWarnPane.this)); + dialog.setVisible(true); + dialog.toFront(); + } + }); + } public InformationWarnPane(String infor, String moreInfo, String title) { this.title = title; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index a2c6efcb2b..74dc180755 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -10,9 +10,11 @@ import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.dialog.BasicPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.utils.LoadingUtils; import javax.swing.JComponent; import javax.swing.JLayeredPane; +import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -31,7 +33,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener private static final long serialVersionUID = 1L; private JTemplate component; private TransparentPane transparentPane = new TransparentPane(); - private OpenLoadingPane loadingPane = new OpenLoadingPane(); + private JPanel loadingPane = LoadingUtils.createLoadingPane(); private OpenFailedPane failedPane = new OpenFailedPane(); private JLayeredPane layeredPane = new JLayeredPane() { @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 2975eaca43..6e8b020007 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -1096,7 +1096,7 @@ public abstract class JTemplate> String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); if (showTipPane) { - new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront(); } return true; } @@ -1119,7 +1119,7 @@ public abstract class JTemplate> String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion)); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); if (showTipPane) { - new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront(); } return true; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java b/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java similarity index 78% rename from designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java rename to designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java index adc30b2bff..e14f3f1018 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java +++ b/designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java @@ -1,35 +1,29 @@ -package com.fr.design.mainframe; +package com.fr.design.utils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.general.IOUtils; + +import javax.swing.ImageIcon; +import javax.swing.JPanel; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.LayoutManager; -import javax.swing.ImageIcon; -import javax.swing.JPanel; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2021/4/9 - */ -public class OpenLoadingPane extends JPanel { - private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png")); +public class LoadingUtils { + private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.png")); private static final Color TIP_COLOR = new Color(108, 174, 235); private static final int Y_GAP = 50; private static final int X_GAP = 10; - private UILabel loadingLabel; - private UILabel tipLabel; - - public OpenLoadingPane() { - - setLayout(new LayoutManager() { - + public static JPanel createLoadingPane() { + JPanel jPanel = new JPanel(); + UILabel loadingLabel = new UILabel(LOADING_ICON); + UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Loading")); + tipLabel.setForeground(TIP_COLOR); + jPanel.setLayout(new LayoutManager() { @Override public void removeLayoutComponent(Component comp) { } @@ -64,12 +58,10 @@ public class OpenLoadingPane extends JPanel { public void addLayoutComponent(String name, Component comp) { } }); - setBackground(Color.WHITE); - loadingLabel = new UILabel(LOADING_ICON); - tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading")); - tipLabel.setForeground(TIP_COLOR); - add(loadingLabel); - add(tipLabel); + jPanel.setBackground(Color.WHITE); + jPanel.add(loadingLabel); + jPanel.add(tipLabel); + return jPanel; } -} +} \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png b/designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png similarity index 100% rename from designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png rename to designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java b/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java index 437835662a..3a51357747 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java @@ -27,7 +27,11 @@ public enum OnlineWidgetSortType implements SortType { public int compare(OnlineShareWidget o1, OnlineShareWidget o2) { double t1 = getSortValue(o1, parameterMap); double t2 = getSortValue(o2, parameterMap); - return ComparatorUtils.compareCommonType(t2, t1); + // Comparator中比较double/float相等时,不允许误差. 否则会违背 "若x = y , y = z, 则x = z"的约定。 + // 因为允许误差的情况下,x和y间的误差在允许范围内,被判定相等,y和间的误差在允许范围内,被判定相等, + // 但x和z间的误差可能超出允许范围,从而不相等,因此会违背上述约定。 + // 产生IllegalArgumentException: Comparison method violates its general contract! + return Double.compare(t2, t1); } }); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java index 80162a4065..56b9dd65ac 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java @@ -8,14 +8,11 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.FormSelection; -import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.bean.ShareLayoutWidget; import com.fr.form.share.constants.ComponentPath; import com.fr.form.ui.Widget; -import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -38,9 +35,7 @@ public class ShareComponentUtils { public static XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) { XCreator xCreator; - if (creatorSource instanceof WCardMainBorderLayout) { - xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(500, 300)); - } else if (creatorSource instanceof ShareLayoutWidget) { + if (creatorSource instanceof ShareLayoutWidget) { xCreator = XCreatorUtils.createXCreator(((ShareLayoutWidget) creatorSource).getWidget(), new Dimension(provider.getWidth(), provider.getHeight())); } else { xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight())); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index 437458c9ae..2efd5e7541 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java @@ -8,7 +8,6 @@ import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.app.PluginRemote.PluginStatus; -import com.fr.design.ui.util.UIUtil; import com.fr.locale.InterProviderFactory; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarkerAdapter; @@ -27,6 +26,7 @@ import com.fr.third.guava.cache.CacheBuilder; import com.fr.third.guava.collect.Multimap; import com.fr.workspace.WorkContext; +import javax.swing.SwingUtilities; import java.time.Duration; import java.util.Collection; import java.util.Map; @@ -167,8 +167,8 @@ public class DesignerAppUtils { disable.clear(); // 从所有未安装中过滤远程未启用的,添加到未启用列表 disable.addAll(notInstall.stream().filter(plugin -> - pluginRemoteStatus.containsKey(plugin.getPluginID()) - && !pluginRemoteStatus.get(plugin.getPluginID()).isRunning()) + pluginRemoteStatus.containsKey(plugin.getPluginID()) + && !pluginRemoteStatus.get(plugin.getPluginID()).isRunning()) .collect(Collectors.toList())); // 清理未安装中所有远程安装过的插件(包含启用和未启用) notInstall.removeIf(adapter -> pluginRemoteStatus.containsKey(adapter.getPluginID())); @@ -183,7 +183,7 @@ public class DesignerAppUtils { // 试图获取多行读取错误提示并缓存待处理列表 String detail = dealWithErrorDetailMultiLineAndCache(path); if (detail.length() > 0) { - UIUtil.invokeLaterIfNeeded(() -> { + SwingUtilities.invokeLater(() -> { if (WorkContext.getCurrent().isLocal()) { UIExpandDialog.Builder() .owner(DesignerContext.getDesignerFrame()) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index dc6b0490fd..26340c1e2b 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -834,7 +834,7 @@ public class CellDSColumnEditor extends CellQuickEditor { //显示set和tip setCardPane.setPreferredSize(new Dimension(156, 20)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 40)); + tipCardPane.setPreferredSize(new Dimension(224, 50)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); } else { //未定义 @@ -958,7 +958,7 @@ public class CellDSColumnEditor extends CellQuickEditor { //显示set和tip setCardPane.setPreferredSize(new Dimension(156, 20)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 40)); + tipCardPane.setPreferredSize(new Dimension(224, 50)); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); break; case EVEN: