From 3c184dd951271f4cfee172e1d4100a47a16b3fd1 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 09:48:02 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-62647=20=E7=BB=84=E4=BB=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=88=90=E5=8A=9F=E5=90=8E=E5=8F=AF=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=A0=87=E5=BF=97=E5=BA=94=E8=AF=A5=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 更新成功后没有替换视图块中的组件数据,导致组件 数据模型中的版本还是低版本,所以会继续绘制可 更新标志。 【改动思路】 更新成功后,依照id取出最新的数据并赋值重绘 --- .../share/ui/block/LocalWidgetUpdater.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java index 083df1b4e..65e5fcc94 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -5,12 +5,16 @@ import com.fr.design.extra.Process; import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.share.collect.ComponentCollector; +import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoUpdater; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.ui.util.UIUtil; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.Group; +import com.fr.form.share.GroupManege; +import com.fr.form.share.SharableWidgetProvider; +import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -106,6 +110,9 @@ public class LocalWidgetUpdater implements Process { } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } + if (success) { + resetWidgetOfBlock(); + } if (updateListener != null) { updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId()); } @@ -115,6 +122,21 @@ public class LocalWidgetUpdater implements Process { worker.execute(); } + private void resetWidgetOfBlock() { + GroupManege groupManege = DefaultShareGroupManager.getInstance(); + Group group = groupManege.getGroup(getGroup().getGroupName()); + if (group != null) { + String id = widgetBlock.getWidgetUuid(); + if (StringUtils.isNotEmpty(id)) { + SharableWidgetProvider localLatestWidget = group.getElCaseBindInfoById(widgetBlock.getWidgetUuid()); + if (localLatestWidget instanceof DefaultSharableWidget) { + widgetBlock.widget = (DefaultSharableWidget) localLatestWidget; + repaintBlockAndOverlay(); + } + } + } + } + public void cancelUpdate() { if (worker.isDone() || worker.isCancelled()) { return; @@ -126,7 +148,10 @@ public class LocalWidgetUpdater implements Process { @Override public void process(Double processValue) { this.processValue = processValue; + repaintBlockAndOverlay(); + } + private void repaintBlockAndOverlay() { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { From 0a1394d78940c0e1a6b7a6fbeba76a061bf2166f Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 09:58:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-62652=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E4=B8=8D=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=9B=BE=E6=A0=87=E5=BA=94=E8=AF=A5=E6=98=AF?= =?UTF-8?q?=E7=BA=A2=E8=89=B2=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 替换不兼容提示弹窗图标 【改动思路】 同上 --- .../design/mainframe/share/ui/block/LocalWidgetBlock.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index e08c317d8..4846468d6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -38,8 +38,10 @@ import org.jetbrains.annotations.Nullable; import javax.swing.Action; import javax.swing.Icon; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import javax.swing.UIManager; import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; @@ -224,7 +226,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock } if (!widget.isCompatibleWithCurrentEnv()) { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip") + Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") ); return; } From 0099f1f88ee8dce45562abdb4ead0cd102c53ec9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 11:19:03 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-62576=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=9B=B4=E6=96=B0=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E5=8F=96=E6=B6=88=E6=9B=B4=E6=96=B0=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 未处理取消异常 【改动思路】 try-catch块中使用Exception匹配所有异常 --- .../share/ui/block/LocalWidgetUpdater.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java index 65e5fcc94..68a3123f7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java @@ -5,7 +5,6 @@ import com.fr.design.extra.Process; import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.share.collect.ComponentCollector; -import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoUpdater; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; @@ -24,7 +23,6 @@ import java.awt.Component; import java.awt.Container; import java.io.File; import java.io.IOException; -import java.util.concurrent.ExecutionException; /** * @author Starryi @@ -107,7 +105,7 @@ public class LocalWidgetUpdater implements Process { boolean success = false; try { success = get(); - } catch (InterruptedException | ExecutionException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success) { @@ -138,10 +136,11 @@ public class LocalWidgetUpdater implements Process { } public void cancelUpdate() { - if (worker.isDone() || worker.isCancelled()) { - return; + if (worker != null && !worker.isDone()) { + worker.cancel(true); + worker = null; } - worker.cancel(true); + process(-1.0); } @@ -152,7 +151,7 @@ public class LocalWidgetUpdater implements Process { } private void repaintBlockAndOverlay() { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock); From d5d81f8f7c087b169fc847f56d971dfb525eef79 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 11:29:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-62677=20=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E5=9C=A8=E7=BA=BF=E7=BB=84=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 有个同时进行的任务在优化这部分代码,导致新修改的在线组件数据请求 路径在合并时丢失了,需要补充一下 【改动思路】 try-catch块中使用Exception匹配所有异常 --- .../com/fr/design/mainframe/share/util/OnlineShopUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java index 67326c853..c8c7b54ea 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java @@ -46,7 +46,7 @@ public class OnlineShopUtils { } private static String getWidgetReusePath() { - return getReuInfoPath(); + return StableUtils.pathJoin(getReuInfoPath(), "all/detail/"); } private static String getPackageChildrenPath() { From 1b42276edf338ca8c89b4b66b77c97e54dc1b519 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 12:02:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-62653=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E2=80=9C=E7=89=88=E6=9C=AC=E4=B8=8D=E5=85=BC=E5=AE=B9=E2=80=9D?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E4=B8=8D=E6=98=8E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改提示文字背景及字体 【改动思路】 同上 --- .../mainframe/share/ui/block/LocalWidgetBlock.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index 4846468d6..72eb35d00 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.design.base.mode.DesignModeContext; @@ -59,6 +60,7 @@ import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.util.UUID; @@ -298,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock double canvasH = coverDim.getHeight(); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); - GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); - Font tipFont = FRFont.getInstance().deriveFont(8F); + Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F); FontRenderContext frc = g2d.getFontRenderContext(); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); - Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); - double tipTextHeight = dim.getHeight(); + LineMetrics metrics = tipFont.getLineMetrics(tipText, frc); + double tipTextHeight = metrics.getHeight(); g2d.setColor(Color.WHITE); g2d.setFont(tipFont); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);