From 5e1308a268047bbd1445c9f2e39b8bed57588271 Mon Sep 17 00:00:00 2001 From: Yyming Date: Fri, 16 Oct 2020 17:08:55 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-41333=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E5=85=A8=E5=B1=80=E5=8F=82=E6=95=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=8F=82=E6=95=B0p1p2=EF=BC=8C=E5=B0=86p2?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BAp1=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E5=8F=82=E6=95=B0=E5=90=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/parameter/ParameterArrayPane.java | 130 +++++++++--------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java index d3efcae4a..6014db3f3 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java @@ -7,7 +7,7 @@ import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; -import com.fr.design.gui.ilist.ModNameActionListener; +import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -18,79 +18,75 @@ import java.util.Arrays; import java.util.List; public class ParameterArrayPane extends JListControlPane { - /** - * Constructor. - */ - public ParameterArrayPane() { - super(); - this.addModNameActionListener(new ModNameActionListener() { - public void nameModed(int index, String oldName, String newName) { - populateSelectedValue(); - } + /** + * Constructor. + */ + /**/ + public ParameterArrayPane() { + super(); + this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue()); + this.addEditingListener(new PropertyChangeAdapter() { + public void propertyChange() { + Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); + String[] allListNames = nameableList.getAllNames(); + allListNames[editingIndex] = StringUtils.EMPTY; + String tempName = getEditingName(); + if (StringUtils.isEmpty(tempName)) { + nameableList.stopEditing(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); + setIllegalIndex(editingIndex); + return; + } + if (!ComparatorUtils.equals(tempName, selectedName) + && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { + nameableList.stopEditing(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), + Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); + setIllegalIndex(editingIndex); + } + } + }); + } - }); - this.addEditingListener(new PropertyChangeAdapter() { - public void propertyChange() { - Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); - String[] allListNames = nameableList.getAllNames(); - allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; - String tempName = getEditingName(); - if (StringUtils.isEmpty(tempName)) { - nameableList.stopEditing(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); - setIllegalIndex(editingIndex); - return; - } - if (!ComparatorUtils.equals(tempName, selectedName) - && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { - nameableList.stopEditing(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); - setIllegalIndex(editingIndex); - } - } - }); - } + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); + } - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); - } - - /** - * 创建模板参数设置组件 - * - * @return 模板参数设置组件 - */ - public NameableCreator[] createNameableCreators() { - return new NameableCreator[]{ - new NameableSelfCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { - public Parameter createNameable(UnrepeatedNameHelper helper) { - // 返回参数设置面板. - return new Parameter(helper.createUnrepeatedName("p")); - } + /** + * 创建模板参数设置组件 + * + * @return 模板参数设置组件 + */ + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { + public Parameter createNameable(UnrepeatedNameHelper helper) { + // 返回参数设置面板. + return new Parameter(helper.createUnrepeatedName("p")); + } - @Override - public String createTooltip() { - return null; - } - } - }; - } + @Override + public String createTooltip() { + return null; + } + } + }; + } - /** - * 更新参数 + /** + * 更新参数 * * @return 更新后的参数 - */ - public Parameter[] updateParameters() { - // Nameable[]居然不能强转成Parameter[],一定要这么写... - Nameable[] res = this.update(); - Parameter[] res_array = new Parameter[res.length]; - java.util.Arrays.asList(res).toArray(res_array); + */ + public Parameter[] updateParameters() { + // Nameable[]居然不能强转成Parameter[],一定要这么写... + Nameable[] res = this.update(); + Parameter[] res_array = new Parameter[res.length]; + java.util.Arrays.asList(res).toArray(res_array); - return res_array; - } + return res_array; + } } From e1299d33627f9bc881b2c376e9aebd944d374be6 Mon Sep 17 00:00:00 2001 From: Yyming Date: Fri, 16 Oct 2020 17:16:11 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-41333=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E5=85=A8=E5=B1=80=E5=8F=82=E6=95=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=8F=82=E6=95=B0p1p2=EF=BC=8C=E5=B0=86p2?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BAp1=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E5=8F=82=E6=95=B0=E5=90=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=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/parameter/ParameterArrayPane.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java index 6014db3f3..adb0e4847 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java @@ -21,7 +21,6 @@ public class ParameterArrayPane extends JListControlPane { /** * Constructor. */ - /**/ public ParameterArrayPane() { super(); this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue()); @@ -33,7 +32,7 @@ public class ParameterArrayPane extends JListControlPane { String tempName = getEditingName(); if (StringUtils.isEmpty(tempName)) { nameableList.stopEditing(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); setIllegalIndex(editingIndex); return; } @@ -85,7 +84,7 @@ public class ParameterArrayPane extends JListControlPane { // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] res = this.update(); Parameter[] res_array = new Parameter[res.length]; - java.util.Arrays.asList(res).toArray(res_array); + Arrays.asList(res).toArray(res_array); return res_array; } From 949a24e96e74d111d9369d59c2918e79c4347638 Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 19 Oct 2020 15:40:25 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-41414=20&&=20REPORT-41495=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91REPORT-41?= =?UTF-8?q?414=E4=B8=AD=E4=B9=8B=E5=89=8D=E6=94=B9=E5=8A=A8=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=80=83=E8=99=91=E5=88=B0=E8=8F=9C=E5=8D=95=E6=A0=8F?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF-=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E7=95=8C=E9=9D=A2=E4=B8=AD=E4=B9=9F=E4=BC=9A=E5=8C=85?= =?UTF-8?q?=E6=8B=ACMaxMemRowCountPanel=EF=BC=8C=E7=84=B6=E8=80=8C?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE=E9=9B=86=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=E7=BB=99MaxMemRowCountPanel=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E6=AF=94=E8=BE=83=E5=B0=8F=EF=BC=8C=E4=BC=9A=E9=80=A0?= =?UTF-8?q?=E6=88=90MaxMemRowCountPanel=E6=98=BE=E7=A4=BA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=EF=BC=9BREPORT-41495=E4=BA=A7=E7=94=9F=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E6=98=AFWindows=E4=B8=8B=E7=9A=84JDK11=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E6=97=B6=E4=BC=9A=E6=9C=89=E7=BC=A9=E6=94=BE=E6=95=88?= =?UTF-8?q?=E6=9E=9C=EF=BC=8C=E8=BF=99=E9=87=8C=E6=98=AF=E5=AD=97=E8=A2=AB?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E4=BA=86=E4=B8=80=E7=82=B9=EF=BC=8C=E6=8A=8A?= =?UTF-8?q?=E5=90=8E=E9=9D=A2=E7=9A=84=E6=A1=86=E6=8C=A4=E4=B8=8B=E5=8E=BB?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E8=80=8C=E4=B9=8B=E5=89=8D=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E5=8F=AA=E4=BF=AE=E6=94=B9=E4=BA=86"?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=87=8D=E5=91=BD=E5=90=8D"=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=80=83=E8=99=91?= =?UTF-8?q?"=E6=96=87=E4=BB=B6=E5=A4=B9=E9=87=8D=E5=91=BD=E5=90=8D"=20?= =?UTF-8?q?=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91REPORT-41?= =?UTF-8?q?414=20=E5=9C=A8DBTableDataPane=E4=B8=AD=E6=8A=8A=E4=B8=AD?= =?UTF-8?q?=E9=97=B4=E4=B8=80=E9=83=A8=E5=88=86=E7=9A=84=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E7=BC=A9=E7=9F=AD=E4=B8=80=E7=82=B9=EF=BC=8C=E7=9B=B8=E5=BD=93?= =?UTF-8?q?=E4=BA=8E=E6=8B=89=E9=95=BF=E4=BA=86=E5=8F=B3=E4=BE=A7=E7=9A=84?= =?UTF-8?q?MaxMemRowCountPanel=EF=BC=9BREPORT-41495=E4=B8=AD=E5=B0=86?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=A1=86=E7=BC=A9=E5=B0=8F=E4=B8=80=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/tabledata/tabledatapane/DBTableDataPane.java | 3 ++- .../com/fr/design/mainframe/DesignerFrameFileDealerPane.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index d1beacb1d..6065d0485 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -185,7 +185,8 @@ public class DBTableDataPane extends AbstractTableDataPane { box.setMinimumSize(new Dimension(300, 400)); // 防止数据连接名过长时影响 split pane 分割效果 - connectionTableProcedurePane.setMinimumSize(new Dimension(250, 400)); + // 本界面中给MaxMemRowCountPanel留的空间太小,造成MaxMemRowCountPanel显示异常,这边减小一点最小宽度,拉长MaxMemRowCountPanel + connectionTableProcedurePane.setMinimumSize(new Dimension(230, 400)); connectionTableProcedurePane.setMaximumSize(new Dimension(500, 400)); // 使用SplitPane JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane); 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 870853a45..4f59032dc 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 @@ -578,7 +578,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } }); nameField.selectAll(); - nameField.setPreferredSize(new Dimension(180, 20)); + nameField.setPreferredSize(new Dimension(170, 20)); JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15)); From c0ab66fb038b9ed1cb677c401abdbeb994967eb4 Mon Sep 17 00:00:00 2001 From: Yyming Date: Mon, 19 Oct 2020 17:12:13 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-41491=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91af=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E9=94=99?= =?UTF-8?q?=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/cell/render/ContentCellRender.java | 6 +++++- .../search/manager/impl/FileSearchManager.java | 2 +- .../alphafine/cell/render/ContentCellRenderTest.java | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index da44fa510..d2befc90c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -124,7 +124,10 @@ public class ContentCellRender implements ListCellRenderer { private String getReplacedString(String modelName, String string) { //需要考虑modelName有空格的情况 //比如现在是work boo k 搜索词是workb,应该要替换的部分是work b - //先去掉空格进行匹配 + //先去掉已经匹配替换过的部分,因为考虑到分词的情况,可能会进行多次替换 + final String regex = "\\|\\|"; + modelName = modelName.replaceAll(regex, StringUtils.EMPTY); + //再去掉空格进行匹配 String noBlackName = modelName.replaceAll(StringUtils.BLANK, StringUtils.EMPTY).toLowerCase(); int index = noBlackName.indexOf(string.toLowerCase()); if (index == -1) { @@ -141,4 +144,5 @@ public class ContentCellRender implements ListCellRenderer { } + } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index d3bd1f637..0497828c7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -112,7 +112,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { name = name.replaceAll(StringUtils.BLANK, StringUtils.EMPTY); if (name.contains(searchText)) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); - if (!AlphaFineHelper.getFilterResult().contains(model)) { + if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { AlphaFineHelper.checkCancel(); filterModelList.add(model); } diff --git a/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRenderTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRenderTest.java index 9daa70f3a..d5f3a8206 100644 --- a/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRenderTest.java +++ b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRenderTest.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.alphafine.cell.render; +import com.fr.stable.StringUtils; import org.junit.Test; + import static org.junit.Assert.*; /** @@ -13,11 +15,20 @@ public class ContentCellRenderTest { @Test public void highLightModelName() { + final String regex = ""; String searchText = "workb"; ContentCellRender contentCellRender = new ContentCellRender(searchText,new String[]{searchText}); String workbook = contentCellRender.highLightModelName("workbook", new String[]{searchText}); assertTrue(workbook.endsWith("workbook")); workbook = contentCellRender.highLightModelName("work book", new String[]{searchText}); assertTrue(workbook.endsWith("work book")); + + searchText = "我是空格"; + contentCellRender = new ContentCellRender(searchText, new String[]{"我是空格", "我是", "空格"}); + workbook = contentCellRender.highLightModelName("我是 空格", new String[]{searchText}); + assertEquals(workbook.replaceFirst(regex, StringUtils.EMPTY), workbook.replaceAll(regex, StringUtils.EMPTY)); + + workbook = contentCellRender.highLightModelName("我是是 空格", new String[]{"我是空格", "我是", "空格"}); + assertNotEquals(workbook.replaceFirst(regex, StringUtils.EMPTY), workbook.replaceAll(regex, StringUtils.EMPTY)); } } \ No newline at end of file From ce7864b6027b82b386e63cb0cc76c16a587ada4d Mon Sep 17 00:00:00 2001 From: Yyming Date: Mon, 19 Oct 2020 17:24:29 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-41543=20=E8=A7=A6=E5=8F=91=E4=B8=80?= =?UTF-8?q?=E4=B8=8Bpr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/cell/render/ContentCellRender.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index d2befc90c..4f57b92b2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -142,7 +142,4 @@ public class ContentCellRender implements ListCellRenderer { } return result.toString(); } - - - } From 578d4145bc3f06acd5028a5219378ee990564446 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 19 Oct 2020 19:16:45 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-41492=20jdk11=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=BB=98=E8=AE=A4=E5=AD=97=E4=BD=93=E6=9C=89=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/iprogressbar/ProgressDialog.java | 10 ++- .../java/com/fr/design/utils/DesignUtils.java | 67 +++++++++++-------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 29214984c..d1847545c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -3,11 +3,12 @@ package com.fr.design.gui.iprogressbar; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; -import com.fr.stable.os.support.OSBasedAction; -import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import javax.swing.JDialog; import javax.swing.JLabel; @@ -57,7 +58,10 @@ public class ProgressDialog extends UIDialog { progressBar.setMaximum(1000); panel.add(progressBar, BorderLayout.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); - FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); + FRFont font = DesignUtils + .getDefaultGUIFont() + .applySize(14) + .applyForeground(new ColorUIResource(333334)); text.setFont(font); panel.add(text, BorderLayout.SOUTH); panel.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index f443a10ec..775118d28 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -8,6 +8,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.exit.DesignerExiter; import com.fr.file.FileFILE; @@ -21,7 +22,9 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; import com.fr.start.ServerStarter; +import com.fr.value.NotNullLazyValue; import com.fr.workspace.WorkContext; +import org.jetbrains.annotations.NotNull; import javax.swing.SwingUtilities; import javax.swing.UIManager; @@ -248,6 +251,7 @@ public class DesignUtils { // 刷新DesignerFrame里面的面板 SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { if (DesignerContext.getDesignerFrame() == null) { return; @@ -269,7 +273,7 @@ public class DesignUtils { FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); } //获取当前系统语言下设计器用的默认字体 - FRFont guiFRFont = getCurrentLocaleFont(); + FRFont guiFRFont = getDefaultGUIFont(); //指定UIManager中字体 Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { @@ -286,41 +290,50 @@ public class DesignUtils { } /** - * 获取当前系统语言下设计器用的默认字体 + * 获取当前系统语言下设计器界面使用的默认字体 * * @return 默认字体 */ - private static FRFont getCurrentLocaleFont() { - FRFont guiFRFont; - Locale defaultLocale = Locale.getDefault(); - // JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体 - if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) { - guiFRFont = getNamedFont("Microsoft YaHei"); - } else if (isDisplaySimSun(defaultLocale)) { - guiFRFont = getNamedFont("SimSun"); - } else { - guiFRFont = getNamedFont("Dialog"); - } + public static FRFont getDefaultGUIFont() { + return CURRENT_LOCALE_FONT.getValue(); + } - //先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. - Locale designerLocale = GeneralContext.getLocale(); - String file = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"); - char displayChar = file.charAt(0); - if (!guiFRFont.canDisplay(displayChar)) { - //如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器 - //默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog) - guiFRFont = getNamedFont("SimSun"); - if (!guiFRFont.canDisplay(displayChar)) { - //比如想在中文或英文系统里用韩文设计器 + /** + * 获取当前系统语言下设计器用的默认字体 + */ + private static final NotNullLazyValue CURRENT_LOCALE_FONT = new NotNullLazyValue() { + @NotNull + @Override + protected FRFont compute() { + FRFont guiFRFont; + Locale defaultLocale = Locale.getDefault(); + // JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体 + if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) { + guiFRFont = getNamedFont("Microsoft YaHei"); + } else if (isDisplaySimSun(defaultLocale)) { + guiFRFont = getNamedFont("SimSun"); + } else { guiFRFont = getNamedFont("Dialog"); + } + + String file = Toolkit.i18nText("Fine-Design_Basic_File"); + char displayChar = file.charAt(0); + if (!guiFRFont.canDisplay(displayChar)) { + //如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器 + //默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog) + guiFRFont = getNamedFont("SimSun"); if (!guiFRFont.canDisplay(displayChar)) { - FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); + //比如想在中文或英文系统里用韩文设计器 + guiFRFont = getNamedFont("Dialog"); + if (!guiFRFont.canDisplay(displayChar)) { + FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); + } } } - } - return guiFRFont; - } + return guiFRFont; + } + }; private static FRFont getNamedFont(String name) { return FRFont.getInstance(name, Font.PLAIN, 12); From c8059e3b01704e56723e2e753670853e20a604f6 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Oct 2020 09:42:28 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-41479=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=95=8C=E9=9D=A2=E5=AE=BD=E5=BA=A6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/parameter/FormParaDesigner.java | 24 +++++++++++++++++++ .../mainframe/EditingMouseListener.java | 11 +-------- .../com/fr/design/mainframe/FormDesigner.java | 9 +++++++ .../fr/design/mainframe/FormDesignerUI.java | 15 +++++++----- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 8956125eb..8d13f3ab4 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -30,6 +30,7 @@ import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesignerModeForSpecial; +import com.fr.design.mainframe.FormDesignerUI; import com.fr.design.mainframe.FormParaPane; import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.JTemplate; @@ -58,6 +59,7 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; +import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -467,6 +469,21 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return ((FormParameterUI) getTarget()).getDesignSize(); } + /** + * 设置其UI类为DesignerUI,负责渲染 + */ + @Override + public void updateUI() { + setUI(new FormDesignerUI(){ + @Override + protected Rectangle getFitPaintBounds(Component component, Component parent) { + return new Rectangle(0, 0, parent.getSize().width, parent.getSize().height); + } + + }); + } + + /** * 设置高度 * @@ -722,4 +739,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new FormDeleteAction(this).createToolBarComponent()}; } + + @Override + public boolean checkIfBeyondValidArea(MouseEvent e){ + return false; + } + + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 21b210a3b..524dd8bf1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter { // 获取焦点,以便获取热键 designer.requestFocus(); } - if (e.getButton() == MouseEvent.BUTTON1 && !beyondValidArea(e)) { + if (e.getButton() == MouseEvent.BUTTON1 && !designer.checkIfBeyondValidArea(e)) { Direction dir = selectionModel.getDirectionAt(e); if (!DesignerMode.isAuthorityEditing()) { @@ -194,15 +194,6 @@ public class EditingMouseListener extends MouseInputAdapter { e.translatePoint(oldX - e.getX(), oldY - e.getY()); } - private boolean beyondValidArea(MouseEvent e) { - if (e.getX() < 0 || e.getY() < 0 || - e.getX() > designer.getRootComponent().getWidth() || - e.getY() > (designer.getRootComponent().getHeight() + designer.getParaHeight())) { - return true; - } - return false; - } - private void offsetEventPoint(MouseEvent e){ int x = designer.getRelativeX(e.getX()); int y = designer.getRelativeY(e.getY()); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index a80032ed6..62c89b9ca 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1733,4 +1733,13 @@ public class FormDesigner extends TargetComponent
implements TreeSelection return (int) (this.getArea().getVerticalValue() / this.scale); } + public boolean checkIfBeyondValidArea(MouseEvent e){ + if (e.getX() < 0 || e.getY() < 0 || + e.getX() > this.getRootComponent().getWidth() || + e.getY() > (this.getRootComponent().getHeight() + this.getParaHeight())) { + return true; + } + return false; + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 233ee2a96..a21a2efad 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -424,12 +424,8 @@ public class FormDesignerUI extends ComponentUI { // 禁止双缓冲 ComponentUtils.disableBuffer(component, dbcomponents); Graphics clipg; - clipg = g.create( - -designer.getHorizontalScaleValue(), - -designer.getVerticalScaleValue() + designer.getParaHeight(), - component.getSize().width + designer.getHorizontalScaleValue(), - component.getSize().height + designer.getVerticalScaleValue()); - + Rectangle clipgBounds = getFitPaintBounds(component, parent); + clipg = g.create(clipgBounds.x, clipgBounds.y, clipgBounds.width, clipgBounds.height); designer.paintContent(clipg); paintWatermark((Graphics2D) clipg); clipg.dispose(); @@ -439,6 +435,13 @@ public class FormDesignerUI extends ComponentUI { designer.resetEditorComponentBounds(); } + protected Rectangle getFitPaintBounds(Component component, Component parent) { + return new Rectangle(-designer.getHorizontalScaleValue(), + -designer.getVerticalScaleValue() + designer.getParaHeight(), + component.getSize().width + designer.getHorizontalScaleValue(), + component.getSize().height + designer.getVerticalScaleValue()); + } + /** * 画参数面板 */