diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 1457f0d111..11d30f6dba 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/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; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.TableData; import com.fr.design.DesignModelAdapter; 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.editlock.EditLockUtils; 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.UIMenuItem; 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.DsNameTarget; import com.fr.esd.event.StrategyEventsNotifier; -import com.fr.file.TableDataConfig; import com.fr.report.LockItem; @@ -79,12 +75,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } // 锁定成功,执行后续操作 final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); + final Map tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { - - TableDataConfig mirror = tableDataConfig.mirror(); - populate(mirror); + populate(tableDataMap); } protected void renameConnection(final String oldName, final String newName) { @@ -102,10 +96,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS globalTableDataDialog.setDoOKSucceed(false); return; } - globalTableDataPane.update(tableDataConfig); + globalTableDataPane.update(tableDataMap); DesignTableDataManager.clearGlobalDs(); // 保存时 移除服务器数据集列名缓存 - for (String name : tableDataConfig.getTableDatas().keySet()) { + for (String name : tableDataMap.keySet()) { DesignTableDataManager.removeSelectedColumnNames(name); } // 刷新共有数据集 @@ -125,32 +119,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS 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 tableDataMap = datasourceManager.getTableDatas(); - if (tableDataMap.containsKey(NameInspector.ILLEGAL_NAME_HOLDER)) { - return datasourceManager.getTableDataIndex(NameInspector.ILLEGAL_NAME_HOLDER); - } - return -1; - } - public void update() { this.setEnabled(true); } diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 5134e88c8b..5a13ce2adc 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -1,5 +1,6 @@ package com.fr.design.data; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; 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.parameter.ParameterInputPane; import com.fr.file.ProcedureConfig; -import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; @@ -310,7 +310,7 @@ public abstract class DesignTableDataManager { names.add(entry.getKey()); } //服务器数据集 - Map tableDatas = TableDataConfig.getInstance().getTableDatas(); + Map tableDatas = TableDataConfigProviderFactory.getInstance().getTableDatas(); for (Map.Entry entry : tableDatas.entrySet()) { names.add(entry.getKey()); } @@ -442,13 +442,12 @@ public abstract class DesignTableDataManager { } private static void addServerData(java.util.Map resMap) { - TableDataConfig tableDataConfig = TableDataConfig.getInstance(); - String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig); + String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData(); for (String name : namearray) { if (globalDsCache.containsKey(name)) { resMap.put(name, globalDsCache.get(name)); } else { - TableDataWrapper tdw = new ServerTableDataWrapper(tableDataConfig.getTableData(name), name); + TableDataWrapper tdw = new ServerTableDataWrapper(TableDataConfigProviderFactory.getInstance().getTableData(name), name); resMap.put(name, tdw); globalDsCache.put(name, tdw); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java index befbc7ddbd..73c657de1b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneController.java @@ -1,7 +1,7 @@ package com.fr.design.data.datapane; +import com.fr.base.TableData; import com.fr.data.TableDataSource; -import com.fr.file.TableDataConfig; import javax.swing.*; import java.util.Map; @@ -39,9 +39,9 @@ public interface TableDataPaneController { */ boolean isNamePermitted(); - void populate(TableDataConfig tableDataConfig); + void populate(Map tableDataMap); - void update(TableDataConfig tableDataConfig); + void update(Map tableDataMap); void populate(TableDataSource datasourceManagerProvider); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 404924911f..39774e4d70 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/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.TableDataBean; -import com.fr.config.remote.RemoteConfigEvent; import com.fr.data.MultiResultTableData; import com.fr.data.TableDataSource; 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.ilist.ListModelElement; import com.fr.design.i18n.Toolkit; -import com.fr.event.EventDispatcher; import com.fr.file.ProcedureConfig; -import com.fr.file.TableDataConfig; import com.fr.file.TableDataOperator; import com.fr.file.TableDataOperatorImpl; import com.fr.general.ComparatorUtils; @@ -218,13 +215,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData * Populate. */ @Override - public void populate(TableDataConfig tableDataConfig) { - Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); + public void populate(Map tableDataMap) { + Iterator nameIt = tableDataMap.keySet().iterator(); Iterator procedurenameIt = ProcedureConfig.getInstance().getProcedures().keySet().iterator(); List nameObjectList = new ArrayList(); while (nameIt.hasNext()) { String name = nameIt.next(); - nameObjectList.add(new NameObject(name, tableDataConfig.getTableData(name))); + nameObjectList.add(new NameObject(name, tableDataMap.get(name))); } while (procedurenameIt.hasNext()) { String name = procedurenameIt.next(); @@ -235,7 +232,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } @Override - public void update(TableDataConfig tableDataConfig) { + public void update(Map tableDataMap) { Nameable[] tableDataArray = this.update(); List tableDataBeans = new ArrayList<>(); Map map = MapUtils.invertMap(getDsNameChangedMap()); @@ -254,10 +251,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData // 走老的方式 return saveByOldWay(tableDataBeans); } - }).saveTableData(new ArrayList<>(tableDataConfig.getTableDatas().keySet()), tableDataBeans); - if (!WorkContext.getCurrent().isLocal()) { - EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace()); - } + }).saveTableData(new ArrayList<>(tableDataMap.keySet()), tableDataBeans); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java index 422a3a49a8..bca5b29912 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java @@ -1,5 +1,7 @@ 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.impl.RecursionTableData; 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.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; -import com.fr.file.TableDataConfig; import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; +import java.util.Map; public class TreeTableDataComboBox extends UIComboBox { private static final long serialVersionUID = 1L; @@ -59,14 +61,13 @@ public class TreeTableDataComboBox extends UIComboBox { } // 全局数据集 - TableDataConfig mgr = TableDataConfig.getInstance(); - nameIt = mgr.getTableDatas().keySet().iterator(); - while (nameIt.hasNext()) { - String name = nameIt.next(); - if(mgr.getTableData(name) instanceof RecursionTableData) { - ServerTableDataWrapper serverTableDataWrappe = new ServerTableDataWrapper(mgr.getTableData(name), name); + Map map = TableDataConfigProviderFactory.getInstance().getTableDatas(); + for (Map.Entry entry : map.entrySet()) { + TableData tableData = entry.getValue(); + if (tableData instanceof RecursionTableData) { + ServerTableDataWrapper serverTableDataWrappe = new ServerTableDataWrapper(tableData, entry.getKey()); model.addElement(serverTableDataWrappe); - res_map.put(name, serverTableDataWrappe); + res_map.put(entry.getKey(), serverTableDataWrappe); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java index 1f3d60af02..d0eded022f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java @@ -1,11 +1,11 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.data.impl.DecoratedTableData; import com.fr.design.condition.DSColumnLiteConditionPane; import com.fr.design.gui.ilist.CheckBoxList; import com.fr.design.gui.ilist.CheckBoxList.CheckBoxListSelectionChangeListener; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.TableDataConfig; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; import com.fr.log.FineLoggerFactory; @@ -19,9 +19,8 @@ public class DecoratedTableDataPane extends AbstractTableDataPane tableDataNameList = new java.util.ArrayList(); while (serverTableDataNameIterator.hasNext()) { tableDataNameList.add((String)serverTableDataNameIterator.next()); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java index c55e5871ee..b1308f64bf 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.tabledatapane; +import com.fr.base.TableData; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; 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.gui.frpane.LoadingBasicPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.TableDataConfig; 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"); } - public void populate(TableDataConfig tableDataConfig) { + public void populate(Map tableDataMap) { //todo 原来界面上显示的xml路径 // this.tableDataTextField.setText(WorkContext.getCurrent().getPath() + File.separator + ProjectConstants.RESOURCES_NAME // + File.separator + datasourceManager.fileName()); - this.tableDataPane.populate(tableDataConfig); + this.tableDataPane.populate(tableDataMap); } - public void update(TableDataConfig tableDataConfig) { - this.tableDataPane.update(tableDataConfig); + public void update(Map tableDataMap) { + this.tableDataPane.update(tableDataMap); } public Map getDsChangedNameMap () { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index 8345bde944..e716547e6b 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -1,5 +1,6 @@ package com.fr.design.data.tabledata.wrapper; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.TableData; import com.fr.data.TableDataSource; 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.ProcedureDataPane; import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; -import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -174,14 +174,14 @@ public abstract class TableDataFactory { } @SuppressWarnings("unchecked") - public static String[] getSortOfChineseNameOfServerData(TableDataConfig tableDataConfig) { + public static String[] getSortOfChineseNameOfServerData() { clearAll(); try { UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class); Iterator nameIt = userAuthority.getAuthServerDataSetNames().iterator(); while (nameIt.hasNext()) { String name = nameIt.next(); - addName(name, tableDataConfig.getTableData(name)); + addName(name, TableDataConfigProviderFactory.getInstance().getTableData(name)); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index 1e69d68540..7308859137 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/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.TableDataConfigProviderFactory; import com.fr.base.CloneCollector; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; -import com.fr.file.TableDataConfig; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; @@ -47,7 +47,7 @@ public class JTemplateAuthorityChecker { private void initAuthNames() { allDatasetNames = new HashSet<>(); - for (String authServerDataSetName : TableDataConfig.getInstance().getTableDatas().keySet()) { + for (String authServerDataSetName : TableDataConfigProviderFactory.getInstance().getTableDatas().keySet()) { allDatasetNames.add(authServerDataSetName); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java index 1fe824156f..9a48a15d31 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java @@ -1,5 +1,6 @@ package com.fr.design.widget.ui.designer; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.BaseUtils; import com.fr.base.Parameter; 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.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.parameter.ParameterGroup; -import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.script.Calculator; @@ -24,8 +24,8 @@ import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; +import java.util.Map; /** * 控件设置面板的“控件名”下拉框,里面是所有参数的名字 @@ -159,10 +159,9 @@ public class ParameterTreeComboBox extends FRTreeComboBox { // 全局数据源参数 parameters = new Parameter[0]; Calculator c = Calculator.createCalculator(); - TableDataConfig tableDataConfig = TableDataConfig.getInstance(); - Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); - while (nameIt.hasNext()) { - TableData tableData = tableDataConfig.getTableData(nameIt.next()); + Map tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas(); + for (Map.Entry entry : tableDataMap.entrySet()) { + TableData tableData = entry.getValue(); ParameterProvider[] ps = tableData.getParameters(c); if (!ArrayUtils.isEmpty(ps)) { parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java index 3d4c66adc0..38f41b6e21 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java +++ b/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; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.data.TableDataSource; import com.fr.design.actions.replace.action.content.formula.SearchFormula; 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.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; -import com.fr.file.TableDataConfig; import java.util.Iterator; import java.util.List; @@ -36,8 +36,7 @@ public class SearchDataFormulaAction implements SearchFormula { } private void dealServerData(List fomulaInfos) { - TableDataConfig tableDataConfig = TableDataConfig.getInstance(); - String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig); + String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(); for (String dataName : nameArray) { ITContent content = new ITContent(); content.addOtherPos( @@ -46,9 +45,9 @@ public class SearchDataFormulaAction implements SearchFormula { ); content.setJumpAble(false); 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) { - dataType.searchFormula(tableDataConfig.getTableData(dataName), content, fomulaInfos); + dataType.searchFormula(TableDataConfigProviderFactory.getInstance().getTableData(dataName), content, fomulaInfos); } } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java index f36e3afbeb..5a41559907 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java +++ b/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; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.data.TableDataSource; import com.fr.data.impl.DBTableData; 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.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; -import com.fr.file.TableDataConfig; import com.fr.stable.AssistUtils; import java.util.ArrayList; @@ -49,17 +49,16 @@ public class SearchSQLAction implements SearchAction { * @param sqlInfos */ private void addServerDataInfos2Array(ITContent content, List sqlInfos) { - TableDataConfig tableDataConfig = TableDataConfig.getInstance(); - String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig); + String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(); for (String dataName : nameArray) { - if (tableDataConfig.getTableData(dataName) instanceof DBTableData) { + if (TableDataConfigProviderFactory.getInstance().getTableData(dataName) instanceof DBTableData) { ITContent newContent = ITContent.copy(content); newContent.addOtherPos( Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"), dataName ); 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)); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java b/designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java index 0383b83b7e..9e0ed829c6 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java @@ -1,5 +1,6 @@ package com.fr.design.widget.ui; +import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.BaseUtils; import com.fr.base.Parameter; 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.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.parameter.ParameterGroup; -import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.script.Calculator; @@ -27,6 +27,7 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * 控件设置面板的“控件名”下拉框,里面是所有参数的名字 @@ -161,10 +162,9 @@ public class ParameterTreeComboBox extends FRTreeComboBox { // 全局数据源参数 parameters = new Parameter[0]; Calculator c = Calculator.createCalculator(); - TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror(); - Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); - while (nameIt.hasNext()) { - TableData tableData = tableDataConfig.getTableData(nameIt.next()); + Map tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas(); + for (Map.Entry entry : tableDataMap.entrySet()) { + TableData tableData = entry.getValue(); ParameterProvider[] ps = tableData.getParameters(c); if (!ArrayUtils.isEmpty(ps)) { parameters = (Parameter[])ArrayUtils.addAll(parameters, ps);