Browse Source

Pull request #12431: REPORT-100195 数据连接信息配置更新

Merge in DESIGN/design from ~BRYANT/design:research/11.0 to research/11.0

* commit 'ead037e0b962908ca7d2d5e56f3816c1ea757a27':
  REPORT-100195 数据连接信息配置更新
research/11.0
Bryant-赵东升 1 year ago
parent
commit
0affb4fb31
  1. 42
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  2. 9
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  3. 6
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java
  4. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  5. 17
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  6. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java
  7. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
  8. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  9. 4
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  10. 11
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java
  11. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java
  12. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java
  13. 10
      designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

42
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -1,8 +1,6 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -14,7 +12,6 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.EditLockUtils; import com.fr.design.editlock.EditLockUtils;
import com.fr.design.editlock.ServerTableDataLockChangeChecker; import com.fr.design.editlock.ServerTableDataLockChangeChecker;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem; import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -23,7 +20,6 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.esd.event.DSMapping; import com.fr.esd.event.DSMapping;
import com.fr.esd.event.DsNameTarget; import com.fr.esd.event.DsNameTarget;
import com.fr.esd.event.StrategyEventsNotifier; import com.fr.esd.event.StrategyEventsNotifier;
import com.fr.file.TableDataConfig;
import com.fr.report.LockItem; import com.fr.report.LockItem;
@ -79,12 +75,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
// 锁定成功,执行后续操作 // 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final Map<String, TableData> tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas();
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() { public void complete() {
populate(tableDataMap);
TableDataConfig mirror = tableDataConfig.mirror();
populate(mirror);
} }
protected void renameConnection(final String oldName, final String newName) { protected void renameConnection(final String oldName, final String newName) {
@ -102,10 +96,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.setDoOKSucceed(false); globalTableDataDialog.setDoOKSucceed(false);
return; return;
} }
globalTableDataPane.update(tableDataConfig); globalTableDataPane.update(tableDataMap);
DesignTableDataManager.clearGlobalDs(); DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存 // 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) { for (String name : tableDataMap.keySet()) {
DesignTableDataManager.removeSelectedColumnNames(name); DesignTableDataManager.removeSelectedColumnNames(name);
} }
// 刷新共有数据集 // 刷新共有数据集
@ -125,32 +119,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.setVisible(true); globalTableDataDialog.setVisible(true);
} }
private boolean doWithDatasourceManager(TableDataConfig datasourceManager, TableDataManagerPane tableDataManagerPane, BasicDialog databaseListDialog) {
boolean isFailed = false;
//
//存在请重命名则不能更新
int index = isTableDataMapContainsRename(datasourceManager);
if (index != -1) {
isFailed = true;
tableDataManagerPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
return !isFailed;
}
/**
* 是否包含重命名key
*
* @return 包含则返回序列 ,若返回-1则说明不包含重命名key
*/
public int isTableDataMapContainsRename(TableDataConfig datasourceManager) {
Map<String, TableData> tableDataMap = datasourceManager.getTableDatas();
if (tableDataMap.containsKey(NameInspector.ILLEGAL_NAME_HOLDER)) {
return datasourceManager.getTableDataIndex(NameInspector.ILLEGAL_NAME_HOLDER);
}
return -1;
}
public void update() { public void update() {
this.setEnabled(true); this.setEnabled(true);
} }

9
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -1,5 +1,6 @@
package com.fr.design.data; package com.fr.design.data;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.StoreProcedureParameter; import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
@ -28,7 +29,6 @@ import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane; import com.fr.design.parameter.ParameterInputPane;
import com.fr.file.ProcedureConfig; import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
@ -310,7 +310,7 @@ public abstract class DesignTableDataManager {
names.add(entry.getKey()); names.add(entry.getKey());
} }
//服务器数据集 //服务器数据集
Map<String, TableData> tableDatas = TableDataConfig.getInstance().getTableDatas(); Map<String, TableData> tableDatas = TableDataConfigProviderFactory.getInstance().getTableDatas();
for (Map.Entry<String, TableData> entry : tableDatas.entrySet()) { for (Map.Entry<String, TableData> entry : tableDatas.entrySet()) {
names.add(entry.getKey()); names.add(entry.getKey());
} }
@ -442,13 +442,12 @@ public abstract class DesignTableDataManager {
} }
private static void addServerData(java.util.Map<String, TableDataWrapper> resMap) { private static void addServerData(java.util.Map<String, TableDataWrapper> resMap) {
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData();
String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig);
for (String name : namearray) { for (String name : namearray) {
if (globalDsCache.containsKey(name)) { if (globalDsCache.containsKey(name)) {
resMap.put(name, globalDsCache.get(name)); resMap.put(name, globalDsCache.get(name));
} else { } else {
TableDataWrapper tdw = new ServerTableDataWrapper(tableDataConfig.getTableData(name), name); TableDataWrapper tdw = new ServerTableDataWrapper(TableDataConfigProviderFactory.getInstance().getTableData(name), name);
resMap.put(name, tdw); resMap.put(name, tdw);
globalDsCache.put(name, tdw); globalDsCache.put(name, tdw);
} }

6
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java

@ -1,7 +1,7 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.file.TableDataConfig;
import javax.swing.*; import javax.swing.*;
import java.util.Map; import java.util.Map;
@ -39,9 +39,9 @@ public interface TableDataPaneController {
*/ */
boolean isNamePermitted(); boolean isNamePermitted();
void populate(TableDataConfig tableDataConfig); void populate(Map<String, TableData> tableDataMap);
void update(TableDataConfig tableDataConfig); void update(Map<String, TableData> tableDataMap);
void populate(TableDataSource datasourceManagerProvider); void populate(TableDataSource datasourceManagerProvider);

16
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -2,7 +2,6 @@ package com.fr.design.data.datapane;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.base.TableDataBean; import com.fr.base.TableDataBean;
import com.fr.config.remote.RemoteConfigEvent;
import com.fr.data.MultiResultTableData; import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.BasicTableDataUtils;
@ -12,9 +11,7 @@ import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.event.EventDispatcher;
import com.fr.file.ProcedureConfig; import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.file.TableDataOperator; import com.fr.file.TableDataOperator;
import com.fr.file.TableDataOperatorImpl; import com.fr.file.TableDataOperatorImpl;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -218,13 +215,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
* Populate. * Populate.
*/ */
@Override @Override
public void populate(TableDataConfig tableDataConfig) { public void populate(Map<String, TableData> tableDataMap) {
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator(); Iterator<String> nameIt = tableDataMap.keySet().iterator();
Iterator<String> procedurenameIt = ProcedureConfig.getInstance().getProcedures().keySet().iterator(); Iterator<String> procedurenameIt = ProcedureConfig.getInstance().getProcedures().keySet().iterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>(); List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();
nameObjectList.add(new NameObject(name, tableDataConfig.getTableData(name))); nameObjectList.add(new NameObject(name, tableDataMap.get(name)));
} }
while (procedurenameIt.hasNext()) { while (procedurenameIt.hasNext()) {
String name = procedurenameIt.next(); String name = procedurenameIt.next();
@ -235,7 +232,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
@Override @Override
public void update(TableDataConfig tableDataConfig) { public void update(Map<String, TableData> tableDataMap) {
Nameable[] tableDataArray = this.update(); Nameable[] tableDataArray = this.update();
List<TableDataBean> tableDataBeans = new ArrayList<>(); List<TableDataBean> tableDataBeans = new ArrayList<>();
Map<String, String> map = MapUtils.invertMap(getDsNameChangedMap()); Map<String, String> map = MapUtils.invertMap(getDsNameChangedMap());
@ -254,10 +251,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
// 走老的方式 // 走老的方式
return saveByOldWay(tableDataBeans); return saveByOldWay(tableDataBeans);
} }
}).saveTableData(new ArrayList<>(tableDataConfig.getTableDatas().keySet()), tableDataBeans); }).saveTableData(new ArrayList<>(tableDataMap.keySet()), tableDataBeans);
if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace());
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

17
designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java

@ -1,5 +1,7 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.RecursionTableData; import com.fr.data.impl.RecursionTableData;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -8,11 +10,11 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.file.TableDataConfig;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Map;
public class TreeTableDataComboBox extends UIComboBox { public class TreeTableDataComboBox extends UIComboBox {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -59,14 +61,13 @@ public class TreeTableDataComboBox extends UIComboBox {
} }
// 全局数据集 // 全局数据集
TableDataConfig mgr = TableDataConfig.getInstance(); Map<String, TableData> map = TableDataConfigProviderFactory.getInstance().getTableDatas();
nameIt = mgr.getTableDatas().keySet().iterator(); for (Map.Entry<String, TableData> entry : map.entrySet()) {
while (nameIt.hasNext()) { TableData tableData = entry.getValue();
String name = nameIt.next(); if (tableData instanceof RecursionTableData) {
if(mgr.getTableData(name) instanceof RecursionTableData) { ServerTableDataWrapper serverTableDataWrappe = new ServerTableDataWrapper(tableData, entry.getKey());
ServerTableDataWrapper serverTableDataWrappe = new ServerTableDataWrapper(mgr.getTableData(name), name);
model.addElement(serverTableDataWrappe); model.addElement(serverTableDataWrappe);
res_map.put(name, serverTableDataWrappe); res_map.put(entry.getKey(), serverTableDataWrappe);
} }
} }
} }

5
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java

@ -1,11 +1,11 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.data.impl.DecoratedTableData; import com.fr.data.impl.DecoratedTableData;
import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.condition.DSColumnLiteConditionPane;
import com.fr.design.gui.ilist.CheckBoxList; import com.fr.design.gui.ilist.CheckBoxList;
import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener; import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.TableDataConfig;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -20,8 +20,7 @@ public class DecoratedTableDataPane extends AbstractTableDataPane<DecoratedTable
public DecoratedTableDataPane() { public DecoratedTableDataPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); java.util.Iterator serverTableDataNameIterator = TableDataConfigProviderFactory.getInstance().getTableDatas().keySet().iterator();
java.util.Iterator serverTableDataNameIterator = tableDataConfig.getTableDatas().keySet().iterator();
java.util.List<String> tableDataNameList = new java.util.ArrayList<String>(); java.util.List<String> tableDataNameList = new java.util.ArrayList<String>();
while (serverTableDataNameIterator.hasNext()) { while (serverTableDataNameIterator.hasNext()) {
tableDataNameList.add((String)serverTableDataNameIterator.next()); tableDataNameList.add((String)serverTableDataNameIterator.next());

10
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.TableData;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataPaneController; import com.fr.design.data.datapane.TableDataPaneController;
@ -7,7 +8,6 @@ import com.fr.design.data.datapane.TableDataPaneListPane;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.TableDataConfig;
import javax.swing.*; import javax.swing.*;
@ -70,15 +70,15 @@ public class TableDataManagerPane extends LoadingBasicPane {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData");
} }
public void populate(TableDataConfig tableDataConfig) { public void populate(Map<String, TableData> tableDataMap) {
//todo 原来界面上显示的xml路径 //todo 原来界面上显示的xml路径
// this.tableDataTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME // this.tableDataTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
// + File.separator + datasourceManager.fileName()); // + File.separator + datasourceManager.fileName());
this.tableDataPane.populate(tableDataConfig); this.tableDataPane.populate(tableDataMap);
} }
public void update(TableDataConfig tableDataConfig) { public void update(Map<String, TableData> tableDataMap) {
this.tableDataPane.update(tableDataConfig); this.tableDataPane.update(tableDataMap);
} }
public Map<String, String> getDsChangedNameMap () { public Map<String, String> getDsChangedNameMap () {

6
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.wrapper; package com.fr.design.data.tabledata.wrapper;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.ClassTableData; import com.fr.data.impl.ClassTableData;
@ -21,7 +22,6 @@ import com.fr.design.data.tabledata.tabledatapane.FileTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.ProcedureDataPane; import com.fr.design.data.tabledata.tabledatapane.ProcedureDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -174,14 +174,14 @@ public abstract class TableDataFactory {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static String[] getSortOfChineseNameOfServerData(TableDataConfig tableDataConfig) { public static String[] getSortOfChineseNameOfServerData() {
clearAll(); clearAll();
try { try {
UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class); UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class);
Iterator<String> nameIt = userAuthority.getAuthServerDataSetNames().iterator(); Iterator<String> nameIt = userAuthority.getAuthServerDataSetNames().iterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();
addName(name, tableDataConfig.getTableData(name)); addName(name, TableDataConfigProviderFactory.getInstance().getTableData(name));
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

4
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -2,13 +2,13 @@ package com.fr.design.mainframe.authority;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.CloneCollector; import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.TableDataConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -47,7 +47,7 @@ public class JTemplateAuthorityChecker {
private void initAuthNames() { private void initAuthNames() {
allDatasetNames = new HashSet<>(); allDatasetNames = new HashSet<>();
for (String authServerDataSetName : TableDataConfig.getInstance().getTableDatas().keySet()) { for (String authServerDataSetName : TableDataConfigProviderFactory.getInstance().getTableDatas().keySet()) {
allDatasetNames.add(authServerDataSetName); allDatasetNames.add(authServerDataSetName);
} }

11
designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
@ -8,7 +9,6 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.parameter.ParameterGroup; import com.fr.design.parameter.ParameterGroup;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -24,8 +24,8 @@ import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 控件设置面板的控件名下拉框里面是所有参数的名字 * 控件设置面板的控件名下拉框里面是所有参数的名字
@ -159,10 +159,9 @@ public class ParameterTreeComboBox extends FRTreeComboBox {
// 全局数据源参数 // 全局数据源参数
parameters = new Parameter[0]; parameters = new Parameter[0];
Calculator c = Calculator.createCalculator(); Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); Map<String, TableData> tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator(); for (Map.Entry<String, TableData> entry : tableDataMap.entrySet()) {
while (nameIt.hasNext()) { TableData tableData = entry.getValue();
TableData tableData = tableDataConfig.getTableData(nameIt.next());
ParameterProvider[] ps = tableData.getParameters(c); ParameterProvider[] ps = tableData.getParameters(c);
if (!ArrayUtils.isEmpty(ps)) { if (!ArrayUtils.isEmpty(ps)) {
parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); parameters = (Parameter[])ArrayUtils.addAll(parameters, ps);

9
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.action.content.formula.data; package com.fr.design.actions.replace.action.content.formula.data;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.actions.replace.action.content.formula.SearchFormula; import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.info.FormulaInfo; import com.fr.design.actions.replace.info.FormulaInfo;
@ -7,7 +8,6 @@ import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.data.tabledata.wrapper.TableDataFactory; import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.TableDataConfig;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -36,8 +36,7 @@ public class SearchDataFormulaAction implements SearchFormula {
} }
private void dealServerData(List<FormulaInfo> fomulaInfos) { private void dealServerData(List<FormulaInfo> fomulaInfos) {
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData();
String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig);
for (String dataName : nameArray) { for (String dataName : nameArray) {
ITContent content = new ITContent(); ITContent content = new ITContent();
content.addOtherPos( content.addOtherPos(
@ -46,9 +45,9 @@ public class SearchDataFormulaAction implements SearchFormula {
); );
content.setJumpAble(false); content.setJumpAble(false);
content.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")); content.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"));
DataType dataType = DataType.match(tableDataConfig.getTableData(dataName).getClass().getSimpleName()); DataType dataType = DataType.match(TableDataConfigProviderFactory.getInstance().getTableData(dataName).getClass().getSimpleName());
if (dataType != null) { if (dataType != null) {
dataType.searchFormula(tableDataConfig.getTableData(dataName), content, fomulaInfos); dataType.searchFormula(TableDataConfigProviderFactory.getInstance().getTableData(dataName), content, fomulaInfos);
} }
} }
} }

9
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.action.content.sql; package com.fr.design.actions.replace.action.content.sql;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.design.actions.replace.action.SearchAction; import com.fr.design.actions.replace.action.SearchAction;
@ -9,7 +10,6 @@ import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.data.tabledata.wrapper.TableDataFactory; import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.TableDataConfig;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -49,17 +49,16 @@ public class SearchSQLAction implements SearchAction {
* @param sqlInfos * @param sqlInfos
*/ */
private void addServerDataInfos2Array(ITContent content, List<SQLInfo> sqlInfos) { private void addServerDataInfos2Array(ITContent content, List<SQLInfo> sqlInfos) {
TableDataConfig tableDataConfig = TableDataConfig.getInstance(); String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData();
String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig);
for (String dataName : nameArray) { for (String dataName : nameArray) {
if (tableDataConfig.getTableData(dataName) instanceof DBTableData) { if (TableDataConfigProviderFactory.getInstance().getTableData(dataName) instanceof DBTableData) {
ITContent newContent = ITContent.copy(content); ITContent newContent = ITContent.copy(content);
newContent.addOtherPos( newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"), Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"),
dataName dataName
); );
newContent.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")); newContent.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"));
newContent.setReplaceObject(tableDataConfig.getTableData(dataName)); newContent.setReplaceObject(TableDataConfigProviderFactory.getInstance().getTableData(dataName));
sqlInfos.add(new SQLInfo(newContent)); sqlInfos.add(new SQLInfo(newContent));
} }

10
designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
@ -8,7 +9,6 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.parameter.ParameterGroup; import com.fr.design.parameter.ParameterGroup;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -27,6 +27,7 @@ import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 控件设置面板的控件名下拉框里面是所有参数的名字 * 控件设置面板的控件名下拉框里面是所有参数的名字
@ -161,10 +162,9 @@ public class ParameterTreeComboBox extends FRTreeComboBox {
// 全局数据源参数 // 全局数据源参数
parameters = new Parameter[0]; parameters = new Parameter[0];
Calculator c = Calculator.createCalculator(); Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror(); Map<String, TableData> tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator(); for (Map.Entry<String, TableData> entry : tableDataMap.entrySet()) {
while (nameIt.hasNext()) { TableData tableData = entry.getValue();
TableData tableData = tableDataConfig.getTableData(nameIt.next());
ParameterProvider[] ps = tableData.getParameters(c); ParameterProvider[] ps = tableData.getParameters(c);
if (!ArrayUtils.isEmpty(ps)) { if (!ArrayUtils.isEmpty(ps)) {
parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); parameters = (Parameter[])ArrayUtils.addAll(parameters, ps);

Loading…
Cancel
Save