From 7dd024fba772db268f96cd3938aece86204ff0d5 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Thu, 9 Jun 2022 11:11:06 +0800 Subject: [PATCH 1/9] =?UTF-8?q?REPORT-73106=20=E5=B0=86=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=8E=A7=E4=BB=B6=E5=89=AA=E5=88=87=E5=88=B0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=96=B0=E7=9A=84cpt,=E5=8E=9Ffrm=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=B0=B1=E5=8F=98=E6=88=90=E5=92=8Ccpt=E4=B8=80?= =?UTF-8?q?=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index df645e2df..082075707 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -25,7 +25,6 @@ import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; -import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; @@ -140,11 +139,28 @@ public class SelectionModel { if (cutSelection != null) { cutSelection.cut2ClipBoard(clipboard); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); + setSelectedCreator(hasSelectedParaComponent() ? designer.getParaComponent() : designer.getRootComponent()); designer.repaint(); } } } + /** + * 判断是否选中参数面板中的组件 + * @return boolean + */ + private boolean hasSelectedParaComponent() { + XCreator[] roots = selection.getSelectedCreators(); + if (roots.length > 0) { + for (XCreator creator : roots) { + if ((creator.getParent() instanceof XWParameterLayout)) { + return true; + } + } + } + return false; + } + /** * 复制当前选中的组件到剪切板 */ From 9815174813fbb6189ea9703bb0d2b1eb4e81b603 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 14 Jun 2022 17:00:54 +0800 Subject: [PATCH 2/9] =?UTF-8?q?REPORT-71476=20=E6=96=B0=E5=BB=BA=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=90=8E=EF=BC=8C=E7=9B=AE=E5=BD=95=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=A8=A1=E6=9D=BF=EF=BC=8C=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E5=BA=94=E8=AF=A5=E9=AB=98=E4=BA=AE=20?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B010.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 1 + 1 file changed, 1 insertion(+) 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 6e8b02000..52dd81b33 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 @@ -1555,6 +1555,7 @@ public abstract class JTemplate> refreshToolArea(); } DesignerFrameFileDealerPane.getInstance().refresh(); + DesignerFrameFileDealerPane.getInstance().stateChange(); } }); From aa611e019d31edc5bc1ea8437c16a78668459cd9 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 8 Jun 2022 19:34:17 +0800 Subject: [PATCH 3/9] =?UTF-8?q?REPORT-72570=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/form/util/FontTransformUtil.java | 8 +++ .../fr/design/form/util/HtmlPaintUtils.java | 42 ++++++++++++++++ .../design/form/util/HtmlPaintUtilsTest.java | 49 +++++++++++++++++++ .../cell/editor/RichTextCellEditor.java | 9 +++- .../design/cell/editor/RichTextToolBar.java | 4 +- 5 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java create mode 100644 designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java diff --git a/designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java b/designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java index 769707ebe..eab2a64bb 100644 --- a/designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java +++ b/designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java @@ -5,6 +5,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.stable.Constants; import com.fr.stable.unit.PT; +import java.math.BigDecimal; /** @@ -43,4 +44,11 @@ public class FontTransformUtil { return value * (double) Constants.DEFAULT_FONT_PAINT_RESOLUTION / (double) getDesignerFontResolution(); } + + public static int roundUp(double num) { + String numStr = Double.toString(num); + numStr = new BigDecimal(numStr).setScale(0, BigDecimal.ROUND_HALF_UP).toString(); + return Integer.valueOf(numStr); + } + } diff --git a/designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java b/designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java new file mode 100644 index 000000000..f8620f52d --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java @@ -0,0 +1,42 @@ +package com.fr.design.form.util; + +import com.fr.base.Style; +import com.fr.general.FRFont; +import com.fr.log.FineLoggerFactory; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 富文本导出工具栏 + * + * @author hades + * @version 11.0 + * Created by hades on 2022/5/19 + */ +public class HtmlPaintUtils { + + + private static final Pattern FONT_SIZE_PATTERN = Pattern.compile(Pattern.quote("font-size:") + "(.*?)" + Pattern.quote("px")); + + /** + * 设置单元格字体为富文本中的最大字体 + * + * @param style + */ + public static Style deriveMaxFontFromRichChar(Style style, String html) { + int maxSize = style.getFRFont().getSize(); + Matcher matcher = FONT_SIZE_PATTERN.matcher(html); + while (matcher.find()) { + String value = matcher.group(1); + try { + double pxSize = Double.parseDouble(value); + int ptSize = FontTransformUtil.roundUp(FontTransformUtil.px2pt(pxSize)); + maxSize = Math.max(maxSize, ptSize); + } catch (Throwable e) { + FineLoggerFactory.getLogger().debug(e.getMessage(), e); + } + } + FRFont cellFont = style.getFRFont(); + return style.deriveFRFont(cellFont.applySize(maxSize)); + } +} diff --git a/designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java b/designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java new file mode 100644 index 000000000..445e865ab --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java @@ -0,0 +1,49 @@ +package com.fr.design.form.util; + +import com.fr.base.Style; +import junit.framework.TestCase; +import org.junit.Assert; + + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/5/25 + */ +public class HtmlPaintUtilsTest extends TestCase { + + public void testDeriveMaxFontFromRichChar() { + // 富文本字体size更大 + String testHtml0 = "这是一条测试数据"; + Style style0 = Style.DEFAULT_STYLE; + Assert.assertEquals(16, HtmlPaintUtils.deriveMaxFontFromRichChar(style0, testHtml0).getFRFont().getSize()); + + // 单元格字体size更大 + String testHtml1 = "这是一条测试数据"; + Style style1 = Style.DEFAULT_STYLE; + int oldFontSize = style1.getFRFont().getSize(); + Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style1, testHtml1).getFRFont().getSize()); + + // 富文本字体size更大 不同文本 有不同size + String testHtml2 = "这是一条测试数"; + Style style2 = Style.DEFAULT_STYLE; + Assert.assertEquals(23, HtmlPaintUtils.deriveMaxFontFromRichChar(style2, testHtml2).getFRFont().getSize()); + + + // 异常场景1 + String testHtml3 = "xxxx奇怪的格式xxxx"; + Style style3 = Style.DEFAULT_STYLE; + oldFontSize = style1.getFRFont().getSize(); + Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style3, testHtml3).getFRFont().getSize()); + + // 异常场景2 + String testHtml4 = "这是一条测试数据"; + Style style4 = Style.DEFAULT_STYLE; + oldFontSize = style1.getFRFont().getSize(); + Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style4, testHtml4).getFRFont().getSize()); + + + } + + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java index 101928135..1d2a5eda2 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java @@ -1,5 +1,8 @@ package com.fr.design.cell.editor; +import com.fr.design.mainframe.DesignerContext; +import com.fr.general.GeneralUtils; +import com.fr.design.form.util.HtmlPaintUtils; import java.awt.Component; import javax.swing.SwingUtilities; @@ -42,6 +45,11 @@ public class RichTextCellEditor extends AbstractCellEditor implements @Override public void doOk() { RichTextCellEditor.this.fireEditingStopped(); + CellElement newCellElement = parentTplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()); + if (cellElement.getCellGUIAttr().isShowAsHTML()) { + newCellElement.setStyle(HtmlPaintUtils.deriveMaxFontFromRichChar(newCellElement.getStyle(), GeneralUtils.objectToString(newCellElement.getValue()))); + DesignerContext.getDesignerFrame().refreshToolbar(); + } } @Override @@ -49,7 +57,6 @@ public class RichTextCellEditor extends AbstractCellEditor implements RichTextCellEditor.this.fireEditingCanceled(); } }); - richTextDialog.addDialogActionListener(this); this.richTextPane.populate(parentTplEC, cellElement); setShowAsHtml(cellElement); diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java index f95681be3..74654cd2e 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java @@ -366,9 +366,7 @@ public class RichTextToolBar extends BasicPane { }; private int roundUp(double num) { - String numStr = Double.toString(num); - numStr = new BigDecimal(numStr).setScale(0, BigDecimal.ROUND_HALF_UP).toString(); - return Integer.valueOf(numStr); + return FontTransformUtil.roundUp(num); } private CaretListener textCareListener = new CaretListener() { From af8cf0b5412729c82f0eacd5c02a05b6bf7dbda1 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 27 May 2022 17:01:17 +0800 Subject: [PATCH 4/9] =?UTF-8?q?REPORT-70562=20=E5=AF=BC=E5=87=BA=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=AD=97=E5=8F=B7=E9=97=AE=E9=A2=98-=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ilable/ActionLabel.java | 11 ++- .../fr/design/report/ExportUniversalPane.java | 78 +++++++++++++++++++ .../design/report/ReportExportAttrPane.java | 13 ++++ 3 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java index ebccd24f4..85d73515e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java @@ -13,11 +13,16 @@ import java.awt.event.MouseEvent; */ public class ActionLabel extends UILabel { private ActionListener actionListener; + private Color color; public ActionLabel(String text) { - super(text); + this(text, Color.blue); + } - this.setForeground(Color.blue); + public ActionLabel(String text, Color color) { + super(text); + this.color = color; + this.setForeground(color); this.addMouseListener(mouseInputAdapter); this.addMouseMotionListener(mouseInputAdapter); } @@ -33,7 +38,7 @@ public class ActionLabel extends UILabel { public void paintComponent(Graphics _gfx) { super.paintComponent(_gfx); - _gfx.setColor(Color.blue); + _gfx.setColor(this.color); _gfx.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); } diff --git a/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java new file mode 100644 index 000000000..c95d37205 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java @@ -0,0 +1,78 @@ +package com.fr.design.report; + +import com.fr.base.CustomConfig; +import com.fr.config.Configuration; +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.ActionLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.BrowseUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/5/26 + */ +public class ExportUniversalPane extends BasicPane { + + private UICheckBox specialCharacterExport; + + public ExportUniversalPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + JPanel outerNorthPane =FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Config")); + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); + JPanel specialCharacterExportPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + specialCharacterExport = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character")); + specialCharacterExport.setSelected(true); + specialCharacterExportPane.add(specialCharacterExport); + northPane.add(specialCharacterExportPane); + JPanel labelPane = new JPanel(new BorderLayout()); + labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + UILabel centerLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character_Tip")); + centerLabel.setForeground(Color.GRAY); + ActionLabel rightLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_More_Alternative_Fonts"), UIConstants.FLESH_BLUE); + rightLabel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + BrowseUtils.browser("http://www.baidu.com"); + } + }); + labelPane.add(centerLabel, BorderLayout.CENTER); + labelPane.add(rightLabel, BorderLayout.EAST); + northPane.add(labelPane); + outerNorthPane.add(northPane); + this.add(outerNorthPane); + } + + @Override + protected String title4PopupWindow() { + return "ExportUniversalPane"; + } + + public void populate() { + this.specialCharacterExport.setSelected(CustomConfig.getInstance().isOptimizedSpecialCharacterExport()); + } + + public void update() { + Configurations.modify(new WorkerFacade(CustomConfig.class) { + @Override + public void run() { + CustomConfig.getInstance().setOptimizedSpecialCharacterExport(specialCharacterExport.isSelected()); + } + }); + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java index 1ac27cc88..d0770a13b 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java @@ -5,6 +5,7 @@ import com.fr.design.beans.BasicStorePane; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.ExportAttrTabProvider; import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.i18n.Toolkit; import com.fr.io.attr.ReportExportAttr; import javax.swing.*; @@ -17,12 +18,15 @@ public class ReportExportAttrPane extends BasicPane { private ExcelExportPane excelExportPane; private PDFExportPane pdfExportPane; private WordExportPane wordExportPane; + private ExportUniversalPane exportUniversalPane; private List> paneList; public ReportExportAttrPane() { UITabbedPane uiTabbedPane = new UITabbedPane(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + exportUniversalPane = new ExportUniversalPane(); + uiTabbedPane.addTab(Toolkit.i18nText("Fine-Design_Report_Universal_Export"), exportUniversalPane); excelExportPane = new ExcelExportPane(); uiTabbedPane.addTab("Excel", excelExportPane); pdfExportPane = new PDFExportPane(); @@ -49,6 +53,10 @@ public class ReportExportAttrPane extends BasicPane { reportExportAttr = new ReportExportAttr(); } + if (this.exportUniversalPane != null) { + this.exportUniversalPane.populate(); + } + if (this.excelExportPane != null) { this.excelExportPane.populate(reportExportAttr.getExcelExportAttr()); } @@ -69,6 +77,11 @@ public class ReportExportAttrPane extends BasicPane { public ReportExportAttr update() { ReportExportAttr reportExportAttr = new ReportExportAttr(); + + if (this.exportUniversalPane != null) { + this.exportUniversalPane.update(); + } + if (this.excelExportPane != null) { reportExportAttr.setExcelExportAttr(this.excelExportPane.update()); } From 5e39938cd154803954c0aa573c9a508235009c41 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 27 May 2022 17:48:56 +0800 Subject: [PATCH 5/9] =?UTF-8?q?REPORT-70562=20=E5=B8=AE=E5=8A=A9=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20url=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/ExportUniversalPane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java index c95d37205..3714d66a2 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.BrowseUtils; +import com.fr.general.CloudCenter; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import java.awt.BorderLayout; @@ -26,6 +27,8 @@ import javax.swing.JPanel; */ public class ExportUniversalPane extends BasicPane { + private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("help.alt_font.zh_CN", "https://help.fanruan.com/finereport/doc-view-4707.html"); + private UICheckBox specialCharacterExport; public ExportUniversalPane() { @@ -46,7 +49,7 @@ public class ExportUniversalPane extends BasicPane { rightLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - BrowseUtils.browser("http://www.baidu.com"); + BrowseUtils.browser(HELP_URL); } }); labelPane.add(centerLabel, BorderLayout.CENTER); From d61fdf98b90047172ab4ea99b035ccdb4b0a535f Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 24 Jun 2022 14:25:23 +0800 Subject: [PATCH 6/9] =?UTF-8?q?REPORT-71839=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E4=BB=8D=E8=BF=9E=E6=9B=BE=E6=96=AD=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 4 +++- .../fr/design/versioncheck/VersionCheckUtils.java | 15 +++++++++++---- .../src/main/java/com/fr/start/BaseDesigner.java | 10 ++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index cd9c835f3..d575c68d0 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -427,7 +427,9 @@ public class EnvChangeEntrance { DesignerExiter.getInstance().execute(); } else { updateNotRememberPwdEnv(); - VersionCheckUtils.showVersionCheckDialog(envListPane.getSelectedName()); + if (DesignerContext.getDesignerFrame().isVisible()) { + VersionCheckUtils.showVersionCheckDialog(envListPane.getSelectedName()); + } } } diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index d2794cd6e..fcb763461 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -52,6 +52,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import javax.swing.SwingWorker; /** * @author pengda @@ -95,9 +96,15 @@ public class VersionCheckUtils { } public static void showVersionCheckDialog(String envName) { - if (!VersionCheckUtils.versionCheck(envName)) { - showNotificationDialog(envName); - } + new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + if (!VersionCheckUtils.versionCheck(envName)) { + showNotificationDialog(envName); + } + return null; + } + }.execute(); } private static void showNotificationDialog(String envName) { @@ -294,7 +301,7 @@ public class VersionCheckUtils { private static boolean isPluginNeedIgnore(JSONObject remotePlugin) { return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC)) - || (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX) + || (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.getString(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX) || pluginsNeedIgnore.contains(remotePlugin.getString(ID))); } diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index b3945d0d7..d913f7a79 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -16,6 +16,7 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.ui.util.UIUtil; +import com.fr.design.versioncheck.VersionCheckUtils; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -84,10 +85,19 @@ public abstract class BaseDesigner extends ToolBarMenuDock { eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); } collectUserInformation(); + checkVersion(); } }); } + private void checkVersion() { + try { + VersionCheckUtils.showVersionCheckDialog(DesignerEnvManager.getEnvManager().getCurEnvName()); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn("Check Service Failed"); + } + } + public void show() { UIUtil.invokeLaterIfNeeded(this::refreshTemplateTree); } From 903076ed08babf9b141db9f97580ddc2c177d1d8 Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 24 Jun 2022 14:27:55 +0800 Subject: [PATCH 7/9] =?UTF-8?q?REPORT-71839=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E4=BB=8D=E8=BF=9E=E6=9B=BE=E6=96=AD=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/start/module/DesignerWorkspaceProvider.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 724f947c9..9c8b2e0f5 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -61,18 +61,6 @@ public class DesignerWorkspaceProvider extends Activator { EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(null, workspaceInfo); } else { WorkContext.switchTo(workspace); - //在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可 - final String selectEnv = current; - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { - @Override - public void on(Event event, Null aNull) { - try { - VersionCheckUtils.showVersionCheckDialog(selectEnv); - } catch (Exception e) { - FineLoggerFactory.getLogger().warn("Check Service Failed"); - } - } - }); } } catch (Throwable e) { EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(e, workspaceInfo); From 0e6693903cf4d51d052221aec2380018d05467b9 Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 24 Jun 2022 15:01:39 +0800 Subject: [PATCH 8/9] =?UTF-8?q?REPORT-71839=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E4=BB=8D=E8=BF=9E=E6=9B=BE=E6=96=AD=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/versioncheck/VersionCheckUtils.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index fcb763461..fb0ea0c76 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -96,13 +96,21 @@ public class VersionCheckUtils { } public static void showVersionCheckDialog(String envName) { - new SwingWorker() { + new SwingWorker() { @Override - protected Void doInBackground() throws Exception { - if (!VersionCheckUtils.versionCheck(envName)) { - showNotificationDialog(envName); + protected Boolean doInBackground() { + return !VersionCheckUtils.versionCheck(envName); + } + + @Override + protected void done() { + try { + if (get()) { + showNotificationDialog(envName); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return null; } }.execute(); } From 4585ce89a8cac1bd5aaf6e80b3d50b0d87245d0e Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 24 Jun 2022 15:24:31 +0800 Subject: [PATCH 9/9] =?UTF-8?q?REPORT-71839=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E4=BB=8D=E8=BF=9E=E6=9B=BE=E6=96=AD=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E4=BC=9A=E6=9C=89?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/versioncheck/VersionCheckUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index fb0ea0c76..d7823aadf 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -109,7 +109,7 @@ public class VersionCheckUtils { showNotificationDialog(envName); } } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().warn(e.getMessage(), e); } } }.execute();