From 777f4550eb19a1acd894ac824d460b7ea8410a28 Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Thu, 30 Dec 2021 10:25:39 +0800 Subject: [PATCH 01/79] =?UTF-8?q?REPORT-65090:body=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=BD=9C=E4=B8=BAObject=E6=B7=BB=E5=8A=A0=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E9=97=AE=E9=A2=98=EF=BC=8Cbuilder?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E5=AF=B9body=E7=9A=84=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E4=B8=8D=E8=83=BD=E5=BA=94=E5=AF=B9=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=9A=84=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/report/ReportEngineAttrAction.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java index 8e958f536..8bac8dac7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java @@ -74,12 +74,8 @@ public class ReportEngineAttrAction extends ReportComponentAction Date: Wed, 23 Mar 2022 20:05:30 +0800 Subject: [PATCH 02/79] =?UTF-8?q?REPORT-66853=20=E8=80=81=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8-=E6=B2=A1=E6=9C=89=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=9B=BE=E7=89=87=E5=8E=8B=E7=BC=A9=EF=BC=8C=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E8=AE=BE=E7=BD=AE=E5=9B=BE=E7=89=87=E4=B8=BB?= =?UTF-8?q?=E4=BD=93=E5=A1=AB=E5=85=85=EF=BC=8Cweb=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=97=B6=E5=9B=BE=E7=89=87=E4=BC=9A=E6=A8=A1=E7=B3=8A=201?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E4=BA=86jpg=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E7=9A=84=E5=AD=98=E5=82=A8=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=8E=9F=E6=96=87=E4=BB=B6=E7=9B=B4=E6=8E=A5=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java index 19823d8b4..1f8475869 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java @@ -105,7 +105,7 @@ public class ImgChooseWrapper { } else { BufferedImage image = BaseUtils.readImage(selectedFile.getPath()); String type = ImageUtils.getImageType(selectedFile); - imageWithSuffix = new ImageWithSuffix(image, type); + imageWithSuffix = new ImageWithSuffix(image, type, selectedFile.getPath()); } CoreGraphHelper.waitForImage(imageWithSuffix); From dfcb34be713768944c8f934d96fecd6f7bd5f0ae Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Fri, 25 Mar 2022 17:01:51 +0800 Subject: [PATCH 03/79] =?UTF-8?q?KERNEL-10650:=E6=A8=A1=E6=9D=BF=E5=B9=B6?= =?UTF-8?q?=E8=A1=8C=E5=BC=80=E5=85=B3=E9=9D=A2=E6=9D=BF=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormParallelAction.java | 87 +++++++ .../java/com/fr/design/mainframe/JForm.java | 5 +- .../ui/designer/FormParallelSettingPane.java | 232 ++++++++++++++++++ 3 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java diff --git a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java new file mode 100644 index 000000000..9011a5d15 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java @@ -0,0 +1,87 @@ +package com.fr.design.actions; + +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JForm; +import com.fr.design.menu.MenuKeySet; +import com.fr.design.widget.ui.designer.FormParallelSettingPane; +import com.fr.form.main.Form; +import com.fr.form.main.parallel.FormParallelAttr; + +import javax.swing.KeyStroke; +import java.awt.Dimension; +import java.awt.event.ActionEvent; + +/** + * @author fly.li + * @version 10.0 + * Created on 2022/03/18 + */ +public class FormParallelAction extends JTemplateAction { + + private static final MenuKeySet FORM_PARALLEL_SETTING = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'P'; + } + + @Override + public String getMenuName() { + //todo 国际化 + return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + + private void initMenuStyle() { + this.setMenuKeySet(FORM_PARALLEL_SETTING); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon("com/fr/design/form/images/parallel.png"); + } + + public FormParallelAction(JForm jForm) { + super(jForm); + initMenuStyle(); + } + + @Override + public void actionPerformed(ActionEvent e) { + final JForm jf = getEditingComponent(); + if (jf == null) { + return; + } + showParallelSettingDialog(jf); + } + + private void showParallelSettingDialog(JForm jf) { + FormParallelSettingPane attrPane = new FormParallelSettingPane(); + Form form = jf.getTarget(); + FormParallelAttr parallelAttr = form.getParallelAttr(); + //兼容之前的frm文件,在获取不到属性时 + if (parallelAttr == null){ + parallelAttr = FormParallelAttr.getDefaultParallelAttr(); + } + attrPane.populateBean(parallelAttr); + //注意这里的pane大小 + UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + fireEditingOk(jf, form, attrPane.updateBean()); + } + }, new Dimension(600, 600)); + dialog.setVisible(true); + } + + private void fireEditingOk(JForm jForm, Form form, FormParallelAttr parallelAttr){ + form.setParallelAttr(parallelAttr); + jForm.fireTargetModified(); + } +} 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 449aa5190..0848244db 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 @@ -15,6 +15,7 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.FormMobileAttrAction; +import com.fr.design.actions.FormParallelAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; @@ -588,9 +589,9 @@ public class JForm extends JTemplate implements BaseJForm { + private AbstractParallelSettingPane calculatePane; + private AbstractParallelSettingPane fetchDataPane; + public FormParallelSettingPane(){ + initPane(); + } + + private void initPane(){ + JPanel calSettingPane = FRGUIPaneFactory.createTitledBorderPane("报表块并行计算设置"); + calSettingPane.add(getCalculateSettingPane()); + calSettingPane.setPreferredSize(new Dimension(550,110)); + this.add(calSettingPane); + JPanel fetchDataSettingPane = FRGUIPaneFactory.createTitledBorderPane("并行取数设置"); + fetchDataSettingPane.add(getFetchDataSettingPane()); + fetchDataSettingPane.setPreferredSize(new Dimension(550, 110)); + this.add(fetchDataSettingPane); + JPanel tip = new JPanel(); + tip.setLayout(new BorderLayout()); + tip.add(new JLabel("注意:在多报表块共用一个数据集并且开启报表块并行计算时,建议同时开启并行取数"), BorderLayout.WEST); + tip.setPreferredSize(new Dimension(500, 20)); + this.add(tip); + } + + private AbstractParallelSettingPane getCalculateSettingPane(){ + if (calculatePane == null){ + this.calculatePane = new AbstractParallelSettingPane("开启报表块并行计算") { + @Override + protected void populateServerSettings() { + //这里获取全局设置并刷新数据到面板 + parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelCal()); + } + }; + } + return calculatePane; + } + + private AbstractParallelSettingPane getFetchDataSettingPane(){ + if (fetchDataPane == null){ + this.fetchDataPane = new AbstractParallelSettingPane("开启并行取数") { + @Override + protected void populateServerSettings() { + parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelFetchData()); + } + }; + } + return fetchDataPane; + } + + @Override + public void populateBean(FormParallelAttr ob) { + getCalculateSettingPane().populateBean(ob.getParallelCalculateMark()); + getFetchDataSettingPane().populateBean(ob.getParallelFetchDataMark()); + } + + @Override + public FormParallelAttr updateBean() { + FormParallelAttr formParallelAttr = new FormParallelAttr(); + formParallelAttr.setParallelCalculateMark(calculatePane.updateBean()); + formParallelAttr.setParallelFetchDataMark(fetchDataPane.updateBean()); + return formParallelAttr; + } + + @Override + protected String title4PopupWindow() { + return "Form并行设置"; + } + + abstract static class AbstractParallelSettingPane extends BasicPane { + private static final String[] CHOOSEITEM = new String[] { + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") + }; + + protected static final int SINGLE_SET = 0; + protected static final int SERVER_SET = 1; + //提示文字标签 + UIComboBox combox; + //并行计算开关 + ParallelSwitchLabel parallelSwitchLabel; + + public AbstractParallelSettingPane(String tip){ + this.setLayout(new BorderLayout()); + JPanel comboxPane = new JPanel(); + UILabel belowSetLabel = new UILabel("设置方式"); + belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { + belowSetLabel, getCombox()}, FlowLayout.LEFT, 0, 0); + comboxPane.setLayout(new BorderLayout()); + comboxPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + this.add(buttonPane, BorderLayout.NORTH); + this.add(getContentPane(tip), BorderLayout.CENTER); + } + + protected JPanel getContentPane(String tip) { + return getSwitchPane(tip); + } + + public UIComboBox getCombox() { + if (combox == null){ + combox = new UIComboBox(CHOOSEITEM); + combox.setFont(new Font(null, 0, 11)); + combox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (combox.getSelectedIndex() == SERVER_SET) { + populateServerSettings(); + } + } + } + }); + } + return combox; + } + + /** + * 从服务器拿数据 + * */ + protected abstract void populateServerSettings(); + + private JPanel getSwitchPane(String tip){ + JPanel innerPane = new JPanel(); + innerPane.setLayout(new BorderLayout()); + innerPane.setPreferredSize(new Dimension(500, 30)); + innerPane.setBorder(BorderFactory.createEmptyBorder(5, 70, 5, 10)); + + JLabel label = new JLabel(tip); + label.setFont(new Font(null, 0, 12)); + innerPane.add(label, BorderLayout.WEST); + innerPane.add(getSwitchLabel(), BorderLayout.EAST); + return innerPane; + } + + private JLabel getSwitchLabel(){ + if (parallelSwitchLabel == null){ + parallelSwitchLabel = new ParallelSwitchLabel(); + parallelSwitchLabel.setSwitchState(false); + parallelSwitchLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (!isUsingServerSettings()){ + parallelSwitchLabel.changeSwitchState(); + } + } + }); + } + return parallelSwitchLabel; + } + + public void populateBean(ParallelAttrMark parallelAttrMark){ + combox.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? 1 : 0); + //只有在单模板设置时才需要在这里设置开关状态,服务器设置在setSelectedIndex的时候自动获取了服务器设置 + if (!parallelAttrMark.isUseServerSetting()){ + parallelSwitchLabel.setSwitchState(parallelAttrMark.isEnableParallel()); + } + } + + private boolean isUsingServerSettings(){ + return combox.getSelectedIndex() == SERVER_SET; + } + + public ParallelAttrMark updateBean(){ + return new ParallelAttrMark(isUsingServerSettings(), parallelSwitchLabel.isParallel()); + } + + @Override + protected String title4PopupWindow() { + return ""; + } + } + + /** + * 一个并行开关Label + * */ + private static class ParallelSwitchLabel extends JLabel{ + boolean parallel; + private final static Icon openIcon = IOUtils.readIcon("com/fr/design/form/images/open.png"); + private final static Icon closeIcon = IOUtils.readIcon("com/fr/design/form/images/close.png"); + //设置计算状态,parallel状态和图标一起变化 + public void setSwitchState(boolean parallel){ + this.parallel = parallel; + if (parallel){ + this.setIcon(openIcon); + }else { + this.setIcon(closeIcon); + } + } + + public void changeSwitchState(){ + parallel = !parallel; + setSwitchState(parallel); + } + + public boolean isParallel() { + return parallel; + } + } + +} From e4b08c5b8bee529d2f9471458ab185c146aedf82 Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Mon, 28 Mar 2022 20:45:02 +0800 Subject: [PATCH 04/79] =?UTF-8?q?KERNEL-10650:=E6=8A=A5=E8=A1=A8=E5=9D=97?= =?UTF-8?q?=E5=B9=B6=E8=A1=8C=E8=AE=A1=E7=AE=97=E5=8D=95=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormParallelAction.java | 4 +- .../ui/designer/FormParallelSettingPane.java | 99 +++++++------------ 2 files changed, 35 insertions(+), 68 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java index 9011a5d15..25a15ae41 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java @@ -29,8 +29,7 @@ public class FormParallelAction extends JTemplateAction { @Override public String getMenuName() { - //todo 国际化 - return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); + return Toolkit.i18nText("Fine-Designer_Parallel_Setting"); } @Override @@ -70,7 +69,6 @@ public class FormParallelAction extends JTemplateAction { parallelAttr = FormParallelAttr.getDefaultParallelAttr(); } attrPane.populateBean(parallelAttr); - //注意这里的pane大小 UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java index ff92e3738..2533e7145 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java @@ -4,8 +4,8 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.JForm; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.main.parallel.FormParallelAttr; import com.fr.form.main.parallel.ParallelAttrMark; @@ -32,76 +32,47 @@ import java.awt.event.MouseEvent; * Created on 2022/03/18 */ public class FormParallelSettingPane extends BasicBeanPane { - private AbstractParallelSettingPane calculatePane; - private AbstractParallelSettingPane fetchDataPane; + private ParallelSettingPane parallelCalculatePane; public FormParallelSettingPane(){ initPane(); } private void initPane(){ - JPanel calSettingPane = FRGUIPaneFactory.createTitledBorderPane("报表块并行计算设置"); + JPanel calSettingPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Setting")); calSettingPane.add(getCalculateSettingPane()); calSettingPane.setPreferredSize(new Dimension(550,110)); this.add(calSettingPane); - JPanel fetchDataSettingPane = FRGUIPaneFactory.createTitledBorderPane("并行取数设置"); - fetchDataSettingPane.add(getFetchDataSettingPane()); - fetchDataSettingPane.setPreferredSize(new Dimension(550, 110)); - this.add(fetchDataSettingPane); - JPanel tip = new JPanel(); - tip.setLayout(new BorderLayout()); - tip.add(new JLabel("注意:在多报表块共用一个数据集并且开启报表块并行计算时,建议同时开启并行取数"), BorderLayout.WEST); - tip.setPreferredSize(new Dimension(500, 20)); - this.add(tip); } - private AbstractParallelSettingPane getCalculateSettingPane(){ - if (calculatePane == null){ - this.calculatePane = new AbstractParallelSettingPane("开启报表块并行计算") { - @Override - protected void populateServerSettings() { - //这里获取全局设置并刷新数据到面板 - parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelCal()); - } - }; + private ParallelSettingPane getCalculateSettingPane(){ + if (parallelCalculatePane == null){ + this.parallelCalculatePane = new ParallelSettingPane(); } - return calculatePane; + return parallelCalculatePane; } - private AbstractParallelSettingPane getFetchDataSettingPane(){ - if (fetchDataPane == null){ - this.fetchDataPane = new AbstractParallelSettingPane("开启并行取数") { - @Override - protected void populateServerSettings() { - parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelFetchData()); - } - }; - } - return fetchDataPane; - } @Override public void populateBean(FormParallelAttr ob) { getCalculateSettingPane().populateBean(ob.getParallelCalculateMark()); - getFetchDataSettingPane().populateBean(ob.getParallelFetchDataMark()); } @Override public FormParallelAttr updateBean() { FormParallelAttr formParallelAttr = new FormParallelAttr(); - formParallelAttr.setParallelCalculateMark(calculatePane.updateBean()); - formParallelAttr.setParallelFetchDataMark(fetchDataPane.updateBean()); + formParallelAttr.setParallelCalculateMark(parallelCalculatePane.updateBean()); return formParallelAttr; } @Override protected String title4PopupWindow() { - return "Form并行设置"; + return Toolkit.i18nText("Fine-Designer_Parallel_Setting"); } - abstract static class AbstractParallelSettingPane extends BasicPane { + static class ParallelSettingPane extends BasicPane { private static final String[] CHOOSEITEM = new String[] { - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") + Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") }; protected static final int SINGLE_SET = 0; @@ -111,24 +82,20 @@ public class FormParallelSettingPane extends BasicBeanPane { //并行计算开关 ParallelSwitchLabel parallelSwitchLabel; - public AbstractParallelSettingPane(String tip){ + public ParallelSettingPane(){ this.setLayout(new BorderLayout()); JPanel comboxPane = new JPanel(); - UILabel belowSetLabel = new UILabel("设置方式"); + comboxPane.setLayout(new BorderLayout()); + comboxPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + UILabel belowSetLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Setting_Mode")); belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { belowSetLabel, getCombox()}, FlowLayout.LEFT, 0, 0); - comboxPane.setLayout(new BorderLayout()); - comboxPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); this.add(buttonPane, BorderLayout.NORTH); - this.add(getContentPane(tip), BorderLayout.CENTER); - } - - protected JPanel getContentPane(String tip) { - return getSwitchPane(tip); + this.add(getSwitchPane(Toolkit.i18nText("Fine-Designer_Enable_Form_Block_Parallel_Calculate")), BorderLayout.CENTER); } - public UIComboBox getCombox() { + private UIComboBox getCombox() { if (combox == null){ combox = new UIComboBox(CHOOSEITEM); combox.setFont(new Font(null, 0, 11)); @@ -146,17 +113,11 @@ public class FormParallelSettingPane extends BasicBeanPane { return combox; } - /** - * 从服务器拿数据 - * */ - protected abstract void populateServerSettings(); - private JPanel getSwitchPane(String tip){ JPanel innerPane = new JPanel(); innerPane.setLayout(new BorderLayout()); innerPane.setPreferredSize(new Dimension(500, 30)); innerPane.setBorder(BorderFactory.createEmptyBorder(5, 70, 5, 10)); - JLabel label = new JLabel(tip); label.setFont(new Font(null, 0, 12)); innerPane.add(label, BorderLayout.WEST); @@ -167,7 +128,7 @@ public class FormParallelSettingPane extends BasicBeanPane { private JLabel getSwitchLabel(){ if (parallelSwitchLabel == null){ parallelSwitchLabel = new ParallelSwitchLabel(); - parallelSwitchLabel.setSwitchState(false); + combox.setSelectedIndex(SERVER_SET); parallelSwitchLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -180,16 +141,25 @@ public class FormParallelSettingPane extends BasicBeanPane { return parallelSwitchLabel; } + private boolean isUsingServerSettings(){ + return combox.getSelectedIndex() == SERVER_SET; + } + public void populateBean(ParallelAttrMark parallelAttrMark){ - combox.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? 1 : 0); - //只有在单模板设置时才需要在这里设置开关状态,服务器设置在setSelectedIndex的时候自动获取了服务器设置 - if (!parallelAttrMark.isUseServerSetting()){ - parallelSwitchLabel.setSwitchState(parallelAttrMark.isEnableParallel()); + combox.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? SERVER_SET : SINGLE_SET); + if (parallelAttrMark.isUseServerSetting()){ + populateServerSettings(); + } else { + populateSingleTemplateSetting(parallelAttrMark); } } - private boolean isUsingServerSettings(){ - return combox.getSelectedIndex() == SERVER_SET; + private void populateServerSettings(){ + parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelCal()); + } + + private void populateSingleTemplateSetting(ParallelAttrMark parallelAttrMark){ + parallelSwitchLabel.setSwitchState(parallelAttrMark.isEnableParallel()); } public ParallelAttrMark updateBean(){ @@ -223,7 +193,6 @@ public class FormParallelSettingPane extends BasicBeanPane { parallel = !parallel; setSwitchState(parallel); } - public boolean isParallel() { return parallel; } From c98346ecd5e88f7e86a1b11a1ae0c1221df51137 Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Tue, 29 Mar 2022 09:46:07 +0800 Subject: [PATCH 05/79] =?UTF-8?q?KERNEL-10650:=E6=8A=A5=E8=A1=A8=E5=9D=97?= =?UTF-8?q?=E5=B9=B6=E8=A1=8C=E8=AE=A1=E7=AE=97=E5=8D=95=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=BC=80=E5=85=B3-=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/design/form/images/close.png | Bin 0 -> 525 bytes .../resources/com/fr/design/form/images/open.png | Bin 0 -> 628 bytes .../com/fr/design/form/images/parallel.png | Bin 0 -> 158 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/close.png create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/open.png create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/parallel.png diff --git a/designer-form/src/main/resources/com/fr/design/form/images/close.png b/designer-form/src/main/resources/com/fr/design/form/images/close.png new file mode 100644 index 0000000000000000000000000000000000000000..b33957c5b35e90f2f8c87fe6625d94383a577b3e GIT binary patch literal 525 zcmV+o0`mQdP)Px$$4Nv%R9HvtRxxW-K@k3Cc|{5h#4d_h1j~cOkO+dkwh>EP!K6FbxvMlO64=?} zic=6P8;O-*m4A@RKq4eyZIM)3q{_kFPI%$&xEx7fILJ2l;C1tT^Sy7sH#>yP4`uF; ziGYa%H#*R4Ht%)2-T9Q#0)V@gz&htniD=I`cUY}f|6hl_Qb3GRRP_xJ{Z`fT-6f)j z0G>3EhigT`_s&^~_9cv}CG#a;dvX)OA$nL;7?G*Px%E=fc|R9HvtR=;Z$K@|Spxee>ST zdqc>1QO^448R%tT#SDzk#QilgMu^x^%(l*fHHf|g>Rny+J&7hZ%`eCOrvXnS=b3Q? zgq=E~0N#M;1v4H4{Luh*131jU5I}cjV4Y}>*J5CC#|CBqa`l914urGPx9%^;^TOl~ zGxnK^N1ja-78oO>uSqpDed>b@Tf2gRoKl1xOWSph}SEO?Q z53VIp1H+8j=S5q$OvtokU~O$0a7*zG5S`Ky&#;QIBP!ajb$M=>PD82nvRF7xZkQef z^F7@lAe@uFeN~(Hhv16zB?y#8#6Jyt->X7{wVGHdL+LQ3(KwWMDbn81TZcN14^Jjt`-!cwlKq(>3FW_$D!Z>EasF)Jm;)HAAjQ zUJ>ZhVkhjZ5z)L+`?J zg8w><)~Tsz@8-8H2C|P_$8l?y%IQJUUdY^@WLhVxOK|U5-pfGl8TbuEHvbcl7d#OF O0000B{B)$PFwlb+P892IG2WDs8=DEM9R%x$0@44$rjF6*2U FngGErHpc(} literal 0 HcmV?d00001 From 5e91a695f3831c2f0aac6932fab0465da3137fee Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Tue, 29 Mar 2022 10:07:09 +0800 Subject: [PATCH 06/79] =?UTF-8?q?KERNEL-10650:=E4=BF=AE=E6=94=B9=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E5=8E=9F=E6=9C=89frm=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE=EF=BC=8C=E4=BB=8EFormParallelAction?= =?UTF-8?q?=E4=B8=AD=E6=94=BE=E5=88=B0FormParallelSettingPane=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormParallelAction.java | 4 ---- .../ui/designer/FormParallelSettingPane.java | 16 ++++++---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java index 25a15ae41..914823af9 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java @@ -64,10 +64,6 @@ public class FormParallelAction extends JTemplateAction { FormParallelSettingPane attrPane = new FormParallelSettingPane(); Form form = jf.getTarget(); FormParallelAttr parallelAttr = form.getParallelAttr(); - //兼容之前的frm文件,在获取不到属性时 - if (parallelAttr == null){ - parallelAttr = FormParallelAttr.getDefaultParallelAttr(); - } attrPane.populateBean(parallelAttr); UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java index 2533e7145..b7ad9cff5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java @@ -39,22 +39,18 @@ public class FormParallelSettingPane extends BasicBeanPane { private void initPane(){ JPanel calSettingPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Setting")); - calSettingPane.add(getCalculateSettingPane()); + this.parallelCalculatePane = new ParallelSettingPane(); + calSettingPane.add(parallelCalculatePane); calSettingPane.setPreferredSize(new Dimension(550,110)); this.add(calSettingPane); } - private ParallelSettingPane getCalculateSettingPane(){ - if (parallelCalculatePane == null){ - this.parallelCalculatePane = new ParallelSettingPane(); - } - return parallelCalculatePane; - } - - @Override public void populateBean(FormParallelAttr ob) { - getCalculateSettingPane().populateBean(ob.getParallelCalculateMark()); + if (ob == null){ + ob = FormParallelAttr.getDefaultParallelAttr(); + } + parallelCalculatePane.populateBean(ob.getParallelCalculateMark()); } @Override From 2a77a7fe5c0e1d31f7309798d7cf7156ea3c4893 Mon Sep 17 00:00:00 2001 From: "Fly.Li" Date: Wed, 6 Apr 2022 16:18:18 +0800 Subject: [PATCH 07/79] =?UTF-8?q?KERNEL-10650:=E5=88=A0=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84=E9=9D=99=E6=80=81=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/com/fr/design/form/images/close.png | Bin 525 -> 0 bytes .../resources/com/fr/design/form/images/open.png | Bin 628 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 designer-form/src/main/resources/com/fr/design/form/images/close.png delete mode 100644 designer-form/src/main/resources/com/fr/design/form/images/open.png diff --git a/designer-form/src/main/resources/com/fr/design/form/images/close.png b/designer-form/src/main/resources/com/fr/design/form/images/close.png deleted file mode 100644 index b33957c5b35e90f2f8c87fe6625d94383a577b3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 525 zcmV+o0`mQdP)Px$$4Nv%R9HvtRxxW-K@k3Cc|{5h#4d_h1j~cOkO+dkwh>EP!K6FbxvMlO64=?} zic=6P8;O-*m4A@RKq4eyZIM)3q{_kFPI%$&xEx7fILJ2l;C1tT^Sy7sH#>yP4`uF; ziGYa%H#*R4Ht%)2-T9Q#0)V@gz&htniD=I`cUY}f|6hl_Qb3GRRP_xJ{Z`fT-6f)j z0G>3EhigT`_s&^~_9cv}CG#a;dvX)OA$nL;7?G*Px%E=fc|R9HvtR=;Z$K@|Spxee>ST zdqc>1QO^448R%tT#SDzk#QilgMu^x^%(l*fHHf|g>Rny+J&7hZ%`eCOrvXnS=b3Q? zgq=E~0N#M;1v4H4{Luh*131jU5I}cjV4Y}>*J5CC#|CBqa`l914urGPx9%^;^TOl~ zGxnK^N1ja-78oO>uSqpDed>b@Tf2gRoKl1xOWSph}SEO?Q z53VIp1H+8j=S5q$OvtokU~O$0a7*zG5S`Ky&#;QIBP!ajb$M=>PD82nvRF7xZkQef z^F7@lAe@uFeN~(Hhv16zB?y#8#6Jyt->X7{wVGHdL+LQ3(KwWMDbn81TZcN14^Jjt`-!cwlKq(>3FW_$D!Z>EasF)Jm;)HAAjQ zUJ>ZhVkhjZ5z)L+`?J zg8w><)~Tsz@8-8H2C|P_$8l?y%IQJUUdY^@WLhVxOK|U5-pfGl8TbuEHvbcl7d#OF O0000 Date: Wed, 6 Apr 2022 16:33:23 +0800 Subject: [PATCH 08/79] =?UTF-8?q?KERNEL-10650:=E6=94=B9=E5=8F=98=E5=B9=B6?= =?UTF-8?q?=E8=A1=8C=E8=AE=A1=E7=AE=97=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=EF=BC=8C=E8=B7=9F=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/FormParallelSettingPane.java | 102 +++++------------- 1 file changed, 28 insertions(+), 74 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java index b7ad9cff5..3db2b4ed3 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java @@ -2,6 +2,7 @@ package com.fr.design.widget.ui.designer; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -9,22 +10,16 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.main.parallel.FormParallelAttr; import com.fr.form.main.parallel.ParallelAttrMark; -import com.fr.general.IOUtils; import com.fr.report.core.config.FormParallelCalConfig; import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JLabel; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; /** * @author fly.li @@ -66,83 +61,69 @@ public class FormParallelSettingPane extends BasicBeanPane { } static class ParallelSettingPane extends BasicPane { - private static final String[] CHOOSEITEM = new String[] { + private static final String[] CHOOSE_ITEM = new String[] { Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") }; - protected static final int SINGLE_SET = 0; protected static final int SERVER_SET = 1; - //提示文字标签 - UIComboBox combox; + //并行设置范围的下拉框(服务器设置还是模板设置) + UIComboBox parallelSettingScope; //并行计算开关 - ParallelSwitchLabel parallelSwitchLabel; + UICheckBox parallelSwitch; public ParallelSettingPane(){ this.setLayout(new BorderLayout()); - JPanel comboxPane = new JPanel(); - comboxPane.setLayout(new BorderLayout()); - comboxPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); UILabel belowSetLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Setting_Mode")); belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[] { - belowSetLabel, getCombox()}, FlowLayout.LEFT, 0, 0); - this.add(buttonPane, BorderLayout.NORTH); + JPanel parallelSettingScopePane = GUICoreUtils.createFlowPane(new Component[] { + belowSetLabel, getParallelSettingScope()}, FlowLayout.LEFT, 0, 0); + this.add(parallelSettingScopePane, BorderLayout.NORTH); this.add(getSwitchPane(Toolkit.i18nText("Fine-Designer_Enable_Form_Block_Parallel_Calculate")), BorderLayout.CENTER); } - private UIComboBox getCombox() { - if (combox == null){ - combox = new UIComboBox(CHOOSEITEM); - combox.setFont(new Font(null, 0, 11)); - combox.addItemListener(new ItemListener() { + private UIComboBox getParallelSettingScope() { + if (parallelSettingScope == null){ + parallelSettingScope = new UIComboBox(CHOOSE_ITEM); + parallelSettingScope.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - if (combox.getSelectedIndex() == SERVER_SET) { + if (isUsingServerSettings()) { populateServerSettings(); + parallelSwitch.setEnabled(false); + } else { + parallelSwitch.setEnabled(true); } } } }); } - return combox; + return parallelSettingScope; } private JPanel getSwitchPane(String tip){ JPanel innerPane = new JPanel(); innerPane.setLayout(new BorderLayout()); innerPane.setPreferredSize(new Dimension(500, 30)); - innerPane.setBorder(BorderFactory.createEmptyBorder(5, 70, 5, 10)); - JLabel label = new JLabel(tip); - label.setFont(new Font(null, 0, 12)); - innerPane.add(label, BorderLayout.WEST); - innerPane.add(getSwitchLabel(), BorderLayout.EAST); + innerPane.setBorder(BorderFactory.createEmptyBorder(10, 70, 5, 10)); + innerPane.add(getSwitchBox(tip)); return innerPane; } - private JLabel getSwitchLabel(){ - if (parallelSwitchLabel == null){ - parallelSwitchLabel = new ParallelSwitchLabel(); - combox.setSelectedIndex(SERVER_SET); - parallelSwitchLabel.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if (!isUsingServerSettings()){ - parallelSwitchLabel.changeSwitchState(); - } - } - }); + private UICheckBox getSwitchBox(String tip){ + if (parallelSwitch == null){ + parallelSwitch = new UICheckBox(tip); } - return parallelSwitchLabel; + return parallelSwitch; } private boolean isUsingServerSettings(){ - return combox.getSelectedIndex() == SERVER_SET; + return parallelSettingScope.getSelectedIndex() == SERVER_SET; } public void populateBean(ParallelAttrMark parallelAttrMark){ - combox.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? SERVER_SET : SINGLE_SET); + parallelSettingScope.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? SERVER_SET : SINGLE_SET); if (parallelAttrMark.isUseServerSetting()){ populateServerSettings(); } else { @@ -151,15 +132,15 @@ public class FormParallelSettingPane extends BasicBeanPane { } private void populateServerSettings(){ - parallelSwitchLabel.setSwitchState(FormParallelCalConfig.getInstance().isParallelCal()); + parallelSwitch.setSelected(FormParallelCalConfig.getInstance().isParallelCal()); } private void populateSingleTemplateSetting(ParallelAttrMark parallelAttrMark){ - parallelSwitchLabel.setSwitchState(parallelAttrMark.isEnableParallel()); + parallelSwitch.setSelected(parallelAttrMark.isEnableParallel()); } public ParallelAttrMark updateBean(){ - return new ParallelAttrMark(isUsingServerSettings(), parallelSwitchLabel.isParallel()); + return new ParallelAttrMark(isUsingServerSettings(), parallelSwitch.isSelected()); } @Override @@ -167,31 +148,4 @@ public class FormParallelSettingPane extends BasicBeanPane { return ""; } } - - /** - * 一个并行开关Label - * */ - private static class ParallelSwitchLabel extends JLabel{ - boolean parallel; - private final static Icon openIcon = IOUtils.readIcon("com/fr/design/form/images/open.png"); - private final static Icon closeIcon = IOUtils.readIcon("com/fr/design/form/images/close.png"); - //设置计算状态,parallel状态和图标一起变化 - public void setSwitchState(boolean parallel){ - this.parallel = parallel; - if (parallel){ - this.setIcon(openIcon); - }else { - this.setIcon(closeIcon); - } - } - - public void changeSwitchState(){ - parallel = !parallel; - setSwitchState(parallel); - } - public boolean isParallel() { - return parallel; - } - } - } From 314b0cb4d798f914fd6c2b50ef3b6f24e54047ea Mon Sep 17 00:00:00 2001 From: "Fly.Li" Date: Wed, 6 Apr 2022 19:16:37 +0800 Subject: [PATCH 09/79] =?UTF-8?q?KERNEL-10650:=E6=94=B9=E5=8F=98=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E9=9D=A2=E6=9D=BF=E7=B1=BB=E5=90=8D=E3=80=81=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=B1=BB=E5=AF=B9=E5=BA=94=E7=9A=84action=E7=B1=BB?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E6=94=B9=E5=8F=98=E4=B8=80=E4=B8=8B=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=B1=BB=E7=9A=84=E7=BB=93=E6=9E=84=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=8E=9F=E6=9C=89=E7=9A=84=E5=B9=B6=E8=A1=8C=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=AD=90=E9=9D=A2=E6=9D=BF=E7=B1=BB=EF=BC=88=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E5=87=BA=E7=8E=B0=E5=85=B6=E4=BB=96=E5=B9=B6=E8=A1=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=86=8D=E9=87=8D=E6=96=B0=E5=A4=84?= =?UTF-8?q?=E7=90=86=E8=BF=99=E9=87=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tion.java => FormECParallelCalAction.java} | 14 +- .../java/com/fr/design/mainframe/JForm.java | 6 +- .../FormECParallelCalSettingPane.java | 131 ++++++++++++++++++ 3 files changed, 141 insertions(+), 10 deletions(-) rename designer-form/src/main/java/com/fr/design/actions/{FormParallelAction.java => FormECParallelCalAction.java} (80%) create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java diff --git a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java b/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java similarity index 80% rename from designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java rename to designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java index 914823af9..48f8cc2c6 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormParallelAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java @@ -6,9 +6,9 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.menu.MenuKeySet; -import com.fr.design.widget.ui.designer.FormParallelSettingPane; +import com.fr.design.widget.ui.designer.FormECParallelCalSettingPane; import com.fr.form.main.Form; -import com.fr.form.main.parallel.FormParallelAttr; +import com.fr.form.main.parallel.FormECParallelCalAttr; import javax.swing.KeyStroke; import java.awt.Dimension; @@ -19,7 +19,7 @@ import java.awt.event.ActionEvent; * @version 10.0 * Created on 2022/03/18 */ -public class FormParallelAction extends JTemplateAction { +public class FormECParallelCalAction extends JTemplateAction { private static final MenuKeySet FORM_PARALLEL_SETTING = new MenuKeySet() { @Override @@ -46,7 +46,7 @@ public class FormParallelAction extends JTemplateAction { this.setSmallIcon("com/fr/design/form/images/parallel.png"); } - public FormParallelAction(JForm jForm) { + public FormECParallelCalAction(JForm jForm) { super(jForm); initMenuStyle(); } @@ -61,9 +61,9 @@ public class FormParallelAction extends JTemplateAction { } private void showParallelSettingDialog(JForm jf) { - FormParallelSettingPane attrPane = new FormParallelSettingPane(); + FormECParallelCalSettingPane attrPane = new FormECParallelCalSettingPane(); Form form = jf.getTarget(); - FormParallelAttr parallelAttr = form.getParallelAttr(); + FormECParallelCalAttr parallelAttr = form.getParallelAttr(); attrPane.populateBean(parallelAttr); UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override @@ -74,7 +74,7 @@ public class FormParallelAction extends JTemplateAction { dialog.setVisible(true); } - private void fireEditingOk(JForm jForm, Form form, FormParallelAttr parallelAttr){ + private void fireEditingOk(JForm jForm, Form form, FormECParallelCalAttr parallelAttr){ form.setParallelAttr(parallelAttr); jForm.fireTargetModified(); } 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 0848244db..493a7fa74 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 @@ -15,7 +15,7 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.FormMobileAttrAction; -import com.fr.design.actions.FormParallelAction; +import com.fr.design.actions.FormECParallelCalAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; @@ -589,9 +589,9 @@ public class JForm extends JTemplate implements BaseJForm { + private static final String[] CHOOSE_ITEM = new String[] { + Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") + }; + protected static final int SINGLE_SET = 0; + protected static final int SERVER_SET = 1; + //并行设置范围的下拉框(服务器设置还是模板设置) + UIComboBox parallelSettingScope; + //并行计算开关 + UICheckBox parallelSwitch; + + public FormECParallelCalSettingPane(){ + initPane(); + } + + private void initPane(){ + JPanel calSettingOutPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Calculate")); + calSettingOutPane.setPreferredSize(new Dimension(550,110)); + calSettingOutPane.add(getCalSettingPane()); + this.add(calSettingOutPane); + } + + private JPanel getCalSettingPane() { + JPanel calSettingPane = new JPanel(); + calSettingPane.setLayout(new BorderLayout()); + UILabel belowSetLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Setting_Mode")); + belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); + JPanel parallelSettingScopePane = GUICoreUtils.createFlowPane(new Component[] { + belowSetLabel, getParallelSettingScope()}, FlowLayout.LEFT, 0, 0); + calSettingPane.add(parallelSettingScopePane, BorderLayout.NORTH); + calSettingPane.add(getSwitchPane(Toolkit.i18nText("Fine-Designer_Enable_Form_Block_Parallel_Calculate")), BorderLayout.CENTER); + return calSettingPane; + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Calculate"); + } + + private UIComboBox getParallelSettingScope() { + if (this.parallelSettingScope == null){ + parallelSettingScope = new UIComboBox(CHOOSE_ITEM); + parallelSettingScope.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if (isUsingServerSettings()) { + populateServerSettings(); + parallelSwitch.setEnabled(false); + } else { + parallelSwitch.setEnabled(true); + } + } + } + }); + } + return this.parallelSettingScope; + } + + private JPanel getSwitchPane(String tip){ + JPanel innerPane = new JPanel(); + innerPane.setLayout(new BorderLayout()); + innerPane.setPreferredSize(new Dimension(500, 30)); + innerPane.setBorder(BorderFactory.createEmptyBorder(10, 70, 5, 10)); + innerPane.add(getParallelSwitch(tip)); + return innerPane; + } + + private UICheckBox getParallelSwitch(String tip){ + if (parallelSwitch == null){ + parallelSwitch = new UICheckBox(tip); + } + return parallelSwitch; + } + + private boolean isUsingServerSettings(){ + return parallelSettingScope.getSelectedIndex() == SERVER_SET; + } + + @Override + public void populateBean(FormECParallelCalAttr formParallelAttr){ + if (formParallelAttr == null){ + formParallelAttr = FormECParallelCalAttr.getDefaultParallelAttr(); + } + parallelSettingScope.setSelectedIndex(formParallelAttr.isUseServerSetting() ? SERVER_SET : SINGLE_SET); + if (formParallelAttr.isUseServerSetting()){ + populateServerSettings(); + } else { + populateSingleTemplateSetting(formParallelAttr); + } + } + + private void populateServerSettings(){ + parallelSwitch.setSelected(FormParallelCalConfig.getInstance().isParallelCal()); + } + + private void populateSingleTemplateSetting(FormECParallelCalAttr parallelAttr){ + parallelSwitch.setSelected(parallelAttr.isParallelCal()); + } + + public FormECParallelCalAttr updateBean(){ + return new FormECParallelCalAttr(isUsingServerSettings(), parallelSwitch.isSelected()); + } +} From e15faf79b3dc11388c6512a3343d52cfab147b24 Mon Sep 17 00:00:00 2001 From: "Fly.Li" Date: Wed, 6 Apr 2022 19:17:24 +0800 Subject: [PATCH 10/79] =?UTF-8?q?KERNEL-10650:=E7=B1=BB=E5=90=8D=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E5=90=8E=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/FormParallelSettingPane.java | 151 ------------------ 1 file changed, 151 deletions(-) delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java deleted file mode 100644 index 3db2b4ed3..000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormParallelSettingPane.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.fr.design.widget.ui.designer; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.form.main.parallel.FormParallelAttr; -import com.fr.form.main.parallel.ParallelAttrMark; -import com.fr.report.core.config.FormParallelCalConfig; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -/** - * @author fly.li - * @version 10.0 - * Created on 2022/03/18 - */ -public class FormParallelSettingPane extends BasicBeanPane { - private ParallelSettingPane parallelCalculatePane; - public FormParallelSettingPane(){ - initPane(); - } - - private void initPane(){ - JPanel calSettingPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Designer_Form_Block_Parallel_Setting")); - this.parallelCalculatePane = new ParallelSettingPane(); - calSettingPane.add(parallelCalculatePane); - calSettingPane.setPreferredSize(new Dimension(550,110)); - this.add(calSettingPane); - } - - @Override - public void populateBean(FormParallelAttr ob) { - if (ob == null){ - ob = FormParallelAttr.getDefaultParallelAttr(); - } - parallelCalculatePane.populateBean(ob.getParallelCalculateMark()); - } - - @Override - public FormParallelAttr updateBean() { - FormParallelAttr formParallelAttr = new FormParallelAttr(); - formParallelAttr.setParallelCalculateMark(parallelCalculatePane.updateBean()); - return formParallelAttr; - } - - @Override - protected String title4PopupWindow() { - return Toolkit.i18nText("Fine-Designer_Parallel_Setting"); - } - - static class ParallelSettingPane extends BasicPane { - private static final String[] CHOOSE_ITEM = new String[] { - Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), - Toolkit.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings") - }; - protected static final int SINGLE_SET = 0; - protected static final int SERVER_SET = 1; - //并行设置范围的下拉框(服务器设置还是模板设置) - UIComboBox parallelSettingScope; - //并行计算开关 - UICheckBox parallelSwitch; - - public ParallelSettingPane(){ - this.setLayout(new BorderLayout()); - UILabel belowSetLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Setting_Mode")); - belowSetLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - JPanel parallelSettingScopePane = GUICoreUtils.createFlowPane(new Component[] { - belowSetLabel, getParallelSettingScope()}, FlowLayout.LEFT, 0, 0); - this.add(parallelSettingScopePane, BorderLayout.NORTH); - this.add(getSwitchPane(Toolkit.i18nText("Fine-Designer_Enable_Form_Block_Parallel_Calculate")), BorderLayout.CENTER); - } - - private UIComboBox getParallelSettingScope() { - if (parallelSettingScope == null){ - parallelSettingScope = new UIComboBox(CHOOSE_ITEM); - parallelSettingScope.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (isUsingServerSettings()) { - populateServerSettings(); - parallelSwitch.setEnabled(false); - } else { - parallelSwitch.setEnabled(true); - } - } - } - }); - } - return parallelSettingScope; - } - - private JPanel getSwitchPane(String tip){ - JPanel innerPane = new JPanel(); - innerPane.setLayout(new BorderLayout()); - innerPane.setPreferredSize(new Dimension(500, 30)); - innerPane.setBorder(BorderFactory.createEmptyBorder(10, 70, 5, 10)); - innerPane.add(getSwitchBox(tip)); - return innerPane; - } - - private UICheckBox getSwitchBox(String tip){ - if (parallelSwitch == null){ - parallelSwitch = new UICheckBox(tip); - } - return parallelSwitch; - } - - private boolean isUsingServerSettings(){ - return parallelSettingScope.getSelectedIndex() == SERVER_SET; - } - - public void populateBean(ParallelAttrMark parallelAttrMark){ - parallelSettingScope.setSelectedIndex(parallelAttrMark.isUseServerSetting() ? SERVER_SET : SINGLE_SET); - if (parallelAttrMark.isUseServerSetting()){ - populateServerSettings(); - } else { - populateSingleTemplateSetting(parallelAttrMark); - } - } - - private void populateServerSettings(){ - parallelSwitch.setSelected(FormParallelCalConfig.getInstance().isParallelCal()); - } - - private void populateSingleTemplateSetting(ParallelAttrMark parallelAttrMark){ - parallelSwitch.setSelected(parallelAttrMark.isEnableParallel()); - } - - public ParallelAttrMark updateBean(){ - return new ParallelAttrMark(isUsingServerSettings(), parallelSwitch.isSelected()); - } - - @Override - protected String title4PopupWindow() { - return ""; - } - } -} From bc2fa8a0962c4c7ea179bc702996f7d611c9c0df Mon Sep 17 00:00:00 2001 From: "Fly.Li" Date: Thu, 7 Apr 2022 11:10:46 +0800 Subject: [PATCH 11/79] =?UTF-8?q?KERNEL-10650:=E6=94=B9=E5=8A=A8=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/FormECParallelCalAction.java | 2 +- .../widget/ui/designer/FormECParallelCalSettingPane.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java b/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java index 48f8cc2c6..5874398c2 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormECParallelCalAction.java @@ -29,7 +29,7 @@ public class FormECParallelCalAction extends JTemplateAction { @Override public String getMenuName() { - return Toolkit.i18nText("Fine-Designer_Parallel_Setting"); + return Toolkit.i18nText("Fine-Design_Form_Calculate_Setting"); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java index 696610e77..312526ff3 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FormECParallelCalSettingPane.java @@ -41,7 +41,7 @@ public class FormECParallelCalSettingPane extends BasicBeanPane Date: Tue, 12 Apr 2022 11:23:31 +0800 Subject: [PATCH 12/79] =?UTF-8?q?REPORT-68987=20=E6=8A=8A=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E7=BC=96=E8=BE=91=E5=BD=93=E4=BD=9C=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/javascript/JSContentPane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index 65bec03a8..c9344f5ca 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java @@ -63,7 +63,9 @@ public class JSContentPane extends BasicPane { initFunctionTitle(args); JPanel jsParaPane = createJSParaPane(); - addNewPaneLabel(); + if (needAdvancedEditor()) { + addNewPaneLabel(); + } this.add(jsParaPane, BorderLayout.NORTH); UIScrollPane sp = createContentTextAreaPanel(); @@ -323,4 +325,8 @@ public class JSContentPane extends BasicPane { return provider; } + + protected boolean needAdvancedEditor() { + return true; + } } \ No newline at end of file From 3237ffbb37022d462715174389cf4f959d215327 Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 13 Apr 2022 14:54:50 +0800 Subject: [PATCH 13/79] =?UTF-8?q?REPORT-68277=20=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=B8=93=E9=A1=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/DateEditorDefinePane.java | 13 +-- .../ui/designer/date/DateFormatCheck.java | 26 +++++ .../designer/date/DateFormatCheckManager.java | 34 +++++++ .../designer/date/DateFormatCheckResult.java | 43 +++++++++ .../date/check/DateFormatCustomCheck.java | 35 +++++++ .../date/check/DateFormatFrontCheck.java | 95 +++++++++++++++++++ .../widget/ui/DateEditorDefinePane.java | 13 +-- 7 files changed, 243 insertions(+), 16 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheck.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckManager.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckResult.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatCustomCheck.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java index e43e567f4..2d459bd1b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java @@ -15,6 +15,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; +import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; +import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; import com.fr.form.ui.DateEditor; import com.fr.stable.ArrayUtils; @@ -172,13 +174,9 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane 0) { try { simpleDateFormat = new SimpleDateFormat(text); - this.currentSamplelabel.setText(simpleDateFormat.format(new Date())); } catch (Exception exp) { simpleDateFormat = new SimpleDateFormat(""); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheck.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheck.java new file mode 100644 index 000000000..d08f1c43f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheck.java @@ -0,0 +1,26 @@ +package com.fr.design.widget.ui.designer.date; + +/** + * 日期控件格式检测接口 + * + * @author Lucian.Chen + * @version 11.0 + * Created by Lucian.Chen on 2022/4/8 + */ +public interface DateFormatCheck { + + /** + * 校验日期格式 + * @param date 日期 + * @param format 格式 + * @return 是否通过 + */ + boolean accept(String date, String format); + + /** + * 校验结果 + * @param sample 提示 + * @return 校验结果 + */ + DateFormatCheckResult result(String sample); +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckManager.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckManager.java new file mode 100644 index 000000000..9a673f61f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckManager.java @@ -0,0 +1,34 @@ +package com.fr.design.widget.ui.designer.date; + +import com.fr.design.widget.ui.designer.date.check.DateFormatCustomCheck; +import com.fr.design.widget.ui.designer.date.check.DateFormatFrontCheck; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Lucian.Chen + * @version 11.0 + * Created by Lucian.Chen on 2022/4/8 + */ +public class DateFormatCheckManager { + + private static final List CHECKS = new ArrayList<>(); + + static { + // 顺序执行 + CHECKS.add(DateFormatFrontCheck.KEY); + CHECKS.add(DateFormatCustomCheck.KEY); + } + + @NotNull + public static DateFormatCheckResult check(String date, String format) { + for (DateFormatCheck check : CHECKS) { + if (!check.accept(date, format)) { + return check.result(date); + } + } + return DateFormatCheckResult.create(date); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckResult.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckResult.java new file mode 100644 index 000000000..3dc786ba3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/DateFormatCheckResult.java @@ -0,0 +1,43 @@ +package com.fr.design.widget.ui.designer.date; + +import java.awt.Color; + +/** + * @author Lucian.Chen + * @version 11.0 + * Created by Lucian.Chen on 2022/4/8 + */ +public class DateFormatCheckResult { + + private String sample; + private Color color; + + public static DateFormatCheckResult create(String sample) { + return create(sample, Color.BLACK); + } + + public static DateFormatCheckResult create(String sample, Color color) { + return new DateFormatCheckResult(sample, color); + } + + DateFormatCheckResult(String sample, Color color) { + this.sample = sample; + this.color = color; + } + + public String getSample() { + return sample; + } + + public void setSample(String sample) { + this.sample = sample; + } + + public Color getColor() { + return color; + } + + public void setColor(Color color) { + this.color = color; + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatCustomCheck.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatCustomCheck.java new file mode 100644 index 000000000..b8aaa2d9b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatCustomCheck.java @@ -0,0 +1,35 @@ +package com.fr.design.widget.ui.designer.date.check; + +import com.fr.data.core.FormatField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.widget.ui.designer.date.DateFormatCheck; +import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; +import com.fr.stable.ArrayUtils; + +import java.awt.Color; + +/** + * 自定义格式校验 + * @author Lucian.Chen + * @version 11.0 + * Created by Lucian.Chen on 2022/4/8 + */ +public class DateFormatCustomCheck implements DateFormatCheck { + + public static final DateFormatCustomCheck KEY = new DateFormatCustomCheck(); + + /** + * 不是自定义格式 + */ + @Override + public boolean accept(String date, String format) { + return ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), format); + } + + @Override + public DateFormatCheckResult result(String sample) { + sample += " " + Toolkit.i18nText("Fine-Design_Basic_DateFormat_Custom_Warning"); + return DateFormatCheckResult.create(sample, Color.red); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java new file mode 100644 index 000000000..791f079c6 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java @@ -0,0 +1,95 @@ +package com.fr.design.widget.ui.designer.date.check; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.widget.ui.designer.date.DateFormatCheck; +import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; +import com.fr.stable.AssistUtils; +import com.fr.stable.StringUtils; + +import java.awt.Color; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 前端的解析方案检测 + * FR.str2Date + * @author Lucian.Chen + * @version 11.0 + * Created by Lucian.Chen on 2022/4/7 + */ +public class DateFormatFrontCheck implements DateFormatCheck { + + private static final Pattern YEAR_PATTERN_1 = Pattern.compile("y{4,}"); //yyyy + private static final Pattern YEAR_PATTERN_2 = Pattern.compile("y{2,}"); //yy + private static final Pattern MONTH_PATTERN_1 = Pattern.compile("M{4,}"); //MMMM + private static final Pattern MONTH_PATTERN_2 = Pattern.compile("M{3}"); //MMM + private static final Pattern MONTH_PATTERN_3 = Pattern.compile("M{2}"); //MM + private static final Pattern MONTH_PATTERN_4 = Pattern.compile("M"); //M + private static final Pattern MONTH_PATTERN_5 = Pattern.compile("a"); + private static final Pattern DAY_PATTERN_1 = Pattern.compile("d{2,}"); //dd + private static final Pattern DAY_PATTERN_2 = Pattern.compile("d"); //d + private static final Pattern HOUR_PATTERN_1 = Pattern.compile("h+"); //hh、h + private static final Pattern HOUR_PATTERN_2 = Pattern.compile("H+"); //HH、H + private static final Pattern MINUTE_PATTERN = Pattern.compile("m{2,}"); //mm + private static final Pattern SECOND_PATTERN = Pattern.compile("s{2,}"); //ss + private static final Pattern FMT_PATTERN = Pattern.compile("%."); + + public static final DateFormatFrontCheck KEY = new DateFormatFrontCheck(); + + /** + * 前端支持的格式 + */ + @Override + public boolean accept(String date, String format) { + if (StringUtils.isBlank(date) || StringUtils.isBlank(format)) { + return false; + } + + String fmt = parseFmt(format); + int fmtCount = 0; + Matcher matcher = FMT_PATTERN.matcher(fmt); + while (matcher.find()) { + fmtCount ++; + } + String[] dates = date.split("\\W+"); + + return dates.length == fmtCount || isSpecialFmt(fmt); + } + + @Override + public DateFormatCheckResult result(String sample) { + return DateFormatCheckResult.create(Toolkit.i18nText("Fine-Design_Basic_DateFormat_Not_Support"), Color.red); + } + + private boolean isSpecialFmt(String fmt) { + String lowerFmt = fmt.toLowerCase(); + return AssistUtils.equals(lowerFmt, "%y%x") || AssistUtils.equals(lowerFmt, "%y%x%d"); + } + + private String parseFmt(String fmt) { + //年 + fmt = YEAR_PATTERN_1.matcher(fmt).replaceAll("%Y"); + fmt = YEAR_PATTERN_2.matcher(fmt).replaceAll("%y"); + //月 + fmt = MONTH_PATTERN_1.matcher(fmt).replaceAll("%b"); + fmt = MONTH_PATTERN_2.matcher(fmt).replaceAll("%B"); + fmt = MONTH_PATTERN_3.matcher(fmt).replaceAll("%X"); + fmt = MONTH_PATTERN_4.matcher(fmt).replaceAll("%x"); + fmt = MONTH_PATTERN_5.matcher(fmt).replaceAll("%p"); + //天 + Matcher dayMatcher = DAY_PATTERN_1.matcher(fmt); + if (dayMatcher.find()) { + fmt = dayMatcher.replaceAll("%d"); + } else { + fmt = DAY_PATTERN_2.matcher(fmt).replaceAll("%e"); + } + //时 + fmt = HOUR_PATTERN_1.matcher(fmt).replaceAll("%I"); + fmt = HOUR_PATTERN_2.matcher(fmt).replaceAll("%H"); + //分 + fmt = MINUTE_PATTERN.matcher(fmt).replaceAll("%M"); + //秒 + fmt = SECOND_PATTERN.matcher(fmt).replaceAll("%S"); + return fmt; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java index c29407b8e..0a3f3d288 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -13,6 +13,8 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; +import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; +import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; import com.fr.form.ui.DateEditor; import com.fr.stable.ArrayUtils; @@ -164,13 +166,9 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane 0) { try { simpleDateFormat = new SimpleDateFormat(text); - this.currentSamplelabel.setText(simpleDateFormat.format(new Date())); } catch (Exception exp) { simpleDateFormat = new SimpleDateFormat(""); } From b99e8ac96520e6e53ca09d02990a14edd924952e Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 18 Apr 2022 15:08:54 +0800 Subject: [PATCH 14/79] =?UTF-8?q?REPORT-69887=E3=80=90=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=B8=93=E9=A1=B9=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E7=9A=84=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BAyyMMdd=E6=88=96yyMM=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=89=8D=E7=AB=AF=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../date/check/DateFormatFrontCheck.java | 3 +-- .../date/check/DateFormatFrontCheckTest.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java index 791f079c6..165a900ad 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java @@ -62,8 +62,7 @@ public class DateFormatFrontCheck implements DateFormatCheck { } private boolean isSpecialFmt(String fmt) { - String lowerFmt = fmt.toLowerCase(); - return AssistUtils.equals(lowerFmt, "%y%x") || AssistUtils.equals(lowerFmt, "%y%x%d"); + return AssistUtils.equals(fmt, "%Y%X") || AssistUtils.equals(fmt, "%Y%X%d"); } private String parseFmt(String fmt) { diff --git a/designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java b/designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java new file mode 100644 index 000000000..d69728441 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java @@ -0,0 +1,27 @@ +package com.fr.design.widget.ui.designer.date.check; + +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2022/4/18 + */ +public class DateFormatFrontCheckTest { + + @Test + public void testAccept() { + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("20220101", "yyyyMMdd")); + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("202201", "yyyyMM")); + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022-01-01", "yyyy-MM-dd")); + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("22/01/01", "yy/MM/dd")); + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022年01月01日", "yyyy年MM月dd日")); + Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022/01/01 12:30:00", "yyyy/MM/dd HH:mm:ss")); + + Assert.assertFalse(DateFormatFrontCheck.KEY.accept("220101", "yyMMdd")); + Assert.assertFalse(DateFormatFrontCheck.KEY.accept("20221", "yyyyM")); + Assert.assertFalse(DateFormatFrontCheck.KEY.accept("20220101123000", "yyyyMMddHHmmss")); + Assert.assertFalse(DateFormatFrontCheck.KEY.accept("2022-01-01", "YYYY-MM-dd")); + } +} From 52cd8e88d1b6efe316b7a89c532fc3251a7fb969 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Mon, 18 Apr 2022 17:32:10 +0800 Subject: [PATCH 15/79] =?UTF-8?q?REPORT-68346=20=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=BB=84=E5=90=88=E6=94=AF=E6=8C=81=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E8=81=94=E5=8A=A8=E4=B8=8E=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/RootDesignDefinePane.java | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 3793da7ea..910b466f7 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -32,11 +32,11 @@ import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.UIBoundSpinner; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; - import com.fr.report.stable.FormConstants; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.JCheckBox; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -52,6 +52,7 @@ public class RootDesignDefinePane extends AbstractDataModify { private UISpinner paraHeight; private UICheckBox displayReport; private UICheckBox useParamsTemplate; + private JCheckBox fireAfterEditor; private AccessibleBackgroundEditor background; private UIButtonGroup hAlignmentPane; private UITextField labelNameTextField; @@ -121,8 +122,8 @@ public class RootDesignDefinePane extends AbstractDataModify { } /** - * @Description: 获取的非新决策报表AdvancePane * @param + * @Description: 获取的非新决策报表AdvancePane * @return: * @Author: Henry.Wang * @date: 2020/11/05 15:36 @@ -133,6 +134,16 @@ public class RootDesignDefinePane extends AbstractDataModify { displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); UIComponentUtils.setLineWrap(displayReport); useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); + fireAfterEditor = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("触发编辑结束事件")); + fireAfterEditor.setEnabled(false); + fireAfterEditor.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + useParamsTemplate.addChangeListener(e -> { + boolean isSelected = ((UICheckBox) e.getSource()).isSelected(); + fireAfterEditor.setEnabled(isSelected); + if (!isSelected) { + fireAfterEditor.setSelected(false); + } + }); background = new AccessibleBackgroundEditor(); Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), @@ -143,14 +154,15 @@ public class RootDesignDefinePane extends AbstractDataModify { , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, new Component[]{displayReport, null}, new Component[]{useParamsTemplate, null}, + new Component[]{fireAfterEditor, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position")), hAlignmentPane} }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); @@ -165,8 +177,8 @@ public class RootDesignDefinePane extends AbstractDataModify { } /** - * @Description: 获取新决策报表的AdvancePane * @param + * @Description: 获取新决策报表的AdvancePane * @return: * @Author: Henry.Wang * @date: 2020/11/05 15:36 @@ -177,18 +189,29 @@ public class RootDesignDefinePane extends AbstractDataModify { displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); UIComponentUtils.setLineWrap(displayReport); useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); + fireAfterEditor = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("触发编辑结束事件")); + fireAfterEditor.setEnabled(false); + fireAfterEditor.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); + useParamsTemplate.addChangeListener(e -> { + boolean isSelected = ((UICheckBox) e.getSource()).isSelected(); + fireAfterEditor.setEnabled(isSelected); + if (!isSelected) { + fireAfterEditor.setSelected(false); + } + }); background = new AccessibleBackgroundEditor(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p}; + double[] rowSize = {p, p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, new Component[]{displayReport, null}, - new Component[]{useParamsTemplate, null} + new Component[]{useParamsTemplate, null}, + new Component[]{fireAfterEditor, null}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); @@ -209,6 +232,8 @@ public class RootDesignDefinePane extends AbstractDataModify { background.setValue(ob.getBackground()); displayReport.setSelected(ob.isDelayDisplayContent()); useParamsTemplate.setSelected(ob.isUseParamsTemplate()); + fireAfterEditor.setEnabled(ob.isUseParamsTemplate()); + fireAfterEditor.setSelected(ob.isParamsFireStopEdit()); if (newForm) { FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); paraHeight.setValue(designer.getParaHeight()); @@ -233,8 +258,8 @@ public class RootDesignDefinePane extends AbstractDataModify { } /** - * @Description: 更新非新决策报表的bean * @param + * @Description: 更新非新决策报表的bean * @return: * @Author: Henry.Wang * @date: 2020/11/05 15:36 @@ -249,6 +274,7 @@ public class RootDesignDefinePane extends AbstractDataModify { } wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); + wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); wParameterLayout.setBackground((Background) background.getValue()); @@ -257,8 +283,8 @@ public class RootDesignDefinePane extends AbstractDataModify { } /** - * @Description: 更新新决策报表的bean * @param + * @Description: 更新新决策报表的bean * @return: * @Author: Henry.Wang * @date: 2020/11/05 15:36 @@ -269,6 +295,7 @@ public class RootDesignDefinePane extends AbstractDataModify { wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); + wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); wParameterLayout.setBackground((Background) background.getValue()); From c387c9909fc15f6ff12bc88d5f3c977c2bad01e3 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 20 Apr 2022 14:56:07 +0800 Subject: [PATCH 16/79] =?UTF-8?q?REPORT-70092=20=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91=E6=8A=A5=E9=94=99=EF=BC=8C=E5=B8=AE=E5=8A=A9=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E8=B7=B3=E8=BD=AC=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/HelpLink.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/HelpLink.java b/designer-base/src/main/java/com/fr/env/HelpLink.java index c717ce6ea..9bc431636 100644 --- a/designer-base/src/main/java/com/fr/env/HelpLink.java +++ b/designer-base/src/main/java/com/fr/env/HelpLink.java @@ -24,6 +24,8 @@ public class HelpLink { map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link); map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_NetWork_Connection_Error_Solution"), link); + map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Redirect_Solution"), link); + map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_NetWork_Config_Solution"), link); return map.get(solution); } From fd32268176d2c78b6b24fbfa9eeead2ce4d55625 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 22 Apr 2022 10:23:36 +0800 Subject: [PATCH 17/79] =?UTF-8?q?KERNEL-10665=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/ui/util/GraphicsConfig.java | 77 ------ .../com/fr/design/report/ImageExportPane.java | 242 ++++++++++++++++++ .../design/report/ReportExportAttrPane.java | 9 +- .../src/main/java/com/fr/grid/GridUI.java | 8 +- .../java/com/fr/start/common/SplashPane.java | 2 +- 5 files changed, 255 insertions(+), 83 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java create mode 100644 designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java diff --git a/designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java b/designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java deleted file mode 100644 index 316b6ac24..000000000 --- a/designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.fr.design.ui.util; - -import org.jetbrains.annotations.NotNull; - -import java.awt.*; -import java.util.Map; - -/** - * 图形渲染配置 - * - * @author vito - * @version 10.0 - * Created by vito on 2019/9/18 - */ -public class GraphicsConfig { - private final Graphics2D myG; - private final Map myHints; - private final Composite myComposite; - private final Stroke myStroke; - - public GraphicsConfig(@NotNull Graphics g) { - myG = (Graphics2D) g; - myHints = (Map) myG.getRenderingHints().clone(); - myComposite = myG.getComposite(); - myStroke = myG.getStroke(); - } - - public GraphicsConfig setAntialiasing(boolean on) { - myG.setRenderingHint(RenderingHints.KEY_ANTIALIASING, on ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); - return this; - } - - public GraphicsConfig setAlpha(float alpha) { - myG.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); - return this; - } - - public GraphicsConfig setRenderingHint(RenderingHints.Key hintKey, Object hintValue) { - myG.setRenderingHint(hintKey, hintValue); - return this; - } - - public Graphics2D getG() { - return myG; - } - - public GraphicsConfig setComposite(Composite composite) { - myG.setComposite(composite); - return this; - } - - public GraphicsConfig setStroke(Stroke stroke) { - myG.setStroke(stroke); - return this; - } - - public GraphicsConfig setupAAPainting() { - return setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) - .setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); - } - - public GraphicsConfig disableAAPainting() { - return setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF) - .setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT); - } - - public GraphicsConfig paintWithAlpha(float alpha) { - assert 0.0f <= alpha && alpha <= 1.0f : "alpha should be in range 0.0f .. 1.0f"; - return setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); - } - - public void restore() { - myG.setRenderingHints(myHints); - myG.setComposite(myComposite); - myG.setStroke(myStroke); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java new file mode 100644 index 000000000..6e91ebd12 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java @@ -0,0 +1,242 @@ +package com.fr.design.report; + +import com.fr.base.extension.FileExtension; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.io.attr.ImageExportAttr; +import com.fr.io.attr.ReportExportAttr; +import com.fr.report.ReportConfigManager; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * 导出图片配置 + * + * @author vito + * @date 2015/7/6 0006 + */ +public class ImageExportPane extends AbstractExportPane { + + private UIRadioButton globalResolutionBtnS; + private UIRadioButton globalResolutionBtnM; + private UIRadioButton globalResolutionBtnL; + + private UIRadioButton globalRenderSpeed; + private UIRadioButton globalRenderQuality; + + private UIRadioButton globalFormatJpg; + private UIRadioButton globalFormatPng; + + private UIRadioButton previewResolutionBtnS; + private UIRadioButton previewResolutionBtnM; + + private UIRadioButton previewRenderSpeed; + private UIRadioButton previewRenderQuality; + + private static final int RESOLUTION_S = 96; + private static final int RESOLUTION_M = 192; + private static final int RESOLUTION_L = 300; + + private static final int DPI_SCALE_S = 1; + private static final int DPI_SCALE_M = 2; + + private static final int GAP = 20; + + public static final String GLOBAL_CONF = Toolkit.i18nText("Fine-Design_Image_Export_Global_Configuration"); + + + private ReportExportAttr reportExportAttr; + + public ImageExportPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + JPanel globalTitlePane = FRGUIPaneFactory.createTitledBorderPane(GLOBAL_CONF); + JPanel previewSetting = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview")); + this.add(globalTitlePane, BorderLayout.NORTH); + this.add(previewSetting, BorderLayout.CENTER); + initGlobalSettings(); + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JComponent[][] comps = { + {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Resolution") + ":"), this.globalResolutionBtnS, this.globalResolutionBtnM, this.globalResolutionBtnL}, + {new UILabel(Toolkit.i18nText("Fine-Design_Report_Format") + ":"), this.globalFormatJpg, null, this.globalFormatPng}, + {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":"), this.globalRenderQuality, null, this.globalRenderSpeed}, + }; + centerPane.add( + TableLayoutHelper.createCommonTableLayoutPane( + comps, + new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, + new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, + GAP), + BorderLayout.CENTER); + globalTitlePane.add(centerPane, BorderLayout.CENTER); + JPanel templateCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JComponent[][] templateComps = { + {new UILabel(Toolkit.i18nText("Fine-Design_Report_Engine_Enlarge_Or_Reduce") + ":"), this.previewResolutionBtnS, this.previewResolutionBtnM}, + {new UILabel(Toolkit.i18nText("Fine-Design_Image_Export_Rendering_Quality") + ":"), this.previewRenderQuality, this.previewRenderSpeed}, + }; + templateCenterPane.add( + TableLayoutHelper.createCommonTableLayoutPane( + templateComps, + new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, + new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, + GAP), + BorderLayout.CENTER); + + previewSetting.add(templateCenterPane, BorderLayout.CENTER); + + + } + + + private void initGlobalSettings() { + globalResolutionBtnS = new UIRadioButton("96dpi", true); + globalResolutionBtnM = new UIRadioButton("192dpi"); + globalResolutionBtnL = new UIRadioButton("300dpi"); + ButtonGroup globalResolutionBtnGroup = new ButtonGroup(); + globalResolutionBtnGroup.add(globalResolutionBtnS); + globalResolutionBtnGroup.add(globalResolutionBtnM); + globalResolutionBtnGroup.add(globalResolutionBtnL); + + globalFormatJpg = new UIRadioButton("jpg", true); + globalFormatPng = new UIRadioButton("png"); + ButtonGroup globalFormatGroup = new ButtonGroup(); + globalFormatGroup.add(globalFormatJpg); + globalFormatGroup.add(globalFormatPng); + + globalRenderQuality = new UIRadioButton("Fine-Design_Image_Export_Quality_First", true); + globalRenderSpeed = new UIRadioButton("Fine-Design_Image_Export_Speed_Priority"); + ButtonGroup globalRenderGroup = new ButtonGroup(); + globalRenderGroup.add(globalRenderQuality); + globalRenderGroup.add(globalRenderSpeed); + + previewResolutionBtnS = new UIRadioButton("100%", true); + previewResolutionBtnM = new UIRadioButton("200%"); + ButtonGroup previewResolutionBtnGroup = new ButtonGroup(); + previewResolutionBtnGroup.add(previewResolutionBtnS); + previewResolutionBtnGroup.add(previewResolutionBtnM); + + previewRenderSpeed = new UIRadioButton("Fine-Design_Image_Export_Speed_Priority"); + previewRenderQuality = new UIRadioButton("Fine-Design_Image_Export_Quality_First"); + ButtonGroup previewRenderGroup = new ButtonGroup(); + previewRenderGroup.add(previewRenderQuality); + previewRenderGroup.add(previewRenderSpeed); + } + + + /** + * 展示界面 + */ + @Override + public void populate(Object exportAttr) { + populateBean(exportAttr); + } + + /** + * 提交数据 + * + * @return 界面上的更新数据 + */ + @Override + public void update(Object exportAttr) { + updateBean(); + } + + private ImageExportAttr getGlobalImageExportAttr() { + return ReportConfigManager.getProviderInstance().getImageExportAttr(); + } + + /** + * 标题 + * + * @return 标题 + */ + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Image_Export_Export_Image_Setting"); + } + + @Override + public void populateBean(Object exportAttr) { + ImageExportAttr attr = getGlobalImageExportAttr(); + switch (attr.getResolution()) { + case 192: + globalResolutionBtnM.setSelected(true); + break; + case 300: + globalResolutionBtnL.setSelected(true); + break; + default: + globalResolutionBtnS.setSelected(true); + } + if (FileExtension.PNG.getExtension().equals(attr.getFormat())) { + globalFormatPng.setSelected(true); + } else { + globalFormatJpg.setSelected(true); + } + if (attr.getRenderQuality() == ImageExportAttr.RENDER_SPEED) { + globalRenderSpeed.setSelected(true); + } else { + globalRenderQuality.setSelected(true); + } + + if (attr.getPreviewRenderQuality() == ImageExportAttr.RENDER_SPEED) { + previewRenderSpeed.setSelected(true); + } else { + previewRenderQuality.setSelected(true); + } + + if (attr.getPreviewResolutionScale() == DPI_SCALE_S) { + previewResolutionBtnS.setSelected(true); + } else { + previewResolutionBtnM.setSelected(true); + } + + } + + @Override + public void updateBean(Object exportAttr) { + ImageExportAttr attr = getGlobalImageExportAttr(); + if (globalResolutionBtnS.isSelected()) { + attr.setResolution(RESOLUTION_S); + } else if (globalResolutionBtnM.isSelected()) { + attr.setResolution(RESOLUTION_M); + } else { + attr.setResolution(RESOLUTION_L); + } + if (globalFormatPng.isSelected()) { + attr.setFormat(FileExtension.PNG.getExtension()); + } else { + attr.setFormat(FileExtension.JPG.getExtension()); + } + if (globalRenderSpeed.isSelected()) { + attr.setRenderQuality(ImageExportAttr.RENDER_SPEED); + } else { + attr.setRenderQuality(ImageExportAttr.RENDER_QUALITY); + } + + if (previewRenderSpeed.isSelected()) { + attr.setPreviewRenderQuality(ImageExportAttr.RENDER_SPEED); + } else { + attr.setPreviewRenderQuality(ImageExportAttr.RENDER_QUALITY); + } + if (previewResolutionBtnS.isSelected()) { + attr.setPreviewResolutionScale(DPI_SCALE_S); + } else { + attr.setPreviewResolutionScale(DPI_SCALE_M); + } + } + + @Override + public String getTitle() { + return "Image"; + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java index 1ac27cc88..a284764d2 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java @@ -14,13 +14,14 @@ import java.util.Set; public class ReportExportAttrPane extends BasicPane { + UITabbedPane uiTabbedPane; private ExcelExportPane excelExportPane; private PDFExportPane pdfExportPane; private WordExportPane wordExportPane; private List> paneList; public ReportExportAttrPane() { - UITabbedPane uiTabbedPane = new UITabbedPane(); + uiTabbedPane = new UITabbedPane(); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); excelExportPane = new ExcelExportPane(); @@ -31,6 +32,7 @@ public class ReportExportAttrPane extends BasicPane { uiTabbedPane.addTab("Word", wordExportPane); Set providers = ExtraDesignClassManager.getInstance().getArray(ExportAttrTabProvider.XML_TAG); paneList = new ArrayList<>(); + initPane(new ImageExportPane()); for (ExportAttrTabProvider provider : providers) { BasicStorePane storePane = provider.toServiceComponent(); uiTabbedPane.addTab(storePane.getTitle(), storePane); @@ -39,6 +41,11 @@ public class ReportExportAttrPane extends BasicPane { this.add(uiTabbedPane); } + private void initPane(BasicStorePane exportPane) { + uiTabbedPane.addTab(exportPane.getTitle(), exportPane); + paneList.add(exportPane); + } + @Override protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportD_Excel_Export"); 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 c6ed5e416..6234acc95 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -406,7 +406,7 @@ public class GridUI extends ComponentUI { rowHeight = gridRange.rowHeightList.get(i); paperYAxisSumSize = paperYAxisSumSize.add(rowHeight); if (showGridLine) { - UNIT columnWidth, xAxisSumSize = FU.getInstance(0); + UNIT columnWidth, xAxisSumSize = FU.getInstance(0); for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) { columnWidth = gridRange.columnWidthList.get(j); if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) { @@ -1018,7 +1018,7 @@ public class GridUI extends ComponentUI { g2d.translate(floatX, floatY); - PaintUtils.paintFloatElement(g2d, tmpFloatElement, + PaintUtils.paintFloatElementWithBackgroundAndBorder(g2d, tmpFloatElement, tmpFloatElement.getWidth().toPixI(resolution), tmpFloatElement.getHeight().toPixI(resolution), resolution); @@ -1220,8 +1220,8 @@ public class GridUI extends ComponentUI { Stroke oldStroke = g2d.getStroke(); g2d.setPaint(Color.black); g2d.setStroke(GraphDrawHelper.getStroke(Constants.LINE_DASH_DOT)); - g2d.drawLine( 0, height, width, height); - g2d.drawLine( width, 0, width, height); + g2d.drawLine(0, height, width, height); + g2d.drawLine(width, 0, width, height); g2d.setPaint(oldPaint); g2d.setStroke(oldStroke); } diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java index 726bdaba4..74500acc3 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java @@ -4,7 +4,7 @@ import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.util.JBUI; import com.fr.base.GraphHelper; import com.fr.design.locale.impl.SplashMark; -import com.fr.design.ui.util.GraphicsConfig; +import com.fr.stable.GraphicsConfig; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; import com.fr.stable.GraphDrawHelper; From 1b1a2e88965fb517aeebdec0c4eaf1ae7ee21a4e Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 22 Apr 2022 16:07:09 +0800 Subject: [PATCH 18/79] =?UTF-8?q?KERNEL-10665=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/ImageExportPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java index 6e91ebd12..d32c006a6 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ImageExportPane.java @@ -112,8 +112,8 @@ public class ImageExportPane extends AbstractExportPane { globalFormatGroup.add(globalFormatJpg); globalFormatGroup.add(globalFormatPng); - globalRenderQuality = new UIRadioButton("Fine-Design_Image_Export_Quality_First", true); - globalRenderSpeed = new UIRadioButton("Fine-Design_Image_Export_Speed_Priority"); + globalRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First"), true); + globalRenderSpeed = new UIRadioButton(Toolkit.i18nText(("Fine-Design_Image_Export_Speed_Priority"))); ButtonGroup globalRenderGroup = new ButtonGroup(); globalRenderGroup.add(globalRenderQuality); globalRenderGroup.add(globalRenderSpeed); @@ -124,8 +124,8 @@ public class ImageExportPane extends AbstractExportPane { previewResolutionBtnGroup.add(previewResolutionBtnS); previewResolutionBtnGroup.add(previewResolutionBtnM); - previewRenderSpeed = new UIRadioButton("Fine-Design_Image_Export_Speed_Priority"); - previewRenderQuality = new UIRadioButton("Fine-Design_Image_Export_Quality_First"); + previewRenderSpeed = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Speed_Priority")); + previewRenderQuality = new UIRadioButton(Toolkit.i18nText("Fine-Design_Image_Export_Quality_First")); ButtonGroup previewRenderGroup = new ButtonGroup(); previewRenderGroup.add(previewRenderQuality); previewRenderGroup.add(previewRenderSpeed); From a1cb79707e242351d60ab515d60313e09b35dc15 Mon Sep 17 00:00:00 2001 From: hades Date: Sun, 24 Apr 2022 09:18:49 +0800 Subject: [PATCH 19/79] =?UTF-8?q?REPORT-67417=20=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81v1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 47 +- .../help/alphafine/AlphaFineConfigPane.java | 19 +- .../actions/help/alphafine/SizedStack.java | 30 + .../design/dialog/link/MessageWithLink.java | 15 +- .../alphafine/AlphaFineConstants.java | 39 + .../mainframe/alphafine/AlphaFineHelper.java | 14 +- .../mainframe/alphafine/AlphaFineUtil.java | 63 ++ .../design/mainframe/alphafine/CellType.java | 43 +- .../alphafine/component/AlphaFineDialog.java | 4 +- .../alphafine/component/AlphaFineFrame.java | 669 ++++++++++++++++++ .../alphafine/component/AlphaFineList.java | 72 ++ .../alphafine/component/AlphaFinePane.java | 2 +- .../component/AlphaFineTextField.java | 15 +- .../AlphaFineToolTipContentCellRender.java | 68 ++ .../component/AlphaFineToolTipList.java | 42 ++ .../component/AlphaSearchTooltipPane.java | 63 ++ .../alphafine/component/LineCellRender.java | 32 + .../ProductNewsContentCellRender.java | 79 +++ .../component/ProductNewsImagePanel.java | 76 ++ .../alphafine/component/ProductNewsList.java | 48 ++ .../ProductNewsSearchResultPane.java | 35 + .../alphafine/component/SearchListModel.java | 126 ++++ .../SearchResultContentCellRender.java | 83 +++ .../alphafine/component/SearchResultPane.java | 51 ++ .../component/SearchTooltipPopup.java | 58 ++ .../alphafine/component/SelectedLabel.java | 91 +++ .../alphafine/model/ProductNews.java | 200 ++++++ .../preview/DefaultProductNewsPane.java | 79 +++ .../preview/HelpDocumentNoResultPane.java | 94 +++ .../preview/LoadingRightSearchResultPane.java | 167 +++++ .../alphafine/preview/NoResultPane.java | 22 +- .../preview/NoResultWithLinkPane.java | 35 + .../alphafine/preview/ResultShowPane.java | 14 + .../alphafine/preview/SearchLoadingPane.java | 19 + .../preview/SimpleRightSearchResultPane.java | 32 + .../alphafine/question/QuestionPane.java | 59 ++ .../alphafine/question/QuestionWindow.java | 86 +++ .../ProductNewsSearchWorkerManager.java | 100 +++ .../alphafine/search/SearchManager.java | 13 + .../alphafine/search/SearchWorkerManager.java | 119 ++++ .../impl/ProductNewsSearchManager.java | 75 ++ .../fr/start/module/DesignerActivator.java | 22 + .../mainframe/alphafine/images/blue_bulb.svg | 4 + .../mainframe/alphafine/images/bulb.svg | 4 + .../mainframe/alphafine/images/close.svg | 3 + .../mainframe/alphafine/images/group.svg | 4 + .../mainframe/alphafine/images/group_new.svg | 4 + .../alphafine/images/groupbackgroud.svg | 3 + .../alphafine/images/history_search.svg | 4 + .../mainframe/alphafine/images/hot_search.svg | 3 + .../mainframe/alphafine/images/minimize.svg | 3 + .../mainframe/alphafine/images/new_tip.svg | 25 + .../mainframe/alphafine/images/search.svg | 3 + 53 files changed, 3046 insertions(+), 34 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/actions/help/alphafine/SizedStack.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/LineCellRender.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchTooltipPopup.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/ProductNews.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ResultShowPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/blue_bulb.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bulb.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/close.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/history_search.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/hot_search.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/minimize.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/new_tip.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index 029632709..a8970f9d1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.design.DesignerEnvManager; import com.fr.general.ComparatorUtils; import com.fr.license.function.VT4FR; import com.fr.stable.OperatingSystem; @@ -8,6 +9,12 @@ import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; +import java.util.Stack; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -82,9 +89,29 @@ public class AlphaFineConfigManager implements XMLable { */ private boolean needRemind = true; + /** + * 产品动态 + */ + private boolean productDynamics = true; + private Map actionSearchTextCache = new HashMap<>(8); private String cacheBuildNO; + + + // todo 暂不持久化 方便测试 + /** + * key: 登录的bbs用户 + * value: alphaFine历史搜索记录 + */ + private Map> historySearchMap = new LinkedHashMap<>(); + + /** + * key: 登录的bbs用户 + * value: 已读的cid的集合 + */ + private Map> readSetMap = new LinkedHashMap<>(); + /** * 直接操作菜单次数 */ @@ -120,6 +147,7 @@ public class AlphaFineConfigManager implements XMLable { this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false)); this.setNeedSegmentationCheckbox(reader.getAttrAsBoolean("needSegmentationCheckbox", true)); this.setNeedIntelligentCustomerService(reader.getAttrAsBoolean("needIntelligentCustomerService", true)); + this.setProductDynamics(reader.getAttrAsBoolean("productDynamics", true)); this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts())); this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true)); this.setOperateCount(reader.getAttrAsInt("operateCount", 0)); @@ -167,7 +195,8 @@ public class AlphaFineConfigManager implements XMLable { .attr("isNeedRemind", this.isNeedRemind()) .attr("operateCount", this.getOperateCount()) .attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox()) - .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()); + .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) + .attr("productDynamics", this.isProductDynamics()); writeActionSearchTextCacheXML(writer); writer.end(); } @@ -335,4 +364,20 @@ public class AlphaFineConfigManager implements XMLable { public void setCacheBuildNO(@NotNull String cacheBuildNO) { this.cacheBuildNO = cacheBuildNO; } + + public Stack getHistorySearch() { + return historySearchMap.computeIfAbsent(DesignerEnvManager.getEnvManager().getDesignerLoginUsername(), k -> new SizedStack<>(3)); + } + + public Set getReadSet() { + return readSetMap.computeIfAbsent(DesignerEnvManager.getEnvManager().getDesignerLoginUsername(), k -> new HashSet<>()); + } + + public boolean isProductDynamics() { + return productDynamics; + } + + public void setProductDynamics(boolean productDynamics) { + this.productDynamics = productDynamics; + } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java index 5bf0214e0..bd26b5cfc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java @@ -55,7 +55,7 @@ public class AlphaFineConfigPane extends BasicPane { private static final double COLUMN_GAP = 180; private static final double ROW_GAP = 25; private KeyStroke shortCutKeyStore = null; - private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox, needIntelligentCustomerService, containRecommendCheckbox, containActionCheckbox, containDocumentCheckbox, containTemplateCheckbox, containPluginCheckbox, containFileContentCheckbox; + private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox, needIntelligentCustomerService, productDynamicsCheckbox, containActionCheckbox, containDocumentCheckbox, containTemplateCheckbox, containPluginCheckbox, containFileContentCheckbox; private UITextField shortcutsField; public AlphaFineConfigPane() { @@ -75,9 +75,8 @@ public class AlphaFineConfigPane extends BasicPane { private Component[][] initSearchRangeComponents() { Component[][] components = new Component[][]{ - new Component[]{containRecommendCheckbox, containActionCheckbox, containDocumentCheckbox}, + new Component[]{productDynamicsCheckbox, containActionCheckbox, containDocumentCheckbox}, new Component[]{containTemplateCheckbox, containPluginCheckbox, containFileContentCheckbox}, - new Component[]{needIntelligentCustomerService, null, null} }; return components; } @@ -95,7 +94,7 @@ public class AlphaFineConfigPane extends BasicPane { double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range")); - containRecommendCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Recommend")); + productDynamicsCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_Dynamics")); containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")); containPluginCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")); containDocumentCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")); @@ -153,16 +152,16 @@ public class AlphaFineConfigPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { if (!searchOnlineCheckbox.isSelected()) { - containRecommendCheckbox.setEnabled(false); + productDynamicsCheckbox.setEnabled(false); containPluginCheckbox.setEnabled(false); containDocumentCheckbox.setEnabled(false); needIntelligentCustomerService.setEnabled(false); - containRecommendCheckbox.setSelected(false); + productDynamicsCheckbox.setSelected(false); containPluginCheckbox.setSelected(false); containDocumentCheckbox.setSelected(false); needIntelligentCustomerService.setSelected(false); } else { - containRecommendCheckbox.setEnabled(true); + productDynamicsCheckbox.setEnabled(true); containPluginCheckbox.setEnabled(true); containDocumentCheckbox.setEnabled(true); needIntelligentCustomerService.setEnabled(true); @@ -207,8 +206,8 @@ public class AlphaFineConfigPane extends BasicPane { this.containPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && enabled4Locale); this.containPluginCheckbox.setEnabled(enabled4Locale); - this.containRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && enabled4Locale); - this.containRecommendCheckbox.setEnabled(enabled4Locale); + this.productDynamicsCheckbox.setSelected(alphaFineConfigManager.isProductDynamics() && enabled4Locale); + this.productDynamicsCheckbox.setEnabled(enabled4Locale); this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts())); @@ -226,7 +225,7 @@ public class AlphaFineConfigPane extends BasicPane { alphaFineConfigManager.setContainPlugin(this.containPluginCheckbox.isSelected()); alphaFineConfigManager.setContainAction(this.containActionCheckbox.isSelected()); alphaFineConfigManager.setContainDocument(this.containDocumentCheckbox.isSelected()); - alphaFineConfigManager.setContainRecommend(this.containRecommendCheckbox.isSelected()); + alphaFineConfigManager.setProductDynamics(this.productDynamicsCheckbox.isSelected()); alphaFineConfigManager.setEnabled(this.enabledCheckbox.isSelected()); alphaFineConfigManager.setSearchOnLine(this.searchOnlineCheckbox.isSelected()); alphaFineConfigManager.setContainTemplate(this.containTemplateCheckbox.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/SizedStack.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/SizedStack.java new file mode 100644 index 000000000..fbc6eca00 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/SizedStack.java @@ -0,0 +1,30 @@ +package com.fr.design.actions.help.alphafine; + +import java.util.Stack; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/23 + */ +public class SizedStack extends Stack { + + private final int maxSize; + + public SizedStack(int size) { + super(); + this.maxSize = size; + } + + @Override + public T push(T object) { + while (this.size() >= maxSize) { + this.remove(0); + } + // 不重复 + if (this.contains(object)) { + return object; + } + return super.push(object); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java b/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java index f73ec77df..2e839d27c 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java +++ b/designer-base/src/main/java/com/fr/design/dialog/link/MessageWithLink.java @@ -37,15 +37,19 @@ public class MessageWithLink extends JEditorPane { } public MessageWithLink(String frontMessage, String linkName, String link, String backMessage) { - this(frontMessage, linkName, link, backMessage, LABEL.getBackground(), LABEL.getFont()); + this(frontMessage, linkName, link, backMessage, LABEL.getBackground(), LABEL.getFont(), LABEL.getForeground()); } public MessageWithLink(String message, String linkName, String link, Color color, Font font) { - this(message, linkName, link, StringUtils.EMPTY, color, font); + this(message, linkName, link, StringUtils.EMPTY, color, font, LABEL.getForeground()); } public MessageWithLink(String frontMessage, String linkName, String link, String backMessage, Color color, Font font) { - super("text/html", "" + frontMessage + "" + linkName + "" + backMessage + ""); + this(frontMessage, linkName, link, backMessage, color, font, LABEL.getForeground()); + } + + public MessageWithLink(String frontMessage, String linkName, String link, String backMessage, Color backgroundColor, Font font, Color fontColor) { + super("text/html", "" + frontMessage + "" + linkName + "" + backMessage + ""); initListener(link); setEditable(false); setBorder(null); @@ -66,12 +70,13 @@ public class MessageWithLink extends JEditorPane { }); } - private static StringBuilder generateStyle(Color color, Font font) { + private static StringBuilder generateStyle(Color backgroundColor, Font font, Color fontColor) { // 构建相同风格样式 StringBuilder style = new StringBuilder("font-family:" + font.getFamily() + ";"); style.append("font-weight:").append(font.isBold() ? "bold" : "normal").append(";"); style.append("font-size:").append(font.getSize()).append("pt;"); - style.append("background-color: rgb(").append(color.getRed()).append(",").append(color.getGreen()).append(",").append(color.getBlue()).append(");"); + style.append("color:rgb(").append(fontColor.getRed()).append(",").append(fontColor.getGreen()).append(",").append(fontColor.getBlue()).append(");"); + style.append("background-color: rgb(").append(backgroundColor.getRed()).append(",").append(backgroundColor.getGreen()).append(",").append(backgroundColor.getBlue()).append(");"); return style; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 3946c9cbc..6afce21e4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -1,13 +1,20 @@ package com.fr.design.mainframe.alphafine; import com.fr.base.extension.FileExtension; +import com.fr.base.svg.IconUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.utils.DesignUtils; import com.fr.general.CloudCenter; +import com.fr.general.IOUtils; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; +import javax.swing.Icon; /** @@ -131,6 +138,8 @@ public class AlphaFineConstants { public static final String ALPHA_PREVIEW = CloudCenter.getInstance().acquireUrlByKind("af.preview"); + public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid"); + public static final String JAVASCRIPT_PREFIX = "javascript:SendJava"; public static final String CHINESE_CHARACTERS = "[\\u4e00-\\u9fa5]"; @@ -143,6 +152,36 @@ public class AlphaFineConstants { public static final String BACK_ICON_NAME = "back@1x.png"; + public static final Icon NO_RESULT_ICON = IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "noresult.png"); + + public static final Color FOREGROUND_COLOR = new Color(51, 51, 52); + + /** + * 后面数字代表透明度 80% + */ + public static final Color FOREGROUND_COLOR_8 = new Color(51, 51, 52, 204); + + public static final Color FOREGROUND_COLOR_6 = new Color(51, 51, 52, 153); + + public static final Color FOREGROUND_COLOR_5 = new Color(51, 51, 52, 128); + + public static final Color BACKGROUND_COLOR = new Color(245, 245, 247); + + public static final Icon BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bulb.svg"); + + public static final Icon BLUE_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/blue_bulb.svg"); + + public static final String HOT_SEARCH = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search"); + + public static final Set HOT_SEARCH_SET = new LinkedHashSet<>( + Arrays.asList( + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search_TOP_ONE"), + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search_TOP_TWO"), + Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search_TOP_THREE") + ) + ); + + public static final ArrayList CONJUNCTION = new ArrayList() {{ add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_HE")); add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_YU")); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index dd5a01349..293829992 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -2,12 +2,11 @@ package com.fr.design.mainframe.alphafine; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.NoResultModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel; -import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; +import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.HotIssuesManager; @@ -32,7 +31,7 @@ import java.util.List; */ public class AlphaFineHelper { public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")); - private static AlphaFineDialog alphaFineDialog; + private static AlphaFineFrame alphaFineDialog; private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com"; private AlphaFineHelper() { @@ -62,7 +61,7 @@ public class AlphaFineHelper { return; } if (alphaFineDialog == null) { - alphaFineDialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); + alphaFineDialog = new AlphaFineFrame(); alphaFineDialog.setVisible(true); final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); manager.setNeedRemind(false); @@ -73,6 +72,13 @@ public class AlphaFineHelper { } + public static void resetAlphaFineDialog() { + alphaFineDialog = null; + } + + public static AlphaFineFrame getAlphaFineDialog() { + return alphaFineDialog; + } /** * 获取文件名上级目录 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java new file mode 100644 index 000000000..66210cddc --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java @@ -0,0 +1,63 @@ +package com.fr.design.mainframe.alphafine; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.stable.StringUtils; +import java.util.List; +import java.util.Set; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/20 + */ +public class AlphaFineUtil { + + public static String highLightModelName(String modelName, String[] strings) { + if (strings == null) { + return modelName; + } + for (String string : strings) { + String primaryStr = getReplacedString(modelName, string); + if (StringUtils.isNotEmpty(primaryStr)) { + modelName = modelName.replaceAll("(?i)" + primaryStr, "|" + primaryStr + "|"); + } + } + modelName = "" + modelName.replaceAll("\\|", StringUtils.EMPTY) + ""; + return modelName; + } + + + private static 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) { + return StringUtils.EMPTY; + } + StringBuilder result = new StringBuilder(); + int count = 0; + while (count < string.length()) { + char pos = modelName.charAt(index++); + result.append(pos); + count += pos == ' ' ? 0 : 1; + } + return result.toString(); + } + + public static boolean unread() { + Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); + List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); + return !productNewsList.isEmpty() && (readSet.size() != productNewsList.size()); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java index 3d533e47b..5e415dee4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java @@ -1,15 +1,46 @@ package com.fr.design.mainframe.alphafine; +import com.fr.stable.StringUtils; + /** * Created by XiaXiang on 2017/4/27. */ public enum CellType { - RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5), NO_RESULT(6), MORE(7), RECOMMEND_ROBOT(8), BOTTOM(9), ROBOT(10); + RECOMMEND(0), + ACTION(1, "action", "actionResult"), + DOCUMENT(2, "document", "documentResult"), + FILE(3, "file", "fileResult"), + PLUGIN(4, "plugin", "pluginResult"), + REUSE(5), + NO_RESULT(6, "noResult", StringUtils.EMPTY), + MORE(7), + RECOMMEND_ROBOT(8), + BOTTOM(9), + ROBOT(10), + PRODUCT_NEWS(11, "productNews", "productNewsResult"); private int typeValue; - CellType(int type) { + /** + * 标志位 索引无搜索结果面板 + * + * 空字符表示不涉及索引该项 + */ + private String flagStr4None; + + /** + * 标志位 索引有搜索结果面板 + */ + private String flagStr4Result; + + CellType(int type, String flagStr4None, String flagStr4Result) { this.typeValue = type; + this.flagStr4None = flagStr4None; + this.flagStr4Result = flagStr4Result; + } + + CellType(int type) { + this(type, StringUtils.EMPTY, StringUtils.EMPTY); } public static CellType parse(int typeValue) { @@ -29,5 +60,13 @@ public enum CellType { public void setTypeValue(int typeValue) { this.typeValue = typeValue; } + + public String getFlagStr4None() { + return flagStr4None; + } + + public String getFlagStr4Result() { + return flagStr4Result; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 47c2e6c7e..e6e924570 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -435,7 +435,7 @@ public class AlphaFineDialog extends UIDialog { */ private void removeLeftPane() { if (searchListModel.isEmpty() && defaultPane == null) { - defaultPane = new NoResultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"), AlphaFineConstants.IMAGE_URL + "no_result.png"); + defaultPane = new NoResultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"), AlphaFineConstants.NO_RESULT_ICON); searchResultPane.remove(leftSearchResultPane); searchResultPane.add(defaultPane, BorderLayout.WEST); refreshContainer(); @@ -661,7 +661,7 @@ public class AlphaFineDialog extends UIDialog { break; case ACTION: rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new NoResultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No_Result"), AlphaFineConstants.IMAGE_URL + "noresult.png")); + rightSearchResultPane.add(new NoResultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No_Result"), AlphaFineConstants.NO_RESULT_ICON)); validate(); repaint(); break; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java new file mode 100644 index 000000000..2911ef68f --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -0,0 +1,669 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.base.svg.IconUtils; +import com.fr.base.svg.SVGLoader; +import com.fr.design.DesignerEnvManager; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane; +import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane; +import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane; +import com.fr.design.mainframe.alphafine.preview.NoResultPane; +import com.fr.design.mainframe.alphafine.preview.NoResultWithLinkPane; +import com.fr.design.mainframe.alphafine.preview.SimpleRightSearchResultPane; +import com.fr.design.mainframe.alphafine.question.QuestionWindow; +import com.fr.design.mainframe.alphafine.search.ProductNewsSearchWorkerManager; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; +import com.fr.design.mainframe.alphafine.search.SearchWorkerManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; +import com.fr.design.utils.DesignUtils; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.Timer; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/04/06 + */ +public class AlphaFineFrame extends JFrame { + + private static final String ADVANCED_SEARCH_MARK = "k:"; + + private static final int TIMER_DELAY = 300; + + private static final String PLACE_HOLDER = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine"); + + private static final String SETTING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"); + + private static final String NO_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No_Result"); + + private static final String SKILLS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Skills"); + + private static final String SEARCH_TERM = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Search_Term"); + + private static final String SEARCH = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Search"); + + private static final String GO_FORUM = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Go_Forum"); + + private static final String TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates"); + + private static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"); + + private static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"); + + private static final String PLUGIN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"); + + private static final String ONE_CLICK_READ = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_One_Click_Read"); + + private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"); + + private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); + + private final CardLayout cardLayout = new CardLayout(); + + private final JPanel resultPane = new JPanel(cardLayout); + + private String storeText; + + private String[] segmentationResult; + + private UILabel useTipLabel; + + private UILabel tipIconLabel; + + private AlphaFineTextField searchTextField; + + private AlphaFineList searchResultList; + + private CellType selectedType; + + private String beforeSearchStr = StringUtils.EMPTY; + + private SearchWorkerManager settingSearchWorkerManager; + + private SearchWorkerManager fileSearchWorkerManager; + + private SearchWorkerManager documentWorkerManager; + + private SearchWorkerManager pluginSearchWorkerManager; + + private SearchWorkerManager currentSearchWorkerManager; + + private ProductNewsSearchWorkerManager productNewsSearchWorkerManager; + + public AlphaFineFrame() { + setUndecorated(true); + setSize(AlphaFineConstants.FIELD_SIZE); + initComponents(); + centerWindow(this); + initSearchManager(); + } + + private void initSearchManager() { + + this.productNewsSearchWorkerManager = new ProductNewsSearchWorkerManager( + CellType.PRODUCT_NEWS, + searchTextBean -> { + return ProductNewsSearchManager.getInstance().getSearchResult(searchTextBean.getSegmentation()); + }, + this + ); + + this.settingSearchWorkerManager = new SearchWorkerManager( + CellType.ACTION, + searchTextBean -> { + ActionSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); + return ActionSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); + }, + this, + new SimpleRightSearchResultPane(new NoResultPane(NO_RESULT, AlphaFineConstants.NO_RESULT_ICON)) + ); + fileSearchWorkerManager = new SearchWorkerManager( + CellType.FILE, + searchTextBean -> { + FileSearchManager.getInstance().getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation()); + return FileSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); + }, + this, + new LoadingRightSearchResultPane() + ); + documentWorkerManager = new SearchWorkerManager( + CellType.DOCUMENT, + searchTextBean -> { + DocumentSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); + return DocumentSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); + }, + this, + new SimpleRightSearchResultPane(new JPanel()) + ); + + pluginSearchWorkerManager = new SearchWorkerManager( + CellType.PLUGIN, + searchTextBean -> { + PluginSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); + return PluginSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); + }, + this, + new LoadingRightSearchResultPane() + ); + + } + + /** + * 初始化全部组件 + */ + private void initComponents() { + + add(createTopPane(), BorderLayout.NORTH); + initSearchTextField(); + add(createSearchPane(), BorderLayout.CENTER); + add(createShowPane(), BorderLayout.SOUTH); + this.getContentPane().setBackground(Color.WHITE); + this.setIconImage(SEARCH_IMAGE); + this.setSize(AlphaFineConstants.FULL_SIZE); + } + + private JPanel createTopPane() { + JPanel topPane = new JPanel(new BorderLayout()); + topPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + topPane.setBackground(Color.WHITE); + JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + topLeftPane.setBackground(Color.WHITE); + UILabel alphaFineLabel = new UILabel("AlphaFine"); + alphaFineLabel.setFont(new Font("Arial Black", Font.PLAIN, 20)); + alphaFineLabel.setForeground(UIConstants.FLESH_BLUE); + topLeftPane.add(alphaFineLabel); + topPane.add(topLeftPane, BorderLayout.WEST); + + JPanel topRightPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); + topRightPane.setBackground(Color.WHITE); + JPanel tipPane = new JPanel(new BorderLayout()); + tipPane.setBackground(Color.WHITE); + String toolTip = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts()); + tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); + tipIconLabel.addMouseListener(tipMouseListener); + tipIconLabel.setToolTipText(toolTip); + useTipLabel = new UILabel(SKILLS); + useTipLabel.addMouseListener(tipMouseListener); + useTipLabel.setToolTipText(toolTip); + useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + tipPane.add(tipIconLabel, BorderLayout.WEST); + tipPane.add(useTipLabel, BorderLayout.CENTER); + topRightPane.add(tipPane); + UIButton minimizeButton = createButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/minimize.svg")); + minimizeButton.addActionListener(e -> AlphaFineFrame.this.setExtendedState(JFrame.ICONIFIED)); + topRightPane.add(minimizeButton); + UIButton closeButton = createButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/close.svg")); + closeButton.addActionListener(e -> AlphaFineFrame.this.dispose()); + topRightPane.add(closeButton); + topPane.add(topRightPane, BorderLayout.EAST); + return topPane; + } + + private MouseAdapter tipMouseListener = new MouseAdapter() { + + @Override + public void mouseEntered(MouseEvent e) { + useTipLabel.setForeground(UIConstants.FLESH_BLUE); + tipIconLabel.setIcon(AlphaFineConstants.BLUE_BULB_ICON); + } + + @Override + public void mouseExited(MouseEvent e) { + useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); + } + }; + + private JPanel createSearchPane() { + JPanel searchPane = new JPanel(new BorderLayout()); + searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + searchPane.add(searchTextField, BorderLayout.CENTER); + JButton searchButton = new JButton(SEARCH) { + @Override + public void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setColor(UIConstants.FLESH_BLUE); + g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 4, 4); + super.paintComponent(g2d); + } + }; + searchButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fireSearch(); + } + }); + searchButton.setPreferredSize(new Dimension(70, 60)); + searchButton.setForeground(Color.WHITE); + searchButton.setBorderPainted(false); + searchButton.setContentAreaFilled(false); + searchPane.add(searchButton, BorderLayout.EAST); + searchPane.setBackground(Color.WHITE); + return searchPane; + } + + private JPanel createShowPane() { + JPanel showPane = new JPanel(new BorderLayout()); + resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); + resultPane.add(new NoResultPane(NO_SEARCH_RESULT, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); + resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None()); + resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); + resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None()); + resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON, generateMap()), CellType.DOCUMENT.getFlagStr4None()); + + JPanel labelPane = new JPanel(new BorderLayout()); + labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + labelPane.setBackground(Color.WHITE); + JPanel labelContentPane = new JPanel(new BorderLayout()); + UILabel tabLabel = new UILabel(PRODUCT_NEWS); + tabLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + tabLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + tabLabel.setPreferredSize(new Dimension(100, 30)); + JPanel westPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + westPane.add(tabLabel); + labelContentPane.add(westPane, BorderLayout.WEST); + JPanel eastPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + UILabel readLabel = new UILabel(ONE_CLICK_READ); + readLabel.setHorizontalAlignment(SwingConstants.RIGHT); + readLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));; + readLabel.setPreferredSize(new Dimension(100, 30)); + readLabel.setForeground(UIConstants.FLESH_BLUE); + readLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); + Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); + for (ProductNews productNews : productNewsList) { + readSet.add(productNews.getId()); + } + showPane.repaint(); + } + }); + eastPane.add(readLabel); + labelContentPane.add(eastPane, BorderLayout.EAST); + labelContentPane.setBackground(new Color(245, 245, 247)); + labelPane.add(labelContentPane); + labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, 30)); + + JPanel tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); + tabPane.setBackground(Color.WHITE); + List selectedLabelList = new ArrayList<>(); + AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); + if (alphaFineConfigManager.isProductDynamics()) { + selectedLabelList.add(new SelectedLabel(PRODUCT_NEWS, CellType.PRODUCT_NEWS, true)); + } + if (alphaFineConfigManager.isContainAction()) { + selectedLabelList.add(new SelectedLabel(SETTING, CellType.ACTION)); + } + if (alphaFineConfigManager.isContainFileContent() || alphaFineConfigManager.isContainTemplate()) { + selectedLabelList.add(new SelectedLabel(TEMPLATES, CellType.FILE)); + } + if (alphaFineConfigManager.isContainDocument()) { + selectedLabelList.add(new SelectedLabel(HELP, CellType.DOCUMENT)); + } + if (alphaFineConfigManager.isContainPlugin()) { + selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN)); + } + selectedType = selectedLabelList.get(0).getCellType(); + for (SelectedLabel selectedLabel : selectedLabelList) { + + selectedLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + for (SelectedLabel label : selectedLabelList) { + label.setSelected(false); + } + selectedLabel.setSelected(true); + tabLabel.setText(selectedLabel.getText()); + readLabel.setVisible(false); + tabPane.repaint(); + switch (selectedLabel.getCellType()) { + case PRODUCT_NEWS: + readLabel.setVisible(true); + switchType(CellType.PRODUCT_NEWS); + break; + case ACTION: + switchType(CellType.ACTION); + currentSearchWorkerManager = settingSearchWorkerManager; + break; + case FILE: + switchType(CellType.FILE); + currentSearchWorkerManager = fileSearchWorkerManager; + break; + case DOCUMENT: + switchType(CellType.DOCUMENT); + currentSearchWorkerManager = documentWorkerManager; + break; + case PLUGIN: + switchType(CellType.PLUGIN); + currentSearchWorkerManager = pluginSearchWorkerManager; + break; + } + if (currentSearchWorkerManager != null) { + AlphaFineList alphaFineList = currentSearchWorkerManager.getSearchResultList(); + if (alphaFineList != null) { + alphaFineList.setSelectedIndex(0); + } + } + } + }); + tabPane.add(selectedLabel); + } + showPane.add(tabPane, BorderLayout.NORTH); + showPane.add(labelPane, BorderLayout.CENTER); + showPane.add(resultPane, BorderLayout.SOUTH); + return showPane; + } + + // todo 暂无 先做测试 + private Map generateMap() { + Map linkMap = new LinkedHashMap<>(); + linkMap.put("test", "https://www.baidu.com"); + linkMap.put("test1", "https://www.baidu.com"); + linkMap.put("test2", "https://www.baidu.com"); + linkMap.put("test3", "https://www.baidu.com"); + linkMap.put("test4", "https://www.baidu.com"); + linkMap.put("test5", "https://www.baidu.com"); + return linkMap; + } + + private void switchType(CellType cellType) { + this.selectedType = cellType; + if (StringUtils.isEmpty(searchTextField.getText())) { + cardLayout.show(resultPane, cellType.getFlagStr4None()); + } else { + cardLayout.show(resultPane, cellType.getFlagStr4Result()); + checkSearchResult(); + } + + } + + private void checkSearchResult() { + if (currentSearchWorkerManager == null) { + return; + } + searchResultList = currentSearchWorkerManager.getSearchResultList(); + if (searchResultList != null) { + searchResultList.requestFocus(); + } + boolean hasSearchResult = true; + if (selectedType == CellType.PRODUCT_NEWS) { + hasSearchResult = productNewsSearchWorkerManager.hasSearchResult(); + } else { + hasSearchResult = currentSearchWorkerManager.hasSearchResult(); + } + + if (!hasSearchResult) { + cardLayout.show(resultPane, CellType.NO_RESULT.getFlagStr4None()); + } + + } + + private void initSearchTextField() { + searchTextField = new AlphaFineTextField(PLACE_HOLDER); + initTextFieldListener(); + searchTextField.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); + searchTextField.setBackground(Color.WHITE); + searchTextField.setPreferredSize(new Dimension(300, 60)); + } + + + private void initTextFieldListener() { + searchTextField.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + // 搜索提示框 + if (StringUtils.isNotEmpty(searchTextField.getText())) { + SearchTooltipPopup.getInstance().show(searchTextField); + } + AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (!alphaFineToolTipList.isSelectionEmpty()) { + fireSearch(alphaFineToolTipList.getSelectedValue()); + return; + } + fireSearch(); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (alphaFineToolTipList.getSelectedIndex() == alphaFineToolTipList.getModel().getSize() - 1) { + alphaFineToolTipList.setSelectedIndex(0); + } + alphaFineToolTipList.setSelectedIndex(alphaFineToolTipList.getSelectedIndex() + 1); + } else if (e.getKeyCode() == KeyEvent.VK_UP) { + alphaFineToolTipList.setSelectedIndex(alphaFineToolTipList.getSelectedIndex() - 1); + } + + } + }); + + searchTextField.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + if (StringUtils.isNotEmpty(searchTextField.getText())) { + SearchTooltipPopup.getInstance().show(searchTextField); + } + } + + @Override + public void focusLost(FocusEvent e) { + if (e.getOppositeComponent() != SearchTooltipPopup.getInstance().getAlphaFineToolTipList()) { + SearchTooltipPopup.getInstance().hide(); + } + } + }); + + startSearchTextFieldTimer(); + + } + + private void startSearchTextFieldTimer() { + Timer timer = new Timer(TIMER_DELAY, e -> { + if (StringUtils.isEmpty(searchTextField.getText())) { + SearchTooltipPopup.getInstance().hide(); + switchType(selectedType); + } + else if (searchTextField.hasFocus()) { + SearchTooltipPopup.getInstance().show(searchTextField); + } + + }); + timer.start(); + } + + public void fireSearch(String text) { + searchTextField.setText(text); + fireSearch(); + } + + private void fireSearch() { + // 焦点转移 + AlphaFineFrame.this.requestFocus(); + if (ComparatorUtils.equals(beforeSearchStr, searchTextField.getText())) { + return; + } + if (StringUtils.isEmpty(searchTextField.getText())) { + beforeSearchStr = StringUtils.EMPTY; + return; + } + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) { + //是高级搜索 + if (searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)) { + segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(searchTextField.getText().toLowerCase())); + } + //是普通搜索 + else { + segmentationResult = SegmentationManager.getInstance().startSegmentation(searchTextField.getText().toLowerCase()); + } + } else { + if (StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))) { + segmentationResult = null; + } else { + segmentationResult = new String[]{getRealSearchText(searchTextField.getText())}; + } + } + DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getHistorySearch().push(searchTextField.getText()); + doSearch(searchTextField.getText().toLowerCase()); + beforeSearchStr = searchTextField.getText(); + SearchTooltipPopup.getInstance().hide(); + } + + private void dealWithSearchResult() { + final AlphaCellModel model = searchResultList.getSelectedValue(); + if (model != null) { + model.doAction(); + } + } + + public void showResult(String flag) { + cardLayout.show(resultPane, flag); + } + + public void addResult(JPanel panel, String flag) { + resultPane.add(panel, flag); + } + + + + private void doSearch(String text) { + SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); + this.productNewsSearchWorkerManager.doSearch(searchTextBean); + this.settingSearchWorkerManager.doSearch(searchTextBean); + this.fileSearchWorkerManager.doSearch(searchTextBean); + this.documentWorkerManager.doSearch(searchTextBean); + this.pluginSearchWorkerManager.doSearch(searchTextBean); + } + + + public CellType getSelectedType() { + return selectedType; + } + + public void setStoreText(String storeText) { + this.storeText = storeText; + } + + /** + * 截取字符串中关键词 + * + * @param searchText + * @return + */ + private String getStoreText(String searchText) { + //这里也需要先做一个去除不需要空格的处理 + setStoreText((searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1)).replaceAll(StringUtils.BLANK, StringUtils.EMPTY)); + return storeText; + } + + + /** + * 去除特殊字符,空格等 + */ + private String getRealSearchText(String searchText) { + searchText = searchText.toLowerCase(); + Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX); + Matcher m = p.matcher(searchText); + searchText = m.replaceAll(StringUtils.EMPTY).trim().replaceAll(StringUtils.BLANK, StringUtils.EMPTY); + if (searchText.length() == 0) { + return null; + } + return searchText; + } + + private UIButton createButton(Icon icon) { + UIButton button = new UIButton() { + @Override + public void paintComponent(Graphics g) { + g.setColor(Color.WHITE); + g.fillRect(0, 0, getSize().width, getSize().height); + super.paintComponent(g); + } + }; + button.setPreferredSize(new Dimension(20, 20)); + button.setIcon(icon); + button.set4ToolbarButton(); + button.setBorderPainted(false); + button.setRolloverEnabled(false); + return button; + } + + /** + * 设置面板位置 + * + * @param win + */ + private void centerWindow(Window win) { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + + Dimension winSize = win.getSize(); + + if (winSize.height > screenSize.height) { + winSize.height = screenSize.height; + } + if (winSize.width > screenSize.width) { + winSize.width = screenSize.width; + } + //这里设置位置:水平居中,竖直偏上 + win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / AlphaFineConstants.SHOW_SIZE); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + QuestionWindow.getInstance().setVisible(!b); + } + + @Override + public void dispose() { + super.dispose(); + AlphaFineHelper.resetAlphaFineDialog(); + QuestionWindow.getInstance().setVisible(true); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java new file mode 100644 index 000000000..bdd630c14 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -0,0 +1,72 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.preview.ResultShowPane; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JList; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/18 + */ +public class AlphaFineList extends JList { + + private ResultShowPane resultShowPane; + + public AlphaFineList() { + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + AlphaCellModel selectedValue = getSelectedValue(); + if (e.getClickCount() == 2 && selectedValue.hasAction()) { + dealWithSearchResult(); + } + } + }); + + addListSelectionListener(e -> { + if (!e.getValueIsAdjusting() && getSelectedValue() != null) { + if (resultShowPane != null) { + resultShowPane.showResult(getSelectedValue()); + } + } + }); + + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + dealWithSearchResult(); + } + } + }); + } + + public void setResultShowPane(ResultShowPane resultShowPane) { + this.resultShowPane = resultShowPane; + } + + @Override + public void setSelectedIndex(int index) { + super.setSelectedIndex(index); + AlphaCellModel alphaCellModel = getSelectedValue(); + if (resultShowPane != null && alphaCellModel != null) { + resultShowPane.showResult(getSelectedValue()); + } + ensureIndexIsVisible(getSelectedIndex()); + } + + private void dealWithSearchResult() { + final AlphaCellModel model = this.getSelectedValue(); + if (model != null) { + model.doAction(); + } + } + + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 74c4d6d34..06c9ff0c1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -31,7 +31,7 @@ public class AlphaFinePane extends BasicPane { setLayout(new BorderLayout()); UIButton refreshButton = new UIButton(); refreshButton.setIcon(IOUtils.readIcon(("/com/fr/design/mainframe/alphafine/images/smallsearch.png"))); - refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine")); + refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); refreshButton.set4ToolbarButton(); refreshButton.setRolloverEnabled(false); this.add(refreshButton); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java index ba4d279fb..cfb49caf5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java @@ -1,8 +1,9 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.report.web.button.Image; - +import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; @@ -13,6 +14,8 @@ import java.awt.RenderingHints; */ public class AlphaFineTextField extends UITextField { + private static final Color BORDER_COLOR = new Color(232, 232, 233); + private String placeHolder; private Image image; @@ -36,8 +39,14 @@ public class AlphaFineTextField extends UITextField { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2.setColor(super.getDisabledTextColor()); - g2.drawString(placeHolder, getInsets().left, g.getFontMetrics().getMaxAscent() + getInsets().top + 15); + g2.setColor(AlphaFineConstants.FOREGROUND_COLOR_5); + g2.drawString(placeHolder, getInsets().left, g.getFontMetrics().getMaxAscent() + getInsets().top + 6); + } + + @Override + protected void paintBorder(Graphics g) { + g.setColor(BORDER_COLOR); + g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); } public Image getImage() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java new file mode 100644 index 000000000..1b439f1a8 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.base.svg.IconUtils; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class AlphaFineToolTipContentCellRender implements ListCellRenderer { + + private static final Color SELECTED_COLOR = new Color(65, 155, 249, 26); + + private static final Icon HOT_SEARCH_ICON = IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/hot_search.svg"); + + private static final Icon SEARCH_ICON = IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/search.svg"); + + private static final Icon HISTORY_SEARCH_ICON = IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/history_search.svg"); + + + @Override + public Component getListCellRendererComponent(JList list, String value, int index, + boolean isSelected, boolean cellHasFocus) { + + if (StringUtils.isEmpty(value)) { + return new LineCellRender().getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } + + JPanel panel = new JPanel(new BorderLayout()); + panel.setBackground(null); + + UILabel iconLabel = new UILabel(); + iconLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 0)); + iconLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + iconLabel.setText(value); + if (ComparatorUtils.equals(value, AlphaFineConstants.HOT_SEARCH)) { + iconLabel.setIcon(HOT_SEARCH_ICON); + } else if (AlphaFineConstants.HOT_SEARCH_SET.contains(value)) { + iconLabel.setIcon(SEARCH_ICON); + } else { + iconLabel.setIcon(HISTORY_SEARCH_ICON); + } + + if (isSelected && !ComparatorUtils.equals(value, AlphaFineConstants.HOT_SEARCH)) { + iconLabel.setText(AlphaFineUtil.highLightModelName(value, new String[]{value})); + panel.setBackground(SELECTED_COLOR); + } + panel.add(iconLabel, BorderLayout.WEST); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + panel.setPreferredSize(new Dimension(640, 32)); + + return panel; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java new file mode 100644 index 000000000..3d3333772 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java @@ -0,0 +1,42 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.general.ComparatorUtils; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JList; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class AlphaFineToolTipList extends JList { + + public AlphaFineToolTipList() { + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + AlphaFineHelper.getAlphaFineDialog().fireSearch(getSelectedValue()); + } + } + }); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + if (ComparatorUtils.equals(getSelectedValue(), AlphaFineConstants.HOT_SEARCH)) { + return; + } + AlphaFineHelper.getAlphaFineDialog().fireSearch(getSelectedValue()); + } + } + }); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java new file mode 100644 index 000000000..b07d506b8 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java @@ -0,0 +1,63 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.stable.StringUtils; +import java.awt.Color; +import java.awt.Dimension; +import java.util.Stack; +import javax.swing.DefaultListModel; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class AlphaSearchTooltipPane extends JPanel { + + private AlphaFineToolTipList alphaFineToolTipList; + + public AlphaSearchTooltipPane() { + alphaFineToolTipList = new AlphaFineToolTipList(); + alphaFineToolTipList.setCellRenderer(new AlphaFineToolTipContentCellRender()); + alphaFineToolTipList.setModel(getDefaultListModel()); + UIScrollPane scrollPane = new UIScrollPane(alphaFineToolTipList); + scrollPane.setBorder(null); + scrollPane.setBackground(Color.WHITE); + this.add(scrollPane); + this.setPreferredSize(new Dimension(640, 250)); + this.setBackground(Color.WHITE); + } + + public AlphaFineToolTipList getAlphaFineToolTipList() { + return alphaFineToolTipList; + } + + private DefaultListModel getDefaultListModel() { + DefaultListModel defaultListModel = new DefaultListModel<>(); + defaultListModel.addElement(AlphaFineConstants.HOT_SEARCH); + for (String content : AlphaFineConstants.HOT_SEARCH_SET) { + defaultListModel.addElement(content); + } + return defaultListModel; + } + + public void refreshHistory() { + Stack stack = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getHistorySearch(); + if (stack.isEmpty()) { + return; + } + DefaultListModel defaultListModel = new DefaultListModel<>(); + for (int i = stack.size() - 1; i >= 0; i--) { + defaultListModel.addElement(stack.get(i)); + } +// defaultListModel.addElement(StringUtils.EMPTY); + defaultListModel.addElement(AlphaFineConstants.HOT_SEARCH); + for (String content : AlphaFineConstants.HOT_SEARCH_SET) { + defaultListModel.addElement(content); + } + alphaFineToolTipList.setModel(defaultListModel); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/LineCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/LineCellRender.java new file mode 100644 index 000000000..9158cb045 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/LineCellRender.java @@ -0,0 +1,32 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ilable.UILabel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class LineCellRender implements ListCellRenderer { + + @Override + public Component getListCellRendererComponent(JList list, String value, int index, + boolean isSelected, boolean cellHasFocus) { + JPanel panel = new JPanel(new BorderLayout()); + UILabel splitLabel = new UILabel(); + panel.setBackground(null); + splitLabel.setBackground(UIConstants.BARNOMAL); + splitLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5,0)); + panel.setPreferredSize(new Dimension(640, 1)); + panel.add(splitLabel); + return panel; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java new file mode 100644 index 000000000..7ef00e6ba --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java @@ -0,0 +1,79 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.utils.DesignUtils; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.text.SimpleDateFormat; +import javax.swing.BorderFactory; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/19 + */ +public class ProductNewsContentCellRender implements ListCellRenderer { + + private static final String FINE_REPORT = "FineReport"; + + private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); + + private String[] segmentationResult; + + public ProductNewsContentCellRender(String[] segmentationResult) { + this.segmentationResult = segmentationResult; + } + + public ProductNewsContentCellRender() { + this(null); + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + ProductNews productNews = (ProductNews) value; + JPanel panel = new JPanel(new BorderLayout()); + panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + panel.setBackground(Color.WHITE); + + panel.add(new ProductNewsImagePanel(productNews), BorderLayout.WEST); + JPanel textPane = new JPanel(new BorderLayout()); + textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0)); + UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult)); + titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20)); + + textPane.add(titleLabel, BorderLayout.NORTH); + JPanel infoPane = new JPanel(new BorderLayout()); + UILabel productLabel = new UILabel(FINE_REPORT) { + @Override + protected void paintComponent(Graphics g) { + g.setColor(AlphaFineConstants.BACKGROUND_COLOR); + g.fillRect(0, getHeight() - 27, getWidth(), 23); + super.paintComponent(g); + } + }; + productLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + infoPane.add(productLabel, BorderLayout.WEST); + + UILabel dateLabel = new UILabel(DATE_FORMAT.format(productNews.getPushDate())); + dateLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + dateLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + infoPane.setBackground(Color.WHITE); + infoPane.add(dateLabel, BorderLayout.CENTER); + textPane.setBackground(Color.WHITE); + textPane.add(infoPane, BorderLayout.CENTER); + panel.add(textPane, BorderLayout.CENTER); + panel.setPreferredSize(new Dimension(500, 80)); + return panel; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java new file mode 100644 index 000000000..69ed4eaed --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -0,0 +1,76 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.base.GraphHelper; +import com.fr.base.svg.SVGLoader; +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; + +import java.awt.RenderingHints; +import java.awt.geom.RoundRectangle2D; +import java.util.Set; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/15 + */ +public class ProductNewsImagePanel extends JPanel { + + private static final Image NEW_TIP_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/new_tip.svg"); + + private static final int BACKGROUND_HEIGHT = 20; + + private static final Color BACKGROUND_COLOR = new Color(116, 181, 249); + + private ProductNews productNews; + + private int width = 200; + private int height = 150; + + public ProductNewsImagePanel(ProductNews productNews) { + this.productNews = productNews; + } + + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); +// g2.setComposite(AlphaComposite.Src); +// g2.fill(new RoundRectangle2D.Float(0, 0, getWidth(), getHeight(), 5, 5)); +// g2.setComposite(AlphaComposite.SrcAtop); + + g2.drawImage(productNews.getImage(), 0, 0, getWidth(), getHeight(), this); + Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); + if (!readSet.contains(productNews.getId())) { + g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); + } + + Color defaultColor = g2.getColor(); + g2.setColor(BACKGROUND_COLOR); + g2.fillRect(0, getHeight() - BACKGROUND_HEIGHT, getWidth(), BACKGROUND_HEIGHT); + g2.setColor(Color.WHITE); + int x = (getWidth() - GraphHelper.getWidth(productNews.getTag().getDesc(), g2.getFont())) / 2; + g2.drawString(productNews.getTag().getDesc(), x, getHeight() - 5); + g2.setColor(defaultColor); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(width, height); + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java new file mode 100644 index 000000000..b681b5622 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java @@ -0,0 +1,48 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.log.FineLoggerFactory; +import java.awt.Desktop; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URI; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.ListModel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/21 + */ +public class ProductNewsList extends JList { + + public ProductNewsList(ListModel dataModel) { + super(dataModel); + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + dealWithClick(); + } + } + }); + } + + public ProductNewsList() { + this(new DefaultListModel<>()); + } + + private void dealWithClick() { + ProductNews productNews = getSelectedValue(); + try { + Desktop.getDesktop().browse(new URI(productNews.getUrl())); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet().add(productNews.getId()); + AlphaFineHelper.getAlphaFineDialog().repaint(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java new file mode 100644 index 000000000..3520cd6c3 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.gui.icontainer.UIScrollPane; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/21 + */ +public class ProductNewsSearchResultPane extends JPanel { + + private ProductNewsList productNewsList; + + public ProductNewsSearchResultPane(String[] segmentationResult) { + + productNewsList = new ProductNewsList(); + UIScrollPane scrollPane = new UIScrollPane(productNewsList); + scrollPane.setBackground(Color.WHITE); + scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult)); + this.setLayout(new BorderLayout()); + this.setBackground(Color.WHITE); + this.add(scrollPane); + this.setPreferredSize(new Dimension(680, 305)); + } + + public ProductNewsList getProductNewsList() { + return productNewsList; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java new file mode 100644 index 000000000..f6948a57d --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchListModel.java @@ -0,0 +1,126 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.model.SearchResult; +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/18 + */ +public class SearchListModel extends DefaultListModel { + + private static final int MAX_SHOW_SIZE = 12; + private static final long serialVersionUID = 7230585307439551228L; + + + private SearchResult myDelegate; + + /** + * 第一有效的项是否被选中 + */ + private boolean isValidSelected; + + private UIScrollPane leftSearchResultPane; + + private AlphaFineList searchResultList; + + public SearchListModel(SearchResult searchResult, AlphaFineList searchResultList, UIScrollPane leftSearchResultPane) { + this.myDelegate = searchResult; + this.searchResultList = searchResultList; + this.leftSearchResultPane = leftSearchResultPane; + } + + @Override + public void addElement(AlphaCellModel element) { + AlphaFineHelper.checkCancel(); + int index = myDelegate.size(); + myDelegate.add(element); + fireContentsChanged(this, index, index); + fireSelectedStateChanged(element, index); + + } + + @Override + protected void fireContentsChanged(Object source, int index0, int index1) { + if (myDelegate.size() > MAX_SHOW_SIZE) { + leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2)); + } else { + leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + } + super.fireContentsChanged(source, index0, index1); + } + + /** + * 触发选中第一有效的项 + * + * @param element + * @param index + */ + private void fireSelectedStateChanged(AlphaCellModel element, int index) { + if (element.hasAction() && !isValidSelected()) { + searchResultList.setSelectedIndex(index); + setValidSelected(true); + } + } + + @Override + public AlphaCellModel getElementAt(int index) { + return myDelegate.get(index); + } + + @Override + public void add(int index, AlphaCellModel element) { + myDelegate.add(index, element); + fireIntervalAdded(this, index, index); + } + + @Override + public AlphaCellModel remove(int index) { + AlphaCellModel object = myDelegate.get(index); + myDelegate.remove(object); + fireContentsChanged(this, index, index); + return object; + } + + @Override + public int getSize() { + return this.myDelegate.size(); + } + + @Override + public void removeAllElements() { + this.myDelegate.clear(); + } + + /** + * 重置选中状态 + */ + public void resetSelectedState() { + setValidSelected(false); + } + + private boolean isValidSelected() { + return isValidSelected; + } + + private void setValidSelected(boolean selected) { + isValidSelected = selected; + } + + @Override + public boolean isEmpty() { + return myDelegate.isEmpty(); + } + + public void resetState() { + for (int i = 0; i < getSize(); i++) { + getElementAt(i).resetState(); + } + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java new file mode 100644 index 000000000..dd65d36a2 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java @@ -0,0 +1,83 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/19 + */ +public class SearchResultContentCellRender implements ListCellRenderer { + + private static final int OFFSET = 45; + private static final String SELECTED_PATH = AlphaFineConstants.IMAGE_URL + "selected"; + private static final String CELL_PATH = AlphaFineConstants.IMAGE_URL + "alphafine"; + private static final String SUFFIX = ".png"; + + private String[] segmentationResult; + + public SearchResultContentCellRender(String[] segmentationResult) { + this.segmentationResult = segmentationResult; + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + + + AlphaCellModel model = (AlphaCellModel) value; + JPanel panel = new JPanel(new BorderLayout()); + panel.setBackground(null); + panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + // 图标icon 样式 + UILabel iconLabel = new UILabel(); + if (isSelected) { + iconLabel.setText(StringUtils.BLANK + model.getName()); + String iconUrl = SELECTED_PATH + model.getType().getTypeValue() + SUFFIX; + panel.setBackground(AlphaFineConstants.BLUE); + iconLabel.setForeground(Color.WHITE); + iconLabel.setIcon(IOUtils.readIcon(iconUrl)); + } else { + iconLabel.setText(AlphaFineUtil.highLightModelName(model.getName(), segmentationResult)); + String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX; + iconLabel.setIcon(IOUtils.readIcon(iconUrl)); + } + iconLabel.setFont(AlphaFineConstants.MEDIUM_FONT); + + + // 内容详情label 样式 + UILabel detailLabel = new UILabel(); + String description = model.getDescription(); + if (StringUtils.isNotBlank(description)) { + detailLabel.setText("-" + description); + detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY); + panel.add(detailLabel, BorderLayout.CENTER); + int width = (int) (iconLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth()); + if (width > AlphaFineConstants.LEFT_WIDTH - OFFSET) { + int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - OFFSET); + iconLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT)); + } + } else { + iconLabel.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH - OFFSET, AlphaFineConstants.CELL_HEIGHT)); + } + + panel.add(iconLabel, BorderLayout.WEST); + panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_HEIGHT)); + return panel; + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java new file mode 100644 index 000000000..05b5a6d49 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java @@ -0,0 +1,51 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.preview.ResultShowPane; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class SearchResultPane extends JPanel { + + private AlphaFineList searchResultList; + + private SearchListModel searchListModel; + + private UIScrollPane leftSearchResultPane; + + + public SearchResultPane(String[] segmentationResult, ResultShowPane rightSearchResultPane) { + searchResultList = new AlphaFineList(); + searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT); + leftSearchResultPane = new UIScrollPane(searchResultList); + leftSearchResultPane.setBorder(null); + leftSearchResultPane.setBackground(Color.WHITE); + leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + searchListModel = new SearchListModel(new SearchResult(), searchResultList, leftSearchResultPane); + searchResultList.setModel(searchListModel); + searchResultList.setCellRenderer(new SearchResultContentCellRender(segmentationResult)); + searchResultList.setResultShowPane(rightSearchResultPane); + this.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); + this.setLayout(new BorderLayout()); + this.add(leftSearchResultPane, BorderLayout.WEST); + this.add(rightSearchResultPane, BorderLayout.EAST); + this.setPreferredSize(new Dimension(680, 305)); + } + + public AlphaFineList getSearchResultList() { + return searchResultList; + } + + public UIScrollPane getLeftSearchResultPane() { + return leftSearchResultPane; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchTooltipPopup.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchTooltipPopup.java new file mode 100644 index 000000000..b3aaa8170 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchTooltipPopup.java @@ -0,0 +1,58 @@ +package com.fr.design.mainframe.alphafine.component; + +import java.awt.Component; +import java.awt.Point; +import javax.swing.Popup; +import javax.swing.PopupFactory; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class SearchTooltipPopup { + + private static final SearchTooltipPopup INSTANCE = new SearchTooltipPopup(); + + public static SearchTooltipPopup getInstance() { + return INSTANCE; + } + + private AlphaSearchTooltipPane alphaSearchTooltipPane; + + private SearchTooltipPopup() { + alphaSearchTooltipPane = new AlphaSearchTooltipPane(); + } + + private boolean showPopup; + + private Popup popup; + + public void show(Component owner) { + if (popup == null || !showPopup) { + PopupFactory pf = PopupFactory.getSharedInstance(); + Point point = owner.getLocationOnScreen(); + alphaSearchTooltipPane.refreshHistory(); + popup = pf.getPopup(owner, alphaSearchTooltipPane, point.x, point.y + owner.getHeight()); + } + if (!showPopup) { + alphaSearchTooltipPane.repaint(); + popup.show(); + getAlphaFineToolTipList().clearSelection(); + showPopup = true; + } + } + + public AlphaFineToolTipList getAlphaFineToolTipList() { + return alphaSearchTooltipPane.getAlphaFineToolTipList(); + } + + public void hide() { + if (popup != null) { + popup.hide(); + } + showPopup = false; + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java new file mode 100644 index 000000000..a7b661dae --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java @@ -0,0 +1,91 @@ +package com.fr.design.mainframe.alphafine.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.design.menu.SnapChatUtil; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.geom.Ellipse2D; +import java.util.List; +import java.util.Set; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/07 + */ +public class SelectedLabel extends UILabel { + + private static final int WIDTH = 4; + private static final int HEIGHT = 4; + private static final int GAP = 2; + + private boolean selected; + private boolean hasRead; + private CellType cellType; + + public SelectedLabel(String text, CellType cellType, boolean selected) { + super(text); + this.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + this.selected = selected; + this.cellType = cellType; + } + + public SelectedLabel(String text, CellType cellType) { + this(text, cellType, false); + } + + @Override + public void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + if (selected) { + g2d.setColor(UIConstants.FLESH_BLUE); + setForeground(UIConstants.FLESH_BLUE); + g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); + } else { + setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + } + + + if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) { + Color oldColor = g.getColor(); + g2d.setColor(Color.RED); + g2d.fillOval(getWidth() - WIDTH, GAP, WIDTH, HEIGHT); + g2d.setColor(oldColor); + } + + super.paintComponent(g); + } + + + public boolean isSelected() { + return selected; + } + + public void setSelected(boolean selected) { + this.selected = selected; + } + + public boolean isHasRead() { + return hasRead; + } + + public void setHasRead(boolean hasRead) { + this.hasRead = hasRead; + } + + public CellType getCellType() { + return cellType; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/ProductNews.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/ProductNews.java new file mode 100644 index 000000000..aea152da2 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/ProductNews.java @@ -0,0 +1,200 @@ +package com.fr.design.mainframe.alphafine.model; + +import com.fr.design.i18n.Toolkit; +import java.awt.Image; +import java.util.Date; + +/** + * 产品动态 + * + * @author hades + * @version 11.0 + * Created by hades on 2022/4/05 + */ +public class ProductNews { + + private long id; + private String title; + + private Tag tag; + private Target target; + + private Status status; + private String url; + private Image image; + + + private Date pushDate; + + /** + * 创建cid的用户 + */ + private int creator; + + public long getId() { + return id; + } + + public ProductNews setId(long id) { + this.id = id; + return this; + } + + public String getTitle() { + return title; + } + + public ProductNews setTitle(String title) { + this.title = title; + return this; + } + + public Tag getTag() { + return tag; + } + + public ProductNews setTag(Tag tag) { + this.tag = tag; + return this; + } + + public Target getTarget() { + return target; + } + + public ProductNews setTarget(Target target) { + this.target = target; + return this; + } + + public Status getStatus() { + return status; + } + + public ProductNews setStatus(Status status) { + this.status = status; + return this; + } + + public String getUrl() { + return url; + } + + public ProductNews setUrl(String url) { + this.url = url; + return this; + } + + public Image getImage() { + return image; + } + + public ProductNews setImage(Image image) { + this.image = image; + return this; + } + + public Date getPushDate() { + return pushDate; + } + + public ProductNews setPushDate(Date pushDate) { + this.pushDate = pushDate; + return this; + } + + public int getCreator() { + return creator; + } + + public ProductNews setCreator(int creator) { + this.creator = creator; + return this; + } + + interface CodeParser { + int getCode(); + } + + public enum Status implements CodeParser { + STOP(0), START(1); + + private final int code; + + Status(int code) { + this.code = code; + } + + @Override + public int getCode() { + return code; + } + + public static Status parseCode(int code) { + for (Status status : values()) { + if (code == status.code) { + return status; + } + } + throw new IllegalArgumentException(); + } + } + + public enum Tag { + SOLUTION(1, Toolkit.i18nText("Fine-Design_Report_AlphaFine_Solution")), + MATERIAL(2, Toolkit.i18nText("Fine-Design_Report_AlphaFine_Material")), + NEW_PRODUCT(3, Toolkit.i18nText("Fine-Design_Report_AlphaFine_New_Product")); + + private final int code; + + private final String desc; + + Tag(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public static Tag parseCode(int code) { + for (Tag tag :values()) { + if (tag.code == code) { + return tag; + } + } + throw new IllegalArgumentException(); + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + } + + public enum Target { + ALL_USER(0); + + private final int code; + + Target(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + + public static Target parseCode(int code) { + for (Target target : values()) { + if (target.code == code) { + return target; + } + } + throw new IllegalArgumentException(); + } + + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java new file mode 100644 index 000000000..d80065177 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java @@ -0,0 +1,79 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.component.ProductNewsContentCellRender; +import com.fr.design.mainframe.alphafine.component.ProductNewsList; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.log.FineLoggerFactory; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JPanel; +import javax.swing.SwingWorker; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/14 + */ +public class DefaultProductNewsPane extends JPanel { + + + private static final String LOADING = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Loading"); + + public DefaultProductNewsPane() { + + setLayout(new BorderLayout()); + JPanel loadingPane = new JPanel(new BorderLayout()); + loadingPane.setBorder(BorderFactory.createEmptyBorder(0, 280, 0, 0)); + loadingPane.add(new UILabel(LOADING)); + loadingPane.setBackground(Color.WHITE); + + this.add(loadingPane); + this.setPreferredSize(new Dimension(680, 305)); + new SwingWorker, Void>() { + + @Override + protected List doInBackground() throws Exception { + return ProductNewsSearchManager.getInstance().getProductNewsList(); + } + + @Override + protected void done() { + DefaultProductNewsPane.this.remove(loadingPane); + try { + DefaultProductNewsPane.this.add(createContentPane(get())); + DefaultProductNewsPane.this.validate(); + DefaultProductNewsPane.this.repaint(); + AlphaFineHelper.getAlphaFineDialog().repaint(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.execute(); + + + } + + private UIScrollPane createContentPane(List productNewsList) { + DefaultListModel productNewsDefaultListModel = new DefaultListModel<>(); + for (ProductNews productNews : productNewsList) { + productNewsDefaultListModel.addElement(productNews); + } + ProductNewsList productNewsJList = new ProductNewsList(productNewsDefaultListModel); + productNewsJList.setBackground(Color.WHITE); + productNewsJList.setCellRenderer(new ProductNewsContentCellRender()); + UIScrollPane scrollPane = new UIScrollPane(productNewsJList); + scrollPane.setBackground(Color.WHITE); + scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + return scrollPane; + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java new file mode 100644 index 000000000..4a2ede608 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -0,0 +1,94 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.utils.DesignUtils; +import com.fr.log.FineLoggerFactory; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.URI; +import java.util.Map; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/13 + */ +public class HelpDocumentNoResultPane extends JPanel { + + private static final String RECOMMEND = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend_For_You"); + + private static final Color DOT_COLOR = new Color(200, 201, 205); + + public HelpDocumentNoResultPane(String title, Icon icon, Map linkMap) { + + setLayout(new BorderLayout()); + add(new NoResultPane(title, icon, 150), BorderLayout.CENTER); + add(createRecommendPane(linkMap), BorderLayout.EAST); + } + + private JPanel createRecommendPane(Map linkMap) { + JPanel wrapRecommendPane = new JPanel(new BorderLayout()); + wrapRecommendPane.setPreferredSize(new Dimension(200, 305)); + JPanel recommendPane = new JPanel(); + recommendPane.setLayout(new GridLayout(0, 1)); + recommendPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 130, 0)); + recommendPane.setBackground(Color.WHITE); + recommendPane.add(new UILabel(RECOMMEND)); + for (Map.Entry entry : linkMap.entrySet()) { + recommendPane.add(createListLabel(entry.getKey(), entry.getValue())); + } + // 分割线 + JSeparator sep = new JSeparator(); + sep.setOrientation(JSeparator.VERTICAL); + sep.setLayout(new GridLayout(0, 1)); + sep.setPreferredSize(new Dimension(1, 285)); + sep.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + sep.add(new UILabel()); + wrapRecommendPane.add(sep, BorderLayout.WEST); + wrapRecommendPane.add(recommendPane, BorderLayout.CENTER); + return wrapRecommendPane; + } + + private JPanel createListLabel(String text, String link) { + UILabel listLabel = new UILabel(String.format("%s", text)); + listLabel.setForeground(UIConstants.FLESH_BLUE); + listLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + listLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + try { + Desktop.getDesktop().browse(URI.create(link)); + } catch (IOException exception) { + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + } + } + }); + + JPanel listPane = new JPanel(new BorderLayout()); + listPane.setBackground(Color.WHITE); + UILabel dotLabel = new UILabel("·"); + dotLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + dotLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); + dotLabel.setHorizontalAlignment(SwingConstants.LEADING); + dotLabel.setForeground(DOT_COLOR); + listPane.add(dotLabel, BorderLayout.WEST); + listPane.add(listLabel, BorderLayout.CENTER); + listPane.setPreferredSize(new Dimension(100, 20)); + return listPane; + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java new file mode 100644 index 000000000..6201c25e5 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java @@ -0,0 +1,167 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.FileModel; +import com.fr.design.mainframe.alphafine.cell.model.PluginModel; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.LocalExportOperator; +import com.fr.workspace.server.exporter.TemplateExportOperator; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URL; +import java.util.concurrent.ExecutionException; +import javax.imageio.ImageIO; +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.SwingWorker; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/20 + */ +public class LoadingRightSearchResultPane extends ResultShowPane { + + private SwingWorker showWorker; + + public LoadingRightSearchResultPane() { + + this.setBackground(Color.WHITE); + this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); + initLoadingLabel(); + + } + + private void initLoadingLabel() { + UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); + label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0)); + this.add(label, BorderLayout.CENTER); + } + + private void showDefaultPreviewPane() { + this.removeAll(); + initLoadingLabel(); + validate(); + repaint(); + revalidate(); + } + + @Override + public void showResult(AlphaCellModel selectedValue) { + showDefaultPreviewPane(); + checkWorker(); + if (selectedValue.getType() == CellType.FILE) { + fileShowWorker(selectedValue); + } + + if (selectedValue.getType() == CellType.PLUGIN) { + pluginShowWorker(selectedValue); + } + this.showWorker.execute(); + } + + private void fileShowWorker(AlphaCellModel selectedValue) { + this.showWorker = new SwingWorker() { + @Override + protected BufferedImage doInBackground() throws Exception { + final String fileName = ((FileModel) selectedValue).getFilePath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1); + if (fileName.endsWith(ProjectConstants.FRM_SUFFIX)) { + return frmToImage(fileName); + } else if (fileName.endsWith(ProjectConstants.CPT_SUFFIX)) { + return cptToImage(fileName); + } else { + return null; + } + } + + @Override + protected void done() { + if (!isCancelled()) { + LoadingRightSearchResultPane.this.removeAll(); + try { + LoadingRightSearchResultPane.this.add(new FilePreviewPane(get())); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + validate(); + repaint(); + } + } + }; + } + + private void pluginShowWorker(AlphaCellModel selectedValue) { + this.showWorker = new SwingWorker() { + @Override + protected BufferedImage doInBackground() { + BufferedImage bufferedImage = null; + try { + bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); + } catch (IOException e) { + try { + bufferedImage = ImageIO.read(getClass().getResource("/com/fr/design/mainframe/alphafine/images/default_product.png")); + } catch (IOException e1) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + return bufferedImage; + } + + @Override + protected void done() { + try { + if (!isCancelled()) { + LoadingRightSearchResultPane.this.removeAll(); + LoadingRightSearchResultPane.this.add(new PluginPreviewPane((selectedValue).getName(), get(), ((PluginModel) selectedValue).getVersion(), ((PluginModel) selectedValue).getJartime(), ((PluginModel) selectedValue).getType(), ((PluginModel) selectedValue).getPrice())); + validate(); + repaint(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }; + } + + + private BufferedImage frmToImage(String fileName) throws Exception { + byte[] bytes = null; + try { + bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportFormAsImageData(fileName); + } catch (Exception ignored) { + // 兼容下老版本 + bytes = new LocalExportOperator().exportFormAsImageData(fileName); + } + return TemplateExportOperator.byteDataToImage(bytes); + } + + + private BufferedImage cptToImage(String fileName) throws Exception { + byte[] bytes = null; + try { + bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportWorkBookAsImageData(fileName); + } catch (Exception ignored) { + // 兼容下老版本 + bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName); + } + return TemplateExportOperator.byteDataToImage(bytes); + } + + + private void checkWorker() { + if (this.showWorker != null && !this.showWorker.isDone()) { + this.showWorker.cancel(true); + this.showWorker = null; + } + } + + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java index 29a8c1e08..db9282118 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -5,7 +5,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.utils.DesignUtils; +import java.awt.Component; import javax.swing.BorderFactory; +import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; @@ -16,21 +18,29 @@ import java.awt.Dimension; * Created by XiaXiang on 2017/8/14. */ public class NoResultPane extends JPanel { - public NoResultPane(String title, String iconUrl) { + public NoResultPane(String title, Icon icon) { + this(title, icon, AlphaFineConstants.LEFT_WIDTH); + } + + public NoResultPane(String title, Icon icon, int width) { setLayout(new BorderLayout()); setBackground(Color.white); - setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + setPreferredSize(new Dimension(width, 305)); UILabel image = new UILabel(); image.setPreferredSize(new Dimension(150, 111)); image.setHorizontalAlignment(SwingConstants.CENTER); - image.setIcon(IconLoader.getIcon(iconUrl)); - image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); + image.setIcon(icon); + image.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); + add(image, BorderLayout.CENTER); + add(generateDescription(title), BorderLayout.SOUTH); + } + + protected Component generateDescription(String title) { UILabel description = new UILabel(title); description.setForeground(AlphaFineConstants.MEDIUM_GRAY); description.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); description.setHorizontalAlignment(SwingConstants.CENTER); - add(image, BorderLayout.CENTER); - add(description, BorderLayout.SOUTH); + return description; } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java new file mode 100644 index 000000000..1f61342c4 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.dialog.link.MessageWithLink; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.utils.DesignUtils; +import java.awt.Color; +import java.awt.Component; +import javax.swing.BorderFactory; +import javax.swing.Icon; + +/** + * 带跳转链接的无结果面板 + * + * @author hades + * @version 11.0 + * Created by hades on 2022/4/12 + */ +public class NoResultWithLinkPane extends NoResultPane { + + private static final String TAG_A_START = ""; + private static final String TAG_A_END = ""; + + public NoResultWithLinkPane(String title, Icon icon) { + super(title, icon); + } + + @Override + protected Component generateDescription(String title) { + String[] para1 = title.split(TAG_A_START); + String[] para2 = para1[1].split(TAG_A_END); + MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineConstants.ALPHA_GO_TO_FORUM, para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY); + messageWithLink.setBorder(BorderFactory.createEmptyBorder(0, AlphaFineConstants.LEFT_WIDTH - 30, 135, 0)); + return messageWithLink; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ResultShowPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ResultShowPane.java new file mode 100644 index 000000000..7e82fc047 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ResultShowPane.java @@ -0,0 +1,14 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public abstract class ResultShowPane extends JPanel { + + public abstract void showResult(AlphaCellModel selectedValue); +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java new file mode 100644 index 000000000..a85c9eeab --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java @@ -0,0 +1,19 @@ +package com.fr.design.mainframe.alphafine.preview; + +import java.awt.Color; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/21 + */ +public class SearchLoadingPane extends JPanel { + + + public SearchLoadingPane() { + + this.setBackground(Color.WHITE); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java new file mode 100644 index 000000000..6d94bd9ed --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java @@ -0,0 +1,32 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import java.awt.Color; +import java.awt.Dimension; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/20 + */ +public class SimpleRightSearchResultPane extends ResultShowPane { + + public SimpleRightSearchResultPane(JPanel contentPane) { + this.add(contentPane); + this.setBackground(Color.WHITE); + this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); + } + + @Override + public void showResult(AlphaCellModel selectedValue) { + if (selectedValue.getType() == CellType.DOCUMENT) { + this.removeAll(); + this.add(new DocumentPreviewPane((selectedValue).getName(), (selectedValue).getContent())); + validate(); + repaint(); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java new file mode 100644 index 000000000..34075a696 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -0,0 +1,59 @@ +package com.fr.design.mainframe.alphafine.question; + +import com.fr.base.svg.SVGLoader; +import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; +import javax.swing.JPanel; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/15 + */ +public class QuestionPane extends JPanel { + + private static final Image NEW_MESSAGE_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/group_new.svg"); + + private static final Image QUESTION_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/group.svg"); + + private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); + + /** + * 是否全部已读 + */ + private boolean hasRead; + + public QuestionPane(boolean hasRead) { + this.setBackground(new Color(0, 0, 0, 0)); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + if (AlphaFineUtil.unread()) { + g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); + } else { + g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); + g2.drawImage(QUESTION_IMAGE, (getWidth() - QUESTION_IMAGE.getWidth(this)) / 2, (getHeight() - QUESTION_IMAGE.getHeight(this)) / 2, this); + } + + } + + public void setHasRead(boolean hasRead) { + this.hasRead = hasRead; + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(40, 40); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java new file mode 100644 index 000000000..9b7cff7d6 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -0,0 +1,86 @@ +package com.fr.design.mainframe.alphafine.question; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JWindow; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/15 + */ +public class QuestionWindow extends JWindow { + + private static final QuestionWindow INSTANCE = new QuestionWindow(); + private final QuestionPane questionPane = new QuestionPane(true); + private int pressX; + private int pressY; + private QuestionWindow() { + this.setBackground(new Color(0, 0, 0, 0)); + questionPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + AlphaFineHelper.showAlphaFineDialog(true); + } + + @Override + public void mousePressed(MouseEvent e) { + pressX = e.getX(); + pressY = e.getY(); + } + }); + questionPane.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + int left = getLocation().x; + int top = getLocation().y; + setLocation(left + e.getX() - pressX, top + e.getY() - pressY); + } + }); + + DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() { + + @Override + public void windowActivated(WindowEvent e) { + QuestionWindow.getInstance().setVisible(true); + } + + @Override + public void windowDeactivated(WindowEvent e) { + QuestionWindow.getInstance().setVisible(false); + } + + }); + this.getLayeredPane().setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); + this.setContentPane(questionPane); + this.setSize(new Dimension(40, 40)); + this.setLocation(DesignerContext.getDesignerFrame().getWidth() - 100, + DesignerContext.getDesignerFrame().getHeight() - 100); + } + + public static QuestionWindow getInstance() { + return INSTANCE; + } + + public void setHasRead(boolean hasRead) { + this.questionPane.setHasRead(hasRead); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + } + + @Override + public void dispose() { + super.dispose(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java new file mode 100644 index 000000000..fd9a08454 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java @@ -0,0 +1,100 @@ +package com.fr.design.mainframe.alphafine.search; + +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; +import com.fr.design.mainframe.alphafine.component.ProductNewsSearchResultPane; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.log.FineLoggerFactory; +import java.util.List; +import java.util.function.Function; +import javax.swing.DefaultListModel; +import javax.swing.SwingWorker; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/22 + */ +public class ProductNewsSearchWorkerManager implements SearchManager { + + private final CellType cellType; + + private SwingWorker, Void> searchWorker; + + private Function> searchFunction; + + private ProductNewsSearchResultPane searchResultPane; + + private AlphaFineFrame alphaFineFrame; + + private volatile boolean hasSearchResult = true; + + public ProductNewsSearchWorkerManager(CellType cellType, Function> searchFunction, AlphaFineFrame alphaFineFrame) { + this.cellType = cellType; + this.searchFunction = searchFunction; + this.alphaFineFrame = alphaFineFrame; + } + + + + @Override + public void doSearch(SearchTextBean searchTextBean) { + checkSearchWork(); + + if (searchResultPane == null) { + searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation()); + alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); + } + + this.searchWorker = new SwingWorker, Void>() { + @Override + protected DefaultListModel doInBackground() throws Exception { + List productNewsList = searchFunction.apply(searchTextBean); + DefaultListModel productNewsDefaultListModel = new DefaultListModel<>(); + for (ProductNews productNews : productNewsList) { + productNewsDefaultListModel.addElement(productNews); + } + return productNewsDefaultListModel; + } + + @Override + protected void done() { + if (!isCancelled()) { + try { + DefaultListModel productNewsDefaultListModel = get(); + hasSearchResult = !productNewsDefaultListModel.isEmpty(); + searchResultPane.getProductNewsList().setModel(get()); + if (alphaFineFrame.getSelectedType() == cellType) { + if (!hasSearchResult) { + alphaFineFrame.showResult(CellType.NO_RESULT.getFlagStr4None()); + return; + } + alphaFineFrame.showResult(cellType.getFlagStr4Result()); + searchResultPane.getProductNewsList().setSelectedIndex(0); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + }; + this.searchWorker.execute(); + } + + public ProductNewsSearchResultPane getSearchResultPane() { + return searchResultPane; + } + + @Override + public boolean hasSearchResult() { + return hasSearchResult; + } + + private void checkSearchWork() { + if (this.searchWorker != null && !this.searchWorker.isDone()) { + this.searchWorker.cancel(true); + this.searchWorker = null; + } + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java new file mode 100644 index 000000000..8de88a5ad --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe.alphafine.search; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/17 + */ +public interface SearchManager { + + void doSearch(SearchTextBean searchTextBean); + + boolean hasSearchResult(); +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java new file mode 100644 index 000000000..a153f80d0 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java @@ -0,0 +1,119 @@ +package com.fr.design.mainframe.alphafine.search; + +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.CellType; +import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; +import com.fr.design.mainframe.alphafine.component.AlphaFineList; +import com.fr.design.mainframe.alphafine.component.SearchListModel; +import com.fr.design.mainframe.alphafine.component.SearchResultPane; +import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.preview.ResultShowPane; +import com.fr.log.FineLoggerFactory; +import java.util.function.Function; +import javax.swing.SwingWorker; +import org.jetbrains.annotations.Nullable; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/16 + */ +public class SearchWorkerManager implements SearchManager { + + private final CellType cellType; + + private SwingWorker searchWorker; + + private Function searchResultFunction; + + private SearchResultPane searchResultPane; + + private AlphaFineFrame alphaFineFrame; + + private ResultShowPane resultShowPane; + + private volatile boolean hasSearchResult = true; + + + public SearchWorkerManager(CellType cellType, Function function, AlphaFineFrame alphaFineFrame, ResultShowPane resultShowPane) { + this.cellType = cellType; + this.searchResultFunction = function; + this.alphaFineFrame = alphaFineFrame; + this.resultShowPane = resultShowPane; + } + + private void initSearchResult(SearchTextBean searchTextBean) { + if (searchResultPane == null) { + searchResultPane = new SearchResultPane(searchTextBean.getSegmentation(), resultShowPane); + alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); + } + + } + + private void checkSearchWork() { + if (this.searchWorker != null && !this.searchWorker.isDone()) { + this.searchWorker.cancel(true); + this.searchWorker = null; + } + } + + private void initSearchWorker(SearchTextBean searchTextBean) { + this.searchWorker = new SwingWorker() { + @Override + protected SearchListModel doInBackground() throws Exception { + SearchResult searchResult = searchResultFunction.apply(searchTextBean); + SearchListModel searchListModel = new SearchListModel(new SearchResult(), searchResultPane.getSearchResultList(), searchResultPane.getLeftSearchResultPane()); + for (AlphaCellModel object : searchResult) { + AlphaFineHelper.checkCancel(); + searchListModel.addElement(object); + } + return searchListModel; + } + + @Override + protected void done() { + if (!isCancelled()) { + try { + SearchListModel searchListModel = get(); + hasSearchResult = !searchListModel.isEmpty(); + searchResultPane.getSearchResultList().setModel(get()); + if (alphaFineFrame.getSelectedType() == cellType) { + if (!hasSearchResult) { + alphaFineFrame.showResult(CellType.NO_RESULT.getFlagStr4None()); + return; + } + alphaFineFrame.showResult(cellType.getFlagStr4Result()); + searchResultPane.getSearchResultList().setSelectedIndex(0); + searchResultPane.getSearchResultList().requestFocus(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + }; + } + + @Override + public void doSearch(SearchTextBean searchTextBean) { + initSearchResult(searchTextBean); + checkSearchWork(); + initSearchWorker(searchTextBean); + this.searchWorker.execute(); + } + + @Override + public boolean hasSearchResult() { + return hasSearchResult; + } + + @Nullable + public AlphaFineList getSearchResultList() { + if (searchResultPane != null) { + return searchResultPane.getSearchResultList(); + } + return null; + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java new file mode 100644 index 000000000..3c211deeb --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -0,0 +1,75 @@ +package com.fr.design.mainframe.alphafine.search.manager.impl; + +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.general.http.HttpToolbox; +import com.fr.json.JSON; +import com.fr.json.JSONArray; +import com.fr.json.JSONFactory; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.imageio.ImageIO; + +public class ProductNewsSearchManager { + + private static final ProductNewsSearchManager INSTANCE = new ProductNewsSearchManager(); + private List productNewsResultList; + + private List productNewsList = new ArrayList<>(); + + private ProductNewsSearchManager() { + + } + + public static ProductNewsSearchManager getInstance() { + return INSTANCE; + } + + public List getSearchResult(String[] searchText) { + productNewsResultList = new ArrayList<>(); + try { + List productNewsList = getProductNewsList(); + for (ProductNews productNews : productNewsList) { + for (String str : searchText) { + if (productNews.getTitle().contains(str)) { + productNewsResultList.add(productNews); + break; + } + } + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return productNewsResultList; + } + + + public List getProductNewsList() throws Exception { + productNewsList = new ArrayList<>(); + String jsonStr = HttpToolbox.get(AlphaFineConstants.ALPHA_CID); + AlphaFineHelper.checkCancel(); + JSONObject cidJSON = JSONFactory.createJSON(JSON.OBJECT, jsonStr); + JSONArray jsonArray = cidJSON.getJSONArray("data"); + for (int i = 0, size = jsonArray.size(); i < size; i++) { + JSONObject obj = jsonArray.getJSONObject(i); + ProductNews productNews = new ProductNews(). + setId(obj.getLong("id")).setTitle(obj.getString("title")). + setImage(ImageIO.read(new URL(obj.getString("pic")))). + setUrl(obj.getString("url")).setTag(ProductNews.Tag.parseCode(obj.getInt("tag"))). + setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget( + ProductNews.Target.parseCode(obj.getInt("target"))). + setCreator(obj.getInt("creator")).setPushDate(new Date(obj.getLong("push_time"))); + productNewsList.add(productNews); + } + return productNewsList; + } + + public List getCachedProductNewsList() { + return productNewsList; + } +} diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 93d9f98ee..02152beb1 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -59,6 +59,8 @@ import com.fr.design.mainframe.JTemplateEvent; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.question.QuestionWindow; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.design.mainframe.bbs.BBSGuestPane; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.form.FormECCompositeProvider; @@ -142,6 +144,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.swing.SwingWorker; /** * Created by juhaoyu on 2018/1/31. @@ -499,6 +502,25 @@ public class DesignerActivator extends Activator implements Prepare { LoginAuthServer.getInstance().compatibleStart(); }); ContentReplacerCenter.getInstance().register(); + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null param) { + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + // 触发下cid 搜索 + ProductNewsSearchManager.getInstance().getProductNewsList(); + return null; + } + + @Override + protected void done() { + QuestionWindow.getInstance().setVisible(true); + } + }.execute(); + } + }); } private void startLoginAuthServer() { diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/blue_bulb.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/blue_bulb.svg new file mode 100644 index 000000000..6f8d92a46 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/blue_bulb.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bulb.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bulb.svg new file mode 100644 index 000000000..746f1fd61 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bulb.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/close.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/close.svg new file mode 100644 index 000000000..68259ce14 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group.svg new file mode 100644 index 000000000..2c400e245 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg new file mode 100644 index 000000000..af299d12b --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg new file mode 100644 index 000000000..4d1989ea6 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/history_search.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/history_search.svg new file mode 100644 index 000000000..35b5a2e75 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/history_search.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/hot_search.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/hot_search.svg new file mode 100644 index 000000000..35e2a657b --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/hot_search.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/minimize.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/minimize.svg new file mode 100644 index 000000000..76c199416 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/minimize.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/new_tip.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/new_tip.svg new file mode 100644 index 000000000..549e6e50a --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/new_tip.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search.svg new file mode 100644 index 000000000..245d4fa59 --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search.svg @@ -0,0 +1,3 @@ + + + From 936249f207dad39ea376f5feae0ddd1d72232c12 Mon Sep 17 00:00:00 2001 From: hades Date: Sun, 24 Apr 2022 09:45:59 +0800 Subject: [PATCH 20/79] =?UTF-8?q?REPORT-67417=20=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81v1.0=20add=E6=BC=8F=E4=BA=A4=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/SearchTextBean.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java new file mode 100644 index 000000000..f7148363c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java @@ -0,0 +1,37 @@ +package com.fr.design.mainframe.alphafine.search; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/17 + */ +public class SearchTextBean { + + private String searchText; + + /** + * 分词搜索 + */ + private String[] segmentation; + + public SearchTextBean(String searchText, String[] segmentation) { + this.searchText = searchText; + this.segmentation = segmentation; + } + + public String getSearchText() { + return searchText; + } + + public void setSearchText(String searchText) { + this.searchText = searchText; + } + + public String[] getSegmentation() { + return segmentation; + } + + public void setSegmentation(String[] segmentation) { + this.segmentation = segmentation; + } +} From 714994940d4f15273c49162d8c0a80db5bb6b277 Mon Sep 17 00:00:00 2001 From: pengda Date: Sun, 24 Apr 2022 17:30:15 +0800 Subject: [PATCH 21/79] =?UTF-8?q?REPORT-68363=20=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=B3=BB=E5=88=97=E9=97=B4=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E8=BE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/SummaryMethodComboBox.java | 64 +++++++++++++ .../images/buttonicon/ds_column_summary.png | Bin 0 -> 356 bytes .../com/fr/design/chart/ChartDataHelper.java | 69 ++++++++++++++ .../SeriesCondition/ChartConditionPane.java | 7 +- .../ColSelectedWithSummaryMethodEditor.java | 89 ++++++++++++++++++ .../mainframe/chart/gui/ChartOtherPane.java | 2 + .../chart/gui/data/CalculateComboBox.java | 63 +------------ ...anChartCustomPlotConditionAttrTabPane.java | 2 + .../custom/style/VanChartCustomStylePane.java | 2 + .../designer/style/VanChartStylePane.java | 2 + 10 files changed, 241 insertions(+), 59 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/ds_column_summary.png create mode 100644 designer-chart/src/main/java/com/fr/design/chart/ChartDataHelper.java create mode 100644 designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java new file mode 100644 index 000000000..bd57e7ea2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java @@ -0,0 +1,64 @@ +package com.fr.design.data.datapane; + +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.AverageFunction; +import com.fr.data.util.function.CountFunction; +import com.fr.data.util.function.MaxFunction; +import com.fr.data.util.function.MinFunction; +import com.fr.data.util.function.NoneFunction; +import com.fr.data.util.function.SumFunction; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.base.FirstFunction; + +public class SummaryMethodComboBox extends UIComboBox { + public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), + Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; + public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class, + MaxFunction.class, MinFunction.class, CountFunction.class}; + + public SummaryMethodComboBox() { + super(CALCULATE_ARRAY); + setSelectedIndex(2); + } + + public void reset() { + this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")); + } + + /** + * 更新公式选择. + */ + public void populateBean(AbstractDataFunction function) { + for (int i = 0; i < CLASS_ARRAY.length; i++) { + if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { + setSelectedIndex(i); + break; + } + } + } + + /** + * 返回当前选择的公式 + */ + public AbstractDataFunction updateBean() { + try { + int selectIndex = getSelectedIndex(); + if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { + return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance(); + } + } catch (InstantiationException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } catch (IllegalAccessException e) { + FineLoggerFactory.getLogger().error("Function Error"); + return null; + } + + return null; + } +} diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/ds_column_summary.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/ds_column_summary.png new file mode 100644 index 0000000000000000000000000000000000000000..1d7e13aa488b0a1e7d5335632a166d4f01c24c02 GIT binary patch literal 356 zcmV-q0h|7bP)Px$9!W$&R5(wi)5|JHQ547VkCMBAD1&_ zz`)c<6uG4kDMd?rbNWY|?Ao1kR%?CFZ~xZXRsOlEQvDlF(_X;-58Od4qdD!q40uI# zNin+^&VU!JVIDQuLoJ%n7>U?KJ36q4i6Y<$4LCt>g_3{`6=Kt##KPEkpT&CN2&)(=0?yD=at=PalTD2F9i_gn{4$9#19^P{O8)#S zJuCPNU<})Z#I5kH3?ORbGHqZ7GZ82Yh?)T$W+m@X`#2F2 definitionProviderMap = customDefinition.getDefinitionProviderMap(); + return getFieldNames(definitionProviderMap.get(plotType)); + } + return null; + } + + private static String[] getFieldNames(TopDefinitionProvider definition) { + if (definition == null) { + return null; + } + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + TableDataSource tableDataSource = adapter == null ? null : adapter.getBook(); + TableData tableData = null; + if (ComparatorUtils.equals(definition.getDataDefinitionType(), OneValueCDDefinition.DEFINITION_TYPE)) { + OneValueCDDefinition oneValueCDDefinition = (OneValueCDDefinition) definition; + tableData = oneValueCDDefinition.getTableData(); + } else if (ComparatorUtils.equals(definition.getDataDefinitionType(), MoreNameCDDefinition.DEFINITION_TYPE)) { + MoreNameCDDefinition moreNameCDDefinition = (MoreNameCDDefinition) definition; + tableData = moreNameCDDefinition.getTableData(); + } + if (tableData == null) { + return null; + } + return DesignTableDataManager.getSelectedColumnNames(tableDataSource, tableData.getName()); + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java index af44b6331..4085c7f10 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java @@ -7,6 +7,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.LiteConditionPane; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.VariableResolver; import com.fr.design.gui.icombobox.UIComboBox; @@ -17,6 +18,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.type.ConditionKeyType; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; @@ -79,7 +81,10 @@ public class ChartConditionPane extends LiteConditionPane { return this; } }); - conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); + Editor[] editors = ValueEditorPaneFactory.allEditors(); + ColSelectedWithSummaryMethodEditor colSelectedWithSummaryMethodEditor = new ColSelectedWithSummaryMethodEditor(); + Editor[] allEditors = ArrayUtils.add(editors,colSelectedWithSummaryMethodEditor); + conditionValuePane = ValueEditorPaneFactory.createValueEditorPane(allEditors,StringUtils.EMPTY,StringUtils.EMPTY); conditionKeyComboBox.setPreferredSize(new Dimension(175, conditionKeyComboBox.getPreferredSize().height)); conditionOPComboBox.setPreferredSize(new Dimension(80, 20)); Component[][] components = { diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java new file mode 100644 index 000000000..6b6fe08cc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java @@ -0,0 +1,89 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.chartattr.Chart; +import com.fr.data.DSColumnWithSummaryMethod; +import com.fr.design.chart.ChartDataHelper; +import com.fr.design.data.datapane.SummaryMethodComboBox; +import com.fr.design.editor.editor.Editor; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import java.awt.Dimension; +import javax.swing.DefaultComboBoxModel; + +public class ColSelectedWithSummaryMethodEditor extends Editor { + private UIComboBox columnNameComboBox = new UIComboBox(); + private SummaryMethodComboBox summaryMethodComboBox; + private static DefaultComboBoxModel columnNameComboBoxModel = new DefaultComboBoxModel<>(); + private static DefaultComboBoxModel summaryMethodComboBoxModel = new DefaultComboBoxModel<>(SummaryMethodComboBox.CALCULATE_ARRAY); + + public ColSelectedWithSummaryMethodEditor() { + this.setName(Toolkit.i18nText("Fine-Design_Chart_Summary_Array")); + this.setLayout(FRGUIPaneFactory.createLeftZeroLayout()); + if (columnNameComboBox == null) { + columnNameComboBox = new UIComboBox(); + } + columnNameComboBox.setPreferredSize(new Dimension(82, 20)); + this.add(columnNameComboBox); + summaryMethodComboBox = new SummaryMethodComboBox(); + summaryMethodComboBox.setModel(summaryMethodComboBoxModel); + summaryMethodComboBox.setPreferredSize(new Dimension(82, 20)); + this.add(summaryMethodComboBox); + columnNameComboBox.setModel(columnNameComboBoxModel); + } + + public static void refreshCommonChartFieldNames(Chart chart) { + String[] columnNames = ChartDataHelper.getCommonChartFieldNames(chart); + refreshComboBoxModel(columnNames); + } + + public static void refreshCustomChartTableFieldNames(Chart chart, CustomPlotType plotType) { + String[] columnNames = ChartDataHelper.getCustomChartTableFieldNames(chart, plotType); + refreshComboBoxModel(columnNames); + } + + private static void refreshComboBoxModel(String[] columnNames) { + if (columnNames != null) { + columnNameComboBoxModel.removeAllElements(); + for (String columnName : columnNames) { + columnNameComboBoxModel.addElement(columnName); + } + for (String method : SummaryMethodComboBox.CALCULATE_ARRAY) { + summaryMethodComboBoxModel.addElement(method); + } + } else { + columnNameComboBoxModel.removeAllElements(); + summaryMethodComboBoxModel.removeAllElements(); + } + } + + public String getIconName() { + return "ds_column_summary"; + } + + @Override + public DSColumnWithSummaryMethod getValue() { + if (columnNameComboBox.getSelectedItem() == null || summaryMethodComboBox.getSelectedItem() == null) { + return null; + } + DSColumnWithSummaryMethod dsColumnWithSummaryMethod = new DSColumnWithSummaryMethod(); + dsColumnWithSummaryMethod.setFieldName(columnNameComboBox.getSelectedItem().toString()); + dsColumnWithSummaryMethod.setDataFunction(summaryMethodComboBox.updateBean()); + return dsColumnWithSummaryMethod; + } + + @Override + public void setValue(DSColumnWithSummaryMethod value) { + if (value != null) { + columnNameComboBox.setSelectedItem(value.getFieldName()); + summaryMethodComboBox.setSelectedItem(value.getDataFunction()); + } + } + + @Override + public boolean accept(Object object) { + return object instanceof DSColumnWithSummaryMethod; + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java index 4bc363306..36bc56d6b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chartx.config.info.constant.ConfigType; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.series.SeriesCondition.ColSelectedWithSummaryMethodEditor; import com.fr.design.dialog.BasicPane; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.ChartEditPane; @@ -112,6 +113,7 @@ public class ChartOtherPane extends AbstractChartAttrPane { interactivePane.populateBean(chart); if (ChartOtherPane.this.isHaveCondition()) { VanChartRichEditorPane.refreshCommonChartFieldNames(chart); + ColSelectedWithSummaryMethodEditor.refreshCommonChartFieldNames(chart); conditionAttrPane.populateBean(chart); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java index a1ad22312..61a906a3f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java @@ -1,17 +1,6 @@ package com.fr.design.mainframe.chart.gui.data; -import com.fr.data.util.function.AbstractDataFunction; -import com.fr.data.util.function.AverageFunction; -import com.fr.data.util.function.CountFunction; -import com.fr.data.util.function.MaxFunction; -import com.fr.data.util.function.MinFunction; -import com.fr.data.util.function.NoneFunction; -import com.fr.data.util.function.SumFunction; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.i18n.Toolkit; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.plugin.chart.base.FirstFunction; +import com.fr.design.data.datapane.SummaryMethodComboBox; /** @@ -20,53 +9,11 @@ import com.fr.plugin.chart.base.FirstFunction; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-1-8 上午09:52:15 */ -public class CalculateComboBox extends UIComboBox { - - public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), - Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), - Toolkit.i18nText("Fine-Design_Chart_Data_Function_Max"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Min"), - Toolkit.i18nText("Fine-Design_Chart_Data_Function_Count")}; - public static final Class[] CLASS_ARRAY = {FirstFunction.class, NoneFunction.class, SumFunction.class, AverageFunction.class, - MaxFunction.class, MinFunction.class, CountFunction.class}; +public class CalculateComboBox extends SummaryMethodComboBox { + public static final String[] CALCULATE_ARRAY = SummaryMethodComboBox.CALCULATE_ARRAY; + public static final Class[] CLASS_ARRAY = SummaryMethodComboBox.CLASS_ARRAY; public CalculateComboBox() { - super(CALCULATE_ARRAY); - setSelectedIndex(2); - } - - public void reset() { - this.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum")); - } - - /** - * 更新公式选择. - */ - public void populateBean(AbstractDataFunction function) { - for (int i = 0; i < CLASS_ARRAY.length; i++) { - if (function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { - setSelectedIndex(i); - break; - } - } - } - - /** - * 返回当前选择的公式 - */ - public AbstractDataFunction updateBean() { - try { - int selectIndex = getSelectedIndex(); - if (selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { - return (AbstractDataFunction) CLASS_ARRAY[selectIndex].newInstance(); - } - } catch (InstantiationException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } catch (IllegalAccessException e) { - FineLoggerFactory.getLogger().error("Function Error"); - return null; - } - - return null; + super(); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java index 4cb5c652f..8c2056857 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.custom.other; import com.fr.chart.chartattr.Chart; +import com.fr.design.chart.series.SeriesCondition.ColSelectedWithSummaryMethodEditor; import com.fr.design.dialog.BasicPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.CustomPlotFactory; @@ -91,6 +92,7 @@ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTa CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot); VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType); + ColSelectedWithSummaryMethodEditor.refreshCustomChartTableFieldNames(chart,plotType); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java index da4fa2534..234f2ee1d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.custom.style; import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.chart.series.SeriesCondition.ColSelectedWithSummaryMethodEditor; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; @@ -75,6 +76,7 @@ public class VanChartCustomStylePane extends VanChartStylePane { public void refreshTableFieldNames(VanChartPlot plot) { CustomPlotType plotType = CustomPlotFactory.getCustomType(plot); VanChartRichEditorPane.refreshCustomChartTableFieldNames(getChart(), plotType); + ColSelectedWithSummaryMethodEditor.refreshCustomChartTableFieldNames(getChart(), plotType); } public void refreshTableFieldNames() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java index 7ca77a9fc..603b5af0a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.style; import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.ColSelectedWithSummaryMethodEditor; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; @@ -88,6 +89,7 @@ public class VanChartStylePane extends ChartStylePane { public void refreshTableFieldNames() { VanChartRichEditorPane.refreshCommonChartFieldNames(getChart()); + ColSelectedWithSummaryMethodEditor.refreshCommonChartFieldNames(getChart()); } public void registerChartEditPane(ChartEditPane currentEditPane) { From a6238d0f61454d40b9affbcbe2794ff4fe052e72 Mon Sep 17 00:00:00 2001 From: pengda Date: Sun, 24 Apr 2022 17:48:06 +0800 Subject: [PATCH 22/79] =?UTF-8?q?REPORT-68363=20=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=B3=BB=E5=88=97=E9=97=B4=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E6=AF=94=E8=BE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/SummaryMethodComboBox.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java index bd57e7ea2..7aee00e24 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/SummaryMethodComboBox.java @@ -13,6 +13,12 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.FirstFunction; +/** + * 图表数据汇总方式下拉框 + * + * 支持首个,最后一个,求和,平均,最大值,最小值,个数 + * + */ public class SummaryMethodComboBox extends UIComboBox { public static final String[] CALCULATE_ARRAY = {Toolkit.i18nText("Fine-Design_Chart_Data_Function_First"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Last"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Sum"), Toolkit.i18nText("Fine-Design_Chart_Data_Function_Average"), From 6b3f2f46f58a2fb0360f0569f72e3200025da2b8 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 25 Apr 2022 15:40:44 +0800 Subject: [PATCH 23/79] =?UTF-8?q?REPORT-67417=20=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BA=A7=E5=93=81v1.0=20=E8=A1=A5=E5=85=85=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 2 ++ .../alphafine/component/AlphaFineFrame.java | 30 +++++++++++-------- .../preview/HelpDocumentNoResultPane.java | 19 ++++++------ .../preview/NoResultWithLinkPane.java | 30 ++++++++++++++++++- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 6afce21e4..08ed7ef51 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -140,6 +140,8 @@ public class AlphaFineConstants { public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid"); + public static final String ALPHA_HELP_RECOMMEND = CloudCenter.getInstance().acquireUrlByKind("af.recommend"); + public static final String JAVASCRIPT_PREFIX = "javascript:SendJava"; public static final String CHINESE_CHARACTERS = "[\\u4e00-\\u9fa5]"; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 2911ef68f..52ddd614c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -30,6 +30,10 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchMa import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; +import com.fr.json.JSON; +import com.fr.json.JSONArray; +import com.fr.json.JSONFactory; +import com.fr.json.JSONObject; import com.fr.stable.StringUtils; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -319,11 +323,7 @@ public class AlphaFineFrame extends JFrame { readLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); - Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); - for (ProductNews productNews : productNewsList) { - readSet.add(productNews.getId()); - } + fireOneClickRead(); showPane.repaint(); } }); @@ -403,15 +403,21 @@ public class AlphaFineFrame extends JFrame { return showPane; } - // todo 暂无 先做测试 + private void fireOneClickRead() { + List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); + Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); + for (ProductNews productNews : productNewsList) { + readSet.add(productNews.getId()); + } + } + private Map generateMap() { + JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineConstants.ALPHA_HELP_RECOMMEND); Map linkMap = new LinkedHashMap<>(); - linkMap.put("test", "https://www.baidu.com"); - linkMap.put("test1", "https://www.baidu.com"); - linkMap.put("test2", "https://www.baidu.com"); - linkMap.put("test3", "https://www.baidu.com"); - linkMap.put("test4", "https://www.baidu.com"); - linkMap.put("test5", "https://www.baidu.com"); + for (int i = 0, len = jsonArray.size(); i < len; i++) { + JSONObject json = jsonArray.getJSONObject(i); + linkMap.put(json.getString("name"), json.getString("link")); + } return linkMap; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java index 4a2ede608..d88da9637 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -3,17 +3,14 @@ package com.fr.design.mainframe.alphafine.preview; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.DesignUtils; -import com.fr.log.FineLoggerFactory; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Desktop; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.io.IOException; -import java.net.URI; import java.util.Map; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -69,11 +66,7 @@ public class HelpDocumentNoResultPane extends JPanel { listLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - try { - Desktop.getDesktop().browse(URI.create(link)); - } catch (IOException exception) { - FineLoggerFactory.getLogger().error(exception.getMessage(), exception); - } + responseClick(link); } }); @@ -90,5 +83,13 @@ public class HelpDocumentNoResultPane extends JPanel { return listPane; } + /** + * 方便记录埋点 + * + * @param link + */ + private void responseClick(String link) { + BrowseUtils.browser(link); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java index 1f61342c4..3dc4a44b2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java @@ -2,11 +2,14 @@ package com.fr.design.mainframe.alphafine.preview; import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.DesignUtils; import java.awt.Color; import java.awt.Component; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; /** * 带跳转链接的无结果面板 @@ -28,8 +31,33 @@ public class NoResultWithLinkPane extends NoResultPane { protected Component generateDescription(String title) { String[] para1 = title.split(TAG_A_START); String[] para2 = para1[1].split(TAG_A_END); - MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineConstants.ALPHA_GO_TO_FORUM, para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY); + + MessageWithLink messageWithLink = new MessageWithLink(para1[0], para2[0], AlphaFineConstants.ALPHA_GO_TO_FORUM, para2[1], Color.WHITE, DesignUtils.getDefaultGUIFont().applySize(14), AlphaFineConstants.MEDIUM_GRAY) { + @Override + protected void initListener(String link) { + + addHyperlinkListener(new HyperlinkListener() { + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { + jumpToForum(link); + } + } + }); + } + }; messageWithLink.setBorder(BorderFactory.createEmptyBorder(0, AlphaFineConstants.LEFT_WIDTH - 30, 135, 0)); return messageWithLink; } + + + /** + * 方便记录埋点 + * + * @param link + */ + private void jumpToForum(String link) { + BrowseUtils.browser(link); + } + } From 8fea3f321817e90b959163a1afd0479cb231d340 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 25 Apr 2022 17:23:18 +0800 Subject: [PATCH 24/79] =?UTF-8?q?REPORT-70206=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=20=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4prop=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/module/DesignerStartup.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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 46218b91a..e2c85ea6f 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 @@ -4,6 +4,7 @@ package com.fr.start.module; import com.fr.base.OptimizeUtil; import com.fr.concurrent.NamedThreadFactory; import com.fr.config.dao.DaoSelectorFactory; +import com.fr.config.dao.PropertiesConstants; import com.fr.decision.webservice.v10.encryption.EncryptionConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; @@ -28,6 +29,7 @@ import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; import com.fr.stable.ArrayUtils; import com.fr.stable.BuildContext; +import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -36,6 +38,7 @@ import com.fr.start.ServerStarter; import com.fr.start.event.LazyStartupEvent; import com.fr.start.server.FineEmbedServer; import com.fr.value.NotNullLazyValue; +import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -157,15 +160,28 @@ public class DesignerStartup extends Activator { if (info.getType() == DesignerWorkspaceType.Remote) { DaoSelectorFactory.registerDaoSelector(() -> false); } else { - String dbConfigPath = StableUtils.pathJoin(WorkspaceUtils.getWorkspaceInfo().getPath(), ProjectConstants.CONFIG_DIRECTORY, + String webInfPath = WorkspaceUtils.getWorkspaceInfo().getPath(); + String dbConfigPath = StableUtils.pathJoin(webInfPath, ProjectConstants.CONFIG_DIRECTORY, EncryptionConstants.PROPERTY_NAME); - // + String entityPath = generatePath(webInfPath, PropertiesConstants.ENTITY_PROP); + String xmlEntityPath = generatePath(webInfPath, PropertiesConstants.XML_ENTITY_PROP); + String classNamePath = generatePath(webInfPath, PropertiesConstants.CLASS_NAME_PROP); + // 校验 平台迁移文件/缓存文件 + boolean existPropCache = new File(entityPath).exists() && new File(xmlEntityPath).exists() && new File(classNamePath).exists(); DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable() && OptimizeUtil.isOpen() + && existPropCache && !new File(dbConfigPath).exists()); + } } + private String generatePath(String webInfPath, String name) { + return StableUtils.pathJoin(webInfPath, ProjectConstants.EMBED_DB_DIRECTORY, + ProjectConstants.PROPERTIES_CACHE_FOR_CONFIG, name); + } + + @Override public void stop() { // void From 4bccb3288537ed74cc5f21082a78c6ecffc1a003 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 25 Apr 2022 17:25:50 +0800 Subject: [PATCH 25/79] =?UTF-8?q?REPORT-70206=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E7=94=A8import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 2 -- 1 file changed, 2 deletions(-) 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 e2c85ea6f..695e8d8f2 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 @@ -29,7 +29,6 @@ import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; import com.fr.stable.ArrayUtils; import com.fr.stable.BuildContext; -import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -38,7 +37,6 @@ import com.fr.start.ServerStarter; import com.fr.start.event.LazyStartupEvent; import com.fr.start.server.FineEmbedServer; import com.fr.value.NotNullLazyValue; -import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import java.io.File; From c84ba4871e663229204cbb777c4a741a2d2a4560 Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 25 Apr 2022 18:52:19 +0800 Subject: [PATCH 26/79] =?UTF-8?q?REPORT-65492=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FunctionConstants.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index a1d6023d0..6a1b32aaa 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -58,7 +58,6 @@ public final class FunctionConstants { public static FunctionGroup ALL = getAllFunctionGroup(); public static List abandonFormulas = Arrays.asList("CIRCULAR", "CROSSLAYERTOTAL", "HIERARCHY", "LAYERTOTAL"); public static NameAndFunctionList NEW = getNewFunctionList(); - private static List shieldedFormulas = Arrays.asList("ENBYSTRNUM","TEXTGETNUM" ,"GETCHARNUM","GCD", "LCM"); static { loadEmbededFunctions(); @@ -103,7 +102,7 @@ public final class FunctionConstants { if (StableUtils.classInstanceOf(cls, iface)) { Function inst; inst = (Function) cls.newInstance(); - if (abandonFormulas.contains(inst.getClass().getSimpleName()) || shieldedFormulas.contains(inst.getClass().getSimpleName())) { + if (abandonFormulas.contains(inst.getClass().getSimpleName())) { continue; } for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { @@ -289,7 +288,8 @@ public final class FunctionConstants { private static NameAndFunctionList getNewFunctionList() { return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_New"), new Function[]{ - new ENDOFMONTH(), new NUMTOZH(), new MIDCHAR(), new ISWORKDAY() + new ENDOFMONTH(), new NUMTOZH(), new MIDCHAR(), new ISWORKDAY(),new ENBYSTRNUM(), new TEXTGETNUM(), + new GETCHARNUM(), new GCD(), new LCM() }); } From 282242695a04a316e8d54a10d57f962da9db991c Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 10:06:24 +0800 Subject: [PATCH 27/79] =?UTF-8?q?REPORT-70475=20=E6=96=B0=E6=97=A7fm?= =?UTF-8?q?=E5=88=87=E6=8D=A2=20=E6=82=AC=E6=B5=AE=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/question/QuestionPane.java | 9 +-------- .../alphafine/question/QuestionWindow.java | 17 +++-------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 34075a696..8c593e213 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -23,12 +23,8 @@ public class QuestionPane extends JPanel { private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); - /** - * 是否全部已读 - */ - private boolean hasRead; - public QuestionPane(boolean hasRead) { + public QuestionPane() { this.setBackground(new Color(0, 0, 0, 0)); } @@ -47,9 +43,6 @@ public class QuestionPane extends JPanel { } - public void setHasRead(boolean hasRead) { - this.hasRead = hasRead; - } @Override public Dimension getPreferredSize() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java index 9b7cff7d6..00e8a8f3e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -20,7 +20,7 @@ import javax.swing.JWindow; public class QuestionWindow extends JWindow { private static final QuestionWindow INSTANCE = new QuestionWindow(); - private final QuestionPane questionPane = new QuestionPane(true); + private final QuestionPane questionPane = new QuestionPane(); private int pressX; private int pressY; private QuestionWindow() { @@ -62,6 +62,8 @@ public class QuestionWindow extends JWindow { this.getLayeredPane().setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); this.setContentPane(questionPane); this.setSize(new Dimension(40, 40)); + // 这个地方可以设置alwaysOnTop 弹窗会跟随主页面失去激活状态而隐藏 不会与其他弹窗冲突 + this.setAlwaysOnTop(true); this.setLocation(DesignerContext.getDesignerFrame().getWidth() - 100, DesignerContext.getDesignerFrame().getHeight() - 100); } @@ -70,17 +72,4 @@ public class QuestionWindow extends JWindow { return INSTANCE; } - public void setHasRead(boolean hasRead) { - this.questionPane.setHasRead(hasRead); - } - - @Override - public void setVisible(boolean b) { - super.setVisible(b); - } - - @Override - public void dispose() { - super.dispose(); - } } From 4313157f8fb11d689f72d054a1479e616fdee063 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 10:10:55 +0800 Subject: [PATCH 28/79] =?UTF-8?q?REPORT-70463=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86=E9=94=AE=E5=85=A5=E6=96=87=E6=9C=AC=E5=90=8E=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineFrame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 52ddd614c..d51684f5e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -511,7 +511,8 @@ public class AlphaFineFrame extends JFrame { private void startSearchTextFieldTimer() { Timer timer = new Timer(TIMER_DELAY, e -> { - if (StringUtils.isEmpty(searchTextField.getText())) { + // 坑 isShowing返回false 即使textField有内容 getText返回的也是空 + if (searchTextField.isShowing() && StringUtils.isEmpty(searchTextField.getText())) { SearchTooltipPopup.getInstance().hide(); switchType(selectedType); } From 5971e699efe3bc3bf40507ab5fe96d963930f4b6 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 15:24:29 +0800 Subject: [PATCH 29/79] =?UTF-8?q?REPORT-70456=20=E6=97=A0=E5=B0=81?= =?UTF-8?q?=E9=9D=A2=E5=9B=BE=E7=9A=84=E8=BF=90=E8=90=A5=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductNewsContentCellRender.java | 20 ++++++++++++++++--- .../component/ProductNewsImagePanel.java | 20 +++++++++---------- .../impl/ProductNewsSearchManager.java | 15 +++++++++++++- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java index 7ef00e6ba..f86253d0c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.alphafine.component; -import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineUtil; @@ -28,6 +27,21 @@ public class ProductNewsContentCellRender implements ListCellRenderer { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); + /** + * 透明灰色背景 Y方向偏移 + */ + private static final int GRAY_BACKGROUND_Y_GAP = 39; + + /** + * 透明灰色背景 高度 + */ + private static final int GRAY_BACKGROUND_HEIGHT = 23; + + /** + * 单行产品动态的高度与宽度尺寸 + */ + private static final Dimension DEFAULT_DIMENSION = new Dimension(500, 100); + private String[] segmentationResult; public ProductNewsContentCellRender(String[] segmentationResult) { @@ -58,7 +72,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer { @Override protected void paintComponent(Graphics g) { g.setColor(AlphaFineConstants.BACKGROUND_COLOR); - g.fillRect(0, getHeight() - 27, getWidth(), 23); + g.fillRect(0, getHeight() - GRAY_BACKGROUND_Y_GAP, getWidth(), GRAY_BACKGROUND_HEIGHT); super.paintComponent(g); } }; @@ -73,7 +87,7 @@ public class ProductNewsContentCellRender implements ListCellRenderer { textPane.setBackground(Color.WHITE); textPane.add(infoPane, BorderLayout.CENTER); panel.add(textPane, BorderLayout.CENTER); - panel.setPreferredSize(new Dimension(500, 80)); + panel.setPreferredSize(DEFAULT_DIMENSION); return panel; } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index 69ed4eaed..e87b6f199 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -3,11 +3,7 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.base.GraphHelper; import com.fr.base.svg.SVGLoader; import com.fr.design.DesignerEnvManager; -import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.alphafine.model.ProductNews; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -15,7 +11,6 @@ import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; -import java.awt.geom.RoundRectangle2D; import java.util.Set; import javax.swing.JPanel; @@ -32,6 +27,8 @@ public class ProductNewsImagePanel extends JPanel { private static final Color BACKGROUND_COLOR = new Color(116, 181, 249); + private static final Color COVER_COLOR = new Color(116, 181, 249, 26); + private ProductNews productNews; private int width = 200; @@ -48,17 +45,20 @@ public class ProductNewsImagePanel extends JPanel { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); -// g2.setComposite(AlphaComposite.Src); -// g2.fill(new RoundRectangle2D.Float(0, 0, getWidth(), getHeight(), 5, 5)); -// g2.setComposite(AlphaComposite.SrcAtop); + Color defaultColor = g2.getColor(); - g2.drawImage(productNews.getImage(), 0, 0, getWidth(), getHeight(), this); + Image image = productNews.getImage(); + if (image != null) { + g2.drawImage(productNews.getImage(), 0, 0, getWidth(), getHeight(), this); + } else { + g2.setColor(COVER_COLOR); + g2.fillRect(0, 0, getWidth(), getHeight()); + } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); } - Color defaultColor = g2.getColor(); g2.setColor(BACKGROUND_COLOR); g2.fillRect(0, getHeight() - BACKGROUND_HEIGHT, getWidth(), BACKGROUND_HEIGHT); g2.setColor(Color.WHITE); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java index 3c211deeb..c205a624b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -9,6 +9,9 @@ import com.fr.json.JSONArray; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import org.jetbrains.annotations.Nullable; + +import java.awt.Image; import java.net.URL; import java.util.ArrayList; import java.util.Date; @@ -59,7 +62,7 @@ public class ProductNewsSearchManager { JSONObject obj = jsonArray.getJSONObject(i); ProductNews productNews = new ProductNews(). setId(obj.getLong("id")).setTitle(obj.getString("title")). - setImage(ImageIO.read(new URL(obj.getString("pic")))). + setImage(getCoverImage(obj.getString("pic"))). setUrl(obj.getString("url")).setTag(ProductNews.Tag.parseCode(obj.getInt("tag"))). setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget( ProductNews.Target.parseCode(obj.getInt("target"))). @@ -72,4 +75,14 @@ public class ProductNewsSearchManager { public List getCachedProductNewsList() { return productNewsList; } + + @Nullable + private Image getCoverImage(String url) { + try { + return ImageIO.read(new URL(url)); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + } + return null; + } } From 0180da828083c2a51cfccb9ce8a5449e5dddafcf Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 16:07:43 +0800 Subject: [PATCH 30/79] =?UTF-8?q?REPORT-70456=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E4=B8=8Burl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/ProductNewsSearchManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java index c205a624b..06dbe6ab0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -81,6 +81,7 @@ public class ProductNewsSearchManager { try { return ImageIO.read(new URL(url)); } catch (Exception e) { + FineLoggerFactory.getLogger().warn("get image failed from {}", url); FineLoggerFactory.getLogger().warn(e.getMessage(), e); } return null; From 539d6465d05f549f91fdace0baa275c9ade7b335 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 16:57:44 +0800 Subject: [PATCH 31/79] =?UTF-8?q?REPORT-70458=20tab=E7=9A=84=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E7=8A=B6=E6=80=81=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineFrame.java | 14 +++++++++++++ .../alphafine/component/SelectedLabel.java | 20 ------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index d51684f5e..58e24409e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -360,6 +360,7 @@ public class AlphaFineFrame extends JFrame { public void mousePressed(MouseEvent e) { for (SelectedLabel label : selectedLabelList) { label.setSelected(false); + label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); } selectedLabel.setSelected(true); tabLabel.setText(selectedLabel.getText()); @@ -394,6 +395,19 @@ public class AlphaFineFrame extends JFrame { } } } + + private Color defaultColor; + + @Override + public void mouseEntered(MouseEvent e) { + defaultColor = selectedLabel.getForeground(); + selectedLabel.setForeground(AlphaFineConstants.SUSPENDED_COLOR); + } + + @Override + public void mouseExited(MouseEvent e) { + selectedLabel.setForeground(defaultColor); + } }); tabPane.add(selectedLabel); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java index a7b661dae..1e153c237 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java @@ -1,22 +1,14 @@ package com.fr.design.mainframe.alphafine.component; -import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.CellType; -import com.fr.design.mainframe.alphafine.model.ProductNews; -import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; -import com.fr.design.menu.SnapChatUtil; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Rectangle; import java.awt.RenderingHints; -import java.awt.geom.Ellipse2D; -import java.util.List; -import java.util.Set; /** * @author hades @@ -30,7 +22,6 @@ public class SelectedLabel extends UILabel { private static final int GAP = 2; private boolean selected; - private boolean hasRead; private CellType cellType; public SelectedLabel(String text, CellType cellType, boolean selected) { @@ -53,11 +44,8 @@ public class SelectedLabel extends UILabel { g2d.setColor(UIConstants.FLESH_BLUE); setForeground(UIConstants.FLESH_BLUE); g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); - } else { - setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); } - if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) { Color oldColor = g.getColor(); g2d.setColor(Color.RED); @@ -77,14 +65,6 @@ public class SelectedLabel extends UILabel { this.selected = selected; } - public boolean isHasRead() { - return hasRead; - } - - public void setHasRead(boolean hasRead) { - this.hasRead = hasRead; - } - public CellType getCellType() { return cellType; } From 300288510dfc211770053649acda887e8dbd5649 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 16:58:25 +0800 Subject: [PATCH 32/79] =?UTF-8?q?REPORT-70449=20alphafine=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=BC=A9=E5=B0=8F=E5=90=8E=EF=BC=8C=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/AlphaFineHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 293829992..441bd03ac 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -24,6 +24,7 @@ import com.fr.json.JSONFactory; import com.fr.json.JSONObject; import com.fr.stable.StringUtils; +import java.awt.Frame; import java.util.List; /** @@ -66,7 +67,13 @@ public class AlphaFineHelper { final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); manager.setNeedRemind(false); } else { - alphaFineDialog.setVisible(!alphaFineDialog.isVisible()); + alphaFineDialog.setVisible(true); + // check 如果最小化 点击悬浮按钮后 恢复 + if ((alphaFineDialog.getExtendedState() & Frame.ICONIFIED) != 0) { + // 从最小化恢复 + alphaFineDialog.setExtendedState(Frame.NORMAL); + } + alphaFineDialog.toFront(); } From 5537f2dcc9982e5d5d7e7a50846b1bfa11c6a664 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 16:59:31 +0800 Subject: [PATCH 33/79] =?UTF-8?q?REPORT-70458=20=E8=A1=A5=E4=B8=8A?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/alphafine/AlphaFineConstants.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 08ed7ef51..c7f8e55d1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -156,6 +156,8 @@ public class AlphaFineConstants { public static final Icon NO_RESULT_ICON = IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "noresult.png"); + public static final Color SUSPENDED_COLOR = new Color(84, 165, 249); + public static final Color FOREGROUND_COLOR = new Color(51, 51, 52); /** From 008f12c151c86399fade5a266e28e1f4773d04c2 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 26 Apr 2022 17:02:10 +0800 Subject: [PATCH 34/79] =?UTF-8?q?REPORT-70472=20alphafine=E4=B8=AD?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E7=9A=84=E5=B1=82=E7=BA=A7=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/component/AlphaFineList.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java index bdd630c14..75348468e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import java.awt.event.KeyAdapter; @@ -25,6 +26,8 @@ public class AlphaFineList extends JList { if (e.getClickCount() == 2 && selectedValue.hasAction()) { dealWithSearchResult(); } + // 点击搜索结果 主页面移动到后面 + AlphaFineHelper.getAlphaFineDialog().toBack(); } }); From 96e4c35d7309511ef73af2684ee6cd2f75a15a27 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Wed, 27 Apr 2022 15:51:52 +0800 Subject: [PATCH 35/79] =?UTF-8?q?KERNEL-11019=20=E4=BA=91=E7=AB=AF?= =?UTF-8?q?=E8=BF=90=E7=BB=B4=E6=8F=92=E4=BB=B6=E5=AF=B9=E4=B8=BB=20jar=20?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=80=9F=E5=BA=A6=E5=BD=B1=E5=93=8D=E7=9A=84?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/DesignerEnvManager.java | 8 ++++++++ .../fr/design/actions/file/PreferencePane.java | 18 +++++++++++++----- .../push/DesignerPushUpdateConfigManager.java | 11 +++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 1905a6c5d..7761038b7 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -830,6 +830,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { designerPushUpdateConfigManager.setAutoPushUpdateEnabled(autoPushUpdateEnabled); } + public boolean isCloudAnalyticsDelay() { + return designerPushUpdateConfigManager.isCloudAnalyticsDelay(); + } + + public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) { + designerPushUpdateConfigManager.setCloudAnalyticsDelay(cloudAnalyticsDelay); + } + /** * 设计器登录相关配置 */ diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 2fa06a564..9c12c491c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -171,6 +171,7 @@ public class PreferencePane extends BasicPane { private UICheckBox autoPushUpdateCheckBox; private UICheckBox embedServerLazyStartupCheckBox; private UICheckBox imageCompressPanelCheckBox; + private UICheckBox cloudAnalyticsDelayCheckBox; private UICheckBox vcsEnableCheckBox; private UICheckBox saveCommitCheckBox; @@ -273,6 +274,11 @@ public class PreferencePane extends BasicPane { imageCompressPanelCheckBox = new UICheckBox(i18nText("Fine-Design_Image_Compress")); imageCompressPanel.add(imageCompressPanelCheckBox); advancePane.add(imageCompressPanel); + + JPanel designerStartupOption = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Startup_Option")); + cloudAnalyticsDelayCheckBox = new UICheckBox(i18nText("Fine-Design_Cloud_Analytics_Delay")); + designerStartupOption.add(cloudAnalyticsDelayCheckBox); + advancePane.add(designerStartupOption); } private void createVcsSettingPane(JPanel generalPane) { @@ -444,10 +450,10 @@ public class PreferencePane extends BasicPane { requestFocusInWindow(); label = new UILabel(text); add(GUICoreUtils.createBorderLayoutPane( - new UILabel(i18nText("Fine-Design_Basic_Support_Current_Auto_Complete_Shortcut") + ":"), - BorderLayout.WEST, - label, - BorderLayout.CENTER), + new UILabel(i18nText("Fine-Design_Basic_Support_Current_Auto_Complete_Shortcut") + ":"), + BorderLayout.WEST, + label, + BorderLayout.CENTER), BorderLayout.NORTH); addKeyListener(new KeyAdapter() { @Override @@ -729,7 +735,7 @@ public class PreferencePane extends BasicPane { if (useOptimizedUPMCheckbox != null) { useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM() - || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); + || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); } if (useNewVersionLoginCheckbox != null) { @@ -750,6 +756,7 @@ public class PreferencePane extends BasicPane { this.startWithEmptyFile.setSelected(designerEnvManager.isStartWithEmptyFile()); this.imageCompressPanelCheckBox.setSelected(designerEnvManager.isImageCompress()); + this.cloudAnalyticsDelayCheckBox.setSelected(designerEnvManager.isCloudAnalyticsDelay()); } private int chooseCase(int sign) { @@ -810,6 +817,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected()); + designerEnvManager.setCloudAnalyticsDelay(this.cloudAnalyticsDelayCheckBox.isSelected()); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java index 9ea734e73..950d76d7b 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java @@ -15,6 +15,7 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter { private static DesignerPushUpdateConfigManager singleton; private boolean autoPushUpdateEnabled = true; // 是否开启自动推送更新 + private boolean cloudAnalyticsDelay = false; // 是否云端运维模块延迟启动 private String lastIgnoredVersion = StringUtils.EMPTY; // 最近一次跳过的更新版本 private DesignerPushUpdateConfigManager() { @@ -32,6 +33,7 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter { if (reader.isAttr()) { this.setAutoPushUpdateEnabled(reader.getAttrAsBoolean("autoPushUpdateEnabled", true)); this.setLastIgnoredVersion(reader.getAttrAsString("lastIgnoredVersion", StringUtils.EMPTY)); + this.setCloudAnalyticsDelay(reader.getAttrAsBoolean("cloudAnalyticsDelay", false)); } } @@ -40,6 +42,7 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter { writer.startTAG(XML_TAG); writer.attr("autoPushUpdateEnabled", autoPushUpdateEnabled); writer.attr("lastIgnoredVersion", lastIgnoredVersion); + writer.attr("cloudAnalyticsDelay", cloudAnalyticsDelay); writer.end(); } @@ -58,4 +61,12 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter { public void setLastIgnoredVersion(String lastIgnoredVersion) { this.lastIgnoredVersion = lastIgnoredVersion; } + + public boolean isCloudAnalyticsDelay() { + return cloudAnalyticsDelay; + } + + public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) { + this.cloudAnalyticsDelay = cloudAnalyticsDelay; + } } From 3ccca241a3c4ac07b4f78dae9429c2e110f462c8 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 28 Apr 2022 14:04:30 +0800 Subject: [PATCH 36/79] =?UTF-8?q?REPORT-65492=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8D=83=E5=88=86=E6=AF=94=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/style/TextFormatPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index a477cb16c..a53235cf2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -58,7 +58,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private static final Integer[] TYPES = new Integer[]{ FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, - FormatContents.SCIENTIFIC, + FormatContents.THOUSANDTHS,FormatContents.SCIENTIFIC, FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; From 54aee8313f6e19410ac41d96c0e87fe76d0c3103 Mon Sep 17 00:00:00 2001 From: lucian Date: Thu, 28 Apr 2022 17:39:00 +0800 Subject: [PATCH 37/79] =?UTF-8?q?REPORT-70504=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A1=A8=E6=90=9C=E7=B4=A2=E6=97=B6=E6=9C=89?= =?UTF-8?q?=E8=BE=83=E5=A4=A7=E6=A6=82=E7=8E=87=E5=A4=9A=E4=B8=AA=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/icombobox/TableSearchTreeComboBox.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 7198eeef0..63a0d7186 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -1,5 +1,6 @@ package com.fr.design.gui.icombobox; +import com.fr.concurrent.NamedThreadFactory; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; @@ -24,6 +25,8 @@ import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.util.Enumeration; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * 实现模糊搜索表名的FRTreeComboBox @@ -37,6 +40,10 @@ import java.util.Enumeration; public class TableSearchTreeComboBox extends FRTreeComboBox { // 持有父容器,需要实时获取其他组件值 private final ChoosePane parent; + /** + * 保证模糊搜索的原子性操作 + */ + private final ExecutorService singleExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); @@ -69,14 +76,16 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { */ private void searchExecute() { UIComboBoxEditor searchEditor = (UIComboBoxEditor) this.getEditor(); - new SwingWorker() { + String searchText = (String) searchEditor.getItem(); + singleExecutor.execute( + new SwingWorker() { @Override protected Void doInBackground() { processTableDataNames( parent.getDSName(), parent.getConnection(), parent.getSchema(), - createFilter((String) searchEditor.getItem())); + createFilter(searchText)); return null; } @@ -86,7 +95,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { // 输入框获取焦点 searchEditor.getEditorComponent().requestFocus(); } - }.execute(); + }); } private TableNameFilter createFilter(String text) { From 3d82f964be81f5ca8fbd68d6858980896ec1a385 Mon Sep 17 00:00:00 2001 From: lucian Date: Thu, 28 Apr 2022 17:47:27 +0800 Subject: [PATCH 38/79] =?UTF-8?q?REPORT-70504=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A1=A8=E6=90=9C=E7=B4=A2=E6=97=B6=E6=9C=89?= =?UTF-8?q?=E8=BE=83=E5=A4=A7=E6=A6=82=E7=8E=87=E5=A4=9A=E4=B8=AA=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/TableSearchTreeComboBox.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 63a0d7186..f4b21c3fe 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -77,8 +77,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { private void searchExecute() { UIComboBoxEditor searchEditor = (UIComboBoxEditor) this.getEditor(); String searchText = (String) searchEditor.getItem(); - singleExecutor.execute( - new SwingWorker() { + singleExecutor.execute(new SwingWorker() { @Override protected Void doInBackground() { processTableDataNames( From 82681302074df112d584d2cf387f5acbfc017312 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 09:07:35 +0800 Subject: [PATCH 39/79] =?UTF-8?q?REPORT-70452=20alphafine=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=90=8E=EF=BC=8C=E5=88=87=E6=8D=A2tab,=E6=96=87?= =?UTF-8?q?=E6=A1=A3tab=E4=B8=8B=E7=9A=84=E7=8A=B6=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=20&&=20REPORT-70446=20=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E8=A7=86=E8=A7=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../help/alphafine/AlphaFineConfigPane.java | 36 +--- .../help/alphafine/AlphaFineShortCutUtil.java | 44 +++++ .../alphafine/AlphaFineConstants.java | 14 +- .../design/mainframe/alphafine/CellType.java | 23 ++- .../alphafine/component/AlphaFineFrame.java | 162 ++++++++++++++---- .../component/AlphaFineTextField.java | 21 +-- .../ProductNewsSearchResultPane.java | 4 +- .../alphafine/component/SearchResultPane.java | 2 +- .../alphafine/component/SelectedLabel.java | 20 ++- .../exception/AlphaFineNetworkException.java | 14 ++ .../preview/DefaultProductNewsPane.java | 64 +++++-- .../preview/HelpDocumentNoResultPane.java | 76 +++++++- .../alphafine/preview/NetWorkFailedPane.java | 69 ++++++++ .../alphafine/preview/SearchLoadingPane.java | 11 +- .../alphafine/question/QuestionPane.java | 3 +- .../alphafine/question/QuestionWindow.java | 2 +- .../ProductNewsSearchWorkerManager.java | 30 +++- .../alphafine/search/SearchManager.java | 4 + .../alphafine/search/SearchWorkerManager.java | 28 ++- .../mainframe/alphafine/images/clear.svg | 4 + 20 files changed, 509 insertions(+), 122 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineShortCutUtil.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/exception/AlphaFineNetworkException.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/clear.svg diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java index bd26b5cfc..55d467e88 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java @@ -25,31 +25,6 @@ import java.awt.event.MouseEvent; public class AlphaFineConfigPane extends BasicPane { private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; - private static final String BACK_SLASH = "BACK_SLASH"; - private static final String DISPLAY_BACK_SLASH = "\\"; - private static final String SLASH = "SLASH"; - private static final String DISPLAY_SLASH = "/"; - private static final String CONTROL = "CONTROL"; - private static final String DISPLAY_CONTROL = "ctrl"; - private static final String OPEN_BRACKET = "OPEN_BRACKET"; - private static final String DISPLAY_OPEN_BRACKET = "{"; - private static final String CLOSE_BRACKET = "CLOSE_BRACKET"; - private static final String DISPLAY_CLOSE_BRACKET = "}"; - private static final String COMMA = "COMMA"; - private static final String DISPLAY_COMMA = ","; - private static final String PERIOD = "PERIOD"; - private static final String DISPLAY_PERIOD = "."; - private static final String SEMICOLON = "SEMICOLON"; - private static final String DISPLAY_SEMICOLON = ";"; - private static final String QUOTE = "QUOTE"; - private static final String DISPLAY_QUOTE = "'"; - private static final String EQUALS = "EQUALS"; - private static final String DISPLAY_EQUALS = "+"; - private static final String MINUS = "MINUS"; - private static final String DISPLAY_MINUS = "-"; - private static final String COMMAND = "META"; - private static final String SMALL_COMMAND = "meta"; - private static final String DISPLAY_COMMAND = "\u2318"; private static final double COLUMN_GAP = 180; @@ -138,7 +113,7 @@ public class AlphaFineConfigPane extends BasicPane { int keyCode = e.getKeyCode(); shortCutKeyStore = KeyStroke.getKeyStroke(keyCode, modifier); String str = shortCutKeyStore.toString(); - shortcutsField.setText(getDisplayShortCut(str)); + shortcutsField.setText(AlphaFineShortCutUtil.getDisplayShortCut(str)); shortcutsField.selectAll(); } }); @@ -209,7 +184,7 @@ public class AlphaFineConfigPane extends BasicPane { this.productDynamicsCheckbox.setSelected(alphaFineConfigManager.isProductDynamics() && enabled4Locale); this.productDynamicsCheckbox.setEnabled(enabled4Locale); - this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts())); + this.shortcutsField.setText(AlphaFineShortCutUtil.getDisplayShortCut(alphaFineConfigManager.getShortcuts())); this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox()); @@ -244,13 +219,6 @@ public class AlphaFineConfigPane extends BasicPane { } - private String getDisplayShortCut(String shortCut) { - return shortCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) - .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) - .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) - .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); - } - private KeyStroke convert2KeyStroke(String ks) { return KeyStroke.getKeyStroke(ks.replace(DISPLAY_TYPE, TYPE)); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineShortCutUtil.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineShortCutUtil.java new file mode 100644 index 000000000..e21fc84ee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineShortCutUtil.java @@ -0,0 +1,44 @@ +package com.fr.design.actions.help.alphafine; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/26 + */ +public class AlphaFineShortCutUtil { + + private static final String TYPE = "pressed"; + private static final String DISPLAY_TYPE = "+"; + private static final String BACK_SLASH = "BACK_SLASH"; + private static final String DISPLAY_BACK_SLASH = "\\"; + private static final String SLASH = "SLASH"; + private static final String DISPLAY_SLASH = "/"; + private static final String CONTROL = "CONTROL"; + private static final String DISPLAY_CONTROL = "ctrl"; + private static final String OPEN_BRACKET = "OPEN_BRACKET"; + private static final String DISPLAY_OPEN_BRACKET = "{"; + private static final String CLOSE_BRACKET = "CLOSE_BRACKET"; + private static final String DISPLAY_CLOSE_BRACKET = "}"; + private static final String COMMA = "COMMA"; + private static final String DISPLAY_COMMA = ","; + private static final String PERIOD = "PERIOD"; + private static final String DISPLAY_PERIOD = "."; + private static final String SEMICOLON = "SEMICOLON"; + private static final String DISPLAY_SEMICOLON = ";"; + private static final String QUOTE = "QUOTE"; + private static final String DISPLAY_QUOTE = "'"; + private static final String EQUALS = "EQUALS"; + private static final String DISPLAY_EQUALS = "+"; + private static final String MINUS = "MINUS"; + private static final String DISPLAY_MINUS = "-"; + private static final String COMMAND = "META"; + private static final String SMALL_COMMAND = "meta"; + private static final String DISPLAY_COMMAND = "\u2318"; + + public static String getDisplayShortCut(String shortCut) { + return shortCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) + .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) + .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) + .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index c7f8e55d1..9f4895ddb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -61,6 +61,11 @@ public class AlphaFineConstants { public static final Dimension HOT_ISSUES_JAPNEL_SIZE = new Dimension(213, 182); + /** + * 展示面板的尺寸 + */ + public static final Dimension PREVIEW_SIZE = new Dimension(680, 305); + public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40); public static final Color WHITE = new Color(0xf9f9f9); @@ -138,9 +143,11 @@ public class AlphaFineConstants { public static final String ALPHA_PREVIEW = CloudCenter.getInstance().acquireUrlByKind("af.preview"); - public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid"); + public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid", "https://cid.fanruan.com/api/nav/alphafine"); - public static final String ALPHA_HELP_RECOMMEND = CloudCenter.getInstance().acquireUrlByKind("af.recommend"); + private static final String DEFAULT_RECOMMEND = "[ { \"name\":\"快速入门指南\", \"link\":\"https://help.fanruan.com/finereport/doc-view-1335.html?source=3\" }, { \"name\":\"报表应用学习路径\", \"link\":\"https://help.fanruan.com/finereport/doc-view-1336.html?source=3\" }, { \"name\":\"参数应用学习路径\", \"link\":\"https://help.fanruan.com/finereport/doc-view-4219.html?source=3\" }, { \"name\":\"填报学习路径\", \"link\":\"https://help.fanruan.com/finereport/doc-view-4103.html?source=3\" }, { \"name\":\"API接口汇总\", \"link\":\"https://help.fanruan.com/finereport/doc-view-4327.html?source=3\" }, { \"name\":\"文档月刊\", \"link\":\"https://help.fanruan.com/finereport/doc-view-4613.html?source=3\" } ]"; + + public static final String ALPHA_HELP_RECOMMEND = CloudCenter.getInstance().acquireUrlByKind("af.recommend", DEFAULT_RECOMMEND); public static final String JAVASCRIPT_PREFIX = "javascript:SendJava"; @@ -192,4 +199,7 @@ public class AlphaFineConstants { add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Conjunction_DE")); }}; + public static final String LOADING = "loading"; + + public static final String NETWORK_ERROR = "network error"; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java index 5e415dee4..c558ee584 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java @@ -7,17 +7,17 @@ import com.fr.stable.StringUtils; */ public enum CellType { RECOMMEND(0), - ACTION(1, "action", "actionResult"), - DOCUMENT(2, "document", "documentResult"), - FILE(3, "file", "fileResult"), - PLUGIN(4, "plugin", "pluginResult"), + ACTION(1, "action", "actionResult", false), + DOCUMENT(2, "document", "documentResult", true), + FILE(3, "file", "fileResult", false), + PLUGIN(4, "plugin", "pluginResult", true), REUSE(5), - NO_RESULT(6, "noResult", StringUtils.EMPTY), + NO_RESULT(6, "noResult", StringUtils.EMPTY, false), MORE(7), RECOMMEND_ROBOT(8), BOTTOM(9), ROBOT(10), - PRODUCT_NEWS(11, "productNews", "productNewsResult"); + PRODUCT_NEWS(11, "productNews", "productNewsResult", true); private int typeValue; @@ -33,14 +33,17 @@ public enum CellType { */ private String flagStr4Result; - CellType(int type, String flagStr4None, String flagStr4Result) { + private boolean needNetWork = true; + + CellType(int type, String flagStr4None, String flagStr4Result, boolean needNetWork) { this.typeValue = type; this.flagStr4None = flagStr4None; this.flagStr4Result = flagStr4Result; + this.needNetWork = needNetWork; } CellType(int type) { - this(type, StringUtils.EMPTY, StringUtils.EMPTY); + this(type, StringUtils.EMPTY, StringUtils.EMPTY, true); } public static CellType parse(int typeValue) { @@ -68,5 +71,9 @@ public enum CellType { public String getFlagStr4Result() { return flagStr4Result; } + + public boolean isNeedNetWork() { + return needNetWork; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 58e24409e..2c33cd97c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -4,7 +4,9 @@ import com.fr.base.svg.IconUtils; import com.fr.base.svg.SVGLoader; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; +import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil; import com.fr.design.constants.UIConstants; +import com.fr.design.gui.borders.UITextFieldBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; @@ -15,8 +17,10 @@ import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane; import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane; import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane; +import com.fr.design.mainframe.alphafine.preview.NetWorkFailedPane; import com.fr.design.mainframe.alphafine.preview.NoResultPane; import com.fr.design.mainframe.alphafine.preview.NoResultWithLinkPane; +import com.fr.design.mainframe.alphafine.preview.SearchLoadingPane; import com.fr.design.mainframe.alphafine.preview.SimpleRightSearchResultPane; import com.fr.design.mainframe.alphafine.question.QuestionWindow; import com.fr.design.mainframe.alphafine.search.ProductNewsSearchWorkerManager; @@ -30,10 +34,6 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchMa import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; -import com.fr.json.JSON; -import com.fr.json.JSONArray; -import com.fr.json.JSONFactory; -import com.fr.json.JSONObject; import com.fr.stable.StringUtils; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -44,6 +44,7 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.Insets; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.Window; @@ -56,9 +57,7 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -97,7 +96,7 @@ public class AlphaFineFrame extends JFrame { private static final String TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates"); - private static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"); + public static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"); private static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"); @@ -107,8 +106,12 @@ public class AlphaFineFrame extends JFrame { private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"); + private static final String PRODUCT_DYNAMICS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_Dynamics"); + private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); + private static final Color BORDER_COLOR = new Color(232, 232, 233); + private final CardLayout cardLayout = new CardLayout(); private final JPanel resultPane = new JPanel(cardLayout); @@ -125,6 +128,12 @@ public class AlphaFineFrame extends JFrame { private AlphaFineList searchResultList; + private SearchLoadingPane searchLoadingPane; + + private JPanel searchTextFieldWrapperPane; + + private UILabel clearLabel; + private CellType selectedType; private String beforeSearchStr = StringUtils.EMPTY; @@ -229,7 +238,7 @@ public class AlphaFineFrame extends JFrame { topRightPane.setBackground(Color.WHITE); JPanel tipPane = new JPanel(new BorderLayout()); tipPane.setBackground(Color.WHITE); - String toolTip = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts()); + String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts())); tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); tipIconLabel.addMouseListener(tipMouseListener); tipIconLabel.setToolTipText(toolTip); @@ -268,7 +277,27 @@ public class AlphaFineFrame extends JFrame { private JPanel createSearchPane() { JPanel searchPane = new JPanel(new BorderLayout()); searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); - searchPane.add(searchTextField, BorderLayout.CENTER); + searchTextFieldWrapperPane = new JPanel(new BorderLayout()) { + @Override + protected void paintBorder(Graphics g) { + g.setColor(BORDER_COLOR); + g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); + } + }; + searchTextFieldWrapperPane.setBorder(new UITextFieldBorder(new Insets(2, 3, 2, 3))); + searchTextFieldWrapperPane.setBackground(Color.WHITE); + searchTextFieldWrapperPane.add(searchTextField, BorderLayout.CENTER); + clearLabel = new UILabel(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/clear.svg")); + clearLabel.setVisible(false); + clearLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + searchTextField.setText(StringUtils.EMPTY); + clearLabel.setVisible(false); + } + }); + searchTextFieldWrapperPane.add(clearLabel, BorderLayout.EAST); + searchPane.add(searchTextFieldWrapperPane, BorderLayout.CENTER); JButton searchButton = new JButton(SEARCH) { @Override public void paintComponent(Graphics g) { @@ -297,17 +326,18 @@ public class AlphaFineFrame extends JFrame { private JPanel createShowPane() { JPanel showPane = new JPanel(new BorderLayout()); resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); - resultPane.add(new NoResultPane(NO_SEARCH_RESULT, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); + resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None()); - resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); + resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None()); - resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON, generateMap()), CellType.DOCUMENT.getFlagStr4None()); + resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None()); + resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR); JPanel labelPane = new JPanel(new BorderLayout()); labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); labelPane.setBackground(Color.WHITE); JPanel labelContentPane = new JPanel(new BorderLayout()); - UILabel tabLabel = new UILabel(PRODUCT_NEWS); + UILabel tabLabel = new UILabel(PRODUCT_DYNAMICS); tabLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); tabLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); tabLabel.setPreferredSize(new Dimension(100, 30)); @@ -363,7 +393,12 @@ public class AlphaFineFrame extends JFrame { label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); } selectedLabel.setSelected(true); - tabLabel.setText(selectedLabel.getText()); + // 处理产品动态 tab与下方文字展示不一致 + if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) { + tabLabel.setText(PRODUCT_DYNAMICS); + } else { + tabLabel.setText(selectedLabel.getText()); + } readLabel.setVisible(false); tabPane.repaint(); switch (selectedLabel.getCellType()) { @@ -372,20 +407,20 @@ public class AlphaFineFrame extends JFrame { switchType(CellType.PRODUCT_NEWS); break; case ACTION: - switchType(CellType.ACTION); currentSearchWorkerManager = settingSearchWorkerManager; + switchType(CellType.ACTION); break; case FILE: - switchType(CellType.FILE); currentSearchWorkerManager = fileSearchWorkerManager; + switchType(CellType.FILE); break; case DOCUMENT: - switchType(CellType.DOCUMENT); currentSearchWorkerManager = documentWorkerManager; + switchType(CellType.DOCUMENT); break; case PLUGIN: - switchType(CellType.PLUGIN); currentSearchWorkerManager = pluginSearchWorkerManager; + switchType(CellType.PLUGIN); break; } if (currentSearchWorkerManager != null) { @@ -425,27 +460,61 @@ public class AlphaFineFrame extends JFrame { } } - private Map generateMap() { - JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineConstants.ALPHA_HELP_RECOMMEND); - Map linkMap = new LinkedHashMap<>(); - for (int i = 0, len = jsonArray.size(); i < len; i++) { - JSONObject json = jsonArray.getJSONObject(i); - linkMap.put(json.getString("name"), json.getString("link")); - } - return linkMap; - } - private void switchType(CellType cellType) { this.selectedType = cellType; if (StringUtils.isEmpty(searchTextField.getText())) { cardLayout.show(resultPane, cellType.getFlagStr4None()); } else { + // 当前搜索未结束 不切换loading + if (!checkSearchLoading()) { + return; + } + // 所有都搜索都结束 移除loading + if (isAllSearchOver()) { + resultPane.remove(searchLoadingPane); + } + + // 网络异常 + if (checkNetworkError()) { + return; + } + cardLayout.show(resultPane, cellType.getFlagStr4Result()); checkSearchResult(); } } + private boolean checkNetworkError() { + boolean networkError; + if (selectedType == CellType.PRODUCT_NEWS) { + networkError = productNewsSearchWorkerManager.isNetWorkError(); + } else { + networkError = currentSearchWorkerManager.isNetWorkError(); + } + cardLayout.show(resultPane, AlphaFineConstants.NETWORK_ERROR); + return networkError; + } + + private boolean checkSearchLoading() { + boolean searchOver; + if (selectedType == CellType.PRODUCT_NEWS) { + searchOver = productNewsSearchWorkerManager.isSearchOver(); + } else { + searchOver = currentSearchWorkerManager.isSearchOver(); + } + cardLayout.show(resultPane, AlphaFineConstants.LOADING); + return searchOver; + } + + private boolean isAllSearchOver() { + return productNewsSearchWorkerManager.isSearchOver() + && pluginSearchWorkerManager.isSearchOver() + && fileSearchWorkerManager.isSearchOver() + && settingSearchWorkerManager.isSearchOver() + && documentWorkerManager.isSearchOver(); + } + private void checkSearchResult() { if (currentSearchWorkerManager == null) { return; @@ -473,6 +542,7 @@ public class AlphaFineFrame extends JFrame { searchTextField.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); searchTextField.setBackground(Color.WHITE); searchTextField.setPreferredSize(new Dimension(300, 60)); + searchTextField.setBorder(null); } @@ -482,7 +552,8 @@ public class AlphaFineFrame extends JFrame { public void keyPressed(KeyEvent e) { // 搜索提示框 if (StringUtils.isNotEmpty(searchTextField.getText())) { - SearchTooltipPopup.getInstance().show(searchTextField); + clearLabel.setVisible(true); + SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); } AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); if (e.getKeyCode() == KeyEvent.VK_ENTER) { @@ -507,7 +578,7 @@ public class AlphaFineFrame extends JFrame { @Override public void focusGained(FocusEvent e) { if (StringUtils.isNotEmpty(searchTextField.getText())) { - SearchTooltipPopup.getInstance().show(searchTextField); + SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); } } @@ -531,7 +602,7 @@ public class AlphaFineFrame extends JFrame { switchType(selectedType); } else if (searchTextField.hasFocus()) { - SearchTooltipPopup.getInstance().show(searchTextField); + SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); } }); @@ -593,6 +664,7 @@ public class AlphaFineFrame extends JFrame { private void doSearch(String text) { + initSearchLoadingPane(); SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); this.productNewsSearchWorkerManager.doSearch(searchTextBean); this.settingSearchWorkerManager.doSearch(searchTextBean); @@ -601,6 +673,34 @@ public class AlphaFineFrame extends JFrame { this.pluginSearchWorkerManager.doSearch(searchTextBean); } + /** + * 仅搜索依赖网络的搜索项 + * + */ + private void reSearch() { + String text = this.searchTextField.getText().toLowerCase(); + if (StringUtils.isEmpty(text)) { + return; + } + searchLoadingPane = new SearchLoadingPane(); + SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); + this.productNewsSearchWorkerManager.doSearch(searchTextBean); + this.documentWorkerManager.doSearch(searchTextBean); + this.pluginSearchWorkerManager.doSearch(searchTextBean); + } + + private void initSearchLoadingPane() { + if (searchLoadingPane == null) { + searchLoadingPane = new SearchLoadingPane(); + } + resultPane.add(searchLoadingPane, AlphaFineConstants.LOADING); + cardLayout.show(resultPane, AlphaFineConstants.LOADING); + } + + public String getSearchText() { + return searchTextField.getText(); + } + public CellType getSelectedType() { return selectedType; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java index cfb49caf5..fafe0f60a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java @@ -2,8 +2,6 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.report.web.button.Image; -import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; @@ -14,11 +12,10 @@ import java.awt.RenderingHints; */ public class AlphaFineTextField extends UITextField { - private static final Color BORDER_COLOR = new Color(232, 232, 233); + private static final int PLACE_HOLDER_GAP = 3; private String placeHolder; - private Image image; public AlphaFineTextField(String placeHolder) { this.placeHolder = placeHolder; @@ -40,21 +37,7 @@ public class AlphaFineTextField extends UITextField { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setColor(AlphaFineConstants.FOREGROUND_COLOR_5); - g2.drawString(placeHolder, getInsets().left, g.getFontMetrics().getMaxAscent() + getInsets().top + 6); - } - - @Override - protected void paintBorder(Graphics g) { - g.setColor(BORDER_COLOR); - g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); - } - - public Image getImage() { - return image; - } - - public void setImage(Image image) { - this.image = image; + g2.drawString(placeHolder, getInsets().left, g.getFontMetrics().getMaxAscent() + getInsets().top + PLACE_HOLDER_GAP); } public String getPlaceHolder() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java index 3520cd6c3..2af2da005 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -26,7 +28,7 @@ public class ProductNewsSearchResultPane extends JPanel { this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); this.add(scrollPane); - this.setPreferredSize(new Dimension(680, 305)); + this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); } public ProductNewsList getProductNewsList() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java index 05b5a6d49..d4f6c1802 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java @@ -38,7 +38,7 @@ public class SearchResultPane extends JPanel { this.setLayout(new BorderLayout()); this.add(leftSearchResultPane, BorderLayout.WEST); this.add(rightSearchResultPane, BorderLayout.EAST); - this.setPreferredSize(new Dimension(680, 305)); + this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); } public AlphaFineList getSearchResultList() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java index 1e153c237..9bf151adc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java @@ -5,6 +5,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.CellType; + +import javax.swing.BorderFactory; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; @@ -19,7 +21,9 @@ public class SelectedLabel extends UILabel { private static final int WIDTH = 4; private static final int HEIGHT = 4; - private static final int GAP = 2; + private static final int GAP = 0; + private static final int BORDER_RIGHT = 5; + private static final int BORDER_TOP = 2; private boolean selected; private CellType cellType; @@ -27,6 +31,7 @@ public class SelectedLabel extends UILabel { public SelectedLabel(String text, CellType cellType, boolean selected) { super(text); this.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + this.setBorder(BorderFactory.createEmptyBorder(BORDER_TOP, 0, 0, BORDER_RIGHT)); this.selected = selected; this.cellType = cellType; } @@ -43,20 +48,25 @@ public class SelectedLabel extends UILabel { if (selected) { g2d.setColor(UIConstants.FLESH_BLUE); setForeground(UIConstants.FLESH_BLUE); - g2d.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); + g2d.drawLine(0, this.getHeight() - 1, this.getWidth() - BORDER_RIGHT, this.getHeight() - 1); } + super.paintComponent(g); + } + + @Override + protected void paintBorder(Graphics g) { + super.paintBorder(g); + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (cellType == CellType.PRODUCT_NEWS && AlphaFineUtil.unread()) { Color oldColor = g.getColor(); g2d.setColor(Color.RED); g2d.fillOval(getWidth() - WIDTH, GAP, WIDTH, HEIGHT); g2d.setColor(oldColor); } - - super.paintComponent(g); } - public boolean isSelected() { return selected; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/exception/AlphaFineNetworkException.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/exception/AlphaFineNetworkException.java new file mode 100644 index 000000000..c8fec04e0 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/exception/AlphaFineNetworkException.java @@ -0,0 +1,14 @@ +package com.fr.design.mainframe.alphafine.exception; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/27 + */ +public class AlphaFineNetworkException extends RuntimeException { + + public AlphaFineNetworkException() { + super("NetWork Error"); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java index d80065177..a6e53f479 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java @@ -3,18 +3,21 @@ package com.fr.design.mainframe.alphafine.preview; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.component.ProductNewsContentCellRender; import com.fr.design.mainframe.alphafine.component.ProductNewsList; +import com.fr.design.mainframe.alphafine.exception.AlphaFineNetworkException; import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.design.utils.DesignUtils; import com.fr.log.FineLoggerFactory; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; import java.util.List; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; +import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.SwingWorker; @@ -27,39 +30,78 @@ public class DefaultProductNewsPane extends JPanel { private static final String LOADING = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Loading"); + private static final ImageIcon LOADING_ICON = new ImageIcon(DefaultProductNewsPane.class.getResource("/com/fr/web/images/loading-local.gif")); + + private SwingWorker, Void> worker; public DefaultProductNewsPane() { setLayout(new BorderLayout()); + this.add(createLoadingPane()); + this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); + this.worker = createWorker(); + this.worker.execute(); + } + + + private JPanel createLoadingPane() { JPanel loadingPane = new JPanel(new BorderLayout()); - loadingPane.setBorder(BorderFactory.createEmptyBorder(0, 280, 0, 0)); - loadingPane.add(new UILabel(LOADING)); + UILabel loadingLabel = new UILabel(LOADING); + loadingLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY); + loadingLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); + loadingLabel.setBorder(BorderFactory.createEmptyBorder(0, 280, 0, 0)); + UILabel loadingIconLabel = new UILabel(LOADING_ICON); + loadingIconLabel.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); + loadingPane.add(loadingIconLabel, BorderLayout.NORTH); + loadingPane.add(loadingLabel, BorderLayout.CENTER); loadingPane.setBackground(Color.WHITE); + return loadingPane; + } - this.add(loadingPane); - this.setPreferredSize(new Dimension(680, 305)); - new SwingWorker, Void>() { + private SwingWorker, Void> createWorker() { + if (this.worker != null && !this.worker.isDone()) { + this.worker.cancel(true); + this.worker = null; + } + return new SwingWorker, Void>() { @Override protected List doInBackground() throws Exception { + if (!AlphaFineHelper.isNetworkOk()) { + throw new AlphaFineNetworkException(); + } return ProductNewsSearchManager.getInstance().getProductNewsList(); } @Override protected void done() { - DefaultProductNewsPane.this.remove(loadingPane); + DefaultProductNewsPane.this.removeAll(); try { DefaultProductNewsPane.this.add(createContentPane(get())); - DefaultProductNewsPane.this.validate(); - DefaultProductNewsPane.this.repaint(); - AlphaFineHelper.getAlphaFineDialog().repaint(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (e.getCause() instanceof AlphaFineNetworkException) { + DefaultProductNewsPane.this.add(new NetWorkFailedPane(() -> { + DefaultProductNewsPane.this.removeAll(); + add(createLoadingPane()); + refresh(); + worker = createWorker(); + worker.execute(); + })); + } } + refresh(); } - }.execute(); + }; + } + private void refresh() { + this.validate(); + this.repaint(); + if (AlphaFineHelper.getAlphaFineDialog() != null) { + AlphaFineHelper.getAlphaFineDialog().repaint(); + } } private UIScrollPane createContentPane(List productNewsList) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java index d88da9637..cfaf2bc58 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -3,20 +3,30 @@ package com.fr.design.mainframe.alphafine.preview; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.DesignUtils; +import com.fr.json.JSON; +import com.fr.json.JSONArray; +import com.fr.json.JSONFactory; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.LinkedHashMap; import java.util.Map; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.SwingConstants; +import javax.swing.SwingWorker; /** * @author hades @@ -29,11 +39,71 @@ public class HelpDocumentNoResultPane extends JPanel { private static final Color DOT_COLOR = new Color(200, 201, 205); - public HelpDocumentNoResultPane(String title, Icon icon, Map linkMap) { + private SwingWorker worker; + + private String title; + + private Icon icon; + private Map linkMap; + + public HelpDocumentNoResultPane(String title, Icon icon) { + this.title = title; + this.icon = icon; + this.linkMap = generateMap(); setLayout(new BorderLayout()); - add(new NoResultPane(title, icon, 150), BorderLayout.CENTER); - add(createRecommendPane(linkMap), BorderLayout.EAST); + worker = createWorker(); + worker.execute(); + } + + private SwingWorker createWorker() { + if (this.worker != null && !this.worker.isDone()) { + this.worker.cancel(true); + this.worker = null; + } + return new SwingWorker() { + + @Override + protected Boolean doInBackground() throws Exception { + return AlphaFineHelper.isNetworkOk(); + } + + @Override + protected void done() { + HelpDocumentNoResultPane.this.removeAll(); + try { + if (get()) { + add(new NoResultPane(title, icon, 150), BorderLayout.CENTER); + add(createRecommendPane(linkMap), BorderLayout.EAST); + } else { + add(new NetWorkFailedPane(() -> { + worker = createWorker(); + worker.execute(); + })); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + refresh(); + } + }; + } + + + private void refresh() { + this.validate(); + this.repaint(); + } + + + private Map generateMap() { + JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineConstants.ALPHA_HELP_RECOMMEND); + Map linkMap = new LinkedHashMap<>(); + for (int i = 0, len = jsonArray.size(); i < len; i++) { + JSONObject json = jsonArray.getJSONObject(i); + linkMap.put(json.getString("name"), json.getString("link")); + } + return linkMap; } private JPanel createRecommendPane(Map linkMap) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java new file mode 100644 index 000000000..eb4c107c4 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java @@ -0,0 +1,69 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.share.ui.base.MouseClickListener; +import com.fr.general.IOUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.FlowLayout; +import java.awt.event.MouseEvent; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/4/28 + */ +public class NetWorkFailedPane extends JPanel { + + private Runnable reload; + + public NetWorkFailedPane() { + this(() -> {}); + } + + public NetWorkFailedPane(Runnable reload) { + this.reload = reload; + this.setLayout(new BorderLayout()); + this.add(createInternetErrorPane()); + this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); + this.setBackground(Color.WHITE); + } + + private JPanel createInternetErrorPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); + panel.setBackground(Color.WHITE); + UILabel imagePanel = new UILabel(IOUtils.readIcon("/com/fr/base/images/share/internet_error.png")); + imagePanel.setBorder(BorderFactory.createEmptyBorder(50, 280, 0, 0)); + panel.add(imagePanel); + UILabel uiLabel = tipLabel(Toolkit.i18nText("Fine-Design_Share_Internet_Connect_Failed")); + uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 300, 0, 0)); + uiLabel.setForeground(Color.decode("#8F8F92")); + UILabel reloadLabel = tipLabel(Toolkit.i18nText("Fine-Design_Share_Online_Reload")); + reloadLabel.setBorder(BorderFactory.createEmptyBorder(0, 310, 0, 0)); + reloadLabel.setForeground(Color.decode("#419BF9")); + reloadLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + reloadLabel.addMouseListener(new MouseClickListener() { + @Override + public void mousePressed(MouseEvent e) { + reload.run(); + } + }); + panel.add(uiLabel); + panel.add(reloadLabel); + return panel; + } + + private UILabel tipLabel(String text) { + UILabel tipLabel = new UILabel(text); + tipLabel.setHorizontalAlignment(SwingConstants.CENTER); + return tipLabel; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java index a85c9eeab..e694708e8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java @@ -1,6 +1,12 @@ package com.fr.design.mainframe.alphafine.preview; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; + +import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; +import javax.swing.ImageIcon; import javax.swing.JPanel; /** @@ -10,9 +16,12 @@ import javax.swing.JPanel; */ public class SearchLoadingPane extends JPanel { + private static final ImageIcon LOADING_ICON = new ImageIcon(SearchLoadingPane.class.getResource("/com/fr/design/mainframe/alphafine/images/opening.gif")); public SearchLoadingPane() { - + setLayout(new BorderLayout()); + this.add(new UILabel(LOADING_ICON)); + this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE); this.setBackground(Color.WHITE); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 8c593e213..2726824b7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -38,9 +38,8 @@ public class QuestionPane extends JPanel { g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); } else { g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); - g2.drawImage(QUESTION_IMAGE, (getWidth() - QUESTION_IMAGE.getWidth(this)) / 2, (getHeight() - QUESTION_IMAGE.getHeight(this)) / 2, this); } - + g2.drawImage(QUESTION_IMAGE, (getWidth() - QUESTION_IMAGE.getWidth(this)) / 2, (getHeight() - QUESTION_IMAGE.getHeight(this)) / 2, this); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java index 00e8a8f3e..dc78c22ab 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -59,7 +59,7 @@ public class QuestionWindow extends JWindow { } }); - this.getLayeredPane().setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); + questionPane.setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); this.setContentPane(questionPane); this.setSize(new Dimension(40, 40)); // 这个地方可以设置alwaysOnTop 弹窗会跟随主页面失去激活状态而隐藏 不会与其他弹窗冲突 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java index fd9a08454..0c230844b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.alphafine.search; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; import com.fr.design.mainframe.alphafine.component.ProductNewsSearchResultPane; @@ -29,6 +31,10 @@ public class ProductNewsSearchWorkerManager implements SearchManager { private volatile boolean hasSearchResult = true; + private volatile boolean searchOver = false; + + private volatile boolean networkError = false; + public ProductNewsSearchWorkerManager(CellType cellType, Function> searchFunction, AlphaFineFrame alphaFineFrame) { this.cellType = cellType; this.searchFunction = searchFunction; @@ -40,7 +46,8 @@ public class ProductNewsSearchWorkerManager implements SearchManager { @Override public void doSearch(SearchTextBean searchTextBean) { checkSearchWork(); - + searchOver = false; + networkError = false; if (searchResultPane == null) { searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation()); alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); @@ -49,8 +56,13 @@ public class ProductNewsSearchWorkerManager implements SearchManager { this.searchWorker = new SwingWorker, Void>() { @Override protected DefaultListModel doInBackground() throws Exception { - List productNewsList = searchFunction.apply(searchTextBean); DefaultListModel productNewsDefaultListModel = new DefaultListModel<>(); + if (!AlphaFineHelper.isNetworkOk() && cellType.isNeedNetWork()) { + networkError = true; + FineLoggerFactory.getLogger().warn("alphaFine network error"); + return productNewsDefaultListModel; + } + List productNewsList = searchFunction.apply(searchTextBean); for (ProductNews productNews : productNewsList) { productNewsDefaultListModel.addElement(productNews); } @@ -59,8 +71,13 @@ public class ProductNewsSearchWorkerManager implements SearchManager { @Override protected void done() { + searchOver = true; if (!isCancelled()) { try { + if (networkError) { + alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR); + return; + } DefaultListModel productNewsDefaultListModel = get(); hasSearchResult = !productNewsDefaultListModel.isEmpty(); searchResultPane.getProductNewsList().setModel(get()); @@ -90,6 +107,11 @@ public class ProductNewsSearchWorkerManager implements SearchManager { return hasSearchResult; } + @Override + public boolean isSearchOver() { + return searchOver; + } + private void checkSearchWork() { if (this.searchWorker != null && !this.searchWorker.isDone()) { this.searchWorker.cancel(true); @@ -97,4 +119,8 @@ public class ProductNewsSearchWorkerManager implements SearchManager { } } + @Override + public boolean isNetWorkError() { + return networkError; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java index 8de88a5ad..f9f789395 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java @@ -10,4 +10,8 @@ public interface SearchManager { void doSearch(SearchTextBean searchTextBean); boolean hasSearchResult(); + + boolean isSearchOver(); + + boolean isNetWorkError(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java index a153f80d0..7aa86b84a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; @@ -35,6 +36,9 @@ public class SearchWorkerManager implements SearchManager { private volatile boolean hasSearchResult = true; + private volatile boolean searchOver = false; + + private volatile boolean networkError = false; public SearchWorkerManager(CellType cellType, Function function, AlphaFineFrame alphaFineFrame, ResultShowPane resultShowPane) { this.cellType = cellType; @@ -59,11 +63,18 @@ public class SearchWorkerManager implements SearchManager { } private void initSearchWorker(SearchTextBean searchTextBean) { + this.searchOver = false; + this.networkError = false; this.searchWorker = new SwingWorker() { @Override protected SearchListModel doInBackground() throws Exception { - SearchResult searchResult = searchResultFunction.apply(searchTextBean); SearchListModel searchListModel = new SearchListModel(new SearchResult(), searchResultPane.getSearchResultList(), searchResultPane.getLeftSearchResultPane()); + if (!AlphaFineHelper.isNetworkOk() && cellType.isNeedNetWork()) { + networkError = true; + FineLoggerFactory.getLogger().warn("alphaFine network error"); + return searchListModel; + } + SearchResult searchResult = searchResultFunction.apply(searchTextBean); for (AlphaCellModel object : searchResult) { AlphaFineHelper.checkCancel(); searchListModel.addElement(object); @@ -73,8 +84,13 @@ public class SearchWorkerManager implements SearchManager { @Override protected void done() { + searchOver = true; if (!isCancelled()) { try { + if (networkError) { + alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR); + return; + } SearchListModel searchListModel = get(); hasSearchResult = !searchListModel.isEmpty(); searchResultPane.getSearchResultList().setModel(get()); @@ -108,6 +124,16 @@ public class SearchWorkerManager implements SearchManager { return hasSearchResult; } + @Override + public boolean isSearchOver() { + return searchOver; + } + + @Override + public boolean isNetWorkError() { + return networkError; + } + @Nullable public AlphaFineList getSearchResultList() { if (searchResultPane != null) { diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/clear.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/clear.svg new file mode 100644 index 000000000..815f7c31b --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/clear.svg @@ -0,0 +1,4 @@ + + + + From 2ff33cf948306f10df82a0ec734d5f2bff952d29 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 09:08:47 +0800 Subject: [PATCH 40/79] =?UTF-8?q?REPORT-70483=20cid=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=A4=A9=E6=8E=A8=E9=80=81=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E6=98=AFalphafine=E5=8D=B3=E5=88=BB=E5=B0=B1=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=94=B6=E5=88=B0=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ProductNewsSearchManager.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java index 06dbe6ab0..655eec2c8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search.manager.impl; +import com.fr.concurrent.NamedThreadFactory; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.model.ProductNews; @@ -16,17 +17,33 @@ import java.net.URL; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import javax.imageio.ImageIO; public class ProductNewsSearchManager { private static final ProductNewsSearchManager INSTANCE = new ProductNewsSearchManager(); + private static final int TIME_GAP = 12; private List productNewsResultList; private List productNewsList = new ArrayList<>(); - private ProductNewsSearchManager() { + private ScheduledExecutorService service; + private ProductNewsSearchManager() { + service = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ProductNewsSearchManager", true)); + service.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + try { + getProductNewsList(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }, TIME_GAP, TIME_GAP, TimeUnit.HOURS); } public static ProductNewsSearchManager getInstance() { @@ -67,7 +84,11 @@ public class ProductNewsSearchManager { setStatus(ProductNews.Status.parseCode(obj.getInt("status"))).setTarget( ProductNews.Target.parseCode(obj.getInt("target"))). setCreator(obj.getInt("creator")).setPushDate(new Date(obj.getLong("push_time"))); - productNewsList.add(productNews); + Date currentDate = new Date(System.currentTimeMillis()); + // 推送时间check + if (productNews.getPushDate().before(currentDate)) { + productNewsList.add(productNews); + } } return productNewsList; } From a1d545252b40779a6931932d651bc4b015895edd Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 10:38:23 +0800 Subject: [PATCH 41/79] =?UTF-8?q?REPORT-70452=20=20fix=20=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E7=A9=BAborder=20&&=20=E6=B8=85=E7=A9=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/component/AlphaFineTextField.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java index fafe0f60a..b745b0de9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java @@ -40,6 +40,11 @@ public class AlphaFineTextField extends UITextField { g2.drawString(placeHolder, getInsets().left, g.getFontMetrics().getMaxAscent() + getInsets().top + PLACE_HOLDER_GAP); } + @Override + protected void paintBorder(Graphics g) { + // do nothing + } + public String getPlaceHolder() { return placeHolder; } From bc9e3a46d6e09f1b7634a8a03034d4408310f001 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 10:39:51 +0800 Subject: [PATCH 42/79] =?UTF-8?q?REPORT-70452=20=20fix=20=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E7=A9=BAborder=20&&=20=E6=B8=85=E7=A9=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineFrame.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 2c33cd97c..e05f84b8c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -599,9 +599,10 @@ public class AlphaFineFrame extends JFrame { // 坑 isShowing返回false 即使textField有内容 getText返回的也是空 if (searchTextField.isShowing() && StringUtils.isEmpty(searchTextField.getText())) { SearchTooltipPopup.getInstance().hide(); + clearLabel.setVisible(false); switchType(selectedType); - } - else if (searchTextField.hasFocus()) { + } else if (searchTextField.hasFocus()) { + clearLabel.setVisible(true); SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); } From c91aee4e861fa32cbf4a0c4460341b960e555db2 Mon Sep 17 00:00:00 2001 From: lucian Date: Fri, 29 Apr 2022 10:43:09 +0800 Subject: [PATCH 43/79] =?UTF-8?q?REPORT-70504=20=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/TableSearchTreeComboBox.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index f4b21c3fe..916cd3cf6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -10,6 +10,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.DesignerContext; import com.fr.log.FineLoggerFactory; +import com.fr.module.ModuleContext; import com.fr.stable.ArrayUtils; import com.fr.stable.Filter; import com.fr.stable.StringUtils; @@ -26,7 +27,6 @@ import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.util.Enumeration; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; /** * 实现模糊搜索表名的FRTreeComboBox @@ -43,7 +43,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { /** * 保证模糊搜索的原子性操作 */ - private final ExecutorService singleExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); + private final ExecutorService singleExecutor = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); From ad7328e959e7ad92b1f0a1d549423df4717c56bb Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 11:43:03 +0800 Subject: [PATCH 44/79] =?UTF-8?q?REPORT-70682=20cid=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=9A=90=E8=97=8F=E6=97=B6=20=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E6=8C=89=E9=92=AE=E8=BF=98=E6=98=AF=E6=9C=89=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=96=87=E7=AB=A0=E6=A0=87=E8=AE=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/AlphaFineUtil.java | 6 ++---- .../manager/impl/ProductNewsSearchManager.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java index 66210cddc..0d23a6fc9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.alphafine; import com.fr.design.DesignerEnvManager; -import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.stable.StringUtils; -import java.util.List; import java.util.Set; /** @@ -57,7 +55,7 @@ public class AlphaFineUtil { public static boolean unread() { Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); - List productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); - return !productNewsList.isEmpty() && (readSet.size() != productNewsList.size()); + Set idSet = ProductNewsSearchManager.getInstance().getIdSet(); + return !idSet.isEmpty() && !readSet.containsAll(idSet); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java index 655eec2c8..205735ab3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java @@ -16,7 +16,9 @@ import java.awt.Image; import java.net.URL; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @@ -30,6 +32,12 @@ public class ProductNewsSearchManager { private List productNewsList = new ArrayList<>(); + /** + * 单独记录一份cid的唯一id 用来判断是否已读 + */ + private Set idSet = new HashSet<>(); + + private ScheduledExecutorService service; private ProductNewsSearchManager() { @@ -71,6 +79,7 @@ public class ProductNewsSearchManager { public List getProductNewsList() throws Exception { productNewsList = new ArrayList<>(); + idSet = new HashSet<>(); String jsonStr = HttpToolbox.get(AlphaFineConstants.ALPHA_CID); AlphaFineHelper.checkCancel(); JSONObject cidJSON = JSONFactory.createJSON(JSON.OBJECT, jsonStr); @@ -88,6 +97,7 @@ public class ProductNewsSearchManager { // 推送时间check if (productNews.getPushDate().before(currentDate)) { productNewsList.add(productNews); + idSet.add(productNews.getId()); } } return productNewsList; @@ -97,6 +107,10 @@ public class ProductNewsSearchManager { return productNewsList; } + public Set getIdSet() { + return idSet; + } + @Nullable private Image getCoverImage(String url) { try { From 9c10525ece18cfd5da017ded1ca04abc29331f9f Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 Apr 2022 11:43:53 +0800 Subject: [PATCH 45/79] =?UTF-8?q?REPORT-70472=20alphafine=E4=B8=AD?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E7=9A=84=E5=B1=82=E7=BA=A7=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineList.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java index 75348468e..0ac1c637a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -24,10 +24,10 @@ public class AlphaFineList extends JList { public void mouseClicked(MouseEvent e) { AlphaCellModel selectedValue = getSelectedValue(); if (e.getClickCount() == 2 && selectedValue.hasAction()) { + // 点击搜索结果 主页面移动到后面 + AlphaFineHelper.getAlphaFineDialog().toBack(); dealWithSearchResult(); } - // 点击搜索结果 主页面移动到后面 - AlphaFineHelper.getAlphaFineDialog().toBack(); } }); From 1e6ca906338431088e744f7a14baca4ce6452d73 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 5 May 2022 09:31:40 +0800 Subject: [PATCH 46/79] =?UTF-8?q?REPORT-70446=20=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 4 +++ .../alphafine/component/AlphaFineFrame.java | 3 +- .../alphafine/component/AlphaFineList.java | 3 +- .../ProductNewsContentCellRender.java | 13 ++++++-- .../alphafine/component/ProductNewsList.java | 32 ++++++++++++++++++- .../ProductNewsSearchResultPane.java | 2 +- .../preview/DefaultProductNewsPane.java | 2 +- .../preview/HelpDocumentNoResultPane.java | 2 ++ 8 files changed, 53 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 9f4895ddb..f4440fb5c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -202,4 +202,8 @@ public class AlphaFineConstants { public static final String LOADING = "loading"; public static final String NETWORK_ERROR = "network error"; + + public static final String TITLE = "AlphaFine"; + + public static final int DEFAULT_CLICK_COUNT = 1; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index e05f84b8c..28300c9b2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -151,6 +151,7 @@ public class AlphaFineFrame extends JFrame { private ProductNewsSearchWorkerManager productNewsSearchWorkerManager; public AlphaFineFrame() { + this.setTitle(AlphaFineConstants.TITLE); setUndecorated(true); setSize(AlphaFineConstants.FIELD_SIZE); initComponents(); @@ -228,7 +229,7 @@ public class AlphaFineFrame extends JFrame { topPane.setBackground(Color.WHITE); JPanel topLeftPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); topLeftPane.setBackground(Color.WHITE); - UILabel alphaFineLabel = new UILabel("AlphaFine"); + UILabel alphaFineLabel = new UILabel(AlphaFineConstants.TITLE); alphaFineLabel.setFont(new Font("Arial Black", Font.PLAIN, 20)); alphaFineLabel.setForeground(UIConstants.FLESH_BLUE); topLeftPane.add(alphaFineLabel); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java index 0ac1c637a..b58a3e51b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.preview.ResultShowPane; @@ -23,7 +24,7 @@ public class AlphaFineList extends JList { @Override public void mouseClicked(MouseEvent e) { AlphaCellModel selectedValue = getSelectedValue(); - if (e.getClickCount() == 2 && selectedValue.hasAction()) { + if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT && selectedValue.hasAction()) { // 点击搜索结果 主页面移动到后面 AlphaFineHelper.getAlphaFineDialog().toBack(); dealWithSearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java index f86253d0c..c6b5983d6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineUtil; @@ -44,12 +45,15 @@ public class ProductNewsContentCellRender implements ListCellRenderer { private String[] segmentationResult; - public ProductNewsContentCellRender(String[] segmentationResult) { + private ProductNewsList productNewsList; + + public ProductNewsContentCellRender(String[] segmentationResult, ProductNewsList productNewsList) { this.segmentationResult = segmentationResult; + this.productNewsList = productNewsList; } - public ProductNewsContentCellRender() { - this(null); + public ProductNewsContentCellRender(ProductNewsList productNewsList) { + this(null, productNewsList); } @Override @@ -65,6 +69,9 @@ public class ProductNewsContentCellRender implements ListCellRenderer { textPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 0)); UILabel titleLabel = new UILabel(AlphaFineUtil.highLightModelName(productNews.getTitle(), segmentationResult)); titleLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(20)); + if (productNewsList.getHoverIndex() == index) { + titleLabel.setForeground(UIConstants.FLESH_BLUE); + } textPane.add(titleLabel, BorderLayout.NORTH); JPanel infoPane = new JPanel(new BorderLayout()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java index b681b5622..9e4d1c402 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java @@ -1,12 +1,17 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.log.FineLoggerFactory; + +import java.awt.Cursor; import java.awt.Desktop; +import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; import java.net.URI; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -19,15 +24,36 @@ import javax.swing.ListModel; */ public class ProductNewsList extends JList { + private int hoverIndex = -1; + public ProductNewsList(ListModel dataModel) { super(dataModel); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { + if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT) { dealWithClick(); } } + + @Override + public void mouseExited(MouseEvent e) { + hoverIndex = -1; + ProductNewsList.this.repaint(); + } + }); + + addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + Point p = new Point(e.getX(), e.getY()); + int index = ProductNewsList.this.locationToIndex(p); + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + if (index != hoverIndex) { + hoverIndex = index; + ProductNewsList.this.repaint(); + } + } }); } @@ -45,4 +71,8 @@ public class ProductNewsList extends JList { DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet().add(productNews.getId()); AlphaFineHelper.getAlphaFineDialog().repaint(); } + + public int getHoverIndex() { + return hoverIndex; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java index 2af2da005..b3fd4dc95 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java @@ -24,7 +24,7 @@ public class ProductNewsSearchResultPane extends JPanel { UIScrollPane scrollPane = new UIScrollPane(productNewsList); scrollPane.setBackground(Color.WHITE); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); - productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult)); + productNewsList.setCellRenderer(new ProductNewsContentCellRender(segmentationResult, productNewsList)); this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); this.add(scrollPane); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java index a6e53f479..d70e37ec0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java @@ -111,7 +111,7 @@ public class DefaultProductNewsPane extends JPanel { } ProductNewsList productNewsJList = new ProductNewsList(productNewsDefaultListModel); productNewsJList.setBackground(Color.WHITE); - productNewsJList.setCellRenderer(new ProductNewsContentCellRender()); + productNewsJList.setCellRenderer(new ProductNewsContentCellRender(productNewsJList)); UIScrollPane scrollPane = new UIScrollPane(productNewsJList); scrollPane.setBackground(Color.WHITE); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java index cfaf2bc58..961d490e5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java @@ -15,6 +15,7 @@ import com.fr.log.FineLoggerFactory; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Cursor; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.MouseAdapter; @@ -139,6 +140,7 @@ public class HelpDocumentNoResultPane extends JPanel { responseClick(link); } }); + listLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); JPanel listPane = new JPanel(new BorderLayout()); listPane.setBackground(Color.WHITE); From 3f0695b5b4f78c9f24003e5b7aded4ace7d98f57 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 5 May 2022 10:09:47 +0800 Subject: [PATCH 47/79] =?UTF-8?q?REPORT-69686=20=E3=80=90=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E3=80=91VALUE=E5=87=BD=E6=95=B0=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E5=86=85=E5=AE=B9=E9=BB=98=E8=AE=A4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8=E4=B9=9F=E6=97=A0=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 6fdb5666c..ef321e708 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -1194,7 +1194,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initDescriptionTextArea() { // Description descriptionTextArea = new UITextArea(); - descriptionTextArea.setPreferredSize(new Dimension(350, 200)); descriptionTextArea.setBackground(Color.white); descriptionTextArea.setLineWrap(true); From 9af7ee1f8148f887a2b2d722cda1163649cc590e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 5 May 2022 14:55:16 +0800 Subject: [PATCH 48/79] =?UTF-8?q?REPORT-69470=20=E5=A4=9A=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=9D=90=E6=A0=87=E8=BD=B4=E5=88=86=E5=B1=82=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E9=80=89=E6=8B=A9=E9=83=A8=E5=88=86=E8=BD=B4?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=A2=9C=E8=89=B2=E5=BC=B9=E7=AA=97=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/frpane/ClosableBubbleFloatPane.java | 46 +++++++++++++++++++ .../design/gui/frpane/UIBubbleFloatPane.java | 20 +++++++- ...VanChartCategoryStylePaneWithCheckBox.java | 4 +- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java new file mode 100644 index 000000000..41a4471da --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ClosableBubbleFloatPane.java @@ -0,0 +1,46 @@ +package com.fr.design.gui.frpane; + +import com.fr.base.BaseUtils; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.Icon; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public abstract class ClosableBubbleFloatPane extends UIBubbleFloatPane { + public ClosableBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane contentPane) { + super(arrowPosition, arrowPoint, contentPane); + } + + public ClosableBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane contentPane, int width, int height) { + super(arrowPosition, arrowPoint, contentPane, width, height); + } + + protected void initAWTEventListener() { + + } + + public boolean forceLockFocus() { + return true; + } + + protected JPanel initTopOptionMenu() { + JPanel menu = new JPanel(new BorderLayout()); + Icon icon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + UILabel label = new UILabel(icon); + label.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + showDialog.setVisible(false); + updateContentPane(); + } + }); + + menu.add(label, BorderLayout.EAST); + return menu; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java index 03927ca46..e50140121 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java @@ -48,7 +48,7 @@ public abstract class UIBubbleFloatPane extends BasicBeanPane { private int arrowPosition; private double time = 0.5; - private UIDialog showDialog; + protected UIDialog showDialog; /** * @param arrowPosition 箭头的位置,上下左右,暂时只处理了左边,后面用到了再说 TODO @@ -93,11 +93,22 @@ public abstract class UIBubbleFloatPane extends BasicBeanPane { populateBean(ob); if (showDialog == null) { showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); + if (forceLockFocus()) { + showDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); + } } - Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + initAWTEventListener(); showDialog.setVisible(true); } + public boolean forceLockFocus() { + return false; + } + + protected void initAWTEventListener() { + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + /** * 数据展现 */ @@ -213,9 +224,14 @@ public abstract class UIBubbleFloatPane extends BasicBeanPane { } this.setLayout(new BorderLayout()); + this.add(initTopOptionMenu(), BorderLayout.NORTH); this.add(contentPane, BorderLayout.CENTER); } + protected JPanel initTopOptionMenu() { + return new JPanel(); + } + private class CustomShapedDialog extends UIDialog { private static final int GAP_SMALL = 10; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java index acc87572f..79e4aad9b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartCategoryStylePaneWithCheckBox.java @@ -1,7 +1,7 @@ package com.fr.van.chart.designer.style.axis.component; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.frpane.ClosableBubbleFloatPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; @@ -68,7 +68,7 @@ public class VanChartCategoryStylePaneWithCheckBox extends JPanel { Point comPoint = settingButton.getLocationOnScreen(); Point arrowPoint = new Point(comPoint.x +settingButton.getWidth() - 25, comPoint.y + settingButton.getHeight()); Dimension size = settingPane.getPreferredSize(); - UIBubbleFloatPane pane = new UIBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 230) { + ClosableBubbleFloatPane pane = new ClosableBubbleFloatPane(Constants.LEFT, arrowPoint, settingPane, size.width, 240) { @Override public void updateContentPane() { From a65eb1aa996137ebfb1730da50f6f6abd2cdda70 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 5 May 2022 16:31:49 +0800 Subject: [PATCH 49/79] =?UTF-8?q?REPORT-70665=2011.0.3.1=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=20=E6=8D=A2=E6=9C=80=E6=96=B0feature=E5=8C=85?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 2 ++ 1 file changed, 2 insertions(+) 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 695e8d8f2..da8b559e8 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 @@ -169,6 +169,8 @@ public class DesignerStartup extends Activator { DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable() && OptimizeUtil.isOpen() && existPropCache + // demo启动时 前后目录可能会不一致 造成读取缓存失败 + && !startupArgsValue.getValue().isDemo() && !new File(dbConfigPath).exists()); } From d657b5d8bde751e00727b710d75b906ad626d2f5 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 5 May 2022 18:52:09 +0800 Subject: [PATCH 50/79] =?UTF-8?q?REPORT-70446=20=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/component/ProductNewsImagePanel.java | 2 +- .../fr/design/mainframe/alphafine/question/QuestionPane.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index e87b6f199..dd1b3c483 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -56,7 +56,7 @@ public class ProductNewsImagePanel extends JPanel { } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { - g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); + g2.drawImage(NEW_TIP_IMAGE, 0, 0, (int) (NEW_TIP_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE), (int) (NEW_TIP_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE), this); } g2.setColor(BACKGROUND_COLOR); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 2726824b7..81617d0d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -39,7 +39,9 @@ public class QuestionPane extends JPanel { } else { g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); } - g2.drawImage(QUESTION_IMAGE, (getWidth() - QUESTION_IMAGE.getWidth(this)) / 2, (getHeight() - QUESTION_IMAGE.getHeight(this)) / 2, this); + int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE); + int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); + g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); } From 5f8806250a469f8f08a1913337021b71e38fc857 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 11:02:53 +0800 Subject: [PATCH 51/79] =?UTF-8?q?REPORT-70387=20=E6=AC=A1=E7=AE=A1?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5=EF=BC=8C=E4=BC=9A=E7=9C=8B?= =?UTF-8?q?=E5=88=B0=E7=89=B9=E5=AE=9A=E7=9A=84=E6=B2=A1=E6=9C=89=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index fe69024a8..640fb2762 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -142,7 +142,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { if (StringUtils.isNotBlank(s)) { // 之前的写法有多线程问题,nameList异步尚未初始化完成的时候,这里可能无法匹配设置数据连接名称,导致DBTableDataPane打开后连接面板空白 // 这里的需求无非是设置上一次使用的数据连接,做个简单检查这个连接是否存在即可,存在就设置 - if (ConnectionConfig.getInstance().getConnection(s) != null) { + if (nameList.contains(s)) { this.setSelectedItem(s); } } From f2bdb747137a97b67b79cf716230122c24af0005 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 16:42:15 +0800 Subject: [PATCH 52/79] =?UTF-8?q?REPORT-70446=20=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9=20svg=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/ProductNewsImagePanel.java | 6 ++++- .../alphafine/question/QuestionPane.java | 23 +++++++++++++++---- .../mainframe/alphafine/images/group_new.svg | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index dd1b3c483..b46d094d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -2,8 +2,10 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.base.GraphHelper; import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.utils.SvgPaintUtils; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -56,7 +58,9 @@ public class ProductNewsImagePanel extends JPanel { } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { - g2.drawImage(NEW_TIP_IMAGE, 0, 0, (int) (NEW_TIP_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE), (int) (NEW_TIP_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE), this); + SvgPaintUtils.beforePaint(g2); + g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); + SvgPaintUtils.afterPaint(g2); } g2.setColor(BACKGROUND_COLOR); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 81617d0d8..e0d528894 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.alphafine.question; import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.design.utils.SvgPaintUtils; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -23,6 +25,10 @@ public class QuestionPane extends JPanel { private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); + private static final int WIDTH = 40; + + private static final int HEIGHT = 40; + public QuestionPane() { this.setBackground(new Color(0, 0, 0, 0)); @@ -34,14 +40,21 @@ public class QuestionPane extends JPanel { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + SvgPaintUtils.beforePaint(g2); + // 宽高保持 + int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth(); + int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight(); + if (AlphaFineUtil.unread()) { - g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); + g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this); } else { - g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); + g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this); } - int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE); - int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); - g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); + + int imageWidth = QUESTION_IMAGE.getWidth(this); + int imageHeight = QUESTION_IMAGE.getHeight(this); + g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this); + SvgPaintUtils.afterPaint(g2); } diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg index af299d12b..9b25587c4 100644 --- a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg @@ -1,4 +1,4 @@ - + From 5e3cf961e56c1ba3275668dff59f68942bbb38fe Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 16:42:56 +0800 Subject: [PATCH 53/79] =?UTF-8?q?REPORT-70446=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/SvgPaintUtils.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java b/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java new file mode 100644 index 000000000..fdb460eb4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java @@ -0,0 +1,28 @@ +package com.fr.design.utils; + +import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; +import java.awt.Graphics2D; + +/** + * 用于绘制svg图片缩放(高分屏下) + * + * @author hades + * @version 11.0 + * Created by hades on 2022/5/6 + */ +public class SvgPaintUtils { + + public static void beforePaint(Graphics2D g2) { + if (SystemScaleUtils.isJreHiDPIEnabled()) { + g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE); + } + } + + public static void afterPaint(Graphics2D g2) { + if (SystemScaleUtils.isJreHiDPIEnabled()) { + g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE); + } + } + +} From 0da69cc600d2b8aea42b225e86fe415d760fba0a Mon Sep 17 00:00:00 2001 From: pengda Date: Sat, 7 May 2022 11:00:47 +0800 Subject: [PATCH 54/79] =?UTF-8?q?REPORT-70426=20=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=94=AF=E6=8C=81=E6=B1=87=E6=80=BB=E6=95=B0?= =?UTF-8?q?=E7=BB=84-=E4=BA=A4=E4=BA=92=E7=95=8C=E9=9D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ColSelectedWithSummaryMethodEditor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java index 6b6fe08cc..c8a2ec462 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java @@ -2,6 +2,7 @@ package com.fr.design.chart.series.SeriesCondition; import com.fr.chart.chartattr.Chart; import com.fr.data.DSColumnWithSummaryMethod; +import com.fr.data.util.function.AbstractDataFunction; import com.fr.design.chart.ChartDataHelper; import com.fr.design.data.datapane.SummaryMethodComboBox; import com.fr.design.editor.editor.Editor; @@ -25,12 +26,15 @@ public class ColSelectedWithSummaryMethodEditor extends Editor Date: Sat, 7 May 2022 16:01:58 +0800 Subject: [PATCH 55/79] =?UTF-8?q?REPORT-70426=20=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=94=AF=E6=8C=81=E6=B1=87=E6=80=BB=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E4=BA=A7=E5=93=81=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/ColSelectedWithSummaryMethodEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java index c8a2ec462..875bc705a 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java @@ -20,7 +20,7 @@ public class ColSelectedWithSummaryMethodEditor extends Editor summaryMethodComboBoxModel = new DefaultComboBoxModel<>(SummaryMethodComboBox.CALCULATE_ARRAY); public ColSelectedWithSummaryMethodEditor() { - this.setName(Toolkit.i18nText("Fine-Design_Chart_Summary_Array")); + this.setName(Toolkit.i18nText("Fine-Design_Chart_Summary_Field_Value")); this.setLayout(FRGUIPaneFactory.createLeftZeroLayout()); if (columnNameComboBox == null) { columnNameComboBox = new UIComboBox(); From 8194145fde9f4ce218d328cc2ac91d55f110eb3d Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 7 May 2022 16:35:34 +0800 Subject: [PATCH 56/79] =?UTF-8?q?REPORT-70446=20svg=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=8A=97=E9=94=AF=E9=BD=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/question/QuestionPane.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index e0d528894..0d0d9ab63 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -9,7 +9,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; -import java.awt.RenderingHints; import javax.swing.JPanel; /** @@ -25,11 +24,6 @@ public class QuestionPane extends JPanel { private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); - private static final int WIDTH = 40; - - private static final int HEIGHT = 40; - - public QuestionPane() { this.setBackground(new Color(0, 0, 0, 0)); } @@ -38,22 +32,20 @@ public class QuestionPane extends JPanel { protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); SvgPaintUtils.beforePaint(g2); // 宽高保持 int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth(); int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight(); if (AlphaFineUtil.unread()) { - g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this); + g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, this); } else { - g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this); + g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, this); } int imageWidth = QUESTION_IMAGE.getWidth(this); int imageHeight = QUESTION_IMAGE.getHeight(this); - g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this); + g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2 - 2, (height - imageHeight) / 2 - 2,this); SvgPaintUtils.afterPaint(g2); } From b00644e34e67809ff63ba7aa57f3f1a837653c2f Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 7 May 2022 16:37:36 +0800 Subject: [PATCH 57/79] =?UTF-8?q?REPORT-70681=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E9=AB=98=E4=BA=AE=E5=92=8C=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=87=86=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineFrame.java | 24 +++++++------------ .../ProductNewsSearchWorkerManager.java | 7 +++--- .../alphafine/search/SearchWorkerManager.java | 7 +++--- .../manager/fun/AlphaFineSearchProvider.java | 12 ++++++++++ .../manager/impl/ActionSearchManager.java | 7 ++++++ .../manager/impl/DocumentSearchManager.java | 12 +++++++--- .../manager/impl/FileSearchManager.java | 11 +++++++++ .../manager/impl/PluginSearchManager.java | 11 ++++++++- 8 files changed, 65 insertions(+), 26 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 28300c9b2..d97710ef1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -171,38 +171,26 @@ public class AlphaFineFrame extends JFrame { this.settingSearchWorkerManager = new SearchWorkerManager( CellType.ACTION, - searchTextBean -> { - ActionSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); - return ActionSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); - }, + searchTextBean -> ActionSearchManager.getInstance().getSearchResult(searchTextBean), this, new SimpleRightSearchResultPane(new NoResultPane(NO_RESULT, AlphaFineConstants.NO_RESULT_ICON)) ); fileSearchWorkerManager = new SearchWorkerManager( CellType.FILE, - searchTextBean -> { - FileSearchManager.getInstance().getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation()); - return FileSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); - }, + searchTextBean -> FileSearchManager.getInstance().getSearchResult(searchTextBean), this, new LoadingRightSearchResultPane() ); documentWorkerManager = new SearchWorkerManager( CellType.DOCUMENT, - searchTextBean -> { - DocumentSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); - return DocumentSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); - }, + searchTextBean -> DocumentSearchManager.getInstance().getSearchResult(searchTextBean), this, new SimpleRightSearchResultPane(new JPanel()) ); pluginSearchWorkerManager = new SearchWorkerManager( CellType.PLUGIN, - searchTextBean -> { - PluginSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation()); - return PluginSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText()); - }, + searchTextBean -> PluginSearchManager.getInstance().getSearchResult(searchTextBean), this, new LoadingRightSearchResultPane() ); @@ -663,6 +651,10 @@ public class AlphaFineFrame extends JFrame { resultPane.add(panel, flag); } + public void removeSearchResultPane(JPanel panel) { + resultPane.remove(panel); + } + private void doSearch(String text) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java index 0c230844b..40161e9ba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java @@ -48,10 +48,11 @@ public class ProductNewsSearchWorkerManager implements SearchManager { checkSearchWork(); searchOver = false; networkError = false; - if (searchResultPane == null) { - searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation()); - alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); + if (searchResultPane != null) { + alphaFineFrame.removeSearchResultPane(searchResultPane); } + searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation()); + alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); this.searchWorker = new SwingWorker, Void>() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java index 7aa86b84a..0b25c3ca1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java @@ -48,10 +48,11 @@ public class SearchWorkerManager implements SearchManager { } private void initSearchResult(SearchTextBean searchTextBean) { - if (searchResultPane == null) { - searchResultPane = new SearchResultPane(searchTextBean.getSegmentation(), resultShowPane); - alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); + if (searchResultPane != null) { + alphaFineFrame.removeSearchResultPane(searchResultPane); } + searchResultPane = new SearchResultPane(searchTextBean.getSegmentation(), resultShowPane); + alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java index b75aa894c..631fce88e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.alphafine.search.manager.fun; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; /** * Created by XiaXiang on 2017/3/27. @@ -20,4 +21,15 @@ public interface AlphaFineSearchProvider { * @return */ SearchResult getMoreSearchResult(String searchText); + + + /** + * 获取所有搜索结果 取决于具体实现 + * + * @param searchTextBean + * @return + */ + default SearchResult getSearchResult(SearchTextBean searchTextBean) { + return new SearchResult(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java index 1c4fec090..a2a1a7037 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionModel; @@ -101,4 +102,10 @@ public class ActionSearchManager implements AlphaFineSearchProvider { public SearchResult getMoreSearchResult(String searchText) { return moreModelList; } + + @Override + public SearchResult getSearchResult(SearchTextBean searchTextBean) { + getLessSearchResult(searchTextBean.getSegmentation()); + return filterModelList; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index 0b4953083..7a74ee6c1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -7,15 +7,14 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; -import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import java.io.IOException; /** * Created by XiaXiang on 2017/3/27. @@ -24,6 +23,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { private static volatile DocumentSearchManager instance; private SearchResult lessModelList; private SearchResult moreModelList; + private SearchResult searchResult; public static DocumentSearchManager getInstance() { if (instance == null) { @@ -54,6 +54,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { public SearchResult getLessSearchResult(String[] searchText) { lessModelList = new SearchResult(); moreModelList = new SearchResult(); + searchResult = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) { if (ArrayUtils.isEmpty(searchText)) { lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"))); @@ -63,7 +64,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { if(noConnectList != null){ return noConnectList; } - SearchResult searchResult = new SearchResult(); + searchResult = new SearchResult(); for (int j = 0; j < searchText.length; j++) { String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j]; try { @@ -106,4 +107,9 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { return moreModelList; } + @Override + public SearchResult getSearchResult(SearchTextBean searchTextBean) { + getLessSearchResult(searchTextBean.getSegmentation()); + return searchResult; + } } 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 327d0555c..cbba24938 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 @@ -9,16 +9,19 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.FileModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.rpc.ExceptionHandler; import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import java.util.Arrays; /** @@ -71,6 +74,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); + FineLoggerFactory.getLogger().error("===={}====", searchStr); + FineLoggerFactory.getLogger().error("分词 ==={}===", Arrays.toString(searchText)); for (int j = 0; j < searchText.length; j++) { this.searchText = dealWithSearchText(searchText[j]); if (StringUtils.isBlank(this.searchText) || ComparatorUtils.equals(this.searchText, DS_NAME)) { @@ -114,6 +119,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { return moreModelList; } + @Override + public SearchResult getSearchResult(SearchTextBean searchTextBean) { + getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation()); + return filterModelList; + } + private void doSearch(String searchText) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) { for (FileNode node : fileNodes) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 31a1b18ed..56f7078b4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpToolbox; @@ -28,6 +29,7 @@ import java.net.URLEncoder; public class PluginSearchManager implements AlphaFineSearchProvider { private SearchResult lessModelList; private SearchResult moreModelList; + private SearchResult searchResult; private PluginSearchManager() { @@ -97,7 +99,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { public SearchResult getLessSearchResult(String[] searchText) { this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - SearchResult searchResult = new SearchResult(); + this.searchResult = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) { if (ArrayUtils.isEmpty(searchText)) { lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"))); @@ -146,4 +148,11 @@ public class PluginSearchManager implements AlphaFineSearchProvider { public SearchResult getMoreSearchResult(String searchText) { return this.moreModelList; } + + + @Override + public SearchResult getSearchResult(SearchTextBean searchTextBean) { + getLessSearchResult(searchTextBean.getSegmentation()); + return searchResult; + } } From 9f123d067d00837d9ae081dca1c4af4161cb1158 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 7 May 2022 16:46:57 +0800 Subject: [PATCH 58/79] =?UTF-8?q?REPORT-70681=20fix=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/question/QuestionWindow.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java index dc78c22ab..ddfdc375a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.alphafine.question; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.log.FineLoggerFactory; import java.awt.Color; import java.awt.Dimension; import java.awt.event.MouseAdapter; @@ -10,6 +11,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; import javax.swing.JWindow; /** @@ -51,13 +53,42 @@ public class QuestionWindow extends JWindow { @Override public void windowActivated(WindowEvent e) { QuestionWindow.getInstance().setVisible(true); + FineLoggerFactory.getLogger().error("=====> active"); } @Override public void windowDeactivated(WindowEvent e) { QuestionWindow.getInstance().setVisible(false); + FineLoggerFactory.getLogger().error("=====> Deactivate"); } + @Override + public void windowOpened(WindowEvent e) { + FineLoggerFactory.getLogger().error("=====> open"); + } + + @Override + public void windowGainedFocus(WindowEvent e) { + FineLoggerFactory.getLogger().error("===== get focus"); + } + + @Override + public void windowStateChanged(WindowEvent e) { + FineLoggerFactory.getLogger().error("new: {}", e.getNewState()); + FineLoggerFactory.getLogger().error("old: {}", e.getOldState()); + } + }); + + DesignerContext.getDesignerFrame().addWindowFocusListener(new WindowFocusListener() { + @Override + public void windowGainedFocus(WindowEvent e) { + FineLoggerFactory.getLogger().error("get focus"); + } + + @Override + public void windowLostFocus(WindowEvent e) { + FineLoggerFactory.getLogger().error("lost focus"); + } }); questionPane.setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); this.setContentPane(questionPane); From 8799446feb3717909341ff9705eeb6989cf91b13 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 7 May 2022 16:48:42 +0800 Subject: [PATCH 59/79] =?UTF-8?q?REPORT-70681=20fix=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/question/QuestionWindow.java | 32 ------------------- .../manager/impl/FileSearchManager.java | 4 --- 2 files changed, 36 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java index ddfdc375a..079eecadb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.question; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineHelper; -import com.fr.log.FineLoggerFactory; import java.awt.Color; import java.awt.Dimension; import java.awt.event.MouseAdapter; @@ -11,7 +10,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; import javax.swing.JWindow; /** @@ -53,41 +51,11 @@ public class QuestionWindow extends JWindow { @Override public void windowActivated(WindowEvent e) { QuestionWindow.getInstance().setVisible(true); - FineLoggerFactory.getLogger().error("=====> active"); } @Override public void windowDeactivated(WindowEvent e) { QuestionWindow.getInstance().setVisible(false); - FineLoggerFactory.getLogger().error("=====> Deactivate"); - } - - @Override - public void windowOpened(WindowEvent e) { - FineLoggerFactory.getLogger().error("=====> open"); - } - - @Override - public void windowGainedFocus(WindowEvent e) { - FineLoggerFactory.getLogger().error("===== get focus"); - } - - @Override - public void windowStateChanged(WindowEvent e) { - FineLoggerFactory.getLogger().error("new: {}", e.getNewState()); - FineLoggerFactory.getLogger().error("old: {}", e.getOldState()); - } - }); - - DesignerContext.getDesignerFrame().addWindowFocusListener(new WindowFocusListener() { - @Override - public void windowGainedFocus(WindowEvent e) { - FineLoggerFactory.getLogger().error("get focus"); - } - - @Override - public void windowLostFocus(WindowEvent e) { - FineLoggerFactory.getLogger().error("lost focus"); } }); questionPane.setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); 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 cbba24938..744b5a839 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 @@ -15,13 +15,11 @@ import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; -import com.fr.log.FineLoggerFactory; import com.fr.rpc.ExceptionHandler; import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import java.util.Arrays; /** @@ -74,8 +72,6 @@ public class FileSearchManager implements AlphaFineSearchProvider { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - FineLoggerFactory.getLogger().error("===={}====", searchStr); - FineLoggerFactory.getLogger().error("分词 ==={}===", Arrays.toString(searchText)); for (int j = 0; j < searchText.length; j++) { this.searchText = dealWithSearchText(searchText[j]); if (StringUtils.isBlank(this.searchText) || ComparatorUtils.equals(this.searchText, DS_NAME)) { From f79b56c2532dd0d82fae8115cd5213f853568512 Mon Sep 17 00:00:00 2001 From: yaohwu Date: Sat, 7 May 2022 17:55:23 +0800 Subject: [PATCH 60/79] =?UTF-8?q?REPORT-71028=20=E9=83=A8=E5=88=86execute?= =?UTF-8?q?=20=E5=9F=8B=E7=82=B9=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E9=A2=9D=E5=A4=96=E7=9A=84session=E7=9B=B8=E5=85=B3=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/analyzer/advice/MonitorAdvice.java | 56 ++++++------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java b/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java index 68f8c8508..b70bf44f9 100644 --- a/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java +++ b/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java @@ -5,22 +5,18 @@ import com.fr.general.GeneralUtils; import com.fr.intelli.measure.Estimator; import com.fr.intelli.metrics.Compute; import com.fr.intelli.metrics.MessageRecorderFactory; +import com.fr.intelli.metrics.SessionBinder; import com.fr.intelli.metrics.SupervisoryConfig; import com.fr.intelli.record.Measurable; import com.fr.intelli.record.MeasureObject; import com.fr.intelli.record.MeasureUnit; import com.fr.log.FineLoggerFactory; import com.fr.measure.DBMeterFactory; -import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.stable.web.Session; -import com.fr.stable.web.SessionProvider; import com.fr.third.net.bytebuddy.asm.Advice; import com.fr.third.net.bytebuddy.implementation.bytecode.assign.Assigner; -import com.fr.web.core.SessionPoolManager; import com.fr.web.session.SessionLocalManager; -import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -33,32 +29,31 @@ import java.util.regex.Pattern; * created by Harrison on 2022/03/07 **/ public class MonitorAdvice implements DesignerAnalyzerAdvice { - + private static final Pattern P = Pattern.compile("-?\\d+"); private static final int MIN_ERROR_CODE = 10000000; - + @Advice.OnMethodEnter public static void onMethodEnter(@Advice.Origin Method method, @Advice.AllArguments(typing = Assigner.Typing.DYNAMIC) Object[] args, @Advice.Local("startTime") Long startTime, - @Advice.Local("registeredSession") Boolean registeredSession) { - + @Advice.Local("sessionBinder") SessionBinder sessionBinder) { + startTime = (System.currentTimeMillis()); - registeredSession = (findSessionAnnotation(method, args)); + sessionBinder = new SessionBinder(); + sessionBinder.attachSession(method, args); } - + @Advice.OnMethodExit(onThrowable = Exception.class) public static void onMethodExit(@Advice.This(optional = true, typing = Assigner.Typing.DYNAMIC) Object self, @Advice.Origin Method method, @Advice.AllArguments(typing = Assigner.Typing.DYNAMIC) Object[] args, @Advice.Thrown(typing = Assigner.Typing.DYNAMIC) Exception e, @Advice.Local("startTime") Long startTime, - @Advice.Local("registeredSession") Boolean registeredSession) throws Exception { - + @Advice.Local("sessionBinder") SessionBinder sessionBinder) throws Exception { + String error = StringUtils.EMPTY; - try { - if (e != null) { try { error = getErrorContent(e); @@ -95,14 +90,11 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice { } catch (Exception ignore) { //埋点信息入库失败应该不能影响业务流程 } finally { - if (registeredSession) { - // 如果上面记录了,这里就要释放 - SessionLocalManager.releaseSession(); - } + sessionBinder.detachSession(); } } } - + public static String getErrorContent(Exception e) { int errorCode = GeneralUtils.objectToNumber( extractCodeFromString(e.getMessage()) @@ -110,7 +102,7 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice { // 提取字符串中的第一个数字,最小的错误码为10000000 return e.getClass().getName() + ":" + (errorCode >= MIN_ERROR_CODE ? errorCode : StringUtils.EMPTY); } - + public static String extractCodeFromString(String errorMsg) { Matcher m = P.matcher(errorMsg); if (m.find()) { @@ -118,38 +110,22 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice { } return StringUtils.EMPTY; } - + public static void recordSQLDetail(String uuid) { DBMeterFactory.getMeter().submit(uuid); } - + public static void recordSQL(Compute once, MeasureObject measureObject) { if (SupervisoryConfig.getInstance().isEnableMeasureSql() && once.computeSql()) { measureObject.sqlTime(SessionLocalManager.getSqlTime()); measureObject.sql(SessionLocalManager.getSql()); } } - + public static void recordMemory(Compute once, Measurable measurable, MeasureObject measureObject) { if (SupervisoryConfig.getInstance().isEnableMeasureMemory() && once.computeMemory()) { MeasureUnit unit = measurable.measureUnit(); measureObject.memory(unit.measureMemory()); } } - - public static boolean findSessionAnnotation(Method method, Object[] args) { - Annotation[][] all = method.getParameterAnnotations(); - int len = ArrayUtils.getLength(args); - for (int i = 0; i < len; i++) { - Annotation[] current = all[i]; - for (Annotation annotation : current) { - if (annotation.annotationType().equals(Session.class)) { - SessionLocalManager.setSession( - SessionPoolManager.getSessionIDInfor(GeneralUtils.objectToString(args[i]), SessionProvider.class)); - return true; - } - } - } - return false; - } } From 90875d379d3dbbc1e0489d1a85876b15ea3e6f73 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 9 May 2022 10:16:12 +0800 Subject: [PATCH 61/79] =?UTF-8?q?REPORT-71075=20fix:=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=B6=85=E9=93=BE=E5=BC=B9=E6=A1=86=E5=92=8C?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E7=AA=97=E5=9B=BE=E8=A1=A8=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/component/VanChartUIListControlPane.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java index 823012f58..bfa8b43e9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Nameable; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -128,7 +129,9 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem public void populate(Nameable[] nameableArray) { //特殊处理,使用instanceof判断,弹出不同的面板 - if (SwingUtilities.getWindowAncestor(this) instanceof PopupEditDialog) { + //悬浮窗图表弹框 || 场景地图编辑弹框 都是真正的弹框 从if走 + //fvs.chart走super + if (SwingUtilities.getWindowAncestor(this) instanceof JDialog && !ChartEditContext.duchampMode()) { popupEditDialog = new HyperDialog(cardPane); } super.populate(nameableArray); @@ -136,7 +139,7 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem protected void popupEditDialog(Point mousePos) { //特殊处理,处理连续弹窗情况,弹出面板定为方式不同 - if (SwingUtilities.getWindowAncestor(this) instanceof PopupEditDialog) { + if (SwingUtilities.getWindowAncestor(this) instanceof JDialog && !ChartEditContext.duchampMode()) { GUICoreUtils.centerWindow(popupEditDialog); popupEditDialog.setVisible(true); return; From 310ec18e723435af5c391f75865de5aa2b12439b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 10:41:29 +0800 Subject: [PATCH 62/79] =?UTF-8?q?REPORT-71082=20alphafine=E5=9C=A8?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=90=8E=20=E4=BC=9A=E8=87=AA=E5=8A=A8=E8=B7=B3?= =?UTF-8?q?=E5=88=B0=E6=9C=80=E5=BA=95=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineList.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java index b58a3e51b..665af5665 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; +import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -26,7 +27,10 @@ public class AlphaFineList extends JList { AlphaCellModel selectedValue = getSelectedValue(); if (e.getClickCount() == AlphaFineConstants.DEFAULT_CLICK_COUNT && selectedValue.hasAction()) { // 点击搜索结果 主页面移动到后面 - AlphaFineHelper.getAlphaFineDialog().toBack(); + if (!(selectedValue instanceof DocumentModel)) { + // 帮助文档不跳转 + AlphaFineHelper.getAlphaFineDialog().toBack(); + } dealWithSearchResult(); } } From 8fa4db6705b5fee8a20a5e1cc4f7c98a73d4dd3f Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 10:43:03 +0800 Subject: [PATCH 63/79] =?UTF-8?q?REPORT-70681=20=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/DocumentSearchManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index 7a74ee6c1..bc3b214d0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -11,6 +11,7 @@ import com.fr.design.mainframe.alphafine.search.SearchTextBean; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; +import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -82,6 +83,8 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { } } } + } catch (JSONException jsonException) { + FineLoggerFactory.getLogger().warn(jsonException, jsonException.getMessage()); } catch (Exception e) { FineLoggerFactory.getLogger().error("document search error: " + e.getMessage()); } From 437eacd0441949eb9e157f237f04437271f62b0b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 12:31:55 +0800 Subject: [PATCH 64/79] =?UTF-8?q?REPORT-71083=20=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E5=90=8E=20=E9=87=8D=E6=96=B0=E6=90=9C=E7=B4=A2=E5=90=8C?= =?UTF-8?q?=E6=A0=B7=E5=86=85=E5=AE=B9=E6=97=A0=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineFrame.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index d97710ef1..86edc6caa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -282,6 +282,7 @@ public class AlphaFineFrame extends JFrame { @Override public void mousePressed(MouseEvent e) { searchTextField.setText(StringUtils.EMPTY); + beforeSearchStr = StringUtils.EMPTY; clearLabel.setVisible(false); } }); @@ -543,6 +544,8 @@ public class AlphaFineFrame extends JFrame { if (StringUtils.isNotEmpty(searchTextField.getText())) { clearLabel.setVisible(true); SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); + } else { + beforeSearchStr = StringUtils.EMPTY; } AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); if (e.getKeyCode() == KeyEvent.VK_ENTER) { From d19abdf10d8762b0e1901b41a7ad0ea4005d7cf3 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 12:40:24 +0800 Subject: [PATCH 65/79] =?UTF-8?q?=20REPORT-71083=20=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E5=90=8E=20=E9=87=8D=E6=96=B0=E6=90=9C=E7=B4=A2=E5=90=8C?= =?UTF-8?q?=E6=A0=B7=E5=86=85=E5=AE=B9=E6=97=A0=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/component/AlphaFineFrame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 86edc6caa..218b244ba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -593,6 +593,7 @@ public class AlphaFineFrame extends JFrame { SearchTooltipPopup.getInstance().hide(); clearLabel.setVisible(false); switchType(selectedType); + beforeSearchStr = StringUtils.EMPTY; } else if (searchTextField.hasFocus()) { clearLabel.setVisible(true); SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); From 9f4492592dcd13bd7dc9b44f28d30431d68467f2 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Mon, 9 May 2022 16:01:28 +0800 Subject: [PATCH 66/79] =?UTF-8?q?REPORT-71052=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E5=8D=95=E5=85=83=E6=A0=BC=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=B6=85=E9=93=BE=EF=BC=8C=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=EF=BC=8C=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=81=A2=E5=A4=8D=E4=B8=BA=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=93=9D=E5=AD=97+=E4=B8=8B=E5=88=92=E7=BA=BF=201=E3=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java b/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java index b3bbaf1df..f2b807602 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java @@ -89,7 +89,7 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro } // 首次添加超链接,将文字样式默认改为蓝色下划线 - if (editCellElement.getNameHyperlinkGroup() == null && hyperlinkGroupPane.getCurrentEvent() != null && hyperlinkGroupPane.getCurrentEvent().getType() == ListDataEvent.INTERVAL_ADDED) { + if ((editCellElement.getNameHyperlinkGroup() == null || editCellElement.getNameHyperlinkGroup().size() == 0) && hyperlinkGroupPane.getCurrentEvent() != null && hyperlinkGroupPane.getCurrentEvent().getType() == ListDataEvent.INTERVAL_ADDED) { editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); } From 191b18826b895a974ea5fa454d134172d0ee8056 Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Mon, 9 May 2022 16:04:09 +0800 Subject: [PATCH 67/79] =?UTF-8?q?REPORT-71052=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E5=8D=95=E5=85=83=E6=A0=BC=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=B6=85=E9=93=BE=EF=BC=8C=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=EF=BC=8C=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=81=A2=E5=A4=8D=E4=B8=BA=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=93=9D=E5=AD=97+=E4=B8=8B=E5=88=92=E7=BA=BF=201=E3=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java index 1f8475869..19823d8b4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java @@ -105,7 +105,7 @@ public class ImgChooseWrapper { } else { BufferedImage image = BaseUtils.readImage(selectedFile.getPath()); String type = ImageUtils.getImageType(selectedFile); - imageWithSuffix = new ImageWithSuffix(image, type, selectedFile.getPath()); + imageWithSuffix = new ImageWithSuffix(image, type); } CoreGraphHelper.waitForImage(imageWithSuffix); From e4af85f87cb09cfb85ee6bf5ea6ff87c48c2f8a2 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 17:41:13 +0800 Subject: [PATCH 68/79] =?UTF-8?q?REPORT-71157=20alphafine=20=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineFrame.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 218b244ba..100e58cd3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -77,6 +77,18 @@ import javax.swing.Timer; public class AlphaFineFrame extends JFrame { private static final String ADVANCED_SEARCH_MARK = "k:"; + private static final String ACTION_MARK_SHORT = "k:1 "; + private static final String ACTION_MARK = "k:setting "; + private static final String DOCUMENT_MARK_SHORT = "k:2 "; + private static final String DOCUMENT_MARK = "k:help "; + private static final String FILE_MARK_SHORT = "k:3 "; + private static final String FILE_MARK = "k:reportlets "; + private static final String CPT_MARK = "k:cpt "; + private static final String FRM_MARK = "k:frm "; + private static final String DS_MARK = "k:ds "; + private static final String DS_NAME = "dsname=\""; + private static final String PLUGIN_MARK_SHORT = "k:4 "; + private static final String PLUGIN_MARK = "k:shop "; private static final int TIMER_DELAY = 300; @@ -663,7 +675,7 @@ public class AlphaFineFrame extends JFrame { private void doSearch(String text) { initSearchLoadingPane(); - SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); + SearchTextBean searchTextBean = generateSearchTextBean(text); this.productNewsSearchWorkerManager.doSearch(searchTextBean); this.settingSearchWorkerManager.doSearch(searchTextBean); this.fileSearchWorkerManager.doSearch(searchTextBean); @@ -671,6 +683,21 @@ public class AlphaFineFrame extends JFrame { this.pluginSearchWorkerManager.doSearch(searchTextBean); } + private SearchTextBean generateSearchTextBean(String searchText) { + if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK) + || searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { + return new SearchTextBean(StringUtils.EMPTY, new String[]{getStoreText(searchText)}); + } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK) + || searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK) + || searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { + return new SearchTextBean(getStoreText(searchText), new String[]{getStoreText(searchText)}); + } else if (searchText.startsWith(DS_MARK)) { + return new SearchTextBean(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}); + } else { + return new SearchTextBean(searchText, segmentationResult); + } + } + /** * 仅搜索依赖网络的搜索项 * From 7ad91ed466cca3ec4864eb8bdb29de6ccae06511 Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 9 May 2022 19:05:29 +0800 Subject: [PATCH 69/79] =?UTF-8?q?REPORT-69725=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E9=9B=86=E7=BE=A4=E7=8E=AF=E5=A2=83=EF=BC=8C=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=B2=A1=E6=9C=89=E5=A4=8D=E5=88=B6=E8=BF=87=E6=9D=A5?= =?UTF-8?q?=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=98=AF=E4=BD=BF=E7=94=A8TableDataWrapper=E7=94=9F?= =?UTF-8?q?=E6=88=90TableDataPane=20+=20=E4=BD=BF=E7=94=A8=E5=BD=93?= =?UTF-8?q?=E4=BD=BF=E7=94=A8TableDataPane=E7=94=9F=E6=88=90=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=9B=E5=9C=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90TableDataPane=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=B0=83=E7=94=A8=E5=AF=B9=E5=BA=94Class=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=9E=84=E9=80=A0=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6populateBean=E4=B8=80=E4=B8=8B=EF=BC=9B=E5=AF=B9?= =?UTF-8?q?=E4=BA=8E=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B=EF=BC=8CProcedure?= =?UTF-8?q?DataPane=E5=9C=A8populateBean=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BC=9A=E5=9C=A8SwingWorker=E7=9A=84doInBackground()=E4=B8=AD?= =?UTF-8?q?=E5=8E=BB=E5=81=9A=E4=B8=80=E6=AC=A1=E6=9F=A5=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E7=84=B6=E5=90=8E=E5=9C=A8done()=E6=9B=B4=E6=96=B0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=EF=BC=9B=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E7=9A=84=E8=BF=87=E7=A8=8B=E5=8F=98?= =?UTF-8?q?=E9=95=BF=EF=BC=8C=E5=AF=BC=E8=87=B4=E8=BF=98=E6=B2=A1=E6=9D=A5?= =?UTF-8?q?=E5=BE=97=E5=8F=8A=E6=9B=B4=E6=96=B0=E4=B8=8A=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=90=8E=E7=BB=AD=E4=BD=BF=E7=94=A8TableDataPane?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=B0=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=8F=82=E6=95=B0=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E6=AD=A4=E5=88=9B=E5=BB=BADataModel=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=90=8E=E5=8F=B0=E6=8A=A5=E9=94=99=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E5=89=8D=E7=AB=AF=E8=A1=A8=E7=8E=B0?= =?UTF-8?q?=E4=B8=BA=E6=95=B0=E6=8D=AE=E9=9B=86=E7=BC=96=E8=BE=91=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E4=B8=8A=E6=B2=A1=E5=8F=82=E6=95=B0=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=96=B9=E6=A1=88=E3=80=911.=E4=B8=93?= =?UTF-8?q?=E5=B1=9E=E4=BA=8E=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B=E7=9A=84?= =?UTF-8?q?ProcedureDataPane=E4=B8=AD=E6=8F=90=E4=BE=9B=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=82=E6=95=B0=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9B2.=E5=AF=B9=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=E7=9A=84=E7=94=9F=E6=88=90TableData?= =?UTF-8?q?Pane=E7=9A=84=E6=96=B9=E6=B3=95=E5=8C=85=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E5=B1=82=EF=BC=8C=E7=84=B6=E5=90=8E=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=BA=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=98=AF=E7=9A=84=E8=AF=9D=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E6=BA=90TableData=E7=9A=84=E5=8F=82=E6=95=B0=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BF=9B=E5=8E=BB=EF=BC=8C=E4=BF=9D=E8=AF=81?= =?UTF-8?q?=E5=90=8E=E9=9D=A2=E8=BF=99=E4=B8=AAPane=E9=87=8C=E6=98=AF?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E6=9C=89=E5=8F=82=E6=95=B0=E7=9A=84=20?= =?UTF-8?q?=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=9C=89=E6=9B=B4=E5=A5=BD=E7=9A=84=E6=94=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E9=87=8C=E8=BF=99=E4=B9=88=E6=94=B9=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E6=98=AF=E5=9B=A0=E4=B8=BA=E7=94=9F=E6=88=90TableDataPane?= =?UTF-8?q?=E5=92=8CpopulateBean=E7=9A=84=E4=BB=A3=E7=A0=81=E9=83=BD?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E5=8F=A4=E8=80=81=EF=BC=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=B9=9F=E4=B8=8D=E7=86=9F=EF=BC=8C=E4=B8=8D=E5=A4=AA=E6=95=A2?= =?UTF-8?q?=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/TableDataTreePane.java | 4 ++-- .../paste/TableDataFollowingPasteUtils.java | 20 +++++++++++++++++-- .../tabledatapane/ProcedureDataPane.java | 8 ++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 8f03b1cfc..e42575177 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -19,6 +19,7 @@ import com.fr.design.data.datapane.management.search.pane.TreeSearchToolbarPane; import com.fr.design.data.datapane.management.search.searcher.TableDataSearchMode; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; +import com.fr.design.data.tabledata.paste.TableDataFollowingPasteUtils; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; @@ -1132,8 +1133,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { // 处理数据集名称 String dsName = getNoRepeatedDsName4Paste(dataWrapperEntry.getKey()); AbstractTableDataWrapper wrapper = dataWrapperEntry.getValue(); - AbstractTableDataPane tableDataPane = wrapper.creatTableDataPane(); - addDataPane(tableDataPane, dsName); + addDataPane(TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper), dsName); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index f69312d47..e90b8a420 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -3,10 +3,12 @@ package com.fr.design.data.tabledata.paste; import com.fr.base.TableData; import com.fr.base.chart.BaseChartCollection; import com.fr.data.TableDataSource; +import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.data.tabledata.tabledatapane.ProcedureDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; @@ -63,8 +65,7 @@ public class TableDataFollowingPasteUtils { continue; } AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName); - AbstractTableDataPane tableDataPane = tableDataWrapper.creatTableDataPane(); - tableDataTreePane.addDataPane(tableDataPane, dsName); + tableDataTreePane.addDataPane(generateTableDataPaneWhenPaste(tableDataWrapper), dsName); } } @@ -337,4 +338,19 @@ public class TableDataFollowingPasteUtils { return templeteDataSet; } + /** + * 生成粘贴(新建)时使用的AbstractTableDataPane + * 主要是为了处理StoreProcedure,它在远程情况下,无法及时获取参数。这边因为是复制粘贴,所以直接用原TableData的参数即可 + * @param tableDataWrapper wrapper + * @return AbstractTableDataPane + */ + public static AbstractTableDataPane generateTableDataPaneWhenPaste(AbstractTableDataWrapper tableDataWrapper) { + AbstractTableDataPane tableDataPane = tableDataWrapper.creatTableDataPane(); + TableData tableData = tableDataWrapper.getTableData(); + if (tableData instanceof StoreProcedure) { + StoreProcedure storeProcedure = (StoreProcedure) tableData; + ((ProcedureDataPane) tableDataPane).populateParameters(storeProcedure.getParameters()); + } + return tableDataPane; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index d2a1918d4..a2a279b60 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -225,6 +225,14 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } + /** + * 手动更新参数,用于上面populateBean方法中SwingWorker查询来不及的情况 + * @param procedureParameters + */ + public void populateParameters(StoreProcedureParameter[] procedureParameters) { + this.editorPane.populate(procedureParameters); + } + /** * 增加存储过程监听器 * From 1a49e536029074c7204514d3e3054c0d17bbea46 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 May 2022 19:51:37 +0800 Subject: [PATCH 70/79] =?UTF-8?q?REPORT-67417=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8E=86=E5=8F=B2/=E5=B7=B2=E8=AF=BB=E5=8A=A8=E6=80=81=20?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index a8970f9d1..892c57ff8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -9,7 +9,7 @@ import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; -import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -99,7 +99,6 @@ public class AlphaFineConfigManager implements XMLable { private String cacheBuildNO; - // todo 暂不持久化 方便测试 /** * key: 登录的bbs用户 * value: alphaFine历史搜索记录 @@ -154,6 +153,10 @@ public class AlphaFineConfigManager implements XMLable { } else if (reader.isChildNode()) { if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) { readActionSearchTextCacheXML(reader); + } else if ("SearchHistory".equals(reader.getTagName())) { + readHistorySearch(reader); + } else if ("ReadSet".equals(reader.getTagName())) { + readReadSet(reader); } } } @@ -180,6 +183,47 @@ public class AlphaFineConfigManager implements XMLable { }); } + private void readHistorySearch(XMLableReader reader) { + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader xmLableReader) { + if (ComparatorUtils.equals(reader.getTagName(), "history")) { + String tmpVal = reader.getElementValue(); + if (tmpVal != null) { + tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + Stack stack = new SizedStack<>(3); + List historyList = Arrays.asList(tmpVal.split(",")); + for (String history : historyList) { + stack.add(history.trim()); + } + historySearchMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), stack); + } + } + } + }); + } + + + private void readReadSet(XMLableReader reader) { + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader xmLableReader) { + if (ComparatorUtils.equals(reader.getTagName(), "readId")) { + String tmpVal = reader.getElementValue(); + if (tmpVal != null) { + tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); + String[] idArr = tmpVal.split(","); + Set setId = new HashSet<>(); + for (String id : idArr) { + setId.add(Long.parseLong(id.trim())); + } + readSetMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), setId); + } + } + } + }); + } + @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG("AlphaFineConfigManager"); @@ -198,6 +242,8 @@ public class AlphaFineConfigManager implements XMLable { .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) .attr("productDynamics", this.isProductDynamics()); writeActionSearchTextCacheXML(writer); + writeSearchHistory(writer); + writeReadSet(writer); writer.end(); } @@ -212,6 +258,22 @@ public class AlphaFineConfigManager implements XMLable { writer.end(); } + private void writeSearchHistory(XMLPrintWriter writer) { + writer.startTAG("SearchHistory"); + for (Map.Entry> entry : historySearchMap.entrySet()) { + writer.startTAG("history").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); + } + writer.end(); + } + + private void writeReadSet(XMLPrintWriter writer) { + writer.startTAG("ReadSet"); + for (Map.Entry> entry : readSetMap.entrySet()) { + writer.startTAG("readId").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); + } + writer.end(); + } + public boolean isSearchOnLine() { return searchOnLine; } From f47fda9a9f9c14fb7db424e87369c10816194d02 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 May 2022 14:15:39 +0800 Subject: [PATCH 71/79] =?UTF-8?q?REPORT-71217=20alphafine=E4=BB=85?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=A8=A1=E7=89=88=E6=97=B6=EF=BC=8C=E8=BF=98?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E4=BA=A7=E5=93=81=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=A4=84=E7=90=86=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineFrame.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index 100e58cd3..bb5d6d060 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -385,6 +385,11 @@ public class AlphaFineFrame extends JFrame { selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN)); } selectedType = selectedLabelList.get(0).getCellType(); + // 第一个tab 非产品动态 + if (selectedType != CellType.PRODUCT_NEWS) { + tabLabel.setText(selectedLabelList.get(0).getText()); + readLabel.setVisible(false); + } for (SelectedLabel selectedLabel : selectedLabelList) { selectedLabel.addMouseListener(new MouseAdapter() { From 163293d50a11745b183a2217acc688bd21735ee7 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 May 2022 14:18:37 +0800 Subject: [PATCH 72/79] =?UTF-8?q?REPORT-71221=20=E4=BD=BF=E7=94=A8alt+=20f?= =?UTF-8?q?4=20,=20alphafine=E9=9D=A2=E6=9D=BF=E4=BB=8D=E4=BC=9A=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E4=B8=8A=E4=B8=80=E6=AC=A1=E6=90=9C=E7=B4=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineFrame.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index bb5d6d060..d93a7b296 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -808,6 +808,9 @@ public class AlphaFineFrame extends JFrame { public void setVisible(boolean b) { super.setVisible(b); QuestionWindow.getInstance().setVisible(!b); + if (!b) { + AlphaFineHelper.resetAlphaFineDialog(); + } } @Override From 781c00e627cbceeb0f09edbf73242ddf3fdea5a3 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 May 2022 14:19:47 +0800 Subject: [PATCH 73/79] =?UTF-8?q?REPORT-67417=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A9=BA=E5=80=BC=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../help/alphafine/AlphaFineConfigManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index 892c57ff8..1dd08c526 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -192,9 +192,12 @@ public class AlphaFineConfigManager implements XMLable { if (tmpVal != null) { tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); Stack stack = new SizedStack<>(3); - List historyList = Arrays.asList(tmpVal.split(",")); + String[] historyList = tmpVal.split(","); for (String history : historyList) { - stack.add(history.trim()); + String value = history.trim(); + if (StringUtils.isNotEmpty(value)) { + stack.add(value); + } } historySearchMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), stack); } @@ -215,7 +218,10 @@ public class AlphaFineConfigManager implements XMLable { String[] idArr = tmpVal.split(","); Set setId = new HashSet<>(); for (String id : idArr) { - setId.add(Long.parseLong(id.trim())); + String value = id.trim(); + if (StringUtils.isNotEmpty(value)) { + setId.add(Long.parseLong(value)); + } } readSetMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), setId); } From f57f3b1fe15c8e892c96ff2312e60b304054a9be Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 May 2022 14:20:48 +0800 Subject: [PATCH 74/79] =?UTF-8?q?REPORT-71160=20=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineList.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java index 665af5665..f4ffe50e3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java @@ -49,6 +49,10 @@ public class AlphaFineList extends JList { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { + AlphaCellModel selectedValue = getSelectedValue(); + if (selectedValue.hasAction() && !(selectedValue instanceof DocumentModel)) { + AlphaFineHelper.getAlphaFineDialog().toBack(); + } dealWithSearchResult(); } } From 4b04d52fdc79ec317519be42b32bc0dfc90b572d Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 10 May 2022 14:46:45 +0800 Subject: [PATCH 75/79] =?UTF-8?q?REPORT-70955=20=E8=AE=B8=E5=A4=9A?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E4=B8=8D=E6=94=AF=E6=8C=81=E5=8D=83=E5=88=86?= =?UTF-8?q?=E6=AF=94=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/style/TextFormatPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index a53235cf2..a477cb16c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -58,7 +58,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private static final Integer[] TYPES = new Integer[]{ FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, - FormatContents.THOUSANDTHS,FormatContents.SCIENTIFIC, + FormatContents.SCIENTIFIC, FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; From bb4279b19c0d109f6e96d87d0b82c3326e0d46c8 Mon Sep 17 00:00:00 2001 From: wtianye <10320502+wtianye@user.noreply.gitee.com> Date: Tue, 10 May 2022 15:37:09 +0800 Subject: [PATCH 76/79] =?UTF-8?q?REPORT-71207=20=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=88=A0=E9=99=A4=E8=B6=85=E9=93=BE=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E2=80=9C=E5=8F=96=E6=B6=88=E2=80=9D=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/component/VanChartUIListControlPane.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java index bfa8b43e9..ba66c0392 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java @@ -173,12 +173,8 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0)); controlPane.add(buttonsPane, BorderLayout.EAST); - //确定 addOkButton(buttonsPane); - //取消 - addCancelButton(buttonsPane); - controlPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); return controlPane; From 03d61df45ca7181e5aac4e989ff23c37bde92780 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 10 May 2022 16:03:16 +0800 Subject: [PATCH 77/79] =?UTF-8?q?REPORT-71062=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=8A=A5=E9=94=99=20=E4=B8=8D=E5=BD=B1=E5=93=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E6=8A=A5=E9=94=99=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/login/socketio/LoginAuthServer.java | 2 +- .../com/fr/design/record/analyzer/DesignerAnalyzerListener.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java b/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java index 0340fc3de..235396558 100644 --- a/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java +++ b/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java @@ -74,7 +74,7 @@ public class LoginAuthServer { try { server.start(); } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().warn(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerListener.java b/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerListener.java index 8db3a395f..cd52cec38 100644 --- a/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerListener.java +++ b/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerListener.java @@ -18,6 +18,6 @@ public class DesignerAnalyzerListener extends AgentBuilder.Listener.Adapter { @Override public void onError(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded, Throwable throwable) { - FineLoggerFactory.getLogger().error("Designer-Analyzer transform error:" + typeName); + FineLoggerFactory.getLogger().warn("Designer-Analyzer transform error:" + typeName); } } From 04435927b963c0fd63af039fd671a5aa59431fd5 Mon Sep 17 00:00:00 2001 From: rinoux Date: Tue, 10 May 2022 16:45:14 +0800 Subject: [PATCH 78/79] =?UTF-8?q?REPORT-69285=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=AE=89=E5=85=A8=E5=85=B3=E9=94=AE=E5=AD=97?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E6=8B=A6=E6=88=AA=EF=BC=8C=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConnectionListDialogActionAdapter.java | 12 +++++++++- .../datapane/connect/ConnectionListPane.java | 23 +++++++++++++++++-- .../connect/ConnectionManagerPane.java | 7 +++--- .../datapane/connect/ConnectionShowPane.java | 2 +- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java index 2428c9a00..947cb6e75 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java @@ -2,11 +2,15 @@ package com.fr.design.data.datapane.connect; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editlock.EditLockUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; import com.fr.report.LockItem; +import javax.swing.JOptionPane; + /** * @author hades * @version 11.0 @@ -32,7 +36,13 @@ public class ConnectionListDialogActionAdapter extends DialogActionAdapter { connectionListDialog.setDoOKSucceed(false); return; } - connectionManagerPane.update(connectionConfig); + try { + connectionManagerPane.update(connectionConfig); + } catch (Exception e) { + connectionListDialog.setDoOKSucceed(false); + FineJOptionPane.showMessageDialog(connectionManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + return; + } DesignerContext.getDesignerBean("databasename").refreshBeanElement(); // 关闭定义数据连接页面,为其解锁 EditLockUtils.unlock(LockItem.CONNECTION); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 12c62b435..e4deae04b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,6 +1,7 @@ package com.fr.design.data.datapane.connect; import com.fr.config.RemoteConfigEvent; +import com.fr.data.core.db.JDBCSecurityChecker; import com.fr.data.impl.Connection; import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.JDBCDatabaseConnection; @@ -28,6 +29,7 @@ import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import java.awt.Window; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -166,7 +168,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh /** * Update. */ - public void update(ConnectionConfig connectionConfig) { + public void update(ConnectionConfig connectionConfig) throws Exception { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); Map updatedMap = new LinkedHashMap<>(); @@ -188,10 +190,27 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } }); - + this.checkSecurity(addedOrUpdatedConnections); this.alterConnections(removedConnNames, addedOrUpdatedConnections); } + + private void checkSecurity(List addedOrUpdatedConnections) throws Exception { + + for (ConnectionBean connectionBean : addedOrUpdatedConnections) { + Connection connection = connectionBean.getConnection(); + if (connection instanceof JDBCDatabaseConnection) { + try { + JDBCSecurityChecker.checkURL(((JDBCDatabaseConnection) connection).getURL()); + JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); + } catch (SQLException e) { + throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); + } + } + } + + } + private void alterConnections(List removedConnNames, List addedOrUpdatedConnections) { try { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java index 6c768145f..eadf456e0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java @@ -4,9 +4,8 @@ import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.file.ConnectionConfig; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.util.HashMap; public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane { @@ -39,7 +38,7 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio this.connectionListPane.populate(datasourceManager); } - public void update(ConnectionConfig datasourceManager) { + public void update(ConnectionConfig datasourceManager) throws Exception { this.connectionListPane.update(datasourceManager); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java index b5ae09be8..2b74ddcf9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java @@ -7,7 +7,7 @@ import com.fr.file.ConnectionConfig; * 数据链接显示面板 */ public interface ConnectionShowPane { - void update(ConnectionConfig connectionConfig); + void update(ConnectionConfig connectionConfig) throws Exception; void populate(ConnectionConfig connectionConfig); From 00a9347e5f2981beea40e098b608afea55c153ba Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 10 May 2022 18:26:12 +0800 Subject: [PATCH 79/79] =?UTF-8?q?REPORT-70857=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=A4=8D=E5=88=B6=E5=90=8E=E7=8B=AC=E7=AB=8B=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=9C=A8=E5=81=9A=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?clone=E6=95=B0=E6=8D=AE=E6=BA=90=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=AE=B8=E5=A4=9A=E5=8F=98=E9=87=8F=E9=83=BD=E5=85=B1=E7=94=A8?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E4=BA=8E=E6=98=AF=E4=BC=9A=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=3D=E6=94=B9=E4=B8=80=E7=89=87=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=96=B9=E6=A1=88=E3=80=91=E6=B7=BB=E5=8A=A0clone?= =?UTF-8?q?=E5=A4=84=E7=90=86=20=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91?= =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clip/TableDataTreeClipboard.java | 8 +++- .../paste/TableDataFollowingPasteUtils.java | 37 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/clip/TableDataTreeClipboard.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/clip/TableDataTreeClipboard.java index 44ae90b2c..3094df145 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/clip/TableDataTreeClipboard.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/clip/TableDataTreeClipboard.java @@ -1,6 +1,9 @@ package com.fr.design.data.datapane.management.clip; +import com.fr.base.TableData; +import com.fr.design.data.tabledata.paste.TableDataFollowingPasteUtils; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.general.NameObject; import java.util.HashMap; @@ -45,7 +48,10 @@ public class TableDataTreeClipboard { return resultMap; } for (NameObject selectedNameObject : selectedNameObjects) { - resultMap.put(selectedNameObject.getName(), (AbstractTableDataWrapper) selectedNameObject.getObject()); + TableData cloned = TableDataFollowingPasteUtils.cloneTableData(((AbstractTableDataWrapper) selectedNameObject.getObject()).getTableData()); + if (cloned != null) { + resultMap.put(selectedNameObject.getName(), new TemplateTableDataWrapper(cloned)); + } } return resultMap; } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index e90b8a420..d9892c763 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -28,6 +28,7 @@ import com.fr.report.cell.FloatElement; import com.fr.report.cell.tabledata.ElementUsedTableDataProvider; import com.fr.report.worksheet.FormElementCase; import com.fr.stable.StringUtils; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashMap; @@ -97,6 +98,8 @@ public class TableDataFollowingPasteUtils { } } } + // 对TableData做clone处理 + tempMap = dealWithTableData4Clone(tempMap); // 处理存储过程名称问题 return dealWithStoreProcedure(tempMap); } catch (Exception e) { @@ -179,6 +182,8 @@ public class TableDataFollowingPasteUtils { collectTableDataInChartCollection(templateTableData, tempMap, widget); collectTableDataInElementCaseEditor(templateTableData, tempMap, widget); } + // 对TableData做clone处理 + tempMap = dealWithTableData4Clone(tempMap); // 处理存储过程名称问题 return dealWithStoreProcedure(tempMap); } catch (Exception e) { @@ -187,6 +192,23 @@ public class TableDataFollowingPasteUtils { return new HashMap<>(); } + /** + * 对Map中所有的TableData做clone处理 + * @param tempMap + */ + private static Map dealWithTableData4Clone(Map tempMap) { + Map resultMap = new HashMap<>(); + for (Map.Entry entry : tempMap.entrySet()) { + String name = entry.getKey(); + TableData tableData = entry.getValue(); + TableData clonedTableData = cloneTableData(tableData); + if (clonedTableData != null) { + resultMap.put(name, clonedTableData); + } + } + return resultMap; + } + /** * 收集控件-报表块中使用的数据集 * @@ -353,4 +375,19 @@ public class TableDataFollowingPasteUtils { } return tableDataPane; } + + /** + * clone数据源,如果失败,打印日志,并返回null,谨慎使用 + * @param tableData + * @return + */ + @Nullable + public static TableData cloneTableData(TableData tableData) { + try { + return (TableData) tableData.clone(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, "clone table data {} failed", tableData.getName()); + } + return null; + } }