Browse Source

Merge pull request #14983 in DESIGN/design from bugfix/11.0 to release/11.0

* commit '8d5fbefe2c1d1d94e069268f97f28663e9b43965':
  配置放在设计器模块
  配置放在设计器模块
  REPORT-135046 feat:设计器语言切换支持扩展新语种
  REPORT-130762 feat:JNDI数据连接提供禁用配置
  REPORT-130762 feat:JNDI数据连接提供禁用配置
  REPORT-131817 高德国产图层替换Mapbox图层
  REPORT-134777 超链名称支持公式计算-全局查找匹配不到控件里的公式
  REPORT-126773 fix: 修复自定义主题修改配色预览不生效问题
release/11.0
superman 3 months ago
parent
commit
97d87993eb
  1. 17
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  3. 18
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  4. 19
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  5. 56
      designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java
  6. 29
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  7. 17
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  8. 1
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java
  9. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  10. 13
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  11. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java
  12. 27
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java
  13. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java

17
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<Locale> createLanguageComboBox() {
Map<Locale, String> map = InterProviderFactory.getProvider().getSupportLocaleMap();
Map<Locale, String> map = DesignUtils.getAvailableLanguages();
int size = map.size();
Locale[] keys = new Locale[size];
String[] values = new String[size];

6
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;
}

18
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,11 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override
public void actionPerformed(ActionEvent evt) {
if (mainPanel instanceof JNDIDefPane && SecurityConfig.getInstance().isDisableJNDI()) {
FineJOptionPane.showMessageDialog(mainPanel, Toolkit.i18nText("Fine-Design_Basic_Database_Connection_JNDI_Disabled"),
Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
return;
}
// Try the java connection.
final SwingWorker<Void, Void> connectionThread = new TestConnectionWorker();
midPane.setVisible(false);
@ -493,7 +500,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
driverTips.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver"));
gridJpanel.add(driverTips);
UILabel deatail = new UILabel();
String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + detailMessage+ " " + Toolkit.i18nText("Fine_Designer_Driver");
String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + detailMessage + " " + Toolkit.i18nText("Fine_Designer_Driver");
deatail.setText(content);
deatail.setToolTipText(content);
gridJpanel.add(deatail);
@ -538,7 +545,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
Connection con = DatabaseConnectionPane.this.updateBean();
if(con instanceof JDBCDatabaseConnection && WorkContext.getCurrent().isLocal()) {
if (con instanceof JDBCDatabaseConnection && WorkContext.getCurrent().isLocal()) {
String driverPath = JarFileParseUtil.getDriverClassPath((JDBCDatabaseConnection) con);
jta.append(Toolkit.i18nText("Fine_Designer_Current_Driver_Path") + ":" + driverPath + "\n");
JPanel testDriverPanel = generateTestDriverPanel((JDBCDatabaseConnection) con, driverPath);
@ -581,16 +588,17 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public void mouseExited(MouseEvent e) {
driverTestTip.setCursor(Cursor.getDefaultCursor());
}
@Override
public void mouseClicked(MouseEvent e) {
try {
String path;
if(driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) {
if (driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) {
path = new File(driverPath).getParent();
} else {
path = driverPath;
}
if(hasDuplicateDriver(con.getDriver(), path)) {
if (hasDuplicateDriver(con.getDriver(), path)) {
testResult.setForeground(Color.RED);
testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_Conflict"));
} else {

19
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,25 @@ 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 (SecurityConfig.getInstance().isDisableJNDI()) {
if (connection instanceof NameDatabaseConnection && ((NameDatabaseConnection) connection).getConnection() instanceof JNDIDatabaseConnection) {
throw new SecurityRestrictionException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_JNDI_Disabled"));
}
}
}
/**
* 处理预览Model的列类型
*

56
designer-base/src/main/java/com/fr/design/i18n/DesignExtendLanguageConfig.java

@ -0,0 +1,56 @@
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;
/**
* 获取实例
*/
public static DesignExtendLanguageConfig getInstance() {
if (designExtendLanguageConfig == null) {
designExtendLanguageConfig = ConfigContext.getConfigInstance(DesignExtendLanguageConfig.class);
}
return designExtendLanguageConfig;
}
/**
* 设计器扩展的语言
* key为localeString例如en_US或envalue为改语言对应的国际化翻译key
*/
@Identifier("extendDesignLocales")
private MapConf<Map<String, String>> extendDesignLocales = Holders.map(new HashMap<>(), String.class, String.class);
public Map<String, String> getExtendedDesignLocales() {
return Collections.unmodifiableMap(extendDesignLocales.get());
}
public void setExtendedDesignLocales(Map<String, String> map) {
extendDesignLocales.set(map);
}
@Override
public Object clone() throws CloneNotSupportedException {
DesignExtendLanguageConfig cloned = (DesignExtendLanguageConfig) super.clone();
cloned.extendDesignLocales = ( MapConf<Map<String, String>>) extendDesignLocales.clone();
return cloned;
}
}

29
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -268,9 +268,14 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
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<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 用于 切换工作目录 时的模板资源暂存
*
* @return
*/
public FILE templateToStashFile4Envchange() {
@ -545,6 +551,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 刷新 模板资源 EditingFILE
* 仅在切换工作目录reload模板时使用
*
* @param file
*/
public void refreshResourceAndEditingFILE(FILE file) {
@ -1785,7 +1792,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
private CallbackSaveWorker saveAs(boolean showLoc) {
FILE editingFILE = this.getEditingFILE();
if (editingFILE == null) {
@ -1975,7 +1981,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
@Override
public void saveDirectly() {
if (isSaving()) {
@ -2125,17 +2130,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 获取此模板所使用的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<T extends BaseBook, U extends BaseUndoState<?>>
*
* @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<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 切换环境之前是否需要保存
*
* @return
*/
public boolean needSaveBeforeSwitchEnv(){
public boolean needSaveBeforeSwitchEnv() {
return false;
}

17
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;
@ -19,10 +20,12 @@ 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.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<Locale, String> getAvailableLanguages() {
Map<Locale, String> map = new LinkedHashMap<>(SupportLocale.getInstance().getLocaleMap());
for (Map.Entry<String, String> entry : DesignExtendLanguageConfig.getInstance().getExtendedDesignLocales().entrySet()) {
map.put(CommonUtils.stringToLocale(entry.getKey()), entry.getValue());
}
return Collections.unmodifiableMap(map);
}
}

1
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);

41
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<String, String> getValue(Object... o) {
HashMap<String, String> 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<Pair<Integer, Integer>> 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;
}
};

13
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<Pair<Integer, Integer>> 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;

15
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());
}
}

27
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<FormulaInfo> 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<FormulaInfo> 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;
}

4
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;

Loading…
Cancel
Save