Browse Source

REPORT-6956 设计器适配10.0配置写法

master
kerry 7 years ago
parent
commit
c2bf3d6507
  1. 33
      designer/src/com/fr/design/actions/report/ReportWebAttrAction.java
  2. 29
      designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java
  3. 31
      designer/src/com/fr/design/actions/server/StyleListAction.java
  4. 40
      designer/src/com/fr/design/actions/server/WidgetManagerAction.java
  5. 34
      designer/src/com/fr/design/webattr/PageToolBarPane.java
  6. 37
      designer/src/com/fr/design/webattr/ViewToolBarPane.java
  7. 27
      designer/src/com/fr/design/webattr/WriteToolBarPane.java
  8. 47
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  9. 29
      designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java
  10. 43
      designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java
  11. 70
      designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java
  12. 35
      designer_base/src/com/fr/design/actions/server/ProcedureListAction.java
  13. 41
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

33
designer/src/com/fr/design/actions/report/ReportWebAttrAction.java

@ -7,6 +7,7 @@ import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider; import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -16,6 +17,9 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWebAttrPane; import com.fr.design.webattr.ReportWebAttrPane;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -56,15 +60,26 @@ public class ReportWebAttrAction extends JWorkBookAction {
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
wbTpl.setReportWebAttr(reportWebAttrPane.update()); Configurations.update(new Worker() {
final ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); @Override
Env currentEnv = FRContext.getCurrentEnv(); public void run() {
try { wbTpl.setReportWebAttr(reportWebAttrPane.update());
currentEnv.writeResource(configManager); final ConfigManagerProvider configManager = ConfigManager.getProviderInstance();
} catch (Exception ex) { Env currentEnv = FRContext.getCurrentEnv();
FRContext.getLogger().error(ex.getMessage(), ex); try {
} currentEnv.writeResource(configManager);
jwb.fireTargetModified(); } catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex);
}
jwb.fireTargetModified();
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class};
}
});
} }
}); });

29
designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -7,6 +7,7 @@ import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider; import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -15,6 +16,9 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane; import com.fr.design.webattr.EditReportServerParameterPane;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -51,13 +55,24 @@ public class ServerConfigManagerAction extends UpdateAction {
editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() { editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
editReportServerParameterPane.update(configManager); Configurations.update(new Worker() {
Env currentEnv = FRContext.getCurrentEnv(); @Override
try { public void run() {
currentEnv.writeResource(configManager); editReportServerParameterPane.update(configManager);
} catch (Exception ex) { Env currentEnv = FRContext.getCurrentEnv();
FRContext.getLogger().error(ex.getMessage(), ex); try {
} currentEnv.writeResource(configManager);
} catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex);
}
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class};
}
});
} }
}); });
editReportServerParameterDialog.setVisible(true); editReportServerParameterDialog.setVisible(true);

31
designer/src/com/fr/design/actions/server/StyleListAction.java

@ -4,6 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; 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.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -12,6 +14,8 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -40,14 +44,25 @@ public class StyleListAction extends UpdateAction {
styleListDialog.addDialogActionListener(new DialogActionAdapter() { styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
styleListPane.update(ConfigManager.getProviderInstance()); Configurations.update(new Worker() {
//marks:保存数据 @Override
Env currentEnv = FRContext.getCurrentEnv(); public void run() {
try { styleListPane.update(ConfigManager.getProviderInstance());
currentEnv.writeResource(ConfigManager.getProviderInstance()); //marks:保存数据
} catch (Exception e) { Env currentEnv = FRContext.getCurrentEnv();
FRContext.getLogger().error(e.getMessage(), e); try {
} currentEnv.writeResource(ConfigManager.getProviderInstance());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ServerConfig.class};
}
});
} }
}); });

40
designer/src/com/fr/design/actions/server/WidgetManagerAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -11,9 +12,12 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.WidgetManagerPane; import com.fr.design.webattr.WidgetManagerPane;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.form.ui.WidgetManager; import com.fr.form.ui.WidgetManager;
import com.fr.form.ui.WidgetManagerProvider; import com.fr.form.ui.WidgetManagerProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -43,21 +47,31 @@ public class WidgetManagerAction extends UpdateAction {
BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame,new DialogActionAdapter() { BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame,new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
widgetManagerPane.update(widgetManager); Configurations.update(new Worker() {
@Override
public void run() {
widgetManagerPane.update(widgetManager);
Env currentEnv = FRContext.getCurrentEnv(); Env currentEnv = FRContext.getCurrentEnv();
try { try {
currentEnv.writeResource(widgetManager); currentEnv.writeResource(widgetManager);
//marks: 由于这个面板还改变权限相关的操作,所以这个时候还要操作权限配置 //marks: 由于这个面板还改变权限相关的操作,所以这个时候还要操作权限配置
// currentEnv.writeResource(FRContext.getPrivilegeManager()); // currentEnv.writeResource(FRContext.getPrivilegeManager());
} catch (Exception ex) { } catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex); FRContext.getLogger().error(ex.getMessage(), ex);
} }
DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter();
if (model != null) { if (model != null) {
model.widgetConfigChanged(); model.widgetConfigChanged();
} }
designerFrame.getSelectedJTemplate().refreshToolArea(); designerFrame.getSelectedJTemplate().refreshToolArea();
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{WidgetInfoConfig.class};
}
});
} }
}); });

34
designer/src/com/fr/design/webattr/PageToolBarPane.java

@ -1,6 +1,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.config.Configuration;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -16,7 +17,10 @@ import com.fr.report.web.Location;
import com.fr.report.web.ToolBarManager; import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebContent; import com.fr.report.web.WebContent;
import com.fr.report.web.WebPage; 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.ReportWebAttr;
import com.fr.web.attr.ReportWebConfig;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -142,11 +146,10 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public WebPage updateBean() { public WebPage updateBean() {
WebPage webPage = new WebPage(); WebPage webPage = new WebPage();
if (isUseToolBarCheckBox.isSelected()) {
if (this.isUseToolBarCheckBox.isSelected()) { webPage.setToolBarManagers(toolBarManagers);
webPage.setToolBarManagers(this.toolBarManagers);
}else { }else {
webPage.setToolBarManagers(new ToolBarManager[0]); webPage.setToolBarManagers(new ToolBarManager[0]);
} }
for (int i = 0; i < eventPane.update().size(); i++) { for (int i = 0; i < eventPane.update().size(); i++) {
Listener listener = eventPane.update().get(i); Listener listener = eventPane.update().get(i);
@ -174,12 +177,23 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void doOk() { public void doOk() {
ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); Configurations.update(new Worker() {
if (reportWebAttr == null) { @Override
reportWebAttr = new ReportWebAttr(); public void run() {
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
} if (reportWebAttr == null) {
reportWebAttr.setWebPage(serverPageToolBarPane.updateBean()); reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebPage(serverPageToolBarPane.updateBean());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class};
}
});
} }
}); });
serverPageDialog.setVisible(true); serverPageDialog.setVisible(true);

37
designer/src/com/fr/design/webattr/ViewToolBarPane.java

@ -1,6 +1,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.config.Configuration;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -15,7 +16,10 @@ import com.fr.report.web.Location;
import com.fr.report.web.ToolBarManager; import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebContent; import com.fr.report.web.WebContent;
import com.fr.report.web.WebView; 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.ReportWebAttr;
import com.fr.web.attr.ReportWebConfig;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -113,14 +117,14 @@ public class ViewToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public WebView updateBean() { public WebView updateBean() {
WebView webView = new WebView(); WebView webView = new WebView();
if (this.isUseToolBarCheckBox.isSelected()) { if (isUseToolBarCheckBox.isSelected()) {
webView.setToolBarManagers(this.toolBarManagers); webView.setToolBarManagers(toolBarManagers);
} else { } else {
webView.setToolBarManagers(new ToolBarManager[0]); webView.setToolBarManagers(new ToolBarManager[0]);
} }
webView.setSortFuncCheck(this.sortCheckBox.isSelected()); webView.setSortFuncCheck(sortCheckBox.isSelected());
webView.setConditionFuncCheck(this.conditonFilterBox.isSelected()); webView.setConditionFuncCheck(conditonFilterBox.isSelected());
webView.setListFuncCheck(this.listFilterBox.isSelected()); webView.setListFuncCheck(listFilterBox.isSelected());
for (int i = 0; i < eventPane.update().size(); i++) { for (int i = 0; i < eventPane.update().size(); i++) {
Listener listener = eventPane.update().get(i); Listener listener = eventPane.update().get(i);
webView.addListener(listener); webView.addListener(listener);
@ -143,12 +147,23 @@ public class ViewToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void doOk() { public void doOk() {
ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); Configurations.update(new Worker() {
if (reportWebAttr == null) { @Override
reportWebAttr = new ReportWebAttr(); public void run() {
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
} if (reportWebAttr == null) {
reportWebAttr.setWebView(serverPageToolBarPane.updateBean()); reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebView(serverPageToolBarPane.updateBean());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class};
}
});
} }
}); });
serverPageDialog.setVisible(true); serverPageDialog.setVisible(true);

27
designer/src/com/fr/design/webattr/WriteToolBarPane.java

@ -2,6 +2,7 @@ package com.fr.design.webattr;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.config.Configuration;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -20,7 +21,10 @@ import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebContent; import com.fr.report.web.WebContent;
import com.fr.report.web.WebWrite; import com.fr.report.web.WebWrite;
import com.fr.stable.Constants; 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.ReportWebAttr;
import com.fr.web.attr.ReportWebConfig;
import javax.swing.*; import javax.swing.*;
@ -260,12 +264,23 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void doOk() { public void doOk() {
ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); Configurations.update(new Worker() {
if (reportWebAttr == null) { @Override
reportWebAttr = new ReportWebAttr(); public void run() {
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr); ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
} if (reportWebAttr == null) {
reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean()); reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class};
}
});
} }
}); });
serverPageDialog.setVisible(true); serverPageDialog.setVisible(true);

47
designer_base/src/com/fr/design/actions/server/ConnectionListAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.server;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ModifiedTable; import com.fr.base.ModifiedTable;
import com.fr.config.Configuration;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -14,10 +15,13 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.ConnectionConfig;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -74,20 +78,41 @@ public class ConnectionListAction extends UpdateAction {
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
if (!databaseManagerPane.isNamePermitted()) { Configurations.update(new Worker() {
databaseListDialog.setDoOKSucceed(false); @Override
return; public void run() {
} if (!databaseManagerPane.isNamePermitted()) {
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) { databaseListDialog.setDoOKSucceed(false);
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 return;
return; }
} if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) {
// marks:保存数据 //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
writeFile(datasourceManager); return;
}
// marks:保存数据
writeFile(datasourceManager);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ConnectionConfig.class};
}
});
} }
public void doCancel() { public void doCancel() {
datasourceManager.synchronizedWithServer(); Configurations.update(new Worker() {
@Override
public void run() {
datasourceManager.synchronizedWithServer();
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ConnectionConfig.class};
}
});
} }
}); });
databaseListDialog.setVisible(true); databaseListDialog.setVisible(true);

29
designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java

@ -6,16 +6,20 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FunctionManagerPane; import com.fr.design.formula.FunctionManagerPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.FunctionConfig;
import com.fr.file.FunctionManager; import com.fr.file.FunctionManager;
import com.fr.file.FunctionManagerProvider; import com.fr.file.FunctionManagerProvider;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -45,13 +49,24 @@ public class FunctionManagerAction extends UpdateAction {
final FunctionManagerProvider functionManager = FunctionManager.getProviderInstance(); final FunctionManagerProvider functionManager = FunctionManager.getProviderInstance();
functionManagerDialog.addDialogActionListener(new DialogActionAdapter() { functionManagerDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
functionManagerPane.update(functionManager); Configurations.update(new Worker() {
Env currentEnv = FRContext.getCurrentEnv(); @Override
try { public void run() {
currentEnv.writeResource(functionManager); functionManagerPane.update(functionManager);
} catch (Exception e) { Env currentEnv = FRContext.getCurrentEnv();
FRContext.getLogger().error(e.getMessage(), e); try {
} currentEnv.writeResource(functionManager);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{FunctionConfig.class};
}
});
} }
}); });
functionManagerPane.populate(functionManager); functionManagerPane.populate(functionManager);

43
designer_base/src/com/fr/design/actions/server/GlobalParameterAction.java

@ -7,6 +7,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.config.ServerConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -17,6 +19,8 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.parameter.ParameterManagerPane; import com.fr.design.parameter.ParameterManagerPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider; import com.fr.base.ConfigManagerProvider;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -50,20 +54,31 @@ public class GlobalParameterAction extends UpdateAction {
parameterManagerPane.populate(configManager); parameterManagerPane.populate(configManager);
parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
//apply new parameter list. Configurations.update(new Worker() {
parameterManagerPane.update(configManager); @Override
//marks:保存数据 public void run() {
Env currentEnv = FRContext.getCurrentEnv(); //apply new parameter list.
try { parameterManagerPane.update(configManager);
currentEnv.writeResource(configManager); //marks:保存数据
} catch (Exception ex) { Env currentEnv = FRContext.getCurrentEnv();
FRContext.getLogger().error(ex.getMessage(), ex); try {
} currentEnv.writeResource(configManager);
DesignModelAdapter<?, ?> model = DesignModelAdapter.getCurrentModelAdapter(); } catch (Exception ex) {
if (model != null) { FRContext.getLogger().error(ex.getMessage(), ex);
model.parameterChanged(); }
} DesignModelAdapter<?, ?> model = DesignModelAdapter.getCurrentModelAdapter();
parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); if (model != null) {
model.parameterChanged();
}
parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ServerConfig.class};
}
});
} }
}); });
parameterManagerDialog.setModal(true); parameterManagerDialog.setModal(true);

70
designer_base/src/com/fr/design/actions/server/GlobalTableDataAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.*; import com.fr.base.*;
import com.fr.config.Configuration;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -18,7 +19,10 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.file.TableDataConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -68,8 +72,18 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
populate(datasourceManager); populate(datasourceManager);
} }
protected void renameConnection(String oldName, String newName) { protected void renameConnection(final String oldName, final String newName) {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName); Configurations.update(new Worker() {
@Override
public void run() {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{DatasourceManager.class};
}
});
} }
}; };
final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null); final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null);
@ -78,26 +92,48 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
@Override @Override
public void doOk() { public void doOk() {
if (!globalTableDataPane.isNamePermitted()) { Configurations.update(new Worker() {
globalTableDataDialog.setDoOKSucceed(false); @Override
return; public void run() {
} if (!globalTableDataPane.isNamePermitted()) {
globalTableDataDialog.setDoOKSucceed(false);
return;
}
DesignTableDataManager.clearGlobalDs();
globalTableDataPane.update(datasourceManager);
if (!doWithDatasourceManager(datasourceManager, backupManager, globalTableDataPane, globalTableDataDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
writeFile(datasourceManager);
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
}
DesignTableDataManager.clearGlobalDs(); @Override
globalTableDataPane.update(datasourceManager); public Class<? extends Configuration>[] targets() {
if (!doWithDatasourceManager(datasourceManager, backupManager, globalTableDataPane, globalTableDataDialog)) { return new Class[]{TableDataConfig.class};
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 }
return; });
}
writeFile(datasourceManager);
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
} }
public void doCancel() { public void doCancel() {
datasourceManager.synchronizedWithServer(); Configurations.update(new Worker() {
@Override
public void run() {
datasourceManager.synchronizedWithServer();
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{TableDataConfig.class
};
}
});
} }
}); });
globalTableDataDialog.setVisible(true); globalTableDataDialog.setVisible(true);

35
designer_base/src/com/fr/design/actions/server/ProcedureListAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -13,7 +14,10 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.file.ProcedureConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -42,16 +46,27 @@ public class ProcedureListAction extends UpdateAction {
BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame,null); BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame,null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
DesignTableDataManager.clearGlobalDs(); Configurations.update(new Worker() {
databaseManagerPane.update(datasourceManager); @Override
public void run() {
// marks:保存数据 DesignTableDataManager.clearGlobalDs();
try { databaseManagerPane.update(datasourceManager);
FRContext.getCurrentEnv().writeResource(datasourceManager);
} catch (Exception e) { // marks:保存数据
FRContext.getLogger().error(e.getMessage()); try {
} FRContext.getCurrentEnv().writeResource(datasourceManager);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); } catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ProcedureConfig.class};
}
});
} }
}); });
databaseListDialog.setVisible(true); databaseListDialog.setVisible(true);

41
designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection;
@ -8,10 +9,13 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.ConnectionListAction; import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.ConnectionConfig;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -96,17 +100,38 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
connectionListDialog.setDoOKSucceed(false); connectionListDialog.setDoOKSucceed(false);
return; return;
} }
if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane, Configurations.update(new Worker() {
connectionListDialog)) { @Override
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 public void run() {
return; if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane,
} connectionListDialog)) {
// marks:保存数据 //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
ConnectionListAction.writeFile(datasourceManager); return;
}
// marks:保存数据
ConnectionListAction.writeFile(datasourceManager);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ConnectionConfig.class};
}
});
} }
public void doCancel() { public void doCancel() {
datasourceManager.synchronizedWithServer(); Configurations.update(new Worker() {
@Override
public void run() {
datasourceManager.synchronizedWithServer();
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ConnectionConfig.class};
}
});
} }
}); });
connectionListDialog.setVisible(true); connectionListDialog.setVisible(true);

Loading…
Cancel
Save