From c2fa176e0a57bff1b7768fd09a8787d74b0197ec Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 9 Mar 2020 14:43:20 +0800 Subject: [PATCH 01/23] =?UTF-8?q?CHART-9435=20=E4=BF=AE=E6=94=B9=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E9=BB=98=E8=AE=A4=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ibutton/UIColorButtonWithAuto.java | 9 +++++++++ .../chart/gui/style/ChartTextAttrPaneWithAuto.java | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java index c883148ca3..814d2aa295 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -6,10 +6,19 @@ import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindowWithAuto; import com.fr.general.ComparatorUtils; +import javax.swing.Icon; import java.awt.Color; public class UIColorButtonWithAuto extends UIColorButton { + public UIColorButtonWithAuto() { + super(); + } + + public UIColorButtonWithAuto(Icon autoFontIcon) { + super(autoFontIcon); + } + protected void checkColorChange(Color oldColor, Color newColor) { if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.FONT_ICON); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 70fdf903eb..66e19d9707 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.chart.base.ChartConstants; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; @@ -35,7 +36,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } protected void initFontColorState() { - setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); + setFontColor(isColorAuto ? new UIColorButtonWithAuto(UIConstants.AUTO_FONT_ICON) : new UIColorButton(UIConstants.FONT_ICON)); } protected Object[] getFontSizeComboBoxModel() { From f23feb842df1a93d265ac980be99805b537b3d3d Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 9 Mar 2020 15:16:35 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIColorButtonWithAuto.java | 11 +---------- .../chart/gui/style/ChartTextAttrPaneWithAuto.java | 5 ++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java index 814d2aa295..a7dcad008a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -6,19 +6,10 @@ import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindowWithAuto; import com.fr.general.ComparatorUtils; -import javax.swing.Icon; import java.awt.Color; public class UIColorButtonWithAuto extends UIColorButton { - public UIColorButtonWithAuto() { - super(); - } - - public UIColorButtonWithAuto(Icon autoFontIcon) { - super(autoFontIcon); - } - protected void checkColorChange(Color oldColor, Color newColor) { if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.FONT_ICON); @@ -44,4 +35,4 @@ public class UIColorButtonWithAuto extends UIColorButton { return getPopupWin(); } -} +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 66e19d9707..26f011af44 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.chart.base.ChartConstants; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; @@ -36,7 +35,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } protected void initFontColorState() { - setFontColor(isColorAuto ? new UIColorButtonWithAuto(UIConstants.AUTO_FONT_ICON) : new UIColorButton(UIConstants.FONT_ICON)); + setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); } protected Object[] getFontSizeComboBoxModel() { @@ -64,4 +63,4 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { getFontSizeComboBox().setSelectedItem(frFont.getSize()); } } -} +} \ No newline at end of file From 4011ec7344723e8be26ff02842684ccbf3a25ef5 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 Mar 2020 16:49:51 +0800 Subject: [PATCH 03/23] REPORT-27685 && REPORT-27478 && REPORT-27454 --- .../src/main/java/com/fr/design/RestartHelper.java | 9 ++++++++- .../com/fr/design/mainframe/DesignerFrame.java | 14 +++++++++++--- .../design/update/ui/dialog/UpdateMainDialog.java | 3 +++ .../main/java/com/fr/start/DesignerLauncher.java | 3 ++- .../java/com/fr/start/DesignerSuperListener.java | 2 +- .../src/main/java/com/fr/start/MainDesigner.java | 1 + 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index 596257d70c..b5f1b6b815 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -153,7 +153,14 @@ public class RestartHelper { } finally { WorkContext.getCurrent().close(); frame.dispose(); - DesignerExiter.getInstance().execute(); + try { + // 更新升级过渡用 供当前测试 后面可删除 + Class.forName("com.fr.exit.DesignerExiter"); + DesignerExiter.getInstance().execute(); + } catch (Exception ignore) { + } finally { + System.exit(0); + } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 4d37d75390..d6b9c047ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -50,16 +50,18 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; +import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; @@ -501,8 +503,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); } - this.setIconImages(image); - } catch (IOException e) { + if (OperatingSystem.isMacos()) { + Class clazz = Class.forName("com.apple.eawt.Application"); + BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1); + Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon); + } else { + this.setIconImages(image); + } + } catch (IOException | ClassNotFoundException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); } diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 52e4144deb..78df599c57 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -30,6 +30,8 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.*; import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; @@ -598,6 +600,7 @@ public class UpdateMainDialog extends UIDialog { final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); final JFrame frame = DesignerContext.getDesignerFrame(); final RestartHelper helper = new RestartHelper(); + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); new FileProcess(callBack) { @Override public void onDownloadSuccess() { diff --git a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java index d0633ac6a3..9e98fcb400 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fr.design.RestartHelper; import com.fr.process.FineProcess; import com.fr.process.engine.FineJavaProcessFactory; import com.fr.process.engine.core.FineProcessContext; @@ -63,6 +64,6 @@ public class DesignerLauncher { public void restart() { beforeExit(); - start(args); + RestartHelper.restart(); } } diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java index acbd92271a..db8e532dcf 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -57,7 +57,7 @@ public class DesignerSuperListener { process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener() { @Override public void on(Event event, Null param) { - DesignerLauncher.getInstance().exit(); + System.exit(0); } }); } diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 238b035125..d4eb68e866 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -106,6 +106,7 @@ public class MainDesigner extends BaseDesigner { watch.start(); //启动运行时 FineRuntime.start(); + DesignerSubListener.getInstance().start(); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); From 048c406c48fadef32ea9b02a72252bbac47d9832 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 9 Mar 2020 17:01:06 +0800 Subject: [PATCH 04/23] =?UTF-8?q?CHART-9435=20=E5=A4=9A=E6=8C=87=E9=92=88?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=9D=90=E6=A0=87=E8=BD=B4=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E5=A4=A7=E5=B0=8F=E8=87=AA=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index 55622a85b5..3ec313aab7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -101,7 +101,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { protected ChartTextAttrPane getChartTextAttrPane() { if (isMulti(gaugeStyle)) { - return new ChartTextAttrPaneWithAuto(false, true); + return new ChartTextAttrPaneWithAuto(true, true); } else { return new ChartTextAttrPane(); } From b5575698bc8a42daf42fe5f139af8741eec0fb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 9 Mar 2020 17:30:48 +0800 Subject: [PATCH 05/23] =?UTF-8?q?CHART-12933=20=E5=8C=B9=E9=85=8D=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=8C=BA=E5=88=86=E7=82=B9=E5=9C=B0=E5=9B=BE=E5=92=8C?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java | 2 +- .../data/contentpane/table/VanMapTableDataContentPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java index e445a07ef3..1b6c6f9be0 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java @@ -63,7 +63,7 @@ public abstract class MapDataSetFieldsPane Date: Mon, 9 Mar 2020 18:22:46 +0800 Subject: [PATCH 06/23] =?UTF-8?q?CHART-9435=20=E4=BD=BF=E7=94=A8=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E7=B1=BB=E5=9E=8B=E6=9D=A5=E5=88=A4=E6=96=AD=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E8=87=AA=E5=8A=A8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/ChartTextAttrPaneWithAuto.java | 32 ++++++++++++++----- .../gauge/VanChartGaugeDetailAxisPane.java | 3 +- .../label/VanChartGaugeLabelDetailPane.java | 17 +++++++++- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 26f011af44..4cb9f73739 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.type.FontAutoType; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.GeneralUtils; @@ -22,18 +23,33 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } } - public ChartTextAttrPaneWithAuto() { - super(); - } - - public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { - this.isFontSizeAuto = isFontSizeAuto; - this.isColorAuto = isColorAuto; - + public ChartTextAttrPaneWithAuto(FontAutoType type) { + initAutoType(type); initState(); initComponents(); } + private void initAutoType(FontAutoType type) { + switch (type) { + case NONE: + this.isFontSizeAuto = false; + this.isColorAuto = false; + break; + case SIZE: + this.isFontSizeAuto = true; + this.isColorAuto = false; + break; + case COLOR: + this.isFontSizeAuto = false; + this.isColorAuto = true; + break; + case SIZE_AND_COLOR: + this.isFontSizeAuto = true; + this.isColorAuto = true; + break; + } + } + protected void initFontColorState() { setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index 3ec313aab7..cdb6b04b4c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -13,6 +13,7 @@ import com.fr.design.style.color.ColorSelectBox; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.FontAutoType; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -101,7 +102,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { protected ChartTextAttrPane getChartTextAttrPane() { if (isMulti(gaugeStyle)) { - return new ChartTextAttrPaneWithAuto(true, true); + return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR); } else { return new ChartTextAttrPane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 0303a5a20d..af7cb3b93f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.FontAutoType; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -69,9 +70,23 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return false; } + private FontAutoType getFontAutoType(boolean isFontSizeAuto, boolean isFontColorAuto) { + if (isFontSizeAuto && isFontColorAuto) { + return FontAutoType.SIZE_AND_COLOR; + } + if (isFontSizeAuto) { + return FontAutoType.SIZE; + } + if (isFontColorAuto) { + return FontAutoType.COLOR; + } + return FontAutoType.NONE; + } + protected ChartTextAttrPane initTextFontPane() { + FontAutoType type = getFontAutoType(isFontSizeAuto(), isFontColorAuto()); - return new ChartTextAttrPaneWithAuto(isFontSizeAuto(), isFontColorAuto()) { + return new ChartTextAttrPaneWithAuto(type) { protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p}; From c12aa0e57b3046bafa5688d9a0783e4538c039a9 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 9 Mar 2020 20:19:03 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E7=AE=80=E5=8C=96=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/ChartTextAttrPaneWithAuto.java | 41 +++++++------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 4cb9f73739..292d83c9e7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -12,9 +12,9 @@ import com.fr.general.GeneralUtils; public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); - private boolean isFontSizeAuto = false; - private boolean isColorAuto = false; + private FontAutoType type; public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; + static { FONT_SIZES_WITH_AUTO[0] = AUTO; @@ -24,42 +24,29 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } public ChartTextAttrPaneWithAuto(FontAutoType type) { - initAutoType(type); + this.type = type; initState(); initComponents(); } - private void initAutoType(FontAutoType type) { - switch (type) { - case NONE: - this.isFontSizeAuto = false; - this.isColorAuto = false; - break; - case SIZE: - this.isFontSizeAuto = true; - this.isColorAuto = false; - break; - case COLOR: - this.isFontSizeAuto = false; - this.isColorAuto = true; - break; - case SIZE_AND_COLOR: - this.isFontSizeAuto = true; - this.isColorAuto = true; - break; - } + private boolean isFontSizeAuto() { + return type == FontAutoType.SIZE || type == FontAutoType.SIZE_AND_COLOR; + } + + private boolean isFontColorAuto() { + return type == FontAutoType.COLOR || type == FontAutoType.SIZE_AND_COLOR; } protected void initFontColorState() { - setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); + setFontColor(isFontColorAuto() ? new UIColorButtonWithAuto() : new UIColorButton()); } protected Object[] getFontSizeComboBoxModel() { - return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; + return isFontSizeAuto() ? FONT_SIZES_WITH_AUTO : FONT_SIZES; } protected float updateFontSize() { - if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { + if (isFontSizeAuto() && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { return ChartConstants.AUTO_FONT_SIZE; } @@ -67,7 +54,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } protected void populateFontSize(FRFont frFont) { - if (getFontSizeComboBox() != null && isFontSizeAuto) { + if (getFontSizeComboBox() != null && isFontSizeAuto()) { if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { getFontSizeComboBox().setSelectedItem(AUTO); } else { @@ -75,7 +62,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } } - if (getFontSizeComboBox() != null && !isFontSizeAuto) { + if (getFontSizeComboBox() != null && !isFontSizeAuto()) { getFontSizeComboBox().setSelectedItem(frFont.getSize()); } } From f24b41b4409a523f9b59646092fe4033044b5cb8 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 10 Mar 2020 09:43:28 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E7=AE=80=E5=8C=96=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/label/VanChartGaugeLabelDetailPane.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index af7cb3b93f..ff510c708c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -70,23 +70,21 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return false; } - private FontAutoType getFontAutoType(boolean isFontSizeAuto, boolean isFontColorAuto) { - if (isFontSizeAuto && isFontColorAuto) { + private FontAutoType getFontAutoType() { + if (isFontSizeAuto() && isFontColorAuto()) { return FontAutoType.SIZE_AND_COLOR; } - if (isFontSizeAuto) { + if (isFontSizeAuto()) { return FontAutoType.SIZE; } - if (isFontColorAuto) { + if (isFontColorAuto()) { return FontAutoType.COLOR; } return FontAutoType.NONE; } protected ChartTextAttrPane initTextFontPane() { - FontAutoType type = getFontAutoType(isFontSizeAuto(), isFontColorAuto()); - - return new ChartTextAttrPaneWithAuto(type) { + return new ChartTextAttrPaneWithAuto(getFontAutoType()) { protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p}; From e0cef2e6b969948ab7c2213b5680102c1e32e320 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 Mar 2020 10:23:11 +0800 Subject: [PATCH 09/23] fix npe --- .../java/com/fr/start/DesignerSubListener.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java index 3e8663f89e..c76e6b0728 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java @@ -26,13 +26,15 @@ public class DesignerSubListener { } public void start() { - FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener() { - @Override - public void on(Event event, Null param) { - if (DesignerContext.getDesignerFrame() == null || !DesignerContext.getDesignerFrame().isShowing()) { - FineProcessContext.getParentPipe().fire(new CarryMessageEvent(DesignerProcessType.INSTANCE.obtain())); + if (FineProcessContext.getParentPipe() != null) { + FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener() { + @Override + public void on(Event event, Null param) { + if (DesignerContext.getDesignerFrame() == null || !DesignerContext.getDesignerFrame().isShowing()) { + FineProcessContext.getParentPipe().fire(new CarryMessageEvent(DesignerProcessType.INSTANCE.obtain())); + } } - } - }); + }); + } } } From 282ba7dc2e4957a349ff7abf20fa5d979ea1157e Mon Sep 17 00:00:00 2001 From: Maksim Date: Tue, 10 Mar 2020 13:47:34 +0800 Subject: [PATCH 10/23] =?UTF-8?q?isWarDeploy=E8=B0=83=E7=94=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/env/RemoteWorkspace.java | 16 +++++++--------- .../design/write/submit/CheckServiceDialog.java | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index 735c1a5bdf..7a4453a83a 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -2,10 +2,9 @@ package com.fr.design.env; import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.design.i18n.Toolkit; -import com.fr.invoke.ReflectException; -import com.fr.log.FineLoggerFactory; import com.fr.base.operator.common.CommonOperator; import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; @@ -51,13 +50,12 @@ public class RemoteWorkspace implements Workspace { @Override public boolean isWarDeploy() { - - try { - return WorkContext.getCurrent().get(CommonOperator.class).isWarDeploy(); - } catch (ReflectException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - return false; - } + return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler() { + @Override + public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { + return false; + } + }).isWarDeploy(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java index a5f5d752b2..dfad82edac 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java @@ -54,7 +54,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { font = font.applySize(15).applyStyle(1); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency")); label.setFont(font); - label.setPreferredSize(new Dimension(600,30)); + label.setPreferredSize(new Dimension(650,30)); JLabel label2 = new JLabel(""+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+""); label2.setPreferredSize(new Dimension(600,30)); @@ -98,7 +98,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { this.add(topPanel,BorderLayout.NORTH); this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel,BorderLayout.SOUTH); - this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 700:600, 500)); + this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 750:600, 500)); GUICoreUtils.centerWindow(this); } From 57e7f684a9d54f536fbf9d62c6f1ce5b548b45ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 10 Mar 2020 15:07:17 +0800 Subject: [PATCH 11/23] =?UTF-8?q?CHART-12771=20=E8=B6=85=E9=93=BE=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E5=9B=BE=E8=A1=A8=E7=BB=98=E5=88=B6=E5=B8=A6=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/chart/gui/ChartComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 3fae88fe40..ca1f4f1400 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -257,7 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - painter.paint(g2d, chartWidth, chartHeight, resolution, null); + painter.paint(g2d, chartWidth, chartHeight, resolution, null, this); } } From 22d28e0fa3ffe7aab8394fdd3c50ce5957f09282 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 11 Mar 2020 14:40:17 +0800 Subject: [PATCH 12/23] REPORT-27790 && REPORT-27451 --- .../com/fr/design/utils/DesignerPort.java | 2 +- .../com/fr/design/webattr/WebCssPane.java | 4 ++- .../java/com/fr/design/webattr/WebJsPane.java | 10 ++++--- .../src/main/java/com/fr/start/Designer.java | 23 ++++++++++++-- .../com/fr/start/DesignerJavaRuntime.java | 19 +++++++++++- .../com/fr/start/module/DesignerStartup.java | 2 ++ .../com/fr/start/DesignerJavaRuntimeTest.java | 30 +++++++++++++++++++ 7 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index cd02bc5c5e..55dc1f00d9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -32,7 +32,7 @@ public class DesignerPort implements XMLReadable, XMLWriter { public static final String XML_TAG = "DesignerPort"; private static final int MIN_PORT = 1024; - private static final int MAX_PORT = 65536; + private static final int MAX_PORT = 65535; public static final DesignerPort INSTANCE = new DesignerPort(); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java index a6576faa10..9ebbf875fe 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java @@ -12,6 +12,7 @@ import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.web.attr.ReportWebAttr; import javax.swing.BorderFactory; @@ -46,7 +47,8 @@ public class WebCssPane extends BasicPane { northPane.add(localText, FlowLayout.CENTER); northPane.add(chooseFile, FlowLayout.RIGHT); outnorth.add(northPane,BorderLayout.NORTH); - UILabel infor = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning")); + UILabel infor = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning", + ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); infor.setForeground(new Color(207, 42, 39)); outnorth.add(infor,BorderLayout.CENTER); this.add(outnorth, BorderLayout.NORTH); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java index bf04e554f8..7c5c2e6b9a 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java @@ -15,6 +15,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import com.fr.web.attr.ReportWebAttr; import javax.swing.BorderFactory; @@ -97,7 +98,8 @@ public class WebJsPane extends BasicPane { northPane.add(localText); northPane.add(chooseFile); firstnorth.add(northPane,BorderLayout.NORTH); - infor1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1")); + infor1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", + ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); infor1.setForeground(new Color(207, 42, 39)); firstnorth.add(infor1,BorderLayout.CENTER); @@ -107,7 +109,7 @@ public class WebJsPane extends BasicPane { centerPane.add(urlText); centerPane.add(testConnection); secondnorth.add(centerPane,BorderLayout.NORTH); - infor2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2")); + infor2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); infor2.setForeground(new Color(207, 42, 39)); secondnorth.add(infor2,BorderLayout.CENTER); @@ -221,13 +223,13 @@ public class WebJsPane extends BasicPane { localRadioSelectAction(); urlFileRadioButton.setForeground(new Color(143, 142, 139)); localFileRadioButton.setForeground(Color.black); - infor1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1")); + infor1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME)); infor2.setText(" "); } else if (urlFileRadioButton.isSelected()) { urlRadioSelectAction(); localFileRadioButton.setForeground(new Color(143, 142, 139)); urlFileRadioButton.setForeground(Color.black); - infor2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2")); + infor2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME)); infor1.setText(" "); } if (StringUtils.isEmpty(urlText.getText()) && StringUtils.isEmpty(localText.getText())) { diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 57a6532250..fb974da986 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -1,5 +1,7 @@ package com.fr.start; +import com.fr.log.FineLoggerFactory; + /** * 设计器主进程入口(无缝更换升级jar包,若使用其他类作为入口,需要重新打包designer.exe等,升级后仍然走的原来逻辑) * @@ -11,7 +13,24 @@ package com.fr.start; public class Designer { public static void main(String[] args) { - // 创建进程 - DesignerLauncher.getInstance().start(args); + try { + if (DesignerJavaRuntime.getInstance().isInValidVmOptions()) { + runNonGuardianDesigner(args); + } else { + // 创建进程 + DesignerLauncher.getInstance().start(args); + } + } catch (Exception e) { + runNonGuardianDesigner(args); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + /** + * 启动非守护设计器 + * @param args 参数 + */ + private static void runNonGuardianDesigner(String[] args) { + MainDesigner.main(args); } } diff --git a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java index 351bf1e44f..63beaabfdb 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java @@ -6,6 +6,8 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; +import java.util.Set; + /** * 设计器Java运行环境 * @@ -16,11 +18,12 @@ import com.fr.stable.os.OperatingSystem; public class DesignerJavaRuntime extends AbstractJavaRuntime { private static final String DOT = "."; + private static final String REMOTE_DEBUG = "-agentlib:jdwp=transport=dt_socket"; private static final String INSTALL4J = ".install4j"; private static final String JAVA_EXEC = "java"; private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin"); private static final String MAC_JRE_BIN = StableUtils.pathJoin("jre.bundle", "Contents", "Home", "jre", "bin"); - private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m"}; + private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"}; private static final DesignerJavaRuntime INSTANCE = new DesignerJavaRuntime(); @@ -28,6 +31,20 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { return INSTANCE; } + /** + * 远程调试不走启动守护 + * @return + */ + public boolean isInValidVmOptions() { + String[] options = getJvmOptions(); + for (String op : options) { + if (op.startsWith(REMOTE_DEBUG)) { + return true; + } + } + return false; + } + @Override public String getJavaExec() { String installHome = StableUtils.getInstallHome(); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 3dd7322f61..708cc00203 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -58,6 +58,8 @@ public class DesignerStartup extends Activator { BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); // 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件 checkDebugStart(); + // 都是在启动过程中读取,这边提前初始化xml配置 + DesignerEnvManager.getEnvManager(); // 初始化look and feel DesignUtils.initLookAndFeel(); if (DesignUtils.isPortOccupied()) { diff --git a/designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java b/designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java new file mode 100644 index 0000000000..13576a6e02 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java @@ -0,0 +1,30 @@ +package com.fr.start; + +import junit.framework.TestCase; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/10 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({DesignerJavaRuntime.class}) +public class DesignerJavaRuntimeTest extends TestCase { + + public void testIsInValidVmOptions() { + PowerMock.mockStatic(DesignerJavaRuntime.class); + DesignerJavaRuntime designerJavaRuntime = PowerMock.createPartialMock(DesignerJavaRuntime.class, "isInstallVersion", "getJvmOptions"); + String[] options = new String[]{"-Dfile.encoding=UTF-8", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"}; + EasyMock.expect(designerJavaRuntime.getJvmOptions()).andReturn(options).anyTimes(); + EasyMock.replay(designerJavaRuntime); + PowerMock.replay(DesignerJavaRuntime.class); + Assert.assertTrue(designerJavaRuntime.isInValidVmOptions()); + } +} \ No newline at end of file From 445a349479c8651e43a1f842c886d37bdf2686a2 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 11 Mar 2020 14:47:17 +0800 Subject: [PATCH 13/23] fix --- .../src/main/java/com/fr/start/DesignerJavaRuntime.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java index 63beaabfdb..c264e79cb0 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java @@ -23,7 +23,7 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { private static final String JAVA_EXEC = "java"; private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin"); private static final String MAC_JRE_BIN = StableUtils.pathJoin("jre.bundle", "Contents", "Home", "jre", "bin"); - private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"}; + private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m"}; private static final DesignerJavaRuntime INSTANCE = new DesignerJavaRuntime(); From 661babee78939bc5451b60dd99371626d7e4976d Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 11 Mar 2020 16:22:19 +0800 Subject: [PATCH 14/23] =?UTF-8?q?REPORT-26262=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=EF=BC=8C=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetDefinePaneFactory.java | 32 +++++++++++++++++-- .../widget/WidgetMobilePaneFactory.java | 30 ++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java index 2df2e9f2a0..0dbde28ad7 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java @@ -1,6 +1,7 @@ package com.fr.design.widget; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.gui.core.WidgetConstants; import com.fr.design.widget.ui.ButtonDefinePane; import com.fr.design.widget.ui.CheckBoxDefinePane; @@ -42,7 +43,13 @@ import com.fr.form.ui.TextEditor; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; import com.fr.form.ui.Widget; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.report.web.button.form.TreeNodeToggleButton; import com.fr.report.web.button.write.AppendRowButton; import com.fr.report.web.button.write.DeleteRowButton; @@ -66,6 +73,26 @@ public class WidgetDefinePaneFactory { private static Map, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap(); static { + putDefault(); + + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshPluginMap(); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG); + } + }); + } + + private WidgetDefinePaneFactory() { + + } + + private static void putDefault() { defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + "")); defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); @@ -96,8 +123,9 @@ public class WidgetDefinePaneFactory { defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + "")); } - private WidgetDefinePaneFactory() { - + private static void refreshPluginMap() { + pluginDefineMap.clear(); + pluginDefineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap()); } @Nullable diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java index e6438897cf..86eba335d9 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java @@ -1,13 +1,20 @@ package com.fr.design.widget; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import java.util.HashMap; import java.util.Map; @@ -17,22 +24,43 @@ import java.util.Map; */ public class WidgetMobilePaneFactory { private static Map, Class> mobilePaneMap = new HashMap<>(); + private static Map, Class> mobilePluginPaneMap = new HashMap<>(); static { mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class); - mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); + mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); + + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshPluginMap(); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG); + } + }); } private WidgetMobilePaneFactory() { } + private static void refreshPluginMap() { + mobilePluginPaneMap.clear(); + mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); + } + public static WidgetMobilePane createWidgetMobilePane(Widget widget) { WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE; try { if (mobilePaneMap.containsKey(widget.getClass())) { mobilePane = mobilePaneMap.get(widget.getClass()).newInstance(); mobilePane.populate(widget); + } else if (mobilePluginPaneMap.containsKey(widget.getClass())){ + mobilePane = mobilePluginPaneMap.get(widget.getClass()).newInstance(); + mobilePane.populate(widget); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 16907ac0bf6d42b7aaa4d91e5eaadf48b502d9dd Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 12 Mar 2020 14:09:09 +0800 Subject: [PATCH 15/23] =?UTF-8?q?CHART-12973=20=E7=BB=9F=E4=B8=80=E8=AF=95?= =?UTF-8?q?=E7=AE=A1=E5=9E=8B=E4=BB=AA=E8=A1=A8=E7=9B=98=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 564f45f9a3..9c16fa961b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -92,13 +92,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(attrLabel == null){ return; } + attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); if(gaugeLayout.getSelectedIndex() == 0){ attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); - attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_VERTICAL_PERCENT_LABEL_FONT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); } else { attrLabel.getAttrLabelDetail().setPosition(Constants.BOTTOM); - attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_PERCENT_LABEL_FONT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.BOTTOM); } } From 9dde39c35a589fceb9873c45e4560e0ae62fa4f9 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 12 Mar 2020 14:18:26 +0800 Subject: [PATCH 16/23] REPORT-27771 && REPORT-27493 && REPORT-27954 --- .../tabledatapane/TableDataManagerPane.java | 11 +++++-- .../java/com/fr/design/mainframe/JForm.java | 3 ++ .../design/actions/cell/NewPresentAction.java | 30 ++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java index 7c484c7b29..4c08fae2b6 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java @@ -33,9 +33,16 @@ public class TableDataManagerPane extends LoadingBasicPane { ); } tableDataPane = pane == null ? new TableDataPaneListPane() { - public void rename(String oldName, String newName) { + @Override + public void rename(final String oldName, final String newName) { super.rename(oldName, newName); - renameConnection(oldName, newName); + new SwingWorker() { + @Override + protected Void doInBackground() { + renameConnection(oldName, newName); + return null; + } + }; } } : pane; container.add(tableDataPane.getPanel(), BorderLayout.CENTER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ab19002c18..ef14169e7a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,7 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; +import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; @@ -12,6 +13,7 @@ import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.FloatElementsProvider; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CutAction; @@ -587,6 +589,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Thu, 12 Mar 2020 14:30:42 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E5=8A=A0=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 9c16fa961b..ff6a62f921 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -17,6 +17,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.stable.Constants; @@ -92,7 +93,11 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(attrLabel == null){ return; } - attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); + AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail(); + if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){ + return; + } + attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); if(gaugeLayout.getSelectedIndex() == 0){ attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); From 18562b4dff1722f1f45c56a2d3970aab2e592449 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 12 Mar 2020 15:24:38 +0800 Subject: [PATCH 18/23] fix --- .../java/com/fr/design/data/datapane/TableDataPaneListPane.java | 2 +- .../data/tabledata/tabledatapane/TableDataManagerPane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 437334c530..d2fdc32291 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -69,7 +69,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } if (nameableList.getSelectedValue() instanceof ListModelElement) { Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; - if (!ComparatorUtils.equals(tempName, selected.getName())) { + if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { rename(selected.getName(), tempName); } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java index 4c08fae2b6..c55e5871ee 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java @@ -42,7 +42,7 @@ public class TableDataManagerPane extends LoadingBasicPane { renameConnection(oldName, newName); return null; } - }; + }.execute(); } } : pane; container.add(tableDataPane.getPanel(), BorderLayout.CENTER); From c4dd34ac0981d508e9580b55df66831c5f478104 Mon Sep 17 00:00:00 2001 From: Maksim Date: Thu, 12 Mar 2020 15:45:28 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E8=B0=83=E7=94=A8isCluster=E5=81=9A?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/env/RemoteWorkspace.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index 7a4453a83a..3d96ea1efc 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -1,6 +1,6 @@ package com.fr.design.env; -import com.fr.cluster.engine.base.FineClusterConfig; +import com.fr.cluster.engine.remote.ClusterOperator; import com.fr.design.i18n.Toolkit; import com.fr.base.operator.common.CommonOperator; import com.fr.rpc.ExceptionHandler; @@ -79,7 +79,12 @@ public class RemoteWorkspace implements Workspace { @Override public boolean isCluster() { - return FineClusterConfig.getInstance().isCluster(); + return WorkContext.getCurrent().get(ClusterOperator.class, new ExceptionHandler() { + @Override + public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { + return false; + } + }).isCluster(); } @Override From 2728eca125ea032c24d69c66a8d0043a66e9814c Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 12 Mar 2020 17:36:06 +0800 Subject: [PATCH 20/23] =?UTF-8?q?REPORT-27728=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E8=AE=BE=E7=BD=AE=E8=83=8C=E6=99=AF=E8=89=B2=E4=BC=9A?= =?UTF-8?q?=E9=81=AE=E6=8C=A1=E5=8E=9F=E5=A7=8B=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/CellElementPainter.java | 2 +- designer-realize/src/main/java/com/fr/grid/GridUI.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/CellElementPainter.java b/designer-realize/src/main/java/com/fr/grid/CellElementPainter.java index 607fde54f7..6148ee8d68 100644 --- a/designer-realize/src/main/java/com/fr/grid/CellElementPainter.java +++ b/designer-realize/src/main/java/com/fr/grid/CellElementPainter.java @@ -9,7 +9,7 @@ import com.fr.report.core.PaintUtils; import com.fr.report.elementcase.ElementCase; public class CellElementPainter { - public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, int width, int height) { + public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, double width, double height) { Style.paintBackground(g2d, ce.getStyle(), width, height); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 266cb5cb02..ff027af084 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -497,12 +497,12 @@ public class GridUI extends ComponentUI { paintCellElementRectangleList.add(this.tmpRectangle.clone()); - int cellWidth = (int) this.tmpRectangle.getWidth(); - int cellHeight = (int) this.tmpRectangle.getHeight(); + double cellWidth = this.tmpRectangle.getWidth(); + double cellHeight = this.tmpRectangle.getHeight(); // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 - painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight); - painter.paintContent(g2d, report, tmpCellElement, cellWidth, cellHeight, resolution); + painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1); + painter.paintContent(g2d, report, tmpCellElement, (int) cellWidth, (int) cellHeight, resolution); // denny_Grid: 注意下面还要减一, 因为上面translate时加一 g2d.translate(-this.tmpRectangle.getX() - 1, -this.tmpRectangle.getY() - 1); paintAuthorityCell(g2d, tmpCellElement); From 8de60f31418b6db2a3c40e0597bb3189ca3ed70f Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 12 Mar 2020 20:24:21 +0800 Subject: [PATCH 21/23] REPORT-28026 && REPORT-27919 --- .../mainframe/DesignerFrameFileDealerPane.java | 16 +--------------- .../fr/design/parameter/ParameterInputPane.java | 9 +++++++++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index b4b469e10a..bcac7f946c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -684,21 +684,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt this.dispose(); //模版重命名 - boolean success = false; - - // 提醒保存文件 - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); - // 只有一个文件未保存时 - if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) { - int choose = saveSomeTempaltePane.saveLastOneTemplate(); - if (choose != JOptionPane.CANCEL_OPTION) { - success = selectedOperation.rename(fnf, path, newPath); - } - } else { - if (saveSomeTempaltePane.showSavePane()) { - success = selectedOperation.rename(fnf, path, newPath); - } - } + boolean success = selectedOperation.rename(fnf, path, newPath); if (success) { HistoryTemplateListCache.getInstance().rename(fnf, path, newPath); diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java index 14487ca5fa..8e8819c67d 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java @@ -17,6 +17,7 @@ import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.FloatEditor; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.TextEditor; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -24,6 +25,8 @@ import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; import java.util.Date; @@ -103,6 +106,12 @@ public class ParameterInputPane extends BasicPane { contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane)); //add editor to parameter hashtable. + textF.getCurrentEditor().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); + } + }); this.editorNameMap.put(textF, parameter.getName()); nameAddedList.add(parameter.getName()); } From 9046015866f34875d90054079da5a3ff704835a4 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 13 Mar 2020 10:39:44 +0800 Subject: [PATCH 22/23] REPORT-27945 && REPORT-27934 && REPORT-27940 --- .../fr/common/detect/CommonPortDetector.java | 59 +++++++++++++++++++ .../main/java/com/fr/start/BaseDesigner.java | 2 + .../common/detect/CommonPortDetectorTest.java | 45 ++++++++++++++ .../com/fr/start/module/DesignerStartup.java | 5 ++ 4 files changed, 111 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java create mode 100644 designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java diff --git a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java new file mode 100644 index 0000000000..d49b4c80ab --- /dev/null +++ b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java @@ -0,0 +1,59 @@ +package com.fr.common.detect; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.DesignerEnvManager; +import com.fr.log.FineLoggerFactory; +import com.fr.module.ModuleContext; +import com.fr.web.WebSocketConfig; + +import java.net.Socket; +import java.util.concurrent.ExecutorService; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/10 + */ +public class CommonPortDetector { + + private static final CommonPortDetector INSTANCE = new CommonPortDetector(); + private ExecutorService service = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("CommonDetector")); + + public static CommonPortDetector getInstance() { + return INSTANCE; + } + + public void execute() { + service.submit(new Runnable() { + @Override + public void run() { + detectTomcatPort(); + detectWebSocketPort(); + } + }); + } + + private void detectTomcatPort() { + int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); + if (checkPort(port)) { + FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port); + } + } + + private void detectWebSocketPort() { + Integer[] ports = WebSocketConfig.getInstance().getPort(); + for (int port : ports) { + if (checkPort(port)) { + FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port); + } + } + } + + private boolean checkPort(int port) { + try (Socket socket = new Socket("localhost", port)) { + return true; + } catch (Exception e) { + return false; + } + } +} 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 90ac634ce0..ba231a335f 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -3,6 +3,7 @@ */ package com.fr.start; +import com.fr.common.detect.CommonPortDetector; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.DesignerLaunchStatus; @@ -76,6 +77,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { public void on(Event event, Null param) { EventDispatcher.stopListen(this); collectUserInformation(); + CommonPortDetector.getInstance().execute(); } }); } diff --git a/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java b/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java new file mode 100644 index 0000000000..fa9915b315 --- /dev/null +++ b/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java @@ -0,0 +1,45 @@ +package com.fr.common.detect; + +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; +import junit.framework.TestCase; +import org.junit.Assert; + +import java.io.IOException; +import java.net.ServerSocket; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/10 + */ +public class CommonPortDetectorTest extends TestCase { + + private ServerSocket serverSocket; + + @Override + public void setUp() throws Exception { + serverSocket = new ServerSocket(55555); + new Thread(new Runnable() { + @Override + public void run() { + try { + serverSocket.accept(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }).start(); + } + + public void testCheckPort() { + CommonPortDetector detector = CommonPortDetector.getInstance(); + boolean access = Reflect.on(detector).call("checkPort", 55555).get(); + Assert.assertTrue(access); + } + + @Override + public void tearDown() throws Exception { + serverSocket.close(); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 708cc00203..60de86543a 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -24,6 +24,7 @@ import com.fr.record.analyzer.Metrics; import com.fr.stable.BuildContext; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.start.DesignerProcessType; import com.fr.start.OemHandler; import com.fr.start.ServerStarter; @@ -91,6 +92,10 @@ public class DesignerStartup extends Activator { } }; dialog.setVisible(true); + StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId(), + DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage(), + StringUtils.EMPTY); + FineLoggerFactory.getLogger().error(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId() + ": " + DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage()); } DesignerExiter.getInstance().execute(); return; From a1cddd627db811ebe76b3dcdcabdc450939225c8 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 13 Mar 2020 10:42:01 +0800 Subject: [PATCH 23/23] fix --- .../src/main/java/com/fr/common/detect/CommonPortDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java index d49b4c80ab..310e75dce0 100644 --- a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java +++ b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutorService; public class CommonPortDetector { private static final CommonPortDetector INSTANCE = new CommonPortDetector(); - private ExecutorService service = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("CommonDetector")); + private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); public static CommonPortDetector getInstance() { return INSTANCE;