From a64ace980a9d3abe02fc42e2c02cdfcc37a60279 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 9 Jun 2021 11:25:16 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-53157=20=E5=80=BC=E4=B8=80=E6=A0=B7?= =?UTF-8?q?=20=E5=AF=B9=E8=B1=A1=E5=9C=B0=E5=9D=80=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=E7=9A=84=E5=AF=B9=E8=B1=A1=E5=90=8C=E6=A0=B7=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E8=A2=AB=E8=BF=94=E5=9B=9E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mod/ContentObjectManager.java | 8 ++++---- .../java/com/fr/design/mod/ContentReplacerCenter.java | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java b/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java index 0111f7836..6c8a123fd 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java @@ -24,6 +24,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.FunctionGrouper; import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.stable.Filter; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -48,7 +49,7 @@ public class ContentObjectManager { /** * 放置所有需要替换内容的对象 */ - private Map> objectMap; + private Map> objectMap; private final Set set = new HashSet<>(); @@ -98,14 +99,13 @@ public class ContentObjectManager { } @Nullable - public Map> getObjectMap() { + public Map> getObjectMap() { return objectMap; } public boolean needContentTip(Object ob, Set nameSet) { - long start = System.currentTimeMillis(); objectMap = ClassHelper.searchObject(ob, set, ModClassFilter.getInstance()); - for (Map.Entry> entry : objectMap.entrySet()) { + for (Map.Entry> entry : objectMap.entrySet()) { for (Object o : entry.getValue()) { for (String name : nameSet) { ContentReplacer contentReplacer = map.get(entry.getKey()); diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java index cccc08c9a..7440895a8 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java @@ -29,9 +29,9 @@ import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Set; /** * 默认联动内容替换器实现 @@ -106,14 +106,14 @@ public class ContentReplacerCenter { } private void onRename(List contentChangeItemList, List contentChangeList) { - Map> objectMap = ContentObjectManager.getInstance().getObjectMap(); + Map> objectMap = ContentObjectManager.getInstance().getObjectMap(); if (objectMap != null) { long start = System.currentTimeMillis(); for (ContentChange contentChange : contentChangeList) { - Set set = objectMap.get(contentChange.type()); + Collection objects = objectMap.get(contentChange.type()); // 所有需要处理的js等对象 - if (set != null) { - for (Object ob : set) { + if (objects != null) { + for (Object ob : objects) { fireChange(ob, contentChange, contentChangeItemList); } } From cec0f89c5f8347d3f4836086fec6d75f77c46ca7 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Wed, 9 Jun 2021 14:20:34 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-53367=20=E5=A4=8D=E5=88=B6=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E5=90=8Esql-=E8=BF=9C=E7=A8=8B=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84=E8=BD=AC=E4=B9=89=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/sql/PreviewPerformedSqlPane.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java index 8ddf261cf..462f70b34 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java @@ -6,7 +6,6 @@ import com.fr.base.ParameterMapNameSpace; import com.fr.data.impl.DBTableData; import com.fr.data.impl.EscapeSqlHelper; import com.fr.data.operator.DataOperator; -import com.fr.decision.config.PreventSqlInjConfig; import com.fr.decision.webservice.v10.config.ConfigService; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.link.MessageWithLink; @@ -19,7 +18,6 @@ import com.fr.design.parameter.ParameterInputPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; -import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.plugin.injectable.PluginModule; import com.fr.script.Calculator; @@ -190,11 +188,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { calculator.pushNameSpace(ns); Parameter[] paras = processParameters(tableData, calculator); // 所有被转义参数的集合 - // 远程时如何获取服务器上的转义字符?这里比较恶心 - // 方法1是新增rpc接口,交由服务器去获取转义字符。但是要考虑兼容问题: - // 新设计器jar远程老服务器jar,需要提供Compatible实现,但是这个实现能做什么呢?目前没有老的接口可以去获取服务器的转义字符,仍然啥也做不了; - // 现在采用方法2,通过反射调用PreventSqlInjConfig的刷新方法(因为它是decision模块的private方法,直接改成public仍然有兼容问题) - Reflect.on(PreventSqlInjConfig.class).call("refreshPreventSqlInjConfig"); + refreshEscapeSqlHelper(); Set specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras); // 将参数转义等 Set tableDataProviders = getTableDataProviders(); @@ -223,6 +217,13 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { pane.setVisible(true); } + private static void refreshEscapeSqlHelper() { + EscapeSqlHelper.getInstance().setUseForbidWord(ConfigService.getInstance().getPSIConfig().isUseForbidWord()); + EscapeSqlHelper.getInstance().setSelectedForbidWord(ConfigService.getInstance().getPSIConfig().getSelectedForbidWord()); + EscapeSqlHelper.getInstance().setUseEscapeSpecialChar(ConfigService.getInstance().getPSIConfig().isUseEscapeSpecialChar()); + EscapeSqlHelper.getInstance().setSelectedSpecialChar(ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar()); + } + private static boolean isShowSpecialCharSqlPane(List specialCharParamIndex) { return specialCharParamIndex != null && !specialCharParamIndex.isEmpty(); } From 6782a52e0260322d451733c22f64d4856b991b11 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Jun 2021 14:29:22 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-51958=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dialog/NotificationDialog.java | 173 ++++++++++++++++++ .../dialog/NotificationDialogAction.java | 5 + 2 files changed, 178 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java create mode 100644 designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java new file mode 100644 index 000000000..409f7afe6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java @@ -0,0 +1,173 @@ +package com.fr.design.dialog; + + +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 java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; +import javax.swing.UIManager; + +/** + * 带查看详情的简要通知框 + * + */ +public class NotificationDialog extends JDialog { + public static final int ERROR_MESSAGE = 0; + public static final int NEW_MESSAGE = 1; + public static final int WARNING_MESSAGE = 2; + public static final String HTML_TAG_1 = ""; + public static final String HTML_TAG_2 = ""; + private UILabel messageText; + private NotificationDialogAction notificationDialogAction; + + public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message,NotificationDialogAction action) { + super(owner); + setTitle(title); + initComponents(messageType, message, isModal,action); + } + + public NotificationDialog(Builder builder) { + super(builder.owner); + setTitle(builder.title); + initComponents(builder.messageType, builder.message, builder.modal, builder.action); + } + + public void initComponents(int messageType, String message, boolean isModal,NotificationDialogAction action) { + notificationDialogAction = action; + setModal(isModal); + setResizable(false); + + //消息内容 + UILabel icon = new UILabel(getIconForType(messageType)); + JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 8)); + iconPanel.add(icon); + add(iconPanel, BorderLayout.WEST); + + messageText = new UILabel(HTML_TAG_1 + message + HTML_TAG_2); + messageText.setForeground(new Color(51, 51, 52)); + JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 10)); + JScrollPane jScrollPane = new JScrollPane(messageText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPane.setBorder(BorderFactory.createEmptyBorder()); + centerPanel.add(jScrollPane, BorderLayout.CENTER); + add(centerPanel, BorderLayout.CENTER); + + //查看详情 + UILabel detailLabel = new UILabel(); + detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); + detailLabel.setForeground(Color.BLUE); + JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + detailPanel.add(detailLabel, BorderLayout.EAST); + add(detailPanel, BorderLayout.SOUTH); + setPreferredSize(new Dimension(262, 135)); + + detailLabel.addMouseListener(detailClickListener); + messageText.addMouseListener(detailClickListener); + + pack(); + if (getOwner() != null) { + GUICoreUtils.setWindowCenter(getOwner(), this); + } + } + + private MouseListener detailClickListener = new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if(notificationDialogAction != null){ + hideDialog(); + notificationDialogAction.doClick(); + } + } + }; + + + public void setMessage(String message){ + messageText.setText(HTML_TAG_1 + message + HTML_TAG_2); + } + + private void hideDialog(){ + this.dispose(); + } + + protected Icon getIconForType(int messageType) { + String propertyName; + switch (messageType) { + case 0: + propertyName = "OptionPane.circularErrorIcon"; + break; + case 1: + propertyName = "OptionPane.newMessageIcon"; + break; + case 2: + propertyName = "OptionPane.warningIcon"; + break; + default: + return null; + } + return UIManager.getIcon(propertyName); + } + + public static Builder Builder() { + return new NotificationDialog.Builder(); + } + + public static final class Builder { + public int messageType = WARNING_MESSAGE; + public String message; + public boolean modal = true; + public Frame owner = null; + public String title; + public NotificationDialogAction action; + private Builder() { + + } + + public NotificationDialog build() { + return new NotificationDialog(this); + } + + public Builder owner(Frame owner) { + this.owner = owner; + return this; + } + + public Builder messageType(int messageType) { + this.messageType = messageType; + return this; + } + + public Builder message(String message) { + this.message = message; + return this; + } + + public Builder modal(boolean modal) { + this.modal = modal; + return this; + } + + public Builder title(String title) { + this.title = title; + return this; + } + + public Builder notificationDialogAction(NotificationDialogAction action) { + this.action = action; + return this; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java new file mode 100644 index 000000000..3cd4e85e8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java @@ -0,0 +1,5 @@ +package com.fr.design.dialog; + +public interface NotificationDialogAction { + void doClick(); +} From 725b0c973939fc25aefcc02fc5d8334d32af9a8d Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Jun 2021 14:30:11 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-51958=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/dialog/NotificationDialog.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java index 409f7afe6..db3be1387 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java @@ -95,6 +95,9 @@ public class NotificationDialog extends JDialog { }; + /** + * 设置通知消息 + */ public void setMessage(String message){ messageText.setText(HTML_TAG_1 + message + HTML_TAG_2); } From 616dea871c8f3cec0d54795a0702c74a70c51b1a Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Jun 2021 14:31:57 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-51958=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../images/lookandfeel/circularErrorIcon.png | Bin 0 -> 346 bytes .../images/lookandfeel/circularWarningIcon.png | Bin 0 -> 345 bytes .../design/images/lookandfeel/newMessageIcon.png | Bin 0 -> 423 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularErrorIcon.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularWarningIcon.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/lookandfeel/newMessageIcon.png diff --git a/designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularErrorIcon.png b/designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularErrorIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..bcd2b0611e21f044466269046d4905dc853a192f GIT binary patch literal 346 zcmV-g0j2(lP)%T1_A=*z&!pbD1%&v2W8;s55Jzkg0peevQovK|xz9?QrF{bORB z&&a^Qhs|OC85lk>{rjIN`{dy|m^|D7kmmo4467L!8JY0<>i_?LjQ<%zVTOPW06CkD zjpGh3o3R-9@#n7}svz%x4R|Cg-^#$qSOrrkdGs*DhwdJR?;AFPg*XHJ83am87@k|( zBFy^#zfJD(!)mAj3YQod8FXQ?APvIZT?}ta%NQ6K7#W1SJHc$2fzW`xEcf_<9>f4S zh3^au3>?T#g&6`8!_W*-_(Sf|15P{!1b}TO&H!0_USNQG2e%g}4Mb9-5tN{Q{raH- sk4BI`DN0DN(5EOV!wjJ)Gm(?C0e)kr5!g6wApigX07*qoM6N<$g4Q{dmH+?% literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularWarningIcon.png b/designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularWarningIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..69fc1527d46b02914edb435bb4a3124ea77ee0e4 GIT binary patch literal 345 zcmV-f0jB;JsUP?Up_z2N_UMqdU7234s1ZAQlbn}7WOIe|Cq{A*-AC*v|#Day&iS-|+8(U*aNK@}>0`#(r@P9rd z0|Os6hy7<@_{7M-nE1+m%{rJo+yJm<#{a7s|1&V*^VNSwhJTFz8AD-)fDHgUo15zn zE}PK}{LjGf@%z_rsvz%x4G=vP)XMmuu?obFm2hFGRg7Wy@aHQ--pwgsy_3{)7z9|j z8Jg}dVOa8F4_NF!k@Z**JT22%LKpIk{yck-P6B!s8 zQDgZ3|Njg%cjq(AdA1E^E{XwQFTi9nq1Jd{A-sSbi0FoZ z_*gWf1|qI#1i1tR&}?P^C8+OTzp22Z5fT#=BqW%#DN4#PLnz8j`0@ZQIRI9{wh`a7 R`QiWo002ovPDHLkV1n=4#R32T literal 0 HcmV?d00001 From 8d31a5a6f2d5d0af53ae8276a0c29fdabedc7631 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Jun 2021 14:32:38 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-51958=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/UILookAndFeel.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java index 6d1a729d9..abb9d613d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java +++ b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java @@ -176,6 +176,9 @@ public class UILookAndFeel extends MetalLookAndFeel { table.put("OptionPane.narrow.right", loadIcon("Icon_Narrow_Right_16x16.png", this)); table.put("OptionPane.narrow.down", loadIcon("Icon_Narrow_Down_16x16.png", this)); table.put("OptionPane.warningIcon", loadIcon("WarningIcon.png", this)); + table.put("OptionPane.circularWarningIcon", loadIcon("circularWarningIcon.png", this)); + table.put("OptionPane.newMessageIcon", loadIcon("newMessageIcon.png", this)); + table.put("OptionPane.circularErrorIcon", loadIcon("circularErrorIcon.png", this)); table.put("OptionPane.questionIcon", loadIcon("QuestionIcon.png", this)); table.put("OptionPane.tipIcon", loadIcon("TipIcon.png", this)); table.put("ScrollPane.border", new UIScrollPaneBorder());