From c2bf3d6507fe4ce7272ae4d04ce72d1b2cb55b1b Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 2 Mar 2018 09:51:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-6956=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=80=82=E9=85=8D10.0=E9=85=8D=E7=BD=AE=E5=86=99?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/report/ReportWebAttrAction.java | 33 ++++++--- .../server/ServerConfigManagerAction.java | 29 ++++++-- .../actions/server/StyleListAction.java | 31 +++++--- .../actions/server/WidgetManagerAction.java | 40 +++++++---- .../fr/design/webattr/PageToolBarPane.java | 34 ++++++--- .../fr/design/webattr/ViewToolBarPane.java | 37 +++++++--- .../fr/design/webattr/WriteToolBarPane.java | 27 +++++-- .../actions/server/ConnectionListAction.java | 47 ++++++++++--- .../actions/server/FunctionManagerAction.java | 31 +++++--- .../actions/server/GlobalParameterAction.java | 43 ++++++++---- .../actions/server/GlobalTableDataAction.java | 70 ++++++++++++++----- .../actions/server/ProcedureListAction.java | 35 +++++++--- .../connect/ConnectionComboBoxPanel.java | 41 ++++++++--- 13 files changed, 366 insertions(+), 132 deletions(-) diff --git a/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java b/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java index 3b490d54da..eea11810c6 100644 --- a/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java @@ -7,6 +7,7 @@ import com.fr.base.ConfigManager; import com.fr.base.ConfigManagerProvider; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -16,6 +17,9 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.webattr.ReportWebAttrPane; import com.fr.general.IOUtils; import com.fr.main.TemplateWorkBook; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; +import com.fr.web.attr.ReportWebConfig; import java.awt.event.ActionEvent; @@ -56,15 +60,26 @@ public class ReportWebAttrAction extends JWorkBookAction { dialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - wbTpl.setReportWebAttr(reportWebAttrPane.update()); - final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } - jwb.fireTargetModified(); + Configurations.update(new Worker() { + @Override + public void run() { + wbTpl.setReportWebAttr(reportWebAttrPane.update()); + final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(configManager); + } catch (Exception ex) { + FRContext.getLogger().error(ex.getMessage(), ex); + } + jwb.fireTargetModified(); + } + + @Override + public Class[] targets() { + return new Class[]{ReportWebConfig.class}; + } + }); + } }); diff --git a/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java b/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java index 567f6c9969..ab69866300 100644 --- a/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java +++ b/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java @@ -7,6 +7,7 @@ import com.fr.base.ConfigManager; import com.fr.base.ConfigManagerProvider; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -15,6 +16,9 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.EditReportServerParameterPane; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.event.ActionEvent; @@ -51,13 +55,24 @@ public class ServerConfigManagerAction extends UpdateAction { editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - editReportServerParameterPane.update(configManager); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } + Configurations.update(new Worker() { + @Override + public void run() { + editReportServerParameterPane.update(configManager); + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(configManager); + } catch (Exception ex) { + FRContext.getLogger().error(ex.getMessage(), ex); + } + } + + @Override + public Class[] targets() { + return new Class[]{ReportWebConfig.class}; + } + }); + } }); editReportServerParameterDialog.setVisible(true); diff --git a/designer/src/com/fr/design/actions/server/StyleListAction.java b/designer/src/com/fr/design/actions/server/StyleListAction.java index ff5201b141..f59aba9b93 100644 --- a/designer/src/com/fr/design/actions/server/StyleListAction.java +++ b/designer/src/com/fr/design/actions/server/StyleListAction.java @@ -4,6 +4,8 @@ import com.fr.base.BaseUtils; import com.fr.base.ConfigManager; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; +import com.fr.config.ServerConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -12,6 +14,8 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -40,14 +44,25 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - styleListPane.update(ConfigManager.getProviderInstance()); - //marks:保存数据 - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(ConfigManager.getProviderInstance()); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } + Configurations.update(new Worker() { + @Override + public void run() { + styleListPane.update(ConfigManager.getProviderInstance()); + //marks:保存数据 + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(ConfigManager.getProviderInstance()); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + + @Override + public Class[] targets() { + return new Class[]{ServerConfig.class}; + } + }); + } }); diff --git a/designer/src/com/fr/design/actions/server/WidgetManagerAction.java b/designer/src/com/fr/design/actions/server/WidgetManagerAction.java index 58fb9ec37b..a25c502b1a 100644 --- a/designer/src/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer/src/com/fr/design/actions/server/WidgetManagerAction.java @@ -3,6 +3,7 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -11,9 +12,12 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.WidgetManagerPane; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetManager; import com.fr.form.ui.WidgetManagerProvider; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -43,21 +47,31 @@ public class WidgetManagerAction extends UpdateAction { BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame,new DialogActionAdapter() { @Override public void doOk() { - widgetManagerPane.update(widgetManager); + Configurations.update(new Worker() { + @Override + public void run() { + widgetManagerPane.update(widgetManager); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(widgetManager); - //marks: 由于这个面板还改变权限相关的操作,所以这个时候还要操作权限配置 + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(widgetManager); + //marks: 由于这个面板还改变权限相关的操作,所以这个时候还要操作权限配置 // currentEnv.writeResource(FRContext.getPrivilegeManager()); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } - DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); - if (model != null) { - model.widgetConfigChanged(); - } - designerFrame.getSelectedJTemplate().refreshToolArea(); + } catch (Exception ex) { + FRContext.getLogger().error(ex.getMessage(), ex); + } + DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); + if (model != null) { + model.widgetConfigChanged(); + } + designerFrame.getSelectedJTemplate().refreshToolArea(); + } + + @Override + public Class[] targets() { + return new Class[]{WidgetInfoConfig.class}; + } + }); } }); diff --git a/designer/src/com/fr/design/webattr/PageToolBarPane.java b/designer/src/com/fr/design/webattr/PageToolBarPane.java index 5f3df534c9..a36b90ad09 100644 --- a/designer/src/com/fr/design/webattr/PageToolBarPane.java +++ b/designer/src/com/fr/design/webattr/PageToolBarPane.java @@ -1,6 +1,7 @@ package com.fr.design.webattr; import com.fr.base.ConfigManager; +import com.fr.config.Configuration; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -16,7 +17,10 @@ import com.fr.report.web.Location; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebContent; import com.fr.report.web.WebPage; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -142,11 +146,10 @@ public class PageToolBarPane extends AbstractEditToolBarPane { @Override public WebPage updateBean() { WebPage webPage = new WebPage(); - - if (this.isUseToolBarCheckBox.isSelected()) { - webPage.setToolBarManagers(this.toolBarManagers); + if (isUseToolBarCheckBox.isSelected()) { + webPage.setToolBarManagers(toolBarManagers); }else { - webPage.setToolBarManagers(new ToolBarManager[0]); + webPage.setToolBarManagers(new ToolBarManager[0]); } for (int i = 0; i < eventPane.update().size(); i++) { Listener listener = eventPane.update().get(i); @@ -174,12 +177,23 @@ public class PageToolBarPane extends AbstractEditToolBarPane { @Override public void doOk() { - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } - reportWebAttr.setWebPage(serverPageToolBarPane.updateBean()); + Configurations.update(new Worker() { + @Override + public void run() { + ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + if (reportWebAttr == null) { + reportWebAttr = new ReportWebAttr(); + ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); + } + reportWebAttr.setWebPage(serverPageToolBarPane.updateBean()); + } + + @Override + public Class[] targets() { + return new Class[]{ReportWebConfig.class}; + } + }); + } }); serverPageDialog.setVisible(true); diff --git a/designer/src/com/fr/design/webattr/ViewToolBarPane.java b/designer/src/com/fr/design/webattr/ViewToolBarPane.java index f33ded853d..bce10196cd 100644 --- a/designer/src/com/fr/design/webattr/ViewToolBarPane.java +++ b/designer/src/com/fr/design/webattr/ViewToolBarPane.java @@ -1,6 +1,7 @@ package com.fr.design.webattr; import com.fr.base.ConfigManager; +import com.fr.config.Configuration; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -15,7 +16,10 @@ import com.fr.report.web.Location; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebContent; import com.fr.report.web.WebView; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -113,14 +117,14 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { @Override public WebView updateBean() { WebView webView = new WebView(); - if (this.isUseToolBarCheckBox.isSelected()) { - webView.setToolBarManagers(this.toolBarManagers); + if (isUseToolBarCheckBox.isSelected()) { + webView.setToolBarManagers(toolBarManagers); } else { webView.setToolBarManagers(new ToolBarManager[0]); } - webView.setSortFuncCheck(this.sortCheckBox.isSelected()); - webView.setConditionFuncCheck(this.conditonFilterBox.isSelected()); - webView.setListFuncCheck(this.listFilterBox.isSelected()); + webView.setSortFuncCheck(sortCheckBox.isSelected()); + webView.setConditionFuncCheck(conditonFilterBox.isSelected()); + webView.setListFuncCheck(listFilterBox.isSelected()); for (int i = 0; i < eventPane.update().size(); i++) { Listener listener = eventPane.update().get(i); webView.addListener(listener); @@ -143,12 +147,23 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { @Override public void doOk() { - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } - reportWebAttr.setWebView(serverPageToolBarPane.updateBean()); + Configurations.update(new Worker() { + @Override + public void run() { + ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + if (reportWebAttr == null) { + reportWebAttr = new ReportWebAttr(); + ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); + } + reportWebAttr.setWebView(serverPageToolBarPane.updateBean()); + } + + @Override + public Class[] targets() { + return new Class[]{ReportWebConfig.class}; + } + }); + } }); serverPageDialog.setVisible(true); diff --git a/designer/src/com/fr/design/webattr/WriteToolBarPane.java b/designer/src/com/fr/design/webattr/WriteToolBarPane.java index 70cf35af90..37bd02b1bd 100644 --- a/designer/src/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer/src/com/fr/design/webattr/WriteToolBarPane.java @@ -2,6 +2,7 @@ package com.fr.design.webattr; import com.fr.base.BaseUtils; import com.fr.base.ConfigManager; +import com.fr.config.Configuration; import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -20,7 +21,10 @@ import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebContent; import com.fr.report.web.WebWrite; import com.fr.stable.Constants; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; @@ -260,12 +264,23 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { @Override public void doOk() { - ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } - reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean()); + Configurations.update(new Worker() { + @Override + public void run() { + ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + if (reportWebAttr == null) { + reportWebAttr = new ReportWebAttr(); + ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); + } + reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean()); + } + + @Override + public Class[] targets() { + return new Class[]{ReportWebConfig.class}; + } + }); + } }); serverPageDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java b/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java index a91ab6af1c..4048033380 100644 --- a/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java @@ -3,6 +3,7 @@ package com.fr.design.actions.server; import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.ModifiedTable; +import com.fr.config.Configuration; import com.fr.data.impl.Connection; import com.fr.dav.LocalEnv; import com.fr.design.actions.UpdateAction; @@ -14,10 +15,13 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; +import com.fr.file.ConnectionConfig; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -74,20 +78,41 @@ public class ConnectionListAction extends UpdateAction { final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); databaseListDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - if (!databaseManagerPane.isNamePermitted()) { - databaseListDialog.setDoOKSucceed(false); - return; - } - if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } - // marks:保存数据 - writeFile(datasourceManager); + Configurations.update(new Worker() { + @Override + public void run() { + if (!databaseManagerPane.isNamePermitted()) { + databaseListDialog.setDoOKSucceed(false); + return; + } + if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return; + } + // marks:保存数据 + writeFile(datasourceManager); + } + + @Override + public Class[] targets() { + return new Class[]{ConnectionConfig.class}; + } + }); + } public void doCancel() { - datasourceManager.synchronizedWithServer(); + Configurations.update(new Worker() { + @Override + public void run() { + datasourceManager.synchronizedWithServer(); + } + + @Override + public Class[] targets() { + return new Class[]{ConnectionConfig.class}; + } + }); } }); databaseListDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java b/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java index 7467a00eaf..8f8853baa1 100644 --- a/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java @@ -6,16 +6,20 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.FunctionManagerPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; +import com.fr.file.FunctionConfig; import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -45,14 +49,25 @@ public class FunctionManagerAction extends UpdateAction { final FunctionManagerProvider functionManager = FunctionManager.getProviderInstance(); functionManagerDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - functionManagerPane.update(functionManager); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(functionManager); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } + Configurations.update(new Worker() { + @Override + public void run() { + functionManagerPane.update(functionManager); + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(functionManager); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + + @Override + public Class[] targets() { + return new Class[]{FunctionConfig.class}; + } + }); + + } }); functionManagerPane.populate(functionManager); functionManagerDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java b/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java index e2597c0fe7..198d817777 100644 --- a/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java @@ -7,6 +7,8 @@ import com.fr.base.BaseUtils; import com.fr.base.ConfigManager; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.Configuration; +import com.fr.config.ServerConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -17,6 +19,8 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.parameter.ParameterManagerPane; import com.fr.general.Inter; import com.fr.base.ConfigManagerProvider; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -50,20 +54,31 @@ public class GlobalParameterAction extends UpdateAction { parameterManagerPane.populate(configManager); parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - //apply new parameter list. - parameterManagerPane.update(configManager); - //marks:保存数据 - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } - DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); - if (model != null) { - model.parameterChanged(); - } - parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); + Configurations.update(new Worker() { + @Override + public void run() { + //apply new parameter list. + parameterManagerPane.update(configManager); + //marks:保存数据 + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.writeResource(configManager); + } catch (Exception ex) { + FRContext.getLogger().error(ex.getMessage(), ex); + } + DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); + if (model != null) { + model.parameterChanged(); + } + parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); + } + + @Override + public Class[] targets() { + return new Class[]{ServerConfig.class}; + } + }); + } }); parameterManagerDialog.setModal(true); diff --git a/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java b/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java index 87d095dcb6..3bdef5f4f1 100644 --- a/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java @@ -4,6 +4,7 @@ package com.fr.design.actions.server; import com.fr.base.*; +import com.fr.config.Configuration; import com.fr.dav.LocalEnv; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -18,7 +19,10 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; @@ -68,8 +72,18 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS populate(datasourceManager); } - protected void renameConnection(String oldName, String newName) { - datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); + protected void renameConnection(final String oldName, final String newName) { + Configurations.update(new Worker() { + @Override + public void run() { + datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); + } + + @Override + public Class[] targets() { + return new Class[]{DatasourceManager.class}; + } + }); } }; final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null); @@ -78,26 +92,48 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS @Override public void doOk() { - if (!globalTableDataPane.isNamePermitted()) { - globalTableDataDialog.setDoOKSucceed(false); - return; - } + Configurations.update(new Worker() { + @Override + public void run() { + if (!globalTableDataPane.isNamePermitted()) { + globalTableDataDialog.setDoOKSucceed(false); + return; + } + + DesignTableDataManager.clearGlobalDs(); + globalTableDataPane.update(datasourceManager); + if (!doWithDatasourceManager(datasourceManager, backupManager, globalTableDataPane, globalTableDataDialog)) { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return; + } + + writeFile(datasourceManager); + // 刷新共有数据集 + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + fireDSChanged(globalTableDataPane.getDsChangedNameMap()); + } - DesignTableDataManager.clearGlobalDs(); - globalTableDataPane.update(datasourceManager); - if (!doWithDatasourceManager(datasourceManager, backupManager, globalTableDataPane, globalTableDataDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } + @Override + public Class[] targets() { + return new Class[]{TableDataConfig.class}; + } + }); - writeFile(datasourceManager); - // 刷新共有数据集 - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - fireDSChanged(globalTableDataPane.getDsChangedNameMap()); } public void doCancel() { - datasourceManager.synchronizedWithServer(); + Configurations.update(new Worker() { + @Override + public void run() { + datasourceManager.synchronizedWithServer(); + } + + @Override + public Class[] targets() { + return new Class[]{TableDataConfig.class + }; + } + }); } }); globalTableDataDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java b/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java index 8751c03b31..989acfa69d 100644 --- a/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java +++ b/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java @@ -2,6 +2,7 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -13,7 +14,10 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ProcedureConfig; import com.fr.general.Inter; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import java.awt.event.ActionEvent; @@ -42,16 +46,27 @@ public class ProcedureListAction extends UpdateAction { BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame,null); databaseListDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { - DesignTableDataManager.clearGlobalDs(); - databaseManagerPane.update(datasourceManager); - - // marks:保存数据 - try { - FRContext.getCurrentEnv().writeResource(datasourceManager); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage()); - } - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + Configurations.update(new Worker() { + @Override + public void run() { + DesignTableDataManager.clearGlobalDs(); + databaseManagerPane.update(datasourceManager); + + // marks:保存数据 + try { + FRContext.getCurrentEnv().writeResource(datasourceManager); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + } + + @Override + public Class[] targets() { + return new Class[]{ProcedureConfig.class}; + } + }); + } }); databaseListDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index c80970bd9c..ab9e12162b 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -1,6 +1,7 @@ package com.fr.design.data.datapane.connect; import com.fr.base.FRContext; +import com.fr.config.Configuration; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.data.impl.NameDatabaseConnection; @@ -8,10 +9,13 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.file.ConnectionConfig; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ItemEvent; @@ -96,17 +100,38 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane, - connectionListDialog)) { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return; - } - // marks:保存数据 - ConnectionListAction.writeFile(datasourceManager); + Configurations.update(new Worker() { + @Override + public void run() { + if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane, + connectionListDialog)) { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return; + } + // marks:保存数据 + ConnectionListAction.writeFile(datasourceManager); + } + + @Override + public Class[] targets() { + return new Class[]{ConnectionConfig.class}; + } + }); + } public void doCancel() { - datasourceManager.synchronizedWithServer(); + Configurations.update(new Worker() { + @Override + public void run() { + datasourceManager.synchronizedWithServer(); + } + + @Override + public Class[] targets() { + return new Class[]{ConnectionConfig.class}; + } + }); } }); connectionListDialog.setVisible(true); From 7a39519281c56eb47a09630e43cce973ba13f6c2 Mon Sep 17 00:00:00 2001 From: kerry Date: Sun, 4 Mar 2018 17:04:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-6956=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=80=82=E9=85=8D10.0=E9=85=8D=E7=BD=AE=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/cell/GlobalStyleMenuDef.java | 12 +- .../actions/report/ReportWebAttrAction.java | 14 +- .../server/ServerConfigManagerAction.java | 19 +-- .../actions/server/StyleListAction.java | 15 +- .../actions/server/StyleManagerPane.java | 16 +- .../actions/server/WidgetManagerAction.java | 17 +- .../design/mainframe/ActiveKeyGenerator.java | 4 +- .../mainframe/AuthorityToolBarPane.java | 22 +-- .../alphafine/component/AlphaFineDialog.java | 4 +- .../design/mainframe/bbs/BBSLoginDialog.java | 2 - .../design/mainframe/bbs/UserInfoLabel.java | 6 +- .../fr/design/mainframe/bbs/UserInfoPane.java | 6 +- .../style/PredefinedStylePane.java | 7 +- .../errorinfo/ErrorInfoLogAppender.java | 4 +- .../com/fr/design/module/DesignerModule.java | 5 +- .../com/fr/design/present/StyleArrayPane.java | 6 +- .../com/fr/design/report/ReportStylePane.java | 6 +- .../fr/design/report/WriteShortCutsPane.java | 13 +- .../src/com/fr/design/webattr/CommonPane.java | 6 +- .../EditReportServerParameterPane.java | 34 ++-- .../com/fr/design/webattr/EditToolBar.java | 4 +- .../fr/design/webattr/PageToolBarPane.java | 10 +- .../fr/design/webattr/PageWebSettingPane.java | 6 +- .../fr/design/webattr/ReportWebAttrPane.java | 10 +- .../com/fr/design/webattr/ToolBarButton.java | 4 +- .../fr/design/webattr/ViewToolBarPane.java | 10 +- .../fr/design/webattr/ViewWebSettingPane.java | 6 +- .../src/com/fr/design/webattr/WebCssPane.java | 6 +- .../src/com/fr/design/webattr/WebJsPane.java | 6 +- .../com/fr/design/webattr/WebSettingPane.java | 23 ++- .../fr/design/webattr/WidgetManagerPane.java | 13 +- .../fr/design/webattr/WriteToolBarPane.java | 10 +- .../design/webattr/WriteWebSettingPane.java | 6 +- .../fr/design/widget/WidgetConfigPane.java | 6 +- .../src/com/fr/design/widget/WidgetPane.java | 2 +- .../widget/ui/ParameterTreeComboBox.java | 13 +- .../com/fr/grid/selection/CellSelection.java | 6 +- .../design/actions/file/PreferencePane.java | 13 +- .../actions/server/ConnectionListAction.java | 156 ++++++++---------- .../actions/server/FunctionManagerAction.java | 16 +- .../actions/server/GlobalParameterAction.java | 15 +- .../actions/server/GlobalTableDataAction.java | 152 ++++++++--------- .../actions/server/ProcedureListAction.java | 15 +- .../src/com/fr/design/bbs/BBSLoginUtils.java | 25 ++- .../design/data/DesignTableDataManager.java | 16 +- .../fr/design/data/datapane/ChoosePane.java | 13 +- .../datapane/TableDataPaneController.java | 6 +- .../data/datapane/TableDataPaneListPane.java | 21 +-- .../data/datapane/TreeTableDataComboBox.java | 7 +- .../connect/ConnectionComboBoxPanel.java | 32 +--- .../datapane/connect/ConnectionListPane.java | 16 +- .../connect/ConnectionManagerPane.java | 6 +- .../datapane/connect/ConnectionShowPane.java | 6 +- .../tabledatapane/DecoratedTableDataPane.java | 7 +- .../tabledatapane/ProcedureDataPane.java | 4 +- .../tabledatapane/ProcedureListPane.java | 16 +- .../tabledatapane/ProcedureManagerPane.java | 18 +- .../tabledatapane/TableDataManagerPane.java | 18 +- .../tabledata/wrapper/TableDataFactory.java | 8 +- .../com/fr/design/extra/LoginWebBridge.java | 10 +- .../fr/design/extra/PluginFromStorePane.java | 6 +- .../fr/design/extra/PluginOperateUtils.java | 4 +- .../com/fr/design/extra/PluginUpdatePane.java | 6 +- .../com/fr/design/extra/PluginWebBridge.java | 11 +- .../fr/design/formula/FunctionConstants.java | 6 +- .../design/formula/FunctionManagerPane.java | 14 +- .../formula/VariableResolverAdapter.java | 7 +- .../com/fr/design/gui/core/WidgetOption.java | 2 +- .../fr/design/gui/ilist/TableViewList.java | 8 +- .../design/hyperlink/WebHyperNorthPane.java | 4 +- .../com/fr/design/javascript/EmailPane.java | 6 +- .../com/fr/design/mainframe/JTemplate.java | 9 - .../loghandler/DesignerLogHandler.java | 4 +- .../templateinfo/TemplateInfoCollector.java | 4 +- .../accessibles/AccessibleIconEditor.java | 12 -- .../widget/renderer/IconCellRenderer.java | 6 +- .../design/parameter/ParameterArrayPane.java | 8 +- .../parameter/ParameterManagerPane.java | 17 +- .../src/com/fr/design/web/CustomIconPane.java | 8 +- .../com/fr/design/widget/IconDefinePane.java | 11 +- designer_base/src/com/fr/env/RemoteEnv.java | 10 +- .../map/server/ChartMapEditorAction.java | 3 +- .../design/designer/creator/XNameWidget.java | 2 +- .../fr/design/mainframe/FormEditToolBar.java | 2 +- .../com/fr/design/mainframe/FormParaPane.java | 2 +- .../design/mainframe/FormParaWidgetPane.java | 2 +- .../design/mainframe/FormToolBarButton.java | 4 +- .../editors/NameWidgetComboboxEditor.java | 5 +- .../ui/designer/ParameterTreeComboBox.java | 13 +- 89 files changed, 463 insertions(+), 688 deletions(-) diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 63c38a042f..b7aa2e4a5b 100644 --- a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -5,25 +5,18 @@ package com.fr.design.actions.cell; */ import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.NameStyle; -import com.fr.design.actions.ElementCaseAction; +import com.fr.config.ServerConfig; import com.fr.design.actions.SelectionListenerAction; -import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.imenu.UIMenu; import com.fr.design.mainframe.CellElementPropertyPane; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; -import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; import com.fr.design.style.StylePane; import com.fr.general.Inter; -import com.fr.base.ConfigManagerProvider; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.Selection; import com.fr.stable.StringUtils; import com.fr.stable.pinyin.PinyinHelper; @@ -79,8 +72,7 @@ public class GlobalStyleMenuDef extends MenuDef { public void updateMenu() { UIMenu createdMenu = this.createJMenu(); createdMenu.removeAll(); - ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); - Iterator iterator = configManager.getStyleNameIterator(); + Iterator iterator = ServerConfig.getInstance().getStyleNameIterator(); while (iterator.hasNext()) { String name = (String) iterator.next(); NameStyle nameStyle = NameStyle.getInstance(name); diff --git a/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java b/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java index eea11810c6..46364c9584 100644 --- a/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportWebAttrAction.java @@ -3,10 +3,6 @@ */ package com.fr.design.actions.report; -import com.fr.base.ConfigManager; -import com.fr.base.ConfigManagerProvider; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.config.Configuration; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; @@ -50,7 +46,8 @@ public class ReportWebAttrAction extends JWorkBookAction { final ReportWebAttrPane reportWebAttrPane = new ReportWebAttrPane() { @Override public void complete() { - populate(wbTpl.getReportWebAttr()); + ReportWebConfig config = wbTpl.getReportWebAttr(); + populate((ReportWebConfig) config.clone()); } }; final BasicDialog dialog = reportWebAttrPane.showWindow( @@ -64,13 +61,6 @@ public class ReportWebAttrAction extends JWorkBookAction { @Override public void run() { wbTpl.setReportWebAttr(reportWebAttrPane.update()); - final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } jwb.fireTargetModified(); } diff --git a/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java b/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java index ab69866300..ad1aad61e0 100644 --- a/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java +++ b/designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java @@ -3,11 +3,8 @@ */ package com.fr.design.actions.server; -import com.fr.base.ConfigManager; -import com.fr.base.ConfigManagerProvider; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.config.Configuration; +import com.fr.config.ServerConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -40,11 +37,11 @@ public class ServerConfigManagerAction extends UpdateAction { * @param e 事件 */ public void actionPerformed(ActionEvent e) { - final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); + final ServerConfig config = ServerConfig.getInstance(); final EditReportServerParameterPane editReportServerParameterPane = new EditReportServerParameterPane() { @Override public void complete() { - populate(configManager); + populate((ServerConfig)config.clone()); } }; @@ -58,18 +55,12 @@ public class ServerConfigManagerAction extends UpdateAction { Configurations.update(new Worker() { @Override public void run() { - editReportServerParameterPane.update(configManager); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } + editReportServerParameterPane.update(config); } @Override public Class[] targets() { - return new Class[]{ReportWebConfig.class}; + return new Class[]{ReportWebConfig.class, ServerConfig.class}; } }); diff --git a/designer/src/com/fr/design/actions/server/StyleListAction.java b/designer/src/com/fr/design/actions/server/StyleListAction.java index f59aba9b93..39b2648a8e 100644 --- a/designer/src/com/fr/design/actions/server/StyleListAction.java +++ b/designer/src/com/fr/design/actions/server/StyleListAction.java @@ -1,9 +1,5 @@ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.config.Configuration; import com.fr.config.ServerConfig; import com.fr.design.actions.UpdateAction; @@ -47,14 +43,7 @@ public class StyleListAction extends UpdateAction { Configurations.update(new Worker() { @Override public void run() { - styleListPane.update(ConfigManager.getProviderInstance()); - //marks:保存数据 - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(ConfigManager.getProviderInstance()); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } + styleListPane.update(ServerConfig.getInstance()); } @Override @@ -66,7 +55,7 @@ public class StyleListAction extends UpdateAction { } }); - styleListPane.populate(ConfigManager.getProviderInstance()); + styleListPane.populate((ServerConfig) ServerConfig.getInstance().clone()); styleListDialog.setVisible(true); } diff --git a/designer/src/com/fr/design/actions/server/StyleManagerPane.java b/designer/src/com/fr/design/actions/server/StyleManagerPane.java index 5388c1d072..c1f23e79c6 100644 --- a/designer/src/com/fr/design/actions/server/StyleManagerPane.java +++ b/designer/src/com/fr/design/actions/server/StyleManagerPane.java @@ -1,18 +1,15 @@ package com.fr.design.actions.server; -import com.fr.base.FRContext; -import com.fr.base.ConfigManagerProvider; +import com.fr.config.ServerConfig; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.present.StyleArrayPane; import com.fr.general.Inter; -import com.fr.stable.project.ProjectConstants; import javax.swing.*; import java.awt.*; -import java.io.File; public class StyleManagerPane extends BasicPane { private UITextField StyleTextField; @@ -38,14 +35,15 @@ public class StyleManagerPane extends BasicPane { return Inter.getLocText("ServerM-Predefined_Styles"); } - public void populate(ConfigManagerProvider configManager) { - this.StyleTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + - ProjectConstants.RESOURCES_NAME + - File.separator + configManager.fileName()); + public void populate(ServerConfig configManager) { + //todo 原来界面上显示的xml路径 +// this.StyleTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + +// ProjectConstants.RESOURCES_NAME + +// File.separator + configManager.fileName()); this.styleArrayPane.populate(configManager); } - public void update(ConfigManagerProvider configManager) { + public void update(ServerConfig configManager) { this.styleArrayPane.update(configManager); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/server/WidgetManagerAction.java b/designer/src/com/fr/design/actions/server/WidgetManagerAction.java index a25c502b1a..51dde470cc 100644 --- a/designer/src/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer/src/com/fr/design/actions/server/WidgetManagerAction.java @@ -1,8 +1,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.config.Configuration; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -13,8 +11,6 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.design.webattr.WidgetManagerPane; import com.fr.form.ui.WidgetInfoConfig; -import com.fr.form.ui.WidgetManager; -import com.fr.form.ui.WidgetManagerProvider; import com.fr.general.Inter; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -36,11 +32,11 @@ public class WidgetManagerAction extends UpdateAction { */ public void actionPerformed(ActionEvent e) { final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final WidgetManagerProvider widgetManager = WidgetManager.getProviderInstance(); + final WidgetInfoConfig widgetManager = WidgetInfoConfig.getInstance(); final WidgetManagerPane widgetManagerPane = new WidgetManagerPane() { @Override public void complete() { - populate(widgetManager); + populate((WidgetInfoConfig)widgetManager.clone()); } }; @@ -51,15 +47,6 @@ public class WidgetManagerAction extends UpdateAction { @Override public void run() { widgetManagerPane.update(widgetManager); - - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(widgetManager); - //marks: 由于这个面板还改变权限相关的操作,所以这个时候还要操作权限配置 -// currentEnv.writeResource(FRContext.getPrivilegeManager()); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); if (model != null) { model.widgetConfigChanged(); diff --git a/designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java b/designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java index a941660aa1..a653cf6850 100644 --- a/designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java +++ b/designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java @@ -1,5 +1,5 @@ package com.fr.design.mainframe; -import com.fr.base.ConfigManager; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; @@ -101,7 +101,7 @@ public class ActiveKeyGenerator { HashMap para = new HashMap(); para.put("uuid", envManager.getUUID()); para.put("key", key); - para.put("username", ConfigManager.getProviderInstance().getBbsUsername()); + para.put("username", ServerConfig.getInstance().getBbsUsername()); HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para); if (timeout != -1) { hc.setTimeout(timeout); diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 23e4622e1d..29978d1579 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe; -import com.fr.base.ConfigManager; -import com.fr.base.ConfigManagerProvider; import com.fr.base.FRContext; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.beans.BasicBeanPane; @@ -24,7 +22,7 @@ import com.fr.report.web.Location; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebContent; import com.fr.stable.ArrayUtils; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -36,7 +34,7 @@ import java.util.List; * Date: 13-9-9 * Time: 下午4:58 */ -public class AuthorityToolBarPane extends BasicBeanPane implements AuthorityEditToolBarComponent { +public class AuthorityToolBarPane extends BasicBeanPane implements AuthorityEditToolBarComponent { private static final int SMALL_GAP = 13; private static final int GAP = 25; private static final int PRE_GAP = 9; @@ -195,7 +193,7 @@ public class AuthorityToolBarPane extends BasicBeanPane extends BasicBeanPane extends BasicBeanPane extends BasicBeanPane extends BasicBeanPane extends BasicBeanPane impleme */ public void refreshBeanElement() { defaultListModel.removeAllElements(); - if (ConfigManager.getProviderInstance().hasStyle()) { - Iterator iterato = ConfigManager.getProviderInstance().getStyleNameIterator(); + if (ServerConfig.getInstance().hasStyle()) { + Iterator iterato = ServerConfig.getInstance().getStyleNameIterator(); while (iterato.hasNext()) { String name = (String) iterato.next(); NameStyle nameStyle = NameStyle.getInstance(name); diff --git a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java index 6923e4fae1..59a5a95e3a 100644 --- a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java +++ b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java @@ -1,9 +1,9 @@ package com.fr.design.mainframe.errorinfo; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; import com.fr.base.io.IOFile; import com.fr.base.io.XMLReadHelper; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.general.FRLogLevel; import com.fr.general.FRLogManager; @@ -39,7 +39,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton { this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - this.username = ConfigManager.getProviderInstance().getBbsUsername(); + this.username = ServerConfig.getInstance().getBbsUsername(); this.uuid = envManager.getUUID(); this.activekey = envManager.getActivationKey(); } diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index cdb19d7e30..e0f669bd17 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -2,7 +2,6 @@ package com.fr.design.module; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; import com.fr.base.Formula; import com.fr.base.MultiFieldParameter; @@ -11,6 +10,7 @@ import com.fr.base.TempNameStyle; import com.fr.base.io.XMLEncryptUtils; import com.fr.base.process.ProcessOperator; import com.fr.base.remote.RemoteDeziConstants; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; @@ -395,8 +395,7 @@ public class DesignerModule extends DesignModule { public void actionPerformed(ActionEvent e) { try { for (int i = 0; i < namelist.size(); i++) { - ConfigManager.getProviderInstance().putStyle(namelist.get(i), Style.DEFAULT_STYLE); - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); + ServerConfig.getInstance().putStyle(namelist.get(i), Style.DEFAULT_STYLE); } } catch (Exception ex) { FRLogger.getLogger().error(ex.getMessage()); diff --git a/designer/src/com/fr/design/present/StyleArrayPane.java b/designer/src/com/fr/design/present/StyleArrayPane.java index 061107462e..b0525781b8 100644 --- a/designer/src/com/fr/design/present/StyleArrayPane.java +++ b/designer/src/com/fr/design/present/StyleArrayPane.java @@ -1,6 +1,7 @@ package com.fr.design.present; import com.fr.base.Style; +import com.fr.config.ServerConfig; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -11,7 +12,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.StylePane; import com.fr.general.Inter; import com.fr.general.NameObject; -import com.fr.base.ConfigManagerProvider; import com.fr.stable.Nameable; import java.util.ArrayList; @@ -64,7 +64,7 @@ public class StyleArrayPane extends JListControlPane { /** * Populate */ - public void populate(ConfigManagerProvider configManager) { + public void populate(ServerConfig configManager) { if (configManager == null) { return; } @@ -90,7 +90,7 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ConfigManagerProvider configManager) { + public void update(ServerConfig configManager) { configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... diff --git a/designer/src/com/fr/design/report/ReportStylePane.java b/designer/src/com/fr/design/report/ReportStylePane.java index b61cccb15d..2aba4cc865 100644 --- a/designer/src/com/fr/design/report/ReportStylePane.java +++ b/designer/src/com/fr/design/report/ReportStylePane.java @@ -1,6 +1,6 @@ package com.fr.design.report; -import com.fr.base.ConfigManager; +import com.fr.config.ServerConfig; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.style.StylePane; import com.fr.design.utils.gui.GUICoreUtils; @@ -35,8 +35,8 @@ public class ReportStylePane extends StylePane { if (ComparatorUtils.equals(name, "")) { return; } - if (ConfigManager.getProviderInstance().getStyle(name) == null) { - ConfigManager.getProviderInstance().putStyle(name, ReportStylePane.this.updateBean()); + if (ServerConfig.getInstance().getStyle(name) == null) { + ServerConfig.getInstance().putStyle(name, ReportStylePane.this.updateBean()); } else { JOptionPane.showMessageDialog(getParent(), Inter.getLocText("FR-Designer_This_Name_Has_Exsit") + "!", Inter.getLocText("FR-Designer_Warning"), JOptionPane.WARNING_MESSAGE); } diff --git a/designer/src/com/fr/design/report/WriteShortCutsPane.java b/designer/src/com/fr/design/report/WriteShortCutsPane.java index 19200322b9..8c101fda23 100644 --- a/designer/src/com/fr/design/report/WriteShortCutsPane.java +++ b/designer/src/com/fr/design/report/WriteShortCutsPane.java @@ -2,8 +2,8 @@ package com.fr.design.report; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -29,7 +29,7 @@ public class WriteShortCutsPane extends JPanel{ this.add(getFeatureNamePane()); this.add(getHintsPane()); - if(!ConfigManager.getProviderInstance().isWriteShortCuts()){ + if(!ServerConfig.getInstance().isWriteShortCuts()){ nextColString = "Enter"; nextRowString = "Tab"; switchColRow(); @@ -104,13 +104,8 @@ public class WriteShortCutsPane extends JPanel{ nextColString = nextRowString; nextRowString = temp; switchColRow(); - - ConfigManager.getProviderInstance().setWriteShortCuts(ComparatorUtils.equals(nextColString, "Tab")); - try { - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); - } catch (Exception e1) { - FRContext.getLogger().error(e1.getMessage()); - } + + ServerConfig.getInstance().setWriteShortCuts(ComparatorUtils.equals(nextColString, "Tab")); } }; diff --git a/designer/src/com/fr/design/webattr/CommonPane.java b/designer/src/com/fr/design/webattr/CommonPane.java index d6533e8ca3..22876dd832 100644 --- a/designer/src/com/fr/design/webattr/CommonPane.java +++ b/designer/src/com/fr/design/webattr/CommonPane.java @@ -17,7 +17,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.editor.editor.LongEditor; import com.fr.general.Inter; import com.fr.stable.StringUtils; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; public class CommonPane extends JPanel { private UITextField titleTextField; @@ -53,7 +53,7 @@ public class CommonPane extends JPanel { BorderLayout.CENTER); } - public void populate(ReportWebAttr reportWebAttr) { + public void populate(ReportWebConfig reportWebAttr) { if (reportWebAttr.getTitle() != null && reportWebAttr.getTitle().length() > 0) { this.titleTextField.setText(reportWebAttr.getTitle()); } @@ -61,7 +61,7 @@ public class CommonPane extends JPanel { this.cacheValidateTimeEditor.setValue(Long.valueOf(reportWebAttr.getCacheValidateTime())); } - public void update(ReportWebAttr reportWebAttr) { + public void update(ReportWebConfig reportWebAttr) { if (!StringUtils.isEmpty(this.titleTextField.getText())) { reportWebAttr.setTitle(this.titleTextField.getText()); } else { diff --git a/designer/src/com/fr/design/webattr/EditReportServerParameterPane.java b/designer/src/com/fr/design/webattr/EditReportServerParameterPane.java index 6a3fd219a1..49a004d04b 100644 --- a/designer/src/com/fr/design/webattr/EditReportServerParameterPane.java +++ b/designer/src/com/fr/design/webattr/EditReportServerParameterPane.java @@ -3,9 +3,8 @@ */ package com.fr.design.webattr; -import com.fr.base.ConfigManager; -import com.fr.base.ConfigManagerProvider; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; @@ -13,12 +12,10 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; -import com.fr.stable.project.ProjectConstants; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; -import java.io.File; /** * Edit Report Server Parameter. @@ -33,7 +30,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane { //TODO 表单 // private FormToolBarPane formPane; private WriteToolBarPane writePane; - private ReportWebAttr webAttr; + private ReportWebConfig webAttr; private WebCssPane cssPane; @@ -75,12 +72,13 @@ public class EditReportServerParameterPane extends LoadingBasicPane { return Inter.getLocText("ReportServerP-Report_server_parameter"); } - public void populate(ConfigManagerProvider reportServerConfigManager) { - this.configFileTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + - ProjectConstants.RESOURCES_NAME + - File.separator + ConfigManager.getProviderInstance().fileName()); + public void populate(ServerConfig reportServerConfig) { + //todo 原来界面上显示的xml路径 +// this.configFileTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + +// ProjectConstants.RESOURCES_NAME + +// File.separator + reportServerConfig.fileName()); - webAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + webAttr = (ReportWebConfig) ReportWebConfig.getInstance().clone(); if (webAttr != null) { pagePane.populateBean(webAttr.getWebPage()); viewPane.populateBean(webAttr.getWebView()); @@ -90,18 +88,14 @@ public class EditReportServerParameterPane extends LoadingBasicPane { jsPane.populate(webAttr); } - this.errorTemplatePane.populateBean(reportServerConfigManager.getErrorTemplate()); + this.errorTemplatePane.populateBean(reportServerConfig.getErrorTemplate()); } /** * Update. */ - public void update(ConfigManagerProvider reportServerConfigManager) { - ReportWebAttr webAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (webAttr == null) { - webAttr = new ReportWebAttr(); - reportServerConfigManager.putGlobalAttribute(ReportWebAttr.class, webAttr); - } + public void update(ServerConfig reportServerConfig) { + ReportWebConfig webAttr = ReportWebConfig.getInstance(); webAttr.setWebPage(pagePane.updateBean()); webAttr.setWebView(viewPane.updateBean()); webAttr.setWebWrite(writePane.updateBean()); @@ -109,7 +103,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane { cssPane.update(webAttr); jsPane.update(webAttr); - - reportServerConfigManager.setErrorTemplate(this.errorTemplatePane.updateBean()); + + reportServerConfig.setErrorTemplate(this.errorTemplatePane.updateBean()); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/EditToolBar.java b/designer/src/com/fr/design/webattr/EditToolBar.java index 938fd4509b..a1cf442d11 100644 --- a/designer/src/com/fr/design/webattr/EditToolBar.java +++ b/designer/src/com/fr/design/webattr/EditToolBar.java @@ -27,7 +27,7 @@ import com.fr.design.widget.IconDefinePane; import com.fr.form.ui.Button; import com.fr.form.ui.CustomToolBarButton; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Background; import com.fr.general.Inter; import com.fr.report.web.button.Export; @@ -201,7 +201,7 @@ public class EditToolBar extends BasicPane { if (widget instanceof Button) { String iconname = ((Button) widget).getIconName(); if (StringUtils.isNotBlank(iconname)) { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname); + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); toolBarButton.setIcon(new ImageIcon(iimage)); } } diff --git a/designer/src/com/fr/design/webattr/PageToolBarPane.java b/designer/src/com/fr/design/webattr/PageToolBarPane.java index a36b90ad09..d17ecc1bbe 100644 --- a/designer/src/com/fr/design/webattr/PageToolBarPane.java +++ b/designer/src/com/fr/design/webattr/PageToolBarPane.java @@ -1,6 +1,5 @@ package com.fr.design.webattr; -import com.fr.base.ConfigManager; import com.fr.config.Configuration; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -19,7 +18,6 @@ import com.fr.report.web.WebContent; import com.fr.report.web.WebPage; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebConfig; import javax.swing.*; @@ -168,7 +166,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane { @Override public void editServerToolBarPane() { final PageToolBarPane serverPageToolBarPane = new PageToolBarPane(); - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); if (reportWebAttr != null) { serverPageToolBarPane.populateBean(reportWebAttr.getWebPage()); } @@ -180,11 +178,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane { Configurations.update(new Worker() { @Override public void run() { - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); reportWebAttr.setWebPage(serverPageToolBarPane.updateBean()); } diff --git a/designer/src/com/fr/design/webattr/PageWebSettingPane.java b/designer/src/com/fr/design/webattr/PageWebSettingPane.java index ee415da68c..c563a25f17 100644 --- a/designer/src/com/fr/design/webattr/PageWebSettingPane.java +++ b/designer/src/com/fr/design/webattr/PageWebSettingPane.java @@ -21,7 +21,7 @@ import com.fr.design.gui.core.WidgetOption; import com.fr.general.Inter; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebPage; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; public class PageWebSettingPane extends WebSettingPane { private UIRadioButton centerRadioButton; @@ -119,7 +119,7 @@ public class PageWebSettingPane extends WebSettingPane { } @Override - protected WebPage getWebContent(ReportWebAttr reportWebAttr) { + protected WebPage getWebContent(ReportWebConfig reportWebAttr) { return reportWebAttr == null ? null :reportWebAttr.getWebPage(); } @@ -129,7 +129,7 @@ public class PageWebSettingPane extends WebSettingPane { } @Override - protected void setWebContent(ReportWebAttr reportWebAttr,WebPage webContent) { + protected void setWebContent(ReportWebConfig reportWebAttr,WebPage webContent) { reportWebAttr.setWebPage(webContent); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/ReportWebAttrPane.java b/designer/src/com/fr/design/webattr/ReportWebAttrPane.java index 8577e0e3e4..244d74acc6 100644 --- a/designer/src/com/fr/design/webattr/ReportWebAttrPane.java +++ b/designer/src/com/fr/design/webattr/ReportWebAttrPane.java @@ -9,7 +9,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundPane; import com.fr.design.style.background.BackgroundPane4Browser; import com.fr.general.Inter; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -18,7 +18,7 @@ import java.awt.*; * ReportWebAttr Dialog */ public class ReportWebAttrPane extends LoadingBasicPane { - private ReportWebAttr reportWebAttr; + private ReportWebConfig reportWebAttr; private UITabbedPane tabbedPane; private CommonPane commonPane; @@ -60,9 +60,9 @@ public class ReportWebAttrPane extends LoadingBasicPane { return Inter.getLocText("FR-Designer_Template_Web_Attributes"); } - public void populate(ReportWebAttr reportWebAttr) { + public void populate(ReportWebConfig reportWebAttr) { if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); + reportWebAttr = ReportWebConfig.getInstance(); } this.reportWebAttr = reportWebAttr; @@ -79,7 +79,7 @@ public class ReportWebAttrPane extends LoadingBasicPane { } - public ReportWebAttr update() { + public ReportWebConfig update() { reportWebAttr.setPrinter(this.serverPrintPane.update()); pageWeb.update(reportWebAttr); writeWeb.update(reportWebAttr); diff --git a/designer/src/com/fr/design/webattr/ToolBarButton.java b/designer/src/com/fr/design/webattr/ToolBarButton.java index 817bb20fd2..58590f2ccc 100644 --- a/designer/src/com/fr/design/webattr/ToolBarButton.java +++ b/designer/src/com/fr/design/webattr/ToolBarButton.java @@ -7,7 +7,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.stable.StringUtils; import javax.swing.*; @@ -30,7 +30,7 @@ public class ToolBarButton extends UIButton implements MouseListener { com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget; String iconName = button.getIconName(); if (StringUtils.isNotEmpty(iconName)) { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconName); + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); if (iimage != null) { setIcon(new ImageIcon(iimage)); } diff --git a/designer/src/com/fr/design/webattr/ViewToolBarPane.java b/designer/src/com/fr/design/webattr/ViewToolBarPane.java index bce10196cd..1982d50c67 100644 --- a/designer/src/com/fr/design/webattr/ViewToolBarPane.java +++ b/designer/src/com/fr/design/webattr/ViewToolBarPane.java @@ -1,6 +1,5 @@ package com.fr.design.webattr; -import com.fr.base.ConfigManager; import com.fr.config.Configuration; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -18,7 +17,6 @@ import com.fr.report.web.WebContent; import com.fr.report.web.WebView; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebConfig; import javax.swing.*; @@ -138,7 +136,7 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { @Override public void editServerToolBarPane() { final ViewToolBarPane serverPageToolBarPane = new ViewToolBarPane(); - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); if (reportWebAttr != null) { serverPageToolBarPane.populateBean(reportWebAttr.getWebView()); } @@ -150,11 +148,7 @@ public class ViewToolBarPane extends AbstractEditToolBarPane { Configurations.update(new Worker() { @Override public void run() { - ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); reportWebAttr.setWebView(serverPageToolBarPane.updateBean()); } diff --git a/designer/src/com/fr/design/webattr/ViewWebSettingPane.java b/designer/src/com/fr/design/webattr/ViewWebSettingPane.java index c18e22ca41..17d42f7fe8 100644 --- a/designer/src/com/fr/design/webattr/ViewWebSettingPane.java +++ b/designer/src/com/fr/design/webattr/ViewWebSettingPane.java @@ -8,7 +8,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebView; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -73,7 +73,7 @@ public class ViewWebSettingPane extends WebSettingPane { } @Override - protected WebView getWebContent(ReportWebAttr reportWebAttr) { + protected WebView getWebContent(ReportWebConfig reportWebAttr) { return reportWebAttr == null ? null : reportWebAttr.getWebView(); } @@ -83,7 +83,7 @@ public class ViewWebSettingPane extends WebSettingPane { } @Override - protected void setWebContent(ReportWebAttr reportWebAttr, WebView webContent) { + protected void setWebContent(ReportWebConfig reportWebAttr, WebView webContent) { reportWebAttr.setWebView(webContent); } @Override diff --git a/designer/src/com/fr/design/webattr/WebCssPane.java b/designer/src/com/fr/design/webattr/WebCssPane.java index 8c3851e3b5..916ef45148 100644 --- a/designer/src/com/fr/design/webattr/WebCssPane.java +++ b/designer/src/com/fr/design/webattr/WebCssPane.java @@ -24,7 +24,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.general.Inter; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; public class WebCssPane extends BasicPane { private UITextField localText; @@ -98,7 +98,7 @@ public class WebCssPane extends BasicPane { return Inter.getLocText("ReportServerP-Import_Css"); } - public void populate(ReportWebAttr reportWebAttr) { + public void populate(ReportWebConfig reportWebAttr) { if (reportWebAttr == null) { centerPane.populateBean(new ArrayList()); return; @@ -113,7 +113,7 @@ public class WebCssPane extends BasicPane { centerPane.populateBean(list); } - public void update(ReportWebAttr reportWebAttr) { + public void update(ReportWebConfig reportWebAttr) { List valueList = centerPane.updateBean(); reportWebAttr.clearCSSImportList(); for (int i = 0; i < valueList.size(); i++) { diff --git a/designer/src/com/fr/design/webattr/WebJsPane.java b/designer/src/com/fr/design/webattr/WebJsPane.java index 93208ad8e3..bea7804ba0 100644 --- a/designer/src/com/fr/design/webattr/WebJsPane.java +++ b/designer/src/com/fr/design/webattr/WebJsPane.java @@ -33,7 +33,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.general.Inter; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; public class WebJsPane extends BasicPane { private UITextField localText; @@ -260,7 +260,7 @@ public class WebJsPane extends BasicPane { chooseFile.setEnabled(false); } - public void populate(ReportWebAttr reportWebAttr) { + public void populate(ReportWebConfig reportWebAttr) { if (reportWebAttr == null) { editingPane.populateBean(new ArrayList()); return; @@ -274,7 +274,7 @@ public class WebJsPane extends BasicPane { editingPane.populateBean(list); } - public void update(ReportWebAttr reportWebAttr) { + public void update(ReportWebConfig reportWebAttr) { List valueList = editingPane.updateBean(); reportWebAttr.clearJSImportList(); for (int i = 0; i < valueList.size(); i++) { diff --git a/designer/src/com/fr/design/webattr/WebSettingPane.java b/designer/src/com/fr/design/webattr/WebSettingPane.java index d4bb3485cf..fe151ea5b5 100644 --- a/designer/src/com/fr/design/webattr/WebSettingPane.java +++ b/designer/src/com/fr/design/webattr/WebSettingPane.java @@ -1,6 +1,5 @@ package com.fr.design.webattr; -import com.fr.base.ConfigManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.icombobox.UIComboBox; @@ -13,9 +12,8 @@ import com.fr.form.event.Listener; import com.fr.general.Inter; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebContent; -import com.fr.base.ConfigManagerProvider; import com.fr.stable.StringUtils; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -24,7 +22,7 @@ import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; -public abstract class WebSettingPane extends BasicBeanPane { +public abstract class WebSettingPane extends BasicBeanPane { private static final String[] CHOOSEITEM = new String[] { Inter.getLocText("FR-Designer_I_Want_To_Set_Single"), Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings") @@ -119,7 +117,7 @@ public abstract class WebSettingPane extends BasicBeanPane protected abstract String[] getEventNames(); @Override - public void populateBean(ReportWebAttr reportWebAttr) { + public void populateBean(ReportWebConfig reportWebAttr) { if (reportWebAttr == null || this.getWebContent(reportWebAttr) == null) {// 如果是空值就说明采用服务器配置了 choseComboBox.removeItemListener(itemListener); choseComboBox.setSelectedIndex(SERVER_SET); @@ -147,7 +145,7 @@ public abstract class WebSettingPane extends BasicBeanPane } - public void update(ReportWebAttr reportWebAttr) { + public void update(ReportWebConfig reportWebAttr) { if (this.choseComboBox.getSelectedIndex() == SERVER_SET) { setWebContent(reportWebAttr, null); reportWebAttr = is_Null_ReportWebAttr(reportWebAttr) ? null : reportWebAttr; @@ -157,11 +155,11 @@ public abstract class WebSettingPane extends BasicBeanPane } @Override - public ReportWebAttr updateBean() { + public ReportWebConfig updateBean() { return null; } - private ReportWebAttr TemplateupdateBean(ReportWebAttr reportWebAttr) { + private ReportWebConfig TemplateupdateBean(ReportWebConfig reportWebAttr) { T webContent = updateSubWebSettingBean(); ToolBarManager[] toolBarManagers = dragToolBarPane.updateBean(); webContent.setToolBarManagers(toolBarManagers); @@ -173,13 +171,13 @@ public abstract class WebSettingPane extends BasicBeanPane return reportWebAttr; } - protected abstract T getWebContent(ReportWebAttr reportWebAttr); + protected abstract T getWebContent(ReportWebConfig reportWebAttr); protected abstract void populateSubWebSettingrBean(T ob); protected abstract T updateSubWebSettingBean(); - protected abstract void setWebContent(ReportWebAttr reportWebAttr, T ob); + protected abstract void setWebContent(ReportWebConfig reportWebAttr, T ob); protected abstract WidgetOption[] getToolBarInstance(); @@ -191,8 +189,7 @@ public abstract class WebSettingPane extends BasicBeanPane } private void populateServerSettings() { - ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); - ReportWebAttr reportWebAttr = ((ReportWebAttr)configManager.getGlobalAttribute(ReportWebAttr.class)); + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); T webContent = this.getWebContent(reportWebAttr); if(webContent == null){ return; @@ -217,7 +214,7 @@ public abstract class WebSettingPane extends BasicBeanPane * * @return 模板web属性书否为空 */ - public static boolean is_Null_ReportWebAttr(ReportWebAttr reportWebAttr) { + public static boolean is_Null_ReportWebAttr(ReportWebConfig reportWebAttr) { if (reportWebAttr == null) { return true; } diff --git a/designer/src/com/fr/design/webattr/WidgetManagerPane.java b/designer/src/com/fr/design/webattr/WidgetManagerPane.java index 21f57cc102..fccfdb583b 100644 --- a/designer/src/com/fr/design/webattr/WidgetManagerPane.java +++ b/designer/src/com/fr/design/webattr/WidgetManagerPane.java @@ -6,7 +6,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.WidgetConfigPane; -import com.fr.form.ui.WidgetManagerProvider; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Inter; import com.fr.stable.project.ProjectConstants; @@ -40,14 +40,15 @@ public class WidgetManagerPane extends LoadingBasicPane { return Inter.getLocText("ServerM-Widget_Manager"); } - public void populate(WidgetManagerProvider widgetManager) { - this.widgetTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + - ProjectConstants.RESOURCES_NAME + - File.separator + widgetManager.fileName()); + public void populate(WidgetInfoConfig widgetManager) { + //todo 原来界面上显示的xml路径 +// this.widgetTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + +// ProjectConstants.RESOURCES_NAME + +// File.separator + widgetManager.fileName()); this.widgetConfigPane.populate(widgetManager); } - public void update(WidgetManagerProvider widgetManager) { + public void update(WidgetInfoConfig widgetManager) { this.widgetConfigPane.update(widgetManager); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/WriteToolBarPane.java b/designer/src/com/fr/design/webattr/WriteToolBarPane.java index 37bd02b1bd..933f3934b4 100644 --- a/designer/src/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer/src/com/fr/design/webattr/WriteToolBarPane.java @@ -1,7 +1,6 @@ package com.fr.design.webattr; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.config.Configuration; import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.BasicDialog; @@ -23,7 +22,6 @@ import com.fr.report.web.WebWrite; import com.fr.stable.Constants; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; -import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebConfig; import javax.swing.*; @@ -255,7 +253,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { @Override public void editServerToolBarPane() { final WriteToolBarPane serverPageToolBarPane = new WriteToolBarPane(); - ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); if (reportWebAttr != null) { serverPageToolBarPane.populateBean(reportWebAttr.getWebWrite()); } @@ -267,11 +265,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { Configurations.update(new Worker() { @Override public void run() { - ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); - if (reportWebAttr == null) { - reportWebAttr = new ReportWebAttr(); - ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); - } + ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean()); } diff --git a/designer/src/com/fr/design/webattr/WriteWebSettingPane.java b/designer/src/com/fr/design/webattr/WriteWebSettingPane.java index 92b26b0d59..36dd4b50c7 100644 --- a/designer/src/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer/src/com/fr/design/webattr/WriteWebSettingPane.java @@ -13,7 +13,7 @@ import com.fr.general.Inter; import com.fr.report.web.ToolBarManager; import com.fr.report.web.WebWrite; import com.fr.stable.Constants; -import com.fr.web.attr.ReportWebAttr; +import com.fr.web.attr.ReportWebConfig; import javax.swing.*; import java.awt.*; @@ -180,7 +180,7 @@ public class WriteWebSettingPane extends WebSettingPane { } @Override - protected WebWrite getWebContent(ReportWebAttr reportWebAttr) { + protected WebWrite getWebContent(ReportWebConfig reportWebAttr) { return reportWebAttr == null ? null : reportWebAttr.getWebWrite(); } @@ -190,7 +190,7 @@ public class WriteWebSettingPane extends WebSettingPane { } @Override - protected void setWebContent(ReportWebAttr reportWebAttr, WebWrite webContent) { + protected void setWebContent(ReportWebConfig reportWebAttr, WebWrite webContent) { reportWebAttr.setWebWrite(webContent); } diff --git a/designer/src/com/fr/design/widget/WidgetConfigPane.java b/designer/src/com/fr/design/widget/WidgetConfigPane.java index 78088920f2..88ed923f79 100644 --- a/designer/src/com/fr/design/widget/WidgetConfigPane.java +++ b/designer/src/com/fr/design/widget/WidgetConfigPane.java @@ -6,7 +6,7 @@ import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetConstants; import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.WidgetConfig; -import com.fr.form.ui.WidgetManagerProvider; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.NameObject; import com.fr.stable.Nameable; @@ -36,7 +36,7 @@ public class WidgetConfigPane extends JListControlPane { return "config"; } - public void populate(WidgetManagerProvider widgetManager){ + public void populate(WidgetInfoConfig widgetManager){ Iterator nameIt = widgetManager.getWidgetConfigNameIterator(); List nameObjectList = new ArrayList(); while (nameIt.hasNext()) { @@ -46,7 +46,7 @@ public class WidgetConfigPane extends JListControlPane { this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } - public void update(WidgetManagerProvider widgetManager){ + public void update(WidgetInfoConfig widgetManager){ Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); diff --git a/designer/src/com/fr/design/widget/WidgetPane.java b/designer/src/com/fr/design/widget/WidgetPane.java index d8e816d80d..41a8b291ca 100644 --- a/designer/src/com/fr/design/widget/WidgetPane.java +++ b/designer/src/com/fr/design/widget/WidgetPane.java @@ -225,7 +225,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener for (int i = 0, l = reportWidgetInstance.length; i < l; i++) { items.add(new Item(reportWidgetInstance[i].optionName(), i)); } - WidgetManagerProvider manager = WidgetManager.getProviderInstance(); + WidgetInfoConfig manager = WidgetInfoConfig.getInstance(); java.util.Iterator nameIt = manager.getWidgetConfigNameIterator(); if (userDefined && nameIt.hasNext()) { items.add(item); diff --git a/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java b/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java index 4bbdc301f7..2c80b8e461 100644 --- a/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java +++ b/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java @@ -1,15 +1,14 @@ package com.fr.design.widget.ui; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.Parameter; import com.fr.base.TableData; +import com.fr.config.ServerConfig; 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.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.script.Calculator; @@ -155,17 +154,17 @@ public class ParameterTreeComboBox extends FRTreeComboBox { } // 全局参数 - parameters = ConfigManager.getProviderInstance().getGlobal_Parameters(); + parameters = ServerConfig.getInstance().getGlobeParameters(); if (!ArrayUtils.isEmpty(parameters)) { groupList.add(new ParameterGroup(Inter.getLocText("M_Server-Global_Parameters"), parameters)); } // 全局数据源参数 parameters = new Parameter[0]; Calculator c = Calculator.createCalculator(); - DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - Iterator nameIt = datasourceManager.getTableDataNameIterator(); + TableDataConfig tableDataConfig = TableDataConfig.getInstance(); + Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); while (nameIt.hasNext()) { - TableData tableData = datasourceManager.getTableData(nameIt.next()); + TableData tableData = tableDataConfig.getTableData(nameIt.next()); ParameterProvider[] ps = tableData.getParameters(c); if (!ArrayUtils.isEmpty(ps)) { parameters = (Parameter[])ArrayUtils.addAll(parameters, ps); diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index c501efd265..93a92c6f31 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -2,10 +2,10 @@ package com.fr.grid.selection; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.NameStyle; import com.fr.base.Utils; import com.fr.cache.list.IntList; +import com.fr.config.ServerConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellExpandAttrAction; @@ -456,10 +456,10 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); // richer:add global style menu popup.add(new CellExpandAttrAction().createMenuItem()); - if (!ConfigManager.getProviderInstance().hasStyle()) { + if (!ServerConfig.getInstance().hasStyle()) { UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName()); styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); - Iterator iterato = ConfigManager.getProviderInstance().getStyleNameIterator(); + Iterator iterato = ServerConfig.getInstance().getStyleNameIterator(); while (iterato.hasNext()) { String name = (String) iterato.next(); name = GlobalStyleMenuDef.judgeChina(name); diff --git a/designer_base/src/com/fr/design/actions/file/PreferencePane.java b/designer_base/src/com/fr/design/actions/file/PreferencePane.java index d32b110d16..7cb9e7ed93 100644 --- a/designer_base/src/com/fr/design/actions/file/PreferencePane.java +++ b/designer_base/src/com/fr/design/actions/file/PreferencePane.java @@ -1,8 +1,8 @@ package com.fr.design.actions.file; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicDialog; @@ -371,7 +371,7 @@ public class PreferencePane extends BasicPane { logLevelPane.add(logLevelComboBox); logLevelComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigManager.getProviderInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); + ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); } }); } @@ -551,7 +551,7 @@ public class PreferencePane extends BasicPane { this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); - this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(ConfigManager.getProviderInstance().getServerLogLevel())); + this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(ServerConfig.getInstance().getServerLogLevel())); this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); designerEnvLanguageIndex = designerEnvManager.getLanguage(); @@ -631,12 +631,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); } - ConfigManager.getProviderInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); - try { - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage()); - } + ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); } diff --git a/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java b/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java index 4048033380..bad26b7709 100644 --- a/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer_base/src/com/fr/design/actions/server/ConnectionListAction.java @@ -1,11 +1,7 @@ package com.fr.design.actions.server; -import com.fr.base.Env; -import com.fr.base.FRContext; -import com.fr.base.ModifiedTable; + import com.fr.config.Configuration; -import com.fr.data.impl.Connection; -import com.fr.dav.LocalEnv; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.data.datapane.connect.ConnectionShowPane; @@ -16,16 +12,15 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.file.ConnectionConfig; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.locale.InterProviderFactory; +import com.fr.stable.ListMap; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; import javax.swing.*; import java.awt.event.ActionEvent; -import java.util.HashMap; /** * DatasourceList Action @@ -64,15 +59,14 @@ public class ConnectionListAction extends UpdateAction { */ public void actionPerformed(ActionEvent evt) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - final DatasourceManager backupManager = datasourceManager.getBackUpManager(); + final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { public void complete() { populate(datasourceManager); } protected void renameConnection(String oldName, String newName) { - datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); + datasourceManager.renameConnection(oldName, newName); } }; final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); @@ -85,12 +79,11 @@ public class ConnectionListAction extends UpdateAction { databaseListDialog.setDoOKSucceed(false); return; } - if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { + if (!doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog)) { //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 return; } - // marks:保存数据 - writeFile(datasourceManager); + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); } @Override @@ -100,103 +93,92 @@ public class ConnectionListAction extends UpdateAction { }); } - - public void doCancel() { - Configurations.update(new Worker() { - @Override - public void run() { - datasourceManager.synchronizedWithServer(); - } - - @Override - public Class[] targets() { - return new Class[]{ConnectionConfig.class}; - } - }); - } }); databaseListDialog.setVisible(true); } - /** - * @param datasourceManager - */ - public static void writeFile(DatasourceManagerProvider datasourceManager) { - Env currentEnv = FRContext.getCurrentEnv(); - try { - boolean isSuccess = currentEnv.writeResource(datasourceManager); - if (!isSuccess) { - throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); - } - } catch (Exception e) { - throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); - } - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); - } - /** * 更新datasourceManager * * @param datasourceManager datasource管理对象 - * @param backupManager datasource管理对象备份 * @param connectionShowPane datasource面板 * @param databaseListDialog datasource管理对话框 * @return boolean 是否更新成功 */ - public static boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager - backupManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) { - connectionShowPane.update(datasourceManager); - HashMap modifyDetails = datasourceManager.getConnectionModifyDetails(); - modifyDetails.clear(); - Env currentEnv = FRContext.getCurrentEnv(); - ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID()); + public static boolean doWithDatasourceManager(ConnectionConfig datasourceManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) { +// HashMap modifyDetails = datasourceManager.getConnectionModifyDetails(); +// modifyDetails.clear(); +// Env currentEnv = FRContext.getCurrentEnv(); +// ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID()); boolean isFailed = false; - if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { - //如果是本地,并且有远程用户时则更新自己的修改表 - datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); - } else { - if (!currentEnv.isSupportLocalFileOperate()) { - //如果是远程,则去取服务器的最新的修改表,检查有没有冲突 - ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION); - if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { - //有冲突,进行提示 - String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.YES_OPTION) { - //点击是,进行相应刷新去冲突 - datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION); - //要是有重命名冲突的,则对详细的修改表先进行修改 - datasourceManager.doWithConnectionConflict(localModifiedTable); - localModifiedTable.removeConfilct(); - modifyDetails.clear(); - //更新面板 - connectionShowPane.populate(datasourceManager); - } else { - //更新失败,继续停留页面 - isFailed = true; - } - - } - } - } +// if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { +// //如果是本地,并且有远程用户时则更新自己的修改表 +// datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); +// } else { +// if (!currentEnv.isSupportLocalFileOperate()) { +// //如果是远程,则去取服务器的最新的修改表,检查有没有冲突 +// ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION); +// if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { +// //有冲突,进行提示 +// String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); +// int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); +// if (returnVal == JOptionPane.YES_OPTION) { +// //点击是,进行相应刷新去冲突 +// datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION); +// //要是有重命名冲突的,则对详细的修改表先进行修改 +// datasourceManager.doWithConnectionConflict(localModifiedTable); +// localModifiedTable.removeConfilct(); +// modifyDetails.clear(); +// //更新面板 +// connectionShowPane.populate(datasourceManager); +// } else { +// //更新失败,继续停留页面 +// isFailed = true; +// } +// +// } +// } +// } //存在请重命名则不能更新 - int index = datasourceManager.isConnectionMapContainsRename(); + int index = isConnectionMapContainsRename(datasourceManager); if (index != -1) { isFailed = true; connectionShowPane.setSelectedIndex(index); } databaseListDialog.setDoOKSucceed(!isFailed); - //如果修改成功,则去远程端增量修改修改表 - if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { - currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION); - localModifiedTable.clear(); - modifyDetails.clear(); - } +// //如果修改成功,则去远程端增量修改修改表 +// if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { +// currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION); +// localModifiedTable.clear(); +// modifyDetails.clear(); +// } return !isFailed; } + /** + * 是否包含重命名key + * + * @return 包含则返回序列 ,若返回-1则说明不包含重命名key + */ + public static int isConnectionMapContainsRename(ConnectionConfig datasourceManager) { + ListMap tableDataMap = (ListMap) datasourceManager.getConnections(); + String rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + "!"; + if (tableDataMap.containsKey(rename)) { + return tableDataMap.indexOf(rename); + } + //todo 这边同上面和远程修改数据集属性有关先屏蔽 +// for (int i = tableDataRenameIndex; i >= 1; i--) { +// rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + i + "!"; +// if (nameTableDataMap.map.containsKey(rename)) { +// return nameTableDataMap.map.indexOf(rename); +// } +// } + return -1; + } + + public void update() { this.setEnabled(true); } diff --git a/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java b/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java index 8f8853baa1..05f4760014 100644 --- a/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java @@ -3,9 +3,7 @@ */ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; -import com.fr.base.Env; -import com.fr.base.FRContext; + import com.fr.config.Configuration; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -14,8 +12,6 @@ import com.fr.design.formula.FunctionManagerPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.file.FunctionConfig; -import com.fr.file.FunctionManager; -import com.fr.file.FunctionManagerProvider; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.transaction.Configurations; @@ -46,19 +42,13 @@ public class FunctionManagerAction extends UpdateAction { BasicDialog functionManagerDialog = functionManagerPane.showWindow( DesignerContext.getDesignerFrame(),null); - final FunctionManagerProvider functionManager = FunctionManager.getProviderInstance(); + final FunctionConfig functionManager = FunctionConfig.getInstance(); functionManagerDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { Configurations.update(new Worker() { @Override public void run() { functionManagerPane.update(functionManager); - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(functionManager); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } } @Override @@ -69,7 +59,7 @@ public class FunctionManagerAction extends UpdateAction { } }); - functionManagerPane.populate(functionManager); + functionManagerPane.populate((FunctionConfig) functionManager.clone()); functionManagerDialog.setVisible(true); } diff --git a/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java b/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java index 198d817777..cb5dc33756 100644 --- a/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java +++ b/designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java @@ -4,9 +4,6 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.config.Configuration; import com.fr.config.ServerConfig; import com.fr.design.DesignModelAdapter; @@ -18,7 +15,6 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.design.parameter.ParameterManagerPane; import com.fr.general.Inter; -import com.fr.base.ConfigManagerProvider; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -49,9 +45,9 @@ public class GlobalParameterAction extends UpdateAction { final BasicDialog parameterManagerDialog = parameterManagerPane.showWindow(designerFrame); //marks:读取服务器配置信息 - final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); + final ServerConfig configManager = ServerConfig.getInstance(); - parameterManagerPane.populate(configManager); + parameterManagerPane.populate((ServerConfig) configManager.clone()); parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { public void doOk() { Configurations.update(new Worker() { @@ -59,13 +55,6 @@ public class GlobalParameterAction extends UpdateAction { public void run() { //apply new parameter list. parameterManagerPane.update(configManager); - //marks:保存数据 - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(configManager); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); if (model != null) { model.parameterChanged(); diff --git a/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java b/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java index 3bdef5f4f1..a103af680f 100644 --- a/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java @@ -3,9 +3,8 @@ */ package com.fr.design.actions.server; -import com.fr.base.*; +import com.fr.base.BaseUtils; import com.fr.config.Configuration; -import com.fr.dav.LocalEnv; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -17,10 +16,11 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.general.Inter; +import com.fr.locale.InterProviderFactory; +import com.fr.stable.ListMap; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -65,23 +65,22 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS */ public void actionPerformed(ActionEvent evt) { final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - final DatasourceManager backupManager = datasourceManager.getBackUpManager(); + final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { - populate(datasourceManager); + populate((TableDataConfig) tableDataConfig.clone()); } protected void renameConnection(final String oldName, final String newName) { Configurations.update(new Worker() { @Override public void run() { - datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); + tableDataConfig.renameTableData(oldName, newName); } @Override public Class[] targets() { - return new Class[]{DatasourceManager.class}; + return new Class[]{TableDataConfig.class, ProcedureConfig.class}; } }); } @@ -101,13 +100,11 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS } DesignTableDataManager.clearGlobalDs(); - globalTableDataPane.update(datasourceManager); - if (!doWithDatasourceManager(datasourceManager, backupManager, globalTableDataPane, globalTableDataDialog)) { + globalTableDataPane.update(tableDataConfig); + if (!doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog)) { //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 return; } - - writeFile(datasourceManager); // 刷新共有数据集 TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); fireDSChanged(globalTableDataPane.getDsChangedNameMap()); @@ -120,96 +117,87 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS }); } - - public void doCancel() { - Configurations.update(new Worker() { - @Override - public void run() { - datasourceManager.synchronizedWithServer(); - } - - @Override - public Class[] targets() { - return new Class[]{TableDataConfig.class - }; - } - }); - } }); globalTableDataDialog.setVisible(true); } - private void writeFile(DatasourceManagerProvider datasourceManager) { - - Env currentEnv = FRContext.getCurrentEnv(); - try { - boolean isSuccess = currentEnv.writeResource(datasourceManager); - if (!isSuccess) { - throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); - } - } catch (Exception e) { - throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist")); - } - } - - /** * 是否正常更新完datasourceManager * * @param datasourceManager - * @param databaseManagerPane + * @param tableDataManagerPane + * @param databaseListDialog * @return */ - private boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager backupManager, - TableDataManagerPane tableDataManagerPane, BasicDialog databaseListDialog) { - HashMap modifyDetails = datasourceManager.getTableDataModifyDetails(); - modifyDetails.clear(); - Env currentEnv = FRContext.getCurrentEnv(); - ModifiedTable localModifiedTable = datasourceManager.checkTableDataModifyTable(backupManager, currentEnv.getUserID()); + private boolean doWithDatasourceManager(TableDataConfig datasourceManager, TableDataManagerPane tableDataManagerPane, BasicDialog databaseListDialog) { +// HashMap modifyDetails = datasourceManager.getTableDataModifyDetails(); +// modifyDetails.clear(); +// Env currentEnv = FRContext.getCurrentEnv(); +// ModifiedTable localModifiedTable = datasourceManager.checkTableDataModifyTable(backupManager, currentEnv.getUserID()); boolean isFailed = false; - if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { - //如果是本地,并且有远程用户时则更新自己的修改表 - datasourceManager.updateSelfTableDataTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); - } else { - if (!currentEnv.isSupportLocalFileOperate()) { - //如果是远程,则去取服务器的最新的修改表,检查有没有冲突 - ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.TABLEDATA); - if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { - //有冲突,进行提示 - String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.YES_OPTION) { - //点击是,进行相应刷新去冲突 - datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.TABLEDATA); - //要是有重命名冲突的,则对详细的修改表先进行修改 - datasourceManager.doWithTableDataConfilct(localModifiedTable); - localModifiedTable.removeConfilct(); - modifyDetails.clear(); - //更新面板 - tableDataManagerPane.populate(datasourceManager); - } else { - //更新失败,继续停留页面 - isFailed = true; - } - } - } - } +// if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) { +// //如果是本地,并且有远程用户时则更新自己的修改表 +// datasourceManager.updateSelfTableDataTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER); +// } else { +// if (!currentEnv.isSupportLocalFileOperate()) { +// //如果是远程,则去取服务器的最新的修改表,检查有没有冲突 +// ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.TABLEDATA); +// if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) { +// //有冲突,进行提示 +// String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"}); +// int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); +// if (returnVal == JOptionPane.YES_OPTION) { +// //点击是,进行相应刷新去冲突 +// datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.TABLEDATA); +// //要是有重命名冲突的,则对详细的修改表先进行修改 +// datasourceManager.doWithTableDataConfilct(localModifiedTable); +// localModifiedTable.removeConfilct(); +// modifyDetails.clear(); +// //更新面板 +// tableDataManagerPane.populate(datasourceManager); +// } else { +// //更新失败,继续停留页面 +// isFailed = true; +// } +// } +// } +// } //存在请重命名则不能更新 - int index = datasourceManager.isTableDataMapContainsRename(); + int index = isTableDataMapContainsRename(datasourceManager); if (index != -1) { isFailed = true; tableDataManagerPane.setSelectedIndex(index); } databaseListDialog.setDoOKSucceed(!isFailed); //如果修改成功,则去远程端增量修改修改表 - if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { - currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.TABLEDATA); - localModifiedTable.clear(); - modifyDetails.clear(); - } +// if (!isFailed && !currentEnv.isSupportLocalFileOperate()) { +// currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.TABLEDATA); +// localModifiedTable.clear(); +// modifyDetails.clear(); +// } return !isFailed; } + /** + * 是否包含重命名key + * + * @return 包含则返回序列 ,若返回-1则说明不包含重命名key + */ + public int isTableDataMapContainsRename(TableDataConfig datasourceManager) { + ListMap tableDataMap = (ListMap) datasourceManager.getTableDatas(); + String rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + "!"; + if (tableDataMap.containsKey(rename)) { + return tableDataMap.indexOf(rename); + } + //todo 这边同上面和远程修改数据集属性有关先屏蔽 +// for (int i = tableDataRenameIndex; i >= 1; i--) { +// rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + i + "!"; +// if (nameTableDataMap.map.containsKey(rename)) { +// return nameTableDataMap.map.indexOf(rename); +// } +// } + return -1; + } public void update() { this.setEnabled(true); diff --git a/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java b/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java index 989acfa69d..2b95eae11c 100644 --- a/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java +++ b/designer_base/src/com/fr/design/actions/server/ProcedureListAction.java @@ -12,8 +12,6 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; import com.fr.file.ProcedureConfig; import com.fr.general.Inter; import com.fr.transaction.Configurations; @@ -37,10 +35,10 @@ public class ProcedureListAction extends UpdateAction { public void actionPerformed(ActionEvent evt) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); + final ProcedureConfig procedureConfig = ProcedureConfig.getInstance(); final ProcedureManagerPane databaseManagerPane = new ProcedureManagerPane() { public void complete() { - populate(datasourceManager); + populate((ProcedureConfig)procedureConfig.clone()); } }; BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame,null); @@ -50,14 +48,7 @@ public class ProcedureListAction extends UpdateAction { @Override public void run() { DesignTableDataManager.clearGlobalDs(); - databaseManagerPane.update(datasourceManager); - - // marks:保存数据 - try { - FRContext.getCurrentEnv().writeResource(datasourceManager); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage()); - } + databaseManagerPane.update(procedureConfig); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); } diff --git a/designer_base/src/com/fr/design/bbs/BBSLoginUtils.java b/designer_base/src/com/fr/design/bbs/BBSLoginUtils.java index 51d236e9c7..ce98acdb62 100644 --- a/designer_base/src/com/fr/design/bbs/BBSLoginUtils.java +++ b/designer_base/src/com/fr/design/bbs/BBSLoginUtils.java @@ -1,7 +1,7 @@ package com.fr.design.bbs; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.stable.StringUtils; import java.util.List; @@ -13,9 +13,8 @@ public class BBSLoginUtils { public static void bbsLogin(String username, String password){ try{ - ConfigManager.getProviderInstance().setBbsUsername(username); - ConfigManager.getProviderInstance().setBbsPassword(password); - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); + ServerConfig.getInstance().setBbsUsername(username); + ServerConfig.getInstance().setBbsPassword(password); }catch (Exception e){ FRContext.getLogger().error(e.getMessage()); } @@ -26,11 +25,10 @@ public class BBSLoginUtils { String uid = list.get(0); String username = list.get(1); String password = list.get(2); - ConfigManager.getProviderInstance().setBbsUsername(username); - ConfigManager.getProviderInstance().setBbsPassword(password); - ConfigManager.getProviderInstance().setBbsUid(Integer.parseInt(uid)); - ConfigManager.getProviderInstance().setInShowBBsName(username); - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); + ServerConfig.getInstance().setBbsUsername(username); + ServerConfig.getInstance().setBbsPassword(password); + ServerConfig.getInstance().setBbsUid(Integer.parseInt(uid)); + ServerConfig.getInstance().setInShowBBsName(username); }catch (Exception e){ FRContext.getLogger().error(e.getMessage()); } @@ -38,11 +36,10 @@ public class BBSLoginUtils { public static void bbsLogout(){ try{ - ConfigManager.getProviderInstance().setBbsUsername(StringUtils.EMPTY); - ConfigManager.getProviderInstance().setBbsPassword(StringUtils.EMPTY); - ConfigManager.getProviderInstance().setBbsUid(0); - ConfigManager.getProviderInstance().setInShowBBsName(StringUtils.EMPTY); - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); + ServerConfig.getInstance().setBbsUsername(StringUtils.EMPTY); + ServerConfig.getInstance().setBbsPassword(StringUtils.EMPTY); + ServerConfig.getInstance().setBbsUid(0); + ServerConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); }catch (Exception e){ FRContext.getLogger().error(e.getMessage()); } diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 17afec4717..fb09ab7cf9 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -24,8 +24,8 @@ import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +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; @@ -317,13 +317,13 @@ public abstract class DesignTableDataManager { } private static void addServerData(java.util.Map resMap) { - DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); - String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData(mgr); + TableDataConfig tableDataConfig = TableDataConfig.getInstance(); + String[] namearray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig); for (String name : namearray) { if (globalDsCache.containsKey(name)) { resMap.put(name, globalDsCache.get(name)); } else { - TableDataWrapper tdw = new ServerTableDataWrapper(mgr.getTableData(name), name); + TableDataWrapper tdw = new ServerTableDataWrapper(tableDataConfig.getTableData(name), name); resMap.put(name, tdw); globalDsCache.put(name, tdw); } @@ -332,17 +332,17 @@ public abstract class DesignTableDataManager { private static void addStoreProcedureData(java.util.Map resMap) { - DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); + ProcedureConfig procedureConfig = ProcedureConfig.getInstance(); String[] namearray = new String[0]; @SuppressWarnings("unchecked") - java.util.Iterator nameIt = mgr.getProcedureNameIterator(); + java.util.Iterator nameIt = procedureConfig.getProcedures().keySet().iterator(); while (nameIt.hasNext()) { namearray = (String[]) ArrayUtils.add(namearray, nameIt.next()); } Arrays.sort(namearray, Collator.getInstance(java.util.Locale.CHINA)); for (String name : namearray) { - StoreProcedure storeProcedure = mgr.getProcedure(name); + StoreProcedure storeProcedure = procedureConfig.getProcedure(name); if (globalDsCache.containsKey(name)) { resMap.put(name, globalDsCache.get(name)); } else { diff --git a/designer_base/src/com/fr/design/data/datapane/ChoosePane.java b/designer_base/src/com/fr/design/data/datapane/ChoosePane.java index b6cfc25a7a..d7707a3b94 100644 --- a/designer_base/src/com/fr/design/data/datapane/ChoosePane.java +++ b/designer_base/src/com/fr/design/data/datapane/ChoosePane.java @@ -26,8 +26,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -179,9 +178,9 @@ public class ChoosePane extends BasicBeanPane implements Refresha protected void initDsNameComboBox() { dsNameComboBox.setRefreshingModel(true); - DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); + ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); @SuppressWarnings("unchecked") - Iterator datasourceNameIterator = datasourceManager.getConnectionNameIterator(); + Iterator datasourceNameIterator = connectionConfig.getConnectionNameIterator(); List dsList = new ArrayList(); while (datasourceNameIterator.hasNext()) { dsList.add((String) datasourceNameIterator.next()); @@ -286,13 +285,13 @@ public class ChoosePane extends BasicBeanPane implements Refresha if (StringUtils.isEmpty(selectedDSName)) { return null; // peter:选中了当前的零长度的节点,直接返回. } - DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); + ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); @SuppressWarnings("unchecked") - Iterator datasourceNameIterator = datasourceManager.getConnectionNameIterator(); + Iterator datasourceNameIterator = connectionConfig.getConnectionNameIterator(); while (datasourceNameIterator.hasNext()) { String datasourceName = datasourceNameIterator.next(); if (ComparatorUtils.equals(selectedDSName, datasourceName)) { - return datasourceManager.getConnection(datasourceName); + return connectionConfig.getConnection(datasourceName); } } return null; diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java b/designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java index ed29702c4f..befbc7ddbd 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataPaneController.java @@ -1,7 +1,7 @@ package com.fr.design.data.datapane; import com.fr.data.TableDataSource; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import javax.swing.*; import java.util.Map; @@ -39,9 +39,9 @@ public interface TableDataPaneController { */ boolean isNamePermitted(); - void populate(DatasourceManagerProvider datasourceManagerProvider); + void populate(TableDataConfig tableDataConfig); - void update(DatasourceManagerProvider datasourceManagerProvider); + void update(TableDataConfig tableDataConfig); void populate(TableDataSource datasourceManagerProvider); diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java index 97240dd945..8436badaba 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -7,7 +7,8 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.ilist.ListModelElement; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ProcedureConfig; +import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.NameObject; @@ -191,30 +192,30 @@ public class TableDataPaneListPane extends JListControlPane implements TableData * Populate. */ @Override - public void populate(DatasourceManagerProvider datasourceManager) { - Iterator nameIt = datasourceManager.getTableDataNameIterator(); - Iterator procedurenameIt = datasourceManager.getProcedureNameIterator(); + public void populate(TableDataConfig tableDataConfig) { + Iterator nameIt = tableDataConfig.getTableDatas().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, datasourceManager.getTableData(name))); + nameObjectList.add(new NameObject(name, tableDataConfig.getTableData(name))); } while (procedurenameIt.hasNext()) { String name = procedurenameIt.next(); - nameObjectList.add(new NameObject(name, datasourceManager.getProcedureByName(name))); + nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name))); } populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } @Override - public void update(DatasourceManagerProvider datasourceManager) { - datasourceManager.clearAllTableData(); - datasourceManager.clearAllProcedure(); + public void update(TableDataConfig tableDataConfig) { + tableDataConfig.removeAllTableData(); + ProcedureConfig.getInstance().removeAllProcedure(); Nameable[] tableDataArray = this.update(); for (int i = 0; i < tableDataArray.length; i++) { NameObject nameObject = (NameObject) tableDataArray[i]; - datasourceManager.putTableData(nameObject.getName(), (TableData) nameObject.getObject()); + tableDataConfig.addTableData(nameObject.getName(), (TableData) nameObject.getObject()); } } diff --git a/designer_base/src/com/fr/design/data/datapane/TreeTableDataComboBox.java b/designer_base/src/com/fr/design/data/datapane/TreeTableDataComboBox.java index 27bfa7d87c..94109e8c8d 100644 --- a/designer_base/src/com/fr/design/data/datapane/TreeTableDataComboBox.java +++ b/designer_base/src/com/fr/design/data/datapane/TreeTableDataComboBox.java @@ -7,8 +7,7 @@ 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.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import javax.swing.*; import java.awt.*; @@ -58,8 +57,8 @@ public class TreeTableDataComboBox extends UIComboBox { } // 全局数据集 - DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); - nameIt = mgr.getTableDataNameIterator(); + TableDataConfig mgr = TableDataConfig.getInstance(); + nameIt = mgr.getTableDatas().keySet().iterator(); while (nameIt.hasNext()) { String name = nameIt.next(); if(mgr.getTableData(name) instanceof RecursionTableData) { diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index ab9e12162b..232bbc00ec 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -9,9 +9,8 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; import com.fr.transaction.Configurations; @@ -61,8 +60,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { protected Iterator items() { nameList = new ArrayList(); - DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); - Iterator nameIt = mgr.getConnectionNameIterator(); + ConnectionConfig mgr = ConnectionConfig.getInstance(); + Iterator nameIt = mgr.getConnections().keySet().iterator(); while (nameIt.hasNext()) { String conName = nameIt.next(); Connection connection = mgr.getConnection(conName); @@ -89,9 +88,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { */ protected void editItems() { final ConnectionListPane connectionListPane = new ConnectionListPane(); - final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - final DatasourceManager backupManager = datasourceManager.getBackUpManager(); - connectionListPane.populate(datasourceManager); + final ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); + connectionListPane.populate((ConnectionConfig) connectionConfig.clone()); final BasicDialog connectionListDialog = connectionListPane.showLargeWindow( SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), null); connectionListDialog.addDialogActionListener(new DialogActionAdapter() { @@ -103,13 +101,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { Configurations.update(new Worker() { @Override public void run() { - if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane, + if (!ConnectionListAction.doWithDatasourceManager(connectionConfig, connectionListPane, connectionListDialog)) { //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 return; } - // marks:保存数据 - ConnectionListAction.writeFile(datasourceManager); + connectionListPane.update(connectionConfig); + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); } @Override @@ -119,20 +117,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { }); } - - public void doCancel() { - Configurations.update(new Worker() { - @Override - public void run() { - datasourceManager.synchronizedWithServer(); - } - - @Override - public Class[] targets() { - return new Class[]{ConnectionConfig.class}; - } - }); - } }); connectionListDialog.setVisible(true); refreshItems(); diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java index 1cdf1cb1a9..010227c92e 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -8,7 +8,7 @@ import com.fr.design.fun.ConnectionProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.NameObject; @@ -130,15 +130,15 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh /** * Populate. * - * @param datasourceManager the new datasourceManager. + * @param connectionConfig the new datasourceManager. */ - public void populate(DatasourceManagerProvider datasourceManager) { - Iterator nameIt = datasourceManager.getConnectionNameIterator(); + public void populate(ConnectionConfig connectionConfig) { + Iterator nameIt = connectionConfig.getConnectionNameIterator(); List nameObjectList = new ArrayList(); while (nameIt.hasNext()) { String name = nameIt.next(); - nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name))); + nameObjectList.add(new NameObject(name, connectionConfig.getConnection(name))); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); @@ -147,17 +147,17 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh /** * Update. */ - public void update(DatasourceManagerProvider datasourceManager) { + public void update(ConnectionConfig connectionConfig) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); - datasourceManager.clearAllConnection(); + connectionConfig.clearAllConnection(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; - datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject()); + connectionConfig.putConnection(nameObject.getName(), (Connection) nameObject.getObject()); } } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java index 70d4933faf..6278348206 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java @@ -5,7 +5,7 @@ import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; import com.fr.general.Inter; import com.fr.stable.project.ProjectConstants; @@ -48,13 +48,13 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio return connectionListPane.getRenameMap(); } - public void populate(DatasourceManagerProvider datasourceManager) { + public void populate(ConnectionConfig datasourceManager) { this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME + File.separator + datasourceManager.fileName()); this.connectionListPane.populate(datasourceManager); } - public void update(DatasourceManagerProvider datasourceManager) { + public void update(ConnectionConfig datasourceManager) { this.connectionListPane.update(datasourceManager); } diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java index ce857ddc65..b5ae09be8e 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java @@ -1,15 +1,15 @@ package com.fr.design.data.datapane.connect; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; /** * Created by yaoh.wu on 2017/4/22. * 数据链接显示面板 */ public interface ConnectionShowPane { - void update(DatasourceManagerProvider datasourceManager); + void update(ConnectionConfig connectionConfig); - void populate(DatasourceManagerProvider datasourceManager); + void populate(ConnectionConfig connectionConfig); void setSelectedIndex(int index); } diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java index 0f3f8631b4..c7e0146e8a 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DecoratedTableDataPane.java @@ -6,8 +6,7 @@ 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.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.Inter; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; @@ -22,8 +21,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/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 6f2ee4da33..18ad149bcf 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -40,7 +40,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.file.DatasourceManager; +import com.fr.file.ConnectionConfig; import com.fr.general.Inter; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; @@ -167,7 +167,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } private boolean isAutoParameterDatabase() { - Connection connection = DatasourceManager.getProviderInstance().getConnection(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()); + Connection connection = ConnectionConfig.getInstance().getConnection(connectionTableProcedurePane.getSelectedDatabaseConnnectonName()); return connection == null ? false : ArrayUtils.contains(DRIVERS, connection.getDriver()); } diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java index 636bc4b768..9ab922316c 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java @@ -7,7 +7,7 @@ import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.ilist.ListModelElement; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ProcedureConfig; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.stable.Nameable; @@ -113,16 +113,16 @@ public class ProcedureListPane extends JListControlPane { /** * Populate. * - * @param datasourceManager + * @param procedureConfig * the new datasourceManager. */ - public void populate(DatasourceManagerProvider datasourceManager) { - Iterator nameIt = datasourceManager.getProcedureNameIterator(); + public void populate(ProcedureConfig procedureConfig) { + Iterator nameIt = procedureConfig.getProcedures().keySet().iterator(); List nameObjectList = new ArrayList(); while (nameIt.hasNext()) { String name = nameIt.next(); - nameObjectList.add(new NameObject(name, datasourceManager.getProcedure(name))); + nameObjectList.add(new NameObject(name, procedureConfig.getProcedure(name))); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); @@ -131,17 +131,17 @@ public class ProcedureListPane extends JListControlPane { /** * Update. */ - public void update(DatasourceManagerProvider datasourceManager) { + public void update(ProcedureConfig procedureConfig) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); - datasourceManager.clearAllProcedure(); + procedureConfig.removeAllProcedure(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; - datasourceManager.putProcedure(nameObject.getName(), (StoreProcedure) nameObject.getObject()); + procedureConfig.addProcedure(nameObject.getName(), (StoreProcedure) nameObject.getObject()); } } diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureManagerPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureManagerPane.java index 7274117b51..e178b63b42 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureManagerPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureManagerPane.java @@ -1,17 +1,14 @@ package com.fr.design.data.tabledata.tabledatapane; -import com.fr.base.FRContext; import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ProcedureConfig; import com.fr.general.Inter; -import com.fr.stable.project.ProjectConstants; import javax.swing.*; import java.awt.*; -import java.io.File; public class ProcedureManagerPane extends LoadingBasicPane { private UITextField connectionTextField; @@ -38,14 +35,15 @@ public class ProcedureManagerPane extends LoadingBasicPane { return Inter.getLocText("Datasource-Stored_Procedure"); } - public void populate(DatasourceManagerProvider datasourceManager) { - this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME - + File.separator + datasourceManager.fileName()); - this.procedureListPane.populate(datasourceManager); + public void populate(ProcedureConfig procedureConfig) { + //todo 原来界面上显示的xml路径 +// this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME +// + File.separator + datasourceManager.fileName()); + this.procedureListPane.populate(procedureConfig); } - public void update(DatasourceManagerProvider datasourceManager) { - this.procedureListPane.update(datasourceManager); + public void update(ProcedureConfig procedureConfig) { + this.procedureListPane.update(procedureConfig); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java index 3251f738a5..89b19bde35 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java @@ -1,6 +1,5 @@ package com.fr.design.data.tabledata.tabledatapane; -import com.fr.base.FRContext; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.datapane.TableDataPaneController; @@ -10,13 +9,11 @@ import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.Inter; -import com.fr.stable.project.ProjectConstants; import javax.swing.*; import java.awt.*; -import java.io.File; import java.util.Map; public class TableDataManagerPane extends LoadingBasicPane { @@ -77,14 +74,15 @@ public class TableDataManagerPane extends LoadingBasicPane { return Inter.getLocText("DS-Server_TableData"); } - public void populate(DatasourceManagerProvider datasourceManager) { - this.tableDataTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME - + File.separator + datasourceManager.fileName()); - this.tableDataPane.populate(datasourceManager); + public void populate(TableDataConfig tableDataConfig) { + //todo 原来界面上显示的xml路径 +// this.tableDataTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME +// + File.separator + datasourceManager.fileName()); + this.tableDataPane.populate(tableDataConfig); } - public void update(DatasourceManagerProvider datasourceManager) { - this.tableDataPane.update(datasourceManager); + public void update(TableDataConfig tableDataConfig) { + this.tableDataPane.update(tableDataConfig); } public Map getDsChangedNameMap () { diff --git a/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index ae74667532..cce9373e8a 100644 --- a/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -7,7 +7,7 @@ import com.fr.data.impl.*; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.tabledata.tabledatapane.*; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; @@ -153,12 +153,12 @@ public abstract class TableDataFactory { } @SuppressWarnings("unchecked") - public static String[] getSortOfChineseNameOfServerData(DatasourceManagerProvider mgr) { + public static String[] getSortOfChineseNameOfServerData(TableDataConfig tableDataConfig) { clearAll(); - java.util.Iterator nameIt = mgr.getTableDataNameIterator(); + java.util.Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); while (nameIt.hasNext()) { String name = nameIt.next(); - TableData td = mgr.getTableData(name); + TableData td = TableDataConfig.getInstance().getTableData(name); addName(name, td); } return getSortedNameArray(); diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 3fb83f5faf..07114d3945 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -1,7 +1,7 @@ package com.fr.design.extra; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.PluginLoginExecutor; @@ -125,16 +125,16 @@ public class LoginWebBridge { */ public void setMessageCount(int count) { if (count == MIN_MESSAGE_COUNT) { - uiLabel.setText(ConfigManager.getProviderInstance().getBbsUsername()); - ConfigManager.getProviderInstance().setInShowBBsName(ConfigManager.getProviderInstance().getBbsUsername()); + uiLabel.setText(ServerConfig.getInstance().getBbsUsername()); + ServerConfig.getInstance().setInShowBBsName(ServerConfig.getInstance().getBbsUsername()); return; } this.messageCount = count; StringBuilder sb = new StringBuilder(); - sb.append(StringUtils.BLANK).append(ConfigManager.getProviderInstance().getBbsUsername()) + sb.append(StringUtils.BLANK).append(ServerConfig.getInstance().getBbsUsername()) .append("(").append(this.messageCount) .append(")").append(StringUtils.BLANK); - ConfigManager.getProviderInstance().setInShowBBsName(sb.toString()); + ServerConfig.getInstance().setInShowBBsName(sb.toString()); uiLabel.setText(sb.toString()); } diff --git a/designer_base/src/com/fr/design/extra/PluginFromStorePane.java b/designer_base/src/com/fr/design/extra/PluginFromStorePane.java index 20001cad3c..17d13eb699 100644 --- a/designer_base/src/com/fr/design/extra/PluginFromStorePane.java +++ b/designer_base/src/com/fr/design/extra/PluginFromStorePane.java @@ -1,7 +1,7 @@ package com.fr.design.extra; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; @@ -188,10 +188,10 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane nameObjectList = new ArrayList(); for (int i = 0; i < functionManager.getFunctionDefCount(); i++) { @@ -80,7 +80,7 @@ public class FunctionManagerPane extends BasicPane { /** * Update. */ - public void update(FunctionManagerProvider functionManager) { + public void update(FunctionConfig functionManager) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.functionControlPane.update(); NameObject[] res_array = new NameObject[res.length]; diff --git a/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java b/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java index 623b1cbf4f..b14ee1b804 100644 --- a/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java +++ b/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java @@ -1,9 +1,8 @@ package com.fr.design.formula; -import com.fr.base.ConfigManager; import com.fr.base.Parameter; +import com.fr.config.ServerConfig; import com.fr.design.DesignModelAdapter; -import com.fr.base.ConfigManagerProvider; import com.fr.plugin.ExtraClassManager; import com.fr.script.ScriptConstants; import com.fr.stable.ArrayUtils; @@ -94,8 +93,8 @@ public abstract class VariableResolverAdapter implements VariableResolver { */ public String[] resolveGlobalParameterVariables() { // 加上全局的参数 - ConfigManagerProvider reportServerManager = ConfigManager.getProviderInstance(); - Parameter[] globalParameters = reportServerManager.getGlobal_Parameters(); + ServerConfig reportServerManager = ServerConfig.getInstance(); + Parameter[] globalParameters = reportServerManager.getGlobeParameters(); List variablesList = new ArrayList(); for (int i = 0; i < (globalParameters == null ? 0 : globalParameters.length); i++) { diff --git a/designer_base/src/com/fr/design/gui/core/WidgetOption.java b/designer_base/src/com/fr/design/gui/core/WidgetOption.java index c7cff45afa..215fc3c1d2 100644 --- a/designer_base/src/com/fr/design/gui/core/WidgetOption.java +++ b/designer_base/src/com/fr/design/gui/core/WidgetOption.java @@ -84,7 +84,7 @@ public abstract class WidgetOption implements Serializable { */ public static WidgetOption[] getPredefinedWidget() { java.util.List list = new ArrayList(); - WidgetManagerProvider mgr = WidgetManager.getProviderInstance(); + WidgetInfoConfig mgr = WidgetInfoConfig.getInstance(); java.util.Iterator nameIt = mgr.getWidgetConfigNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); diff --git a/designer_base/src/com/fr/design/gui/ilist/TableViewList.java b/designer_base/src/com/fr/design/gui/ilist/TableViewList.java index f570033b55..574843beac 100644 --- a/designer_base/src/com/fr/design/gui/ilist/TableViewList.java +++ b/designer_base/src/com/fr/design/gui/ilist/TableViewList.java @@ -10,8 +10,7 @@ import com.fr.data.impl.Connection; import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.dnd.SerializableTransferable; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.StringUtils; @@ -86,7 +85,7 @@ public class TableViewList extends UIList { @Override protected Void doInBackground() throws Exception { - Connection datasource = DatasourceManager.getProviderInstance().getConnection(databaseName); + Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); boolean status = false; int count = 3; //总共给3次连接的机会 @@ -127,8 +126,7 @@ public class TableViewList extends UIList { */ private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { DefaultListModel defaultListModel = new DefaultListModel(); - DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - Connection datasource = datasourceManager.getConnection(databaseName); + Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName); if (datasource == null) { return defaultListModel; } diff --git a/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java b/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java index 8951c711f5..c10c924dca 100644 --- a/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java +++ b/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java @@ -1,6 +1,6 @@ package com.fr.design.hyperlink; -import com.fr.base.ConfigManager; +import com.fr.config.ServerConfig; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -80,7 +80,7 @@ public class WebHyperNorthPane extends AbstractHyperNorthPane { protected void populateSubHyperlinkBean(WebHyperlink link) { String url = link.getURL(); if (StringUtils.isBlank(url)) { - url = ConfigManager.getProviderInstance().getHyperlinkAddress(); + url = ServerConfig.getInstance().getHyperlinkAddress(); } this.urlTextField.setText(url); if (itemNameTextField != null) { diff --git a/designer_base/src/com/fr/design/javascript/EmailPane.java b/designer_base/src/com/fr/design/javascript/EmailPane.java index 9f8084d77d..701183a89a 100644 --- a/designer_base/src/com/fr/design/javascript/EmailPane.java +++ b/designer_base/src/com/fr/design/javascript/EmailPane.java @@ -1,6 +1,6 @@ package com.fr.design.javascript; -import com.fr.base.ConfigManager; +import com.fr.config.EmailConfig; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icheckbox.UICheckBox; @@ -51,7 +51,7 @@ public class EmailPane extends FurtherBasicBeanPane { initCenterPane(mainTextLabel, scrollPane, fill, preferred); this.add(centerPane, BorderLayout.CENTER); mainTextEditor.setAutoscrolls(true); - checkEmailConfig(ConfigManager.getProviderInstance().getEmailManager().isEmailConfigValid()); + checkEmailConfig(EmailConfig.getInstance().isEmailConfigValid()); } /** @@ -113,7 +113,7 @@ public class EmailPane extends FurtherBasicBeanPane { if (showTplContent != null) { showTplContent.setSelected(ob ==null ? false: ob.isShowTplContent()); } - checkEmailConfig(ConfigManager.getProviderInstance().getEmailManager().isEmailConfigValid()); + checkEmailConfig(EmailConfig.getInstance().isEmailConfigValid()); } @Override diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 18f5b88ab0..37e9777c26 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -618,15 +618,6 @@ public abstract class JTemplate> ex return false; } - if (BaseUtils.isAuthorityEditing()) { - //触发保存服务器工具栏 - try { - FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance()); - } catch (Exception e1) { - FRContext.getLogger().error(e1.getMessage()); - } - } - } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 9a2aed712f..f929307485 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe.loghandler; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; @@ -129,7 +129,7 @@ public class DesignerLogHandler { @Override public void actionPerformed(ActionEvent e) { JPopupMenu showsetPopup = new JPopupMenu(); - int logLevelvalue = ConfigManager.getProviderInstance().getServerLogLevel().intValue(); + int logLevelvalue = ServerConfig.getInstance().getServerLogLevel().intValue(); if (logLevelvalue <= INFO_INT) { showsetPopup.add(showInfo); showsetPopup.add(showError); diff --git a/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java b/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java index a7b8a25524..62c856befd 100644 --- a/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java +++ b/designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe.templateinfo; -import com.fr.base.ConfigManager; import com.fr.base.FRContext; import com.fr.base.io.IOFile; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -238,7 +238,7 @@ public class TemplateInfoCollector implements Serializable, XM private HashMap getNewConsumingMap(String templateID, long openTime, long timeConsume) { HashMap consumingMap = new HashMap<>(); - String username = ConfigManager.getProviderInstance().getBbsUsername(); + String username = ServerConfig.getInstance().getBbsUsername(); String uuid = DesignerEnvManager.getEnvManager().getUUID(); String activitykey = DesignerEnvManager.getEnvManager().getActivationKey(); String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java index 594b11e901..7a881cfa45 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe.widget.accessibles; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.renderer.IconCellRenderer; @@ -9,10 +7,7 @@ import com.fr.design.mainframe.widget.wrappers.IconWrapper; import com.fr.design.web.CustomIconPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.form.ui.WidgetManager; -import javax.swing.*; -import java.awt.*; public class AccessibleIconEditor extends UneditableAccessibleEditor { @@ -39,13 +34,6 @@ public class AccessibleIconEditor extends UneditableAccessibleEditor { public void doOk() { setValue(customIconPane.update()); fireStateChanged(); - - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(WidgetManager.getProviderInstance()); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } } }); customIconPane.populate((String) this.getValue()); diff --git a/designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java b/designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java index 060592b715..2f7fd272d7 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java +++ b/designer_base/src/com/fr/design/mainframe/widget/renderer/IconCellRenderer.java @@ -5,9 +5,7 @@ import java.awt.*; import com.fr.base.FRContext; import com.fr.base.Icon; import com.fr.base.IconManager; -import com.fr.form.ui.WidgetManager; - -import javax.swing.*; +import com.fr.form.ui.WidgetInfoConfig; public class IconCellRenderer extends GenericCellRenderer { private Image img; @@ -20,7 +18,7 @@ public class IconCellRenderer extends GenericCellRenderer { @Override public void setValue(Object v) { try { - Icon icon = WidgetManager.getProviderInstance().getIconManager().getIcon(v); + Icon icon = WidgetInfoConfig.getInstance().getIconManager().getIcon(v); this.setImage(icon == null ? null : icon.getImage()); } catch (CloneNotSupportedException e) { this.setImage(null); diff --git a/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java b/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java index 223c930788..0de52dbd77 100644 --- a/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java +++ b/designer_base/src/com/fr/design/parameter/ParameterArrayPane.java @@ -1,7 +1,7 @@ package com.fr.design.parameter; -import com.fr.base.ConfigManager; import com.fr.base.Parameter; +import com.fr.config.ServerConfig; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableSelfCreator; @@ -9,7 +9,6 @@ import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import com.fr.base.ConfigManagerProvider; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; @@ -30,10 +29,9 @@ public class ParameterArrayPane extends JListControlPane { } }); - this.addEditingListner(new PropertyChangeAdapter() { + this.addEditingListner( new PropertyChangeAdapter() { public void propertyChange() { - final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); - Parameter[] parameters = configManager.getGlobal_Parameters(); + Parameter[] parameters = ServerConfig.getInstance().getGlobeParameters(); String[] allListNames = nameableList.getAllNames(); allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; String tempName = getEditingName(); diff --git a/designer_base/src/com/fr/design/parameter/ParameterManagerPane.java b/designer_base/src/com/fr/design/parameter/ParameterManagerPane.java index 1d9c2a40ca..18a203331c 100644 --- a/designer_base/src/com/fr/design/parameter/ParameterManagerPane.java +++ b/designer_base/src/com/fr/design/parameter/ParameterManagerPane.java @@ -1,12 +1,12 @@ package com.fr.design.parameter; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; -import com.fr.base.ConfigManagerProvider; import com.fr.stable.project.ProjectConstants; import javax.swing.*; @@ -39,15 +39,16 @@ public class ParameterManagerPane extends BasicPane { return Inter.getLocText("M_Server-Global_Parameters"); } - public void populate(ConfigManagerProvider configManager) { - this.parameterTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + - ProjectConstants.RESOURCES_NAME + - File.separator + configManager.fileName()); - this.parameterArrayPane.populate(configManager.getGlobal_Parameters()); + public void populate(ServerConfig configManager) { + //todo 原来界面上显示的xml路径 +// this.parameterTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + +// ProjectConstants.RESOURCES_NAME + +// File.separator + configManager.fileName()); + this.parameterArrayPane.populate(configManager.getGlobeParameters()); } - public void update(ConfigManagerProvider configManager) { - configManager.setGlobal_Parameters(parameterArrayPane.updateParameters()); + public void update(ServerConfig configManager) { + configManager.setGlobeParameters(parameterArrayPane.updateParameters()); } /** diff --git a/designer_base/src/com/fr/design/web/CustomIconPane.java b/designer_base/src/com/fr/design/web/CustomIconPane.java index eebd65d522..d7bbfbbc73 100644 --- a/designer_base/src/com/fr/design/web/CustomIconPane.java +++ b/designer_base/src/com/fr/design/web/CustomIconPane.java @@ -18,7 +18,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.Constants; @@ -106,7 +106,7 @@ public class CustomIconPane extends BasicPane { private void initIcons() { iconButtonMap = new ListMap(); - iconManager = WidgetManager.getProviderInstance().getIconManager(); + iconManager = WidgetInfoConfig.getInstance().getIconManager(); bg = new ButtonGroup(); Object[] names = iconManager.getIconNames(); Object name = null; @@ -315,7 +315,7 @@ public class CustomIconPane extends BasicPane { this.addActionListener(this); this.setCursor(new Cursor(Cursor.HAND_CURSOR)); this.setBorder(null); - this.iconImage = WidgetManager.getProviderInstance().getIconManager().getIconImage(name); + this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); this.setToolTipText(iconName); } @@ -408,7 +408,7 @@ public class CustomIconPane extends BasicPane { if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { return; } - if (WidgetManager.getProviderInstance().getIconManager().contains(nameTextField.getText())) { + if (WidgetInfoConfig.getInstance().getIconManager().contains(nameTextField.getText())) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Custom_Icon_Message3"), Inter.getLocText("FR-Designer_Tooltips"), diff --git a/designer_base/src/com/fr/design/widget/IconDefinePane.java b/designer_base/src/com/fr/design/widget/IconDefinePane.java index ca0d5eb8f2..356c22e71b 100644 --- a/designer_base/src/com/fr/design/widget/IconDefinePane.java +++ b/designer_base/src/com/fr/design/widget/IconDefinePane.java @@ -10,7 +10,7 @@ import com.fr.design.web.CustomIconPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Inter; import javax.swing.*; @@ -49,13 +49,6 @@ public class IconDefinePane extends BasicPane { curIconName = cip.update(); setShowIconImage(); IconDefinePane.this.repaint(); - - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.writeResource(WidgetManager.getProviderInstance()); - } catch (Exception ex) { - FRContext.getLogger().error(ex.getMessage(), ex); - } } }); editDialog.setVisible(true); @@ -82,7 +75,7 @@ public class IconDefinePane extends BasicPane { } private void setShowIconImage() { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(curIconName); + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(curIconName); if (iimage != null) { showIconImageLable.setIcon(new ImageIcon(iimage)); } else { diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index acaea0f41e..a7e9129eaa 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -26,8 +26,8 @@ import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.file.CacheManager; -import com.fr.file.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.ConnectionConfig; +import com.fr.file.TableDataConfig; import com.fr.file.filetree.FileNode; import com.fr.general.*; import com.fr.general.http.HttpClient; @@ -1060,7 +1060,7 @@ public class RemoteEnv extends AbstractEnv { * DataSource中去除当前角色没有权限访问的数据源 */ public void removeNoPrivilegeConnection() { - DatasourceManagerProvider dm = DatasourceManager.getProviderInstance(); + TableDataConfig dm = TableDataConfig.getInstance(); try { HashMap para = new HashMap(); @@ -1075,8 +1075,8 @@ public class RemoteEnv extends AbstractEnv { ArrayList toBeRemoveTDName = new ArrayList(); for (int i = 0; i < ja.length(); i++) { String toBeRemoveConnName = (String) ((JSONObject) ja.get(i)).get("name"); - dm.removeConnection(toBeRemoveConnName); - Iterator it = dm.getTableDataNameIterator(); + ConnectionConfig.getInstance().removeConnection(toBeRemoveConnName); + Iterator it = dm.getTableDatas().keySet().iterator(); while (it.hasNext()) { String tdName = (String) it.next(); TableData td = dm.getTableData(tdName); diff --git a/designer_chart/src/com/fr/plugin/chart/map/server/ChartMapEditorAction.java b/designer_chart/src/com/fr/plugin/chart/map/server/ChartMapEditorAction.java index 74c1a67655..139b25b3d4 100644 --- a/designer_chart/src/com/fr/plugin/chart/map/server/ChartMapEditorAction.java +++ b/designer_chart/src/com/fr/plugin/chart/map/server/ChartMapEditorAction.java @@ -2,6 +2,7 @@ package com.fr.plugin.chart.map.server; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.config.ServerConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.general.GeneralContext; @@ -24,7 +25,7 @@ public class ChartMapEditorAction extends UpdateAction { public void actionPerformed(ActionEvent evt) { int port = DesignerEnvManager.getEnvManager().getJettyServerPort(); String web = GeneralContext.getCurrentAppNameOfEnv(); - String serverlet = com.fr.base.ConfigManager.getProviderInstance().getServletMapping(); + String serverlet = ServerConfig.getInstance().getServletMapping(); Env env = FRContext.getCurrentEnv(); StartServer.browserURLWithLocalEnv(env.isLocalEnv() ? String.format("http://localhost:%d/%s/%s?op=map", port, web, serverlet) : env.getPath() + "?op=map"); } diff --git a/designer_form/src/com/fr/design/designer/creator/XNameWidget.java b/designer_form/src/com/fr/design/designer/creator/XNameWidget.java index 50252a14ad..abd484e20f 100644 --- a/designer_form/src/com/fr/design/designer/creator/XNameWidget.java +++ b/designer_form/src/com/fr/design/designer/creator/XNameWidget.java @@ -62,7 +62,7 @@ public class XNameWidget extends XWidgetCreator { protected JComponent initEditor() { if (editor == null) { - WidgetManagerProvider widgetManager = WidgetManager.getProviderInstance(); + WidgetInfoConfig widgetManager = WidgetInfoConfig.getInstance(); WidgetConfig wc = widgetManager.getWidgetConfig(toData().getName()); Widget widget; if (wc != null && (widget= wc.toWidget()) != null) { diff --git a/designer_form/src/com/fr/design/mainframe/FormEditToolBar.java b/designer_form/src/com/fr/design/mainframe/FormEditToolBar.java index c2c487ef54..6e74784fdb 100644 --- a/designer_form/src/com/fr/design/mainframe/FormEditToolBar.java +++ b/designer_form/src/com/fr/design/mainframe/FormEditToolBar.java @@ -186,7 +186,7 @@ public class FormEditToolBar extends BasicPane { if (widget instanceof Button) { String iconname = ((Button) widget).getIconName(); if (StringUtils.isNotBlank(iconname)) { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname); + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); toolBarButton.setIcon(new ImageIcon(iimage)); } } diff --git a/designer_form/src/com/fr/design/mainframe/FormParaPane.java b/designer_form/src/com/fr/design/mainframe/FormParaPane.java index d3f0fa0cbb..d42c7878e1 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaPane.java @@ -138,7 +138,7 @@ public class FormParaPane extends JPanel { predifinedwidgeList.add(designerPre[i]); } } - WidgetManagerProvider mgr = WidgetManager.getProviderInstance(); + WidgetInfoConfig mgr = WidgetInfoConfig.getInstance(); Iterator nameIt = mgr.getWidgetConfigNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index 470337190a..cff176ea34 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -227,7 +227,7 @@ public class FormParaWidgetPane extends JPanel { predifinedwidgeList.add(designerPre[i]); } } - WidgetManagerProvider mgr = WidgetManager.getProviderInstance(); + WidgetInfoConfig mgr = WidgetInfoConfig.getInstance(); Iterator nameIt = mgr.getWidgetConfigNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); diff --git a/designer_form/src/com/fr/design/mainframe/FormToolBarButton.java b/designer_form/src/com/fr/design/mainframe/FormToolBarButton.java index a9651c7fa8..211c3ef3dd 100644 --- a/designer_form/src/com/fr/design/mainframe/FormToolBarButton.java +++ b/designer_form/src/com/fr/design/mainframe/FormToolBarButton.java @@ -7,7 +7,7 @@ import com.fr.design.gui.core.WidgetOption; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -36,7 +36,7 @@ public class FormToolBarButton extends JButton implements MouseListener { com.fr.form.ui.Button button = (com.fr.form.ui.Button) widget; String iconName = button.getIconName(); if (StringUtils.isNotEmpty(iconName)) { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconName); + Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); if (iimage != null) { setIcon(new ImageIcon(iimage)); } diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/NameWidgetComboboxEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/NameWidgetComboboxEditor.java index 5951fa0c7b..601e3cfc75 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/editors/NameWidgetComboboxEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/NameWidgetComboboxEditor.java @@ -2,8 +2,7 @@ package com.fr.design.mainframe.widget.editors; import com.fr.design.Exception.ValidationException; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.form.ui.WidgetManager; -import com.fr.form.ui.WidgetManagerProvider; +import com.fr.form.ui.WidgetInfoConfig; import javax.swing.*; import java.awt.*; @@ -18,7 +17,7 @@ public class NameWidgetComboboxEditor extends AbstractPropertyEditor { public NameWidgetComboboxEditor() { Vector items = new Vector(); - WidgetManagerProvider manager = WidgetManager.getProviderInstance(); + WidgetInfoConfig manager = WidgetInfoConfig.getInstance(); java.util.Iterator nameIt = manager.getWidgetConfigNameIterator(); while (nameIt.hasNext()) { String name = nameIt.next(); diff --git a/designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java b/designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java index 4789ba4f7a..7206a25298 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/ParameterTreeComboBox.java @@ -1,15 +1,14 @@ package com.fr.design.widget.ui.designer; import com.fr.base.BaseUtils; -import com.fr.base.ConfigManager; import com.fr.base.Parameter; import com.fr.base.TableData; +import com.fr.config.ServerConfig; 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.DatasourceManager; -import com.fr.file.DatasourceManagerProvider; +import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.script.Calculator; @@ -153,17 +152,17 @@ public class ParameterTreeComboBox extends FRTreeComboBox { } // 全局参数 - parameters = ConfigManager.getProviderInstance().getGlobal_Parameters(); + parameters = ServerConfig.getInstance().getGlobeParameters(); if (!ArrayUtils.isEmpty(parameters)) { groupList.add(new ParameterGroup(Inter.getLocText("M_Server-Global_Parameters"), parameters)); } // 全局数据源参数 parameters = new Parameter[0]; Calculator c = Calculator.createCalculator(); - DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance(); - Iterator nameIt = datasourceManager.getTableDataNameIterator(); + TableDataConfig tableDataConfig = TableDataConfig.getInstance(); + Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); while (nameIt.hasNext()) { - TableData tableData = datasourceManager.getTableData(nameIt.next()); + TableData tableData = tableDataConfig.getTableData(nameIt.next()); ParameterProvider[] ps = tableData.getParameters(c); if (!ArrayUtils.isEmpty(ps)) { parameters = (Parameter[])ArrayUtils.addAll(parameters, ps);