diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 63c38a042..b7aa2e4a5 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 eea11810c..46364c958 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 ab6986630..ad1aad61e 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 f59aba9b9..39b2648a8 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 5388c1d07..c1f23e79c 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 a25c502b1..51dde470c 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 a941660aa..a653cf685 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 23e4622e1..29978d157 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 6923e4fae..59a5a95e3 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 cdb19d7e3..e0f669bd1 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 061107462..b0525781b 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 b61cccb15..2aba4cc86 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 19200322b..8c101fda2 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 d6533e8ca..22876dd83 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 6a3fd219a..49a004d04 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 938fd4509..a1cf442d1 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 a36b90ad0..d17ecc1bb 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 ee415da68..c563a25f1 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 8577e0e3e..244d74acc 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 817bb20fd..58590f2cc 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 bce10196c..1982d50c6 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 c18e22ca4..17d42f7fe 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 8c3851e3b..916ef4514 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 93208ad8e..bea7804ba 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 d4bb3485c..fe151ea5b 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 21f57cc10..fccfdb583 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 37bd02b1b..933f3934b 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 92b26b0d5..36dd4b50c 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 78088920f..88ed923f7 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 d8e816d80..41a8b291c 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 4bbdc301f..2c80b8e46 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 c501efd26..93a92c6f3 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 d32b110d1..7cb9e7ed9 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 404803338..bad26b770 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 8f8853baa..05f476001 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 198d81777..cb5dc3375 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 3bdef5f4f..a103af680 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 989acfa69..2b95eae11 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 51d236e9c..ce98acdb6 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 17afec471..fb09ab7cf 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 b6cfc25a7..d7707a3b9 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 ed29702c4..befbc7ddb 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 97240dd94..8436badab 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 27bfa7d87..94109e8c8 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 ab9e12162..232bbc00e 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 1cdf1cb1a..010227c92 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 70d4933fa..627834820 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 ce857ddc6..b5ae09be8 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 0f3f8631b..c7e0146e8 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 6f2ee4da3..18ad149bc 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 636bc4b76..9ab922316 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 7274117b5..e178b63b4 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 3251f738a..89b19bde3 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 ae7466753..cce9373e8 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 3fb83f5fa..07114d394 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 20001cad3..17d13eb69 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 623b1cbf4..b14ee1b80 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 c7cff45af..215fc3c1d 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 f570033b5..574843bea 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 8951c711f..c10c924dc 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 9f8084d77..701183a89 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 18f5b88ab..37e9777c2 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 9a2aed712..f92930748 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 a7b8a2552..62c856bef 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 594b11e90..7a881cfa4 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 060592b71..2f7fd272d 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 223c93078..0de52dbd7 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 1d9c2a40c..18a203331 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 eebd65d52..d7bbfbbc7 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 ca0d5eb8f..356c22e71 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 acaea0f41..a7e9129ea 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 74c1a6765..139b25b3d 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 50252a14a..abd484e20 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 c2c487ef5..6e74784fd 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 d3f0fa0cb..d42c7878e 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 470337190..cff176ea3 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 a9651c7fa..211c3ef3d 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 5951fa0c7..601e3cfc7 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 4789ba4f7..7206a2529 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);