From 213181dc99a11f01a6a661e619fdb8ae624ff429 Mon Sep 17 00:00:00 2001 From: Anner Date: Wed, 21 Aug 2024 16:09:49 +0800 Subject: [PATCH 1/8] =?UTF-8?q?REPORT-126773=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=BB=E9=A2=98=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=85=8D=E8=89=B2=E9=A2=84=E8=A7=88=E4=B8=8D=E7=94=9F=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 9697113e27..def6cc51fa 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -268,9 +268,14 @@ public abstract class JTemplate> TemplateTheme usingTheme = getTemplateTheme(); boolean isUsingThemeChanged = StringUtils.equals(event.themName, usingTheme.getName()); - if (isUsingThemeChanged && (event.action == TemplateThemeConfig.ThemeConfigAction.REMOVE || - event.action == TemplateThemeConfig.ThemeConfigAction.UPDATE)) { - checkAndResetTheme(); + if (event.action == TemplateThemeConfig.ThemeConfigAction.REMOVE || + event.action == TemplateThemeConfig.ThemeConfigAction.UPDATE) { + if (isUsingThemeChanged) { + checkAndResetTheme(); + } else { + // 修改主题配置,但是没有修改主题名称 , 需要重新保存文件 + fireSuperTargetModified(); + } } } }; @@ -470,6 +475,7 @@ public abstract class JTemplate> /** * 用于 切换工作目录 时的模板资源暂存 + * * @return */ public FILE templateToStashFile4Envchange() { @@ -545,6 +551,7 @@ public abstract class JTemplate> /** * 刷新 模板资源 和 EditingFILE * 仅在切换工作目录,reload模板时使用 + * * @param file */ public void refreshResourceAndEditingFILE(FILE file) { @@ -1785,7 +1792,6 @@ public abstract class JTemplate> } - private CallbackSaveWorker saveAs(boolean showLoc) { FILE editingFILE = this.getEditingFILE(); if (editingFILE == null) { @@ -1975,7 +1981,6 @@ public abstract class JTemplate> } - @Override public void saveDirectly() { if (isSaving()) { @@ -2125,17 +2130,19 @@ public abstract class JTemplate> /** * 获取此模板所使用的tab栏操作类型 + * * @return */ - public String getTemplateTabOperatorType(){ + public String getTemplateTabOperatorType() { return DEFAULT_TAB_OPERATOR; } /** * 当前模板是否可以被保存 + * * @return 是/否 */ - public boolean canBeSaved(){ + public boolean canBeSaved() { return true; } @@ -2144,15 +2151,16 @@ public abstract class JTemplate> * * @return 是/否 */ - public boolean supportCache(){ + public boolean supportCache() { return true; } /** * 获取此模板在tab栏中显示的名称 + * * @return */ - public String getTabShowName(JTemplate jTemplate){ + public String getTabShowName(JTemplate jTemplate) { String name = TemplateUtils.createLockeTemplatedName(jTemplate, jTemplate.getTemplateName()); if (!jTemplate.isSaved() && !name.endsWith(" *")) { name += " *"; @@ -2162,9 +2170,10 @@ public abstract class JTemplate> /** * 切换环境之前是否需要保存 + * * @return */ - public boolean needSaveBeforeSwitchEnv(){ + public boolean needSaveBeforeSwitchEnv() { return false; } From 93ac7196f7c36357f4e5fe622bb129cdad656f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=AF=E9=B9=8F=20=E7=94=B3?= Date: Wed, 18 Sep 2024 10:53:11 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-134777=20=E8=B6=85=E9=93=BE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=94=AF=E6=8C=81=E5=85=AC=E5=BC=8F=E8=AE=A1=E7=AE=97?= =?UTF-8?q?-=E5=85=A8=E5=B1=80=E6=9F=A5=E6=89=BE=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=8E=A7=E4=BB=B6=E9=87=8C=E7=9A=84=E5=85=AC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/formula/FormulaReplaceObject.java | 41 ++++++++++++++++--- .../action/content/formula/FormulaTag.java | 13 +++++- .../formula/cell/SearchCellFormulaAction.java | 15 +++++-- .../AbstractSearchWidgetFormulaAction.java | 27 ++++++++++-- .../actions/replace/info/base/SearchTag.java | 4 ++ 5 files changed, 86 insertions(+), 14 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java index a58ae83d11..f80601fa25 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java @@ -4,27 +4,24 @@ import com.fr.base.BaseFormula; import com.fr.base.Formula; import com.fr.base.Parameter; import com.fr.base.StoreProcedureParameter; -import com.fr.base.core.KV; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.present.FormulaPresent; -import com.fr.base.present.Present; import com.fr.data.condition.FormulaCondition; import com.fr.data.core.Compare; import com.fr.design.actions.replace.info.DealWithInfoValue; import com.fr.design.actions.replace.info.Info; import com.fr.design.actions.replace.utils.ShowValueUtils; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.form.main.Form; -import com.fr.function.IF; import com.fr.general.GeneralUtils; +import com.fr.js.NameJavaScript; import com.fr.js.SingleJavaScript; import com.fr.main.impl.WorkBook; import com.fr.report.cell.cellattr.CellInsertPolicyAttr; -import com.fr.report.cell.cellattr.core.RichChar; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.stable.FormulaProvider; import com.fr.stable.ParameterProvider; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; import org.jetbrains.annotations.Nullable; @@ -545,6 +542,40 @@ public enum FormulaReplaceObject implements DealWithInfoValue { } return false; } + }, + + /** + * 超链名字 + */ + NAMEJAVASCRIPT("NameJavaScript") { + @Override + public Map getValue(Object... o) { + HashMap map = new HashMap<>(); + if (StringUtils.isNotEmpty(((NameJavaScript) o[0]).getName())) { + map.put("content", ((NameJavaScript) o[0]).getName()); + } + return map; + } + + @Override + public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { + Object replaceObject = info.getContent().getReplaceObject(); + info.updateOldStr(((NameJavaScript)replaceObject).getName(), findStr); + String str = ((NameJavaScript)replaceObject).getName(); + ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr); + ((NameJavaScript)replaceObject).setName(ShowValueUtils.replaceAll(str, findStr, replaceStr)); + } + + @Override + public boolean check(Info info) { + if (info.getContent().getReplaceObject() instanceof NameJavaScript) { + NameJavaScript nameJavaScript = (NameJavaScript) info.getContent().getReplaceObject(); + if (StableUtils.canBeFormula(nameJavaScript.getName())) { + return StringUtils.equals(nameJavaScript.getName(), info.getContent().getOldShowStr()); + } + } + return false; + } }; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java index be35a76671..210bd3dc86 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java @@ -1,12 +1,12 @@ package com.fr.design.actions.replace.action.content.formula; -import com.fr.chart.chartdata.MeterReportDefinition; import com.fr.data.VerifyItem; import com.fr.data.impl.FormulaDictionary; import com.fr.design.actions.replace.info.DealWithInfoValue; import com.fr.design.actions.replace.info.Info; import com.fr.design.actions.replace.info.base.SearchTag; import com.fr.design.actions.replace.utils.ShowValueUtils; +import com.fr.form.ui.Widget; import com.fr.general.GeneralUtils; import com.fr.main.impl.WorkBook; import com.fr.plugin.chart.map.data.VanMapReportDefinition; @@ -173,6 +173,17 @@ public enum FormulaTag implements DealWithInfoValue { dictionary.setProduceFormula(ShowValueUtils.replaceAll(str, findStr, replaceStr)); } } + }, + WIDGET_LABEL(SearchTag.WIDGET_LABEL) { + @Override + public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { + if (info.getContent().getHoldObject() instanceof Widget) { + Widget widget = (Widget) info.getContent().getHoldObject(); + String str = widget.getLabelName(); + ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr); + widget.setLabelName(ShowValueUtils.replaceAll(str, findStr, replaceStr)); + } + } }; int index; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java index 39ccf32585..45a85d697a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java @@ -6,13 +6,13 @@ import com.fr.base.present.FormulaPresent; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.actions.replace.action.content.cell.SearchCellAction; import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction; -import com.fr.design.actions.replace.action.content.formula.highlight.condition.*; import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormulaAction; +import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula; +import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager; import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction; import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType; import com.fr.design.actions.replace.info.CellInfo; import com.fr.design.actions.replace.info.FormulaInfo; - import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.actions.replace.info.base.SearchTag; import com.fr.design.i18n.Toolkit; @@ -29,7 +29,7 @@ import com.fr.report.core.sort.common.CellSortAttr; import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.stable.CommonUtils; - +import com.fr.stable.StableUtils; import java.util.List; import java.util.Map; @@ -119,7 +119,14 @@ public class SearchCellFormulaAction implements SearchCellFormula { for (int i = 0; i < nameJavaScriptGroup.size(); i++) { SearchJSHighlightAction action = SearchJSHighlightAction.getInstance(); ITContent content = ITContent.copy(cellInfo.getContent()); - content.addOtherPos(nameJavaScriptGroup.getNameHyperlink(i).getName()); + String name = nameJavaScriptGroup.getNameHyperlink(i).getName(); + if(StableUtils.canBeFormula(name)){ + ITContent newContent = ITContent.copy(content); + newContent.setReplaceObject(nameJavaScriptGroup.getNameHyperlink(i)); + newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Hyperlink")); + formulaInfos.add(new FormulaInfo(newContent)); + } + content.addOtherPos(name); action.searchJSFormulaFromOther(formulaInfos, content, nameJavaScriptGroup.getNameHyperlink(i).getJavaScript()); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java index d8ff30f79e..5cb8aca91a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java @@ -4,12 +4,14 @@ import com.fr.base.Formula; import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction; import com.fr.design.actions.replace.info.FormulaInfo; import com.fr.design.actions.replace.info.base.ITContent; +import com.fr.design.actions.replace.info.base.SearchTag; import com.fr.design.i18n.Toolkit; import com.fr.form.event.Listener; import com.fr.form.ui.DataControl; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.stable.StableUtils; import java.util.List; @@ -33,12 +35,13 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF Widget widget = (Widget) content.getReplaceObject(); //控件值中的公式 searchFormulaFromWidgetValue(content, formulaInfos); + searchFormulaFromWidgetLabel(content, formulaInfos); for (int i = 0; i < widget.getListenerSize(); i++) { Listener listener = widget.getListener(i); ITContent newContent = ITContent.copy(content); //控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理 SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction.getInstance(); - newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"),listener.getName()); + newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"), listener.getName()); jsHighlightAction.searchJSFormulaFromOther(formulaInfos, newContent, listener.getAction()); } @@ -53,8 +56,8 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF @Override public void searchFormulaFromWidgetValue(ITContent content, List formulaInfos) { Widget widget = (Widget) content.getReplaceObject(); - if (widget instanceof WScaleLayout){ - widget = ((CRBoundsWidget)((WScaleLayout)widget).getWidget(0)).getWidget(); + if (widget instanceof WScaleLayout) { + widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget(); } if (widget instanceof DataControl) { if (isWidgetValueValid(((DataControl) widget))) { @@ -66,7 +69,23 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF } } - private boolean isWidgetValueValid(DataControl control){ + public void searchFormulaFromWidgetLabel(ITContent content, List formulaInfos) { + Widget widget = (Widget) content.getReplaceObject(); + if (widget instanceof WScaleLayout) { + widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget(); + } + if (StableUtils.canBeFormula(widget.getLabelName())) { + ITContent newContent = ITContent.copy(content); + newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Form_Label_Name")); + newContent.setHoldObject(widget); + newContent.setReplaceObject(widget.getLabelName()); + newContent.setTag(SearchTag.WIDGET_LABEL); + formulaInfos.add(new FormulaInfo(newContent)); + } + } + + + private boolean isWidgetValueValid(DataControl control) { return control.getWidgetValue() != null && control.getWidgetValue().getValue() instanceof Formula; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java index b5e202bcb1..4664d3b2c7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java @@ -56,6 +56,10 @@ public class SearchTag { * 引用JS */ public static final int IMPORT_JS = 11; + /** + * 控件-标签名称 + */ + public static final int WIDGET_LABEL = 12; From c9acbcae37847bb104a7525eb8bb3063b77b1cad Mon Sep 17 00:00:00 2001 From: "shengzu.xue" Date: Wed, 18 Sep 2024 10:30:26 +0800 Subject: [PATCH 3/8] =?UTF-8?q?REPORT-131817=20=E9=AB=98=E5=BE=B7=E5=9B=BD?= =?UTF-8?q?=E4=BA=A7=E5=9B=BE=E5=B1=82=E6=9B=BF=E6=8D=A2Mapbox=E5=9B=BE?= =?UTF-8?q?=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/van/chart/map/designer/type/GisLayerPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java index 37f178e196..bc224ac922 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java @@ -254,6 +254,7 @@ public class GisLayerPane extends JPanel implements UIObserver { } public void populate(GisLayer layer) { + layer.convertMapboxLayer(); switch (layer.getGisLayerType()) { case AUTO: gisButton.setSelectedIndex(0); From d6e5cd8f31266f6c9ca0154581c6fb2511356306 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Thu, 19 Sep 2024 15:15:38 +0800 Subject: [PATCH 4/8] =?UTF-8?q?REPORT-130762=20feat:JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=8F=90=E4=BE=9B=E7=A6=81=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 7 +++++++ .../connect/DatabaseConnectionPane.java | 9 ++++++++- .../datapane/preview/PreviewTablePane.java | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) 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 6bfd0a37f0..a8468c101d 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 @@ -8,6 +8,7 @@ import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; import com.fr.data.operator.DataOperator; +import com.fr.decision.webservice.exception.security.SecurityRestrictionException; import com.fr.design.ExtraDesignClassManager; import com.fr.general.MapCompareUtils; import com.fr.design.dialog.BasicDialog; @@ -24,7 +25,9 @@ import com.fr.general.NameObject; import com.fr.license.database.DBTypes; import com.fr.license.database.DataBaseTypePointManager; import com.fr.license.exception.DataBaseNotSupportedException; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.security.SecurityConfig; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -233,6 +236,10 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh if (connection instanceof JDBCDatabaseConnection) { DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); } + // JNDI禁用提示 + if (connection instanceof JNDIDatabaseConnection && SecurityConfig.getInstance().isDisableJNDI()) { + throw new SecurityRestrictionException(InterProviderFactory.getProvider().getLocText("Fine-Datasource_JNDI_Disabled")); + } default: break; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 11c3f64d64..05f916f4ef 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -14,6 +14,7 @@ import com.fr.data.solution.entity.DriverPage; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; @@ -22,9 +23,11 @@ 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.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.rpc.ExceptionHandler; import com.fr.rpc.RPCInvokerExceptionInfo; +import com.fr.security.SecurityConfig; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; @@ -42,6 +45,7 @@ import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.UIManager; +import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -95,7 +99,10 @@ public abstract class DatabaseConnectionPane connectionThread = new TestConnectionWorker(); midPane.setVisible(false); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index ffac1388c6..fe4dc5b79e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -7,10 +7,14 @@ import com.fr.base.TableData; import com.fr.base.svg.IconUtils; import com.fr.data.TableDataSource; import com.fr.data.desensitize.base.DesensitizationTableData; +import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.NameDataModel; +import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.operator.DataOperator; +import com.fr.decision.webservice.exception.security.SecurityRestrictionException; import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager; @@ -37,8 +41,10 @@ import com.fr.esd.query.StrategicTableData; import com.fr.function.TIME; import com.fr.general.FRFont; import com.fr.general.data.DataModel; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.security.SecurityConfig; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -589,11 +595,24 @@ public class PreviewTablePane extends BasicPane { if (tableData instanceof DBTableData) { boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase()); if (!status) { + validateJndiDisabled(((DBTableData) tableData).getDatabase()); throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); } } } + /** + * 校验下是否为JNDI连接且禁用该功能,若是显示禁用信息提示 + * @param connection + */ + private void validateJndiDisabled(Connection connection) throws SecurityRestrictionException { + if(connection instanceof NameDatabaseConnection && ((NameDatabaseConnection) connection).getConnection() instanceof JNDIDatabaseConnection) { + if(SecurityConfig.getInstance().isDisableJNDI()) { + throw new SecurityRestrictionException(InterProviderFactory.getProvider().getLocText("Fine-Datasource_JNDI_Disabled")); + } + } + } + /** * 处理预览Model的列类型 * From 7a58801baeda43b0a03c93a5c9ec778c2081d7c1 Mon Sep 17 00:00:00 2001 From: "Richard.Fang" Date: Thu, 19 Sep 2024 15:15:38 +0800 Subject: [PATCH 5/8] =?UTF-8?q?REPORT-130762=20feat:JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=8F=90=E4=BE=9B=E7=A6=81=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 6 ++++++ .../connect/DatabaseConnectionPane.java | 8 +++++++- .../datapane/preview/PreviewTablePane.java | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) 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 6bfd0a37f0..3cfdc04458 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 @@ -8,6 +8,7 @@ import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; import com.fr.data.operator.DataOperator; +import com.fr.decision.webservice.exception.security.SecurityRestrictionException; import com.fr.design.ExtraDesignClassManager; import com.fr.general.MapCompareUtils; import com.fr.design.dialog.BasicDialog; @@ -25,6 +26,7 @@ import com.fr.license.database.DBTypes; import com.fr.license.database.DataBaseTypePointManager; import com.fr.license.exception.DataBaseNotSupportedException; import com.fr.log.FineLoggerFactory; +import com.fr.security.SecurityConfig; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -233,6 +235,10 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh if (connection instanceof JDBCDatabaseConnection) { DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); } + // JNDI禁用提示 + if (connection instanceof JNDIDatabaseConnection && SecurityConfig.getInstance().isDisableJNDI()) { + throw new SecurityRestrictionException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_JNDI_Disabled")); + } default: break; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 11c3f64d64..3efa87c32c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -14,6 +14,7 @@ import com.fr.data.solution.entity.DriverPage; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; @@ -25,6 +26,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.rpc.ExceptionHandler; import com.fr.rpc.RPCInvokerExceptionInfo; +import com.fr.security.SecurityConfig; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; @@ -42,6 +44,7 @@ import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.UIManager; +import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -95,7 +98,10 @@ public abstract class DatabaseConnectionPane connectionThread = new TestConnectionWorker(); midPane.setVisible(false); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index ffac1388c6..5fea6eb958 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -7,10 +7,14 @@ import com.fr.base.TableData; import com.fr.base.svg.IconUtils; import com.fr.data.TableDataSource; import com.fr.data.desensitize.base.DesensitizationTableData; +import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.NameDataModel; +import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.operator.DataOperator; +import com.fr.decision.webservice.exception.security.SecurityRestrictionException; import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager; @@ -39,6 +43,7 @@ import com.fr.general.FRFont; import com.fr.general.data.DataModel; import com.fr.log.FineLoggerFactory; +import com.fr.security.SecurityConfig; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -589,11 +594,24 @@ public class PreviewTablePane extends BasicPane { if (tableData instanceof DBTableData) { boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase()); if (!status) { + validateJndiDisabled(((DBTableData) tableData).getDatabase()); throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); } } } + /** + * 校验下是否为JNDI连接且禁用该功能,若是显示禁用信息提示 + * @param connection + */ + private void validateJndiDisabled(Connection connection) throws SecurityRestrictionException { + if(connection instanceof NameDatabaseConnection && ((NameDatabaseConnection) connection).getConnection() instanceof JNDIDatabaseConnection) { + if(SecurityConfig.getInstance().isDisableJNDI()) { + throw new SecurityRestrictionException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_JNDI_Disabled")); + } + } + } + /** * 处理预览Model的列类型 * From d17b810076546d44ded1117fb421d3c2bf770daf Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 26 Sep 2024 11:09:42 +0800 Subject: [PATCH 6/8] =?UTF-8?q?REPORT-135046=20feat:=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=AF=AD=E8=A8=80=E5=88=87=E6=8D=A2=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=96=B0=E8=AF=AD=E7=A7=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/PreferencePane.java | 17 +++++++++++------ .../java/com/fr/design/utils/DesignUtils.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) 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 f8703275f8..64e59dfff0 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 @@ -40,19 +40,17 @@ import com.fr.design.mainframe.vcs.ui.UIPositiveIntEditor; import com.fr.design.mainframe.vcs.ui.VcsMovePanel; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.unit.UnitConvertUtil; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; -import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.io.attr.ImageExportAttr; -import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; -import com.fr.scheduler.tool.FineScheduler; import com.fr.stable.Constants; import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.logging.log4j.Level; @@ -76,7 +74,6 @@ import javax.swing.ButtonGroup; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFileChooser; -import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; @@ -89,7 +86,15 @@ import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -816,7 +821,7 @@ public class PreferencePane extends BasicPane { } private UIDictionaryComboBox createLanguageComboBox() { - Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); + Map map = DesignUtils.getAvailableLanguages(); int size = map.size(); Locale[] keys = new Locale[size]; String[] values = new String[size]; diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index e8c528ade2..c2be9dad09 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -19,10 +19,13 @@ import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.GeneralContext; +import com.fr.general.SupportLocale; +import com.fr.i18n.LanguageConfig; import com.fr.log.FineLoggerFactory; import com.fr.plugin.injectable.PluginModule; import com.fr.stable.ArrayUtils; import com.fr.stable.CommonCodeUtils; +import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.bridge.ObjectHolder; @@ -50,8 +53,11 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.URI; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.Enumeration; +import java.util.LinkedHashMap; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; @@ -496,4 +502,15 @@ public class DesignUtils { return Utils.getAvailableFontFamilyNames4Report(); } + /** + * 获取设计器可用的开放的语言配置,包括默认开放的五种语言和finedb扩展项 + * @return Locale和翻译对应的key + */ + public static Map getAvailableLanguages() { + Map map = new LinkedHashMap<>(SupportLocale.getInstance().getLocaleMap()); + for (Map.Entry entry : LanguageConfig.getInstance().getExtendedDesignLocales().entrySet()) { + map.put(CommonUtils.stringToLocale(entry.getKey()), entry.getValue()); + } + return Collections.unmodifiableMap(map); + } } From 8b638027035bb958ef175c4a0476ca2cf05427c7 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 26 Sep 2024 17:39:56 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i18n/DesignExtendLanguageConfig.java | 57 +++++++++++++++++++ .../java/com/fr/design/utils/DesignUtils.java | 4 +- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java b/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java new file mode 100644 index 0000000000..d2294faa83 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java @@ -0,0 +1,57 @@ +package com.fr.design.i18n; + +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.Identifier; +import com.fr.config.holder.factory.Holders; +import com.fr.config.holder.impl.MapConf; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +/** + * 设计器语言扩展配置 + * + * @author obo + * @since 11.0 + * Created on 2024/09/26 + */ +public class DesignExtendLanguageConfig extends DefaultConfiguration { + + private static volatile DesignExtendLanguageConfig designExtendLanguageConfig = null; + + /** + * + * @return + */ + public static DesignExtendLanguageConfig getInstance() { + if (designExtendLanguageConfig == null) { + designExtendLanguageConfig = ConfigContext.getConfigInstance(DesignExtendLanguageConfig.class); + } + return designExtendLanguageConfig; + } + + /** + * 设计器扩展的语言 + * key为localeString,例如en_US或en;value为改语言对应的国际化翻译key + */ + @Identifier("extendDesignLocales") + private MapConf> extendDesignLocales = Holders.map(new HashMap<>(), String.class, String.class); + + public Map getExtendedDesignLocales() { + return Collections.unmodifiableMap(extendDesignLocales.get()); + } + + public void setExtendedDesignLocales(Map map) { + extendDesignLocales.set(map); + } + + @Override + public Object clone() throws CloneNotSupportedException { + DesignExtendLanguageConfig cloned = (DesignExtendLanguageConfig) super.clone(); + cloned.extendDesignLocales = ( MapConf>) extendDesignLocales.clone(); + return cloned; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index c2be9dad09..52059552b6 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -11,6 +11,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DefaultValueAdjustProvider; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; +import com.fr.design.i18n.DesignExtendLanguageConfig; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; @@ -20,7 +21,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.GeneralContext; import com.fr.general.SupportLocale; -import com.fr.i18n.LanguageConfig; import com.fr.log.FineLoggerFactory; import com.fr.plugin.injectable.PluginModule; import com.fr.stable.ArrayUtils; @@ -508,7 +508,7 @@ public class DesignUtils { */ public static Map getAvailableLanguages() { Map map = new LinkedHashMap<>(SupportLocale.getInstance().getLocaleMap()); - for (Map.Entry entry : LanguageConfig.getInstance().getExtendedDesignLocales().entrySet()) { + for (Map.Entry entry : DesignExtendLanguageConfig.getInstance().getExtendedDesignLocales().entrySet()) { map.put(CommonUtils.stringToLocale(entry.getKey()), entry.getValue()); } return Collections.unmodifiableMap(map); From 83ad455a6794b2661942849b12b965f32c8c3f51 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 26 Sep 2024 17:40:12 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/i18n/DesignExtendLanguageConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java b/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java index d2294faa83..27d0c839f7 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java @@ -22,8 +22,7 @@ public class DesignExtendLanguageConfig extends DefaultConfiguration { private static volatile DesignExtendLanguageConfig designExtendLanguageConfig = null; /** - * - * @return + * 获取实例 */ public static DesignExtendLanguageConfig getInstance() { if (designExtendLanguageConfig == null) {