Browse Source

Merge pull request #1693 in BA/design from ~KERRY/design:feature/10.0 to feature/10.0

* commit '39a28c729bb172c0c2491b3f86dc6e35f21ffd23':
  wu
  wu
  REPORT-6956 设计器适配10.0配置写法
master
superman 7 years ago
parent
commit
1020b8d7e8
  1. 7
      designer/src/com/fr/design/actions/report/ReportWebAttrAction.java
  2. 4
      designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java
  3. 22
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  4. 16
      designer/src/com/fr/design/webattr/CommonPane.java
  5. 13
      designer/src/com/fr/design/webattr/EditReportServerParameterPane.java
  6. 13
      designer/src/com/fr/design/webattr/PageToolBarPane.java
  7. 6
      designer/src/com/fr/design/webattr/PageWebSettingPane.java
  8. 10
      designer/src/com/fr/design/webattr/ReportWebAttrPane.java
  9. 13
      designer/src/com/fr/design/webattr/ViewToolBarPane.java
  10. 6
      designer/src/com/fr/design/webattr/ViewWebSettingPane.java
  11. 6
      designer/src/com/fr/design/webattr/WebCssPane.java
  12. 6
      designer/src/com/fr/design/webattr/WebJsPane.java
  13. 25
      designer/src/com/fr/design/webattr/WebSettingPane.java
  14. 13
      designer/src/com/fr/design/webattr/WriteToolBarPane.java
  15. 6
      designer/src/com/fr/design/webattr/WriteWebSettingPane.java

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

@ -15,7 +15,7 @@ import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -46,8 +46,7 @@ public class ReportWebAttrAction extends JWorkBookAction {
final ReportWebAttrPane reportWebAttrPane = new ReportWebAttrPane() { final ReportWebAttrPane reportWebAttrPane = new ReportWebAttrPane() {
@Override @Override
public void complete() { public void complete() {
ReportWebConfig config = wbTpl.getReportWebAttr(); populate(wbTpl.getReportWebAttr());
populate((ReportWebConfig) config.clone());
} }
}; };
final BasicDialog dialog = reportWebAttrPane.showWindow( final BasicDialog dialog = reportWebAttrPane.showWindow(
@ -66,7 +65,7 @@ public class ReportWebAttrAction extends JWorkBookAction {
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class}; return new Class[]{ReportWebAttr.class};
} }
}); });

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

@ -15,7 +15,7 @@ import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -60,7 +60,7 @@ public class ServerConfigManagerAction extends UpdateAction {
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class, ServerConfig.class}; return new Class[]{ReportWebAttr.class, ServerConfig.class};
} }
}); });

22
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -22,7 +24,7 @@ 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.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -34,7 +36,7 @@ import java.util.List;
* Date: 13-9-9 * Date: 13-9-9
* Time: 下午4:58 * Time: 下午4:58
*/ */
public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<ReportWebConfig> implements AuthorityEditToolBarComponent { public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<ReportWebAttr> implements AuthorityEditToolBarComponent {
private static final int SMALL_GAP = 13; private static final int SMALL_GAP = 13;
private static final int GAP = 25; private static final int GAP = 25;
private static final int PRE_GAP = 9; private static final int PRE_GAP = 9;
@ -193,7 +195,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
} }
private ReportWebConfig getReportWebAttr() { private ReportWebAttr getReportWebAttr() {
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!editingTemplate.isJWorkBook()) { if (!editingTemplate.isJWorkBook()) {
return null; return null;
@ -213,8 +215,9 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
JWorkBook editingWorkBook = (JWorkBook) editingTemplate; JWorkBook editingWorkBook = (JWorkBook) editingTemplate;
TemplateWorkBook wbTpl = editingWorkBook.getTarget(); TemplateWorkBook wbTpl = editingWorkBook.getTarget();
ReportWebConfig rw = wbTpl.getReportWebAttr(); ReportWebAttr rw = wbTpl.getReportWebAttr();
ReportWebConfig webAttr = ReportWebConfig.getInstance(); ConfigManagerProvider cm = ConfigManager.getProviderInstance();
ReportWebAttr webAttr = ((ReportWebAttr) cm.getGlobalAttribute(ReportWebAttr.class));
//wbTpl.clear先清空 //wbTpl.clear先清空
//再将所有的保存进去 //再将所有的保存进去
@ -261,7 +264,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
} }
public void populateBean(ReportWebConfig reportWebAttr) { public void populateBean(ReportWebAttr reportWebAttr) {
this.remove(title); this.remove(title);
// 如果是空值就说明采用服务器配置了 // 如果是空值就说明采用服务器配置了
if (reportWebAttr == null || this.getWebContent(reportWebAttr) == null) { if (reportWebAttr == null || this.getWebContent(reportWebAttr) == null) {
@ -277,7 +280,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
populate(webContent.getToolBarManagers()); populate(webContent.getToolBarManagers());
} }
public ReportWebConfig updateBean() { public ReportWebAttr updateBean() {
return null; return null;
} }
@ -315,7 +318,8 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
private void populateServerSettings() { private void populateServerSettings() {
ReportWebConfig webAttr = (ReportWebConfig)ReportWebConfig.getInstance().clone(); ConfigManagerProvider cm = ConfigManager.getProviderInstance();
ReportWebAttr webAttr = ((ReportWebAttr) cm.getGlobalAttribute(ReportWebAttr.class));
if (this.getWebContent(webAttr) != null) { if (this.getWebContent(webAttr) != null) {
populate(this.getWebContent(webAttr).getToolBarManagers()); populate(this.getWebContent(webAttr).getToolBarManagers());
} }
@ -326,7 +330,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
} }
private T getWebContent(ReportWebConfig reportWebAttr) { private T getWebContent(ReportWebAttr reportWebAttr) {
if (choseComboBox.getSelectedIndex() == 0) { if (choseComboBox.getSelectedIndex() == 0) {
return reportWebAttr == null ? null : (T) reportWebAttr.getWebPage(); return reportWebAttr == null ? null : (T) reportWebAttr.getWebPage();
} else if (choseComboBox.getSelectedIndex() == 1) { } else if (choseComboBox.getSelectedIndex() == 1) {

16
designer/src/com/fr/design/webattr/CommonPane.java

@ -17,15 +17,15 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.editor.LongEditor; import com.fr.design.editor.editor.LongEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
public class CommonPane extends JPanel { public class CommonPane extends JPanel {
private UITextField titleTextField; private UITextField titleTextField;
private LongEditor cacheValidateTimeEditor; private LongEditor cacheValidateTimeEditor;
public CommonPane() { public CommonPane() {
this.initComponents(); this.initComponents();
} }
@ -38,12 +38,12 @@ public class CommonPane extends JPanel {
this.titleTextField = new UITextField(24); this.titleTextField = new UITextField(24);
this.cacheValidateTimeEditor = new LongEditor(); this.cacheValidateTimeEditor = new LongEditor();
JComponent[][] comps = { JComponent[][] comps = {
{new UILabel(Inter.getLocText("Title") + ":"), this.titleTextField, null}, {new UILabel(Inter.getLocText("Title") + ":"), this.titleTextField, null},
{new UILabel(Inter.getLocText("CacheValidateTime") + ":"), this.cacheValidateTimeEditor, new UILabel("milliseconds")} {new UILabel(Inter.getLocText("CacheValidateTime") + ":"), this.cacheValidateTimeEditor, new UILabel("milliseconds")}
}; };
this.add( this.add(
TableLayoutHelper.createCommonTableLayoutPane( TableLayoutHelper.createCommonTableLayoutPane(
comps, comps,
@ -53,15 +53,15 @@ public class CommonPane extends JPanel {
BorderLayout.CENTER); BorderLayout.CENTER);
} }
public void populate(ReportWebConfig reportWebAttr) { public void populate(ReportWebAttr reportWebAttr) {
if (reportWebAttr.getTitle() != null && reportWebAttr.getTitle().length() > 0) { if (reportWebAttr.getTitle() != null && reportWebAttr.getTitle().length() > 0) {
this.titleTextField.setText(reportWebAttr.getTitle()); this.titleTextField.setText(reportWebAttr.getTitle());
} }
this.cacheValidateTimeEditor.setValue(Long.valueOf(reportWebAttr.getCacheValidateTime())); this.cacheValidateTimeEditor.setValue(Long.valueOf(reportWebAttr.getCacheValidateTime()));
} }
public void update(ReportWebConfig reportWebAttr) { public void update(ReportWebAttr reportWebAttr) {
if (!StringUtils.isEmpty(this.titleTextField.getText())) { if (!StringUtils.isEmpty(this.titleTextField.getText())) {
reportWebAttr.setTitle(this.titleTextField.getText()); reportWebAttr.setTitle(this.titleTextField.getText());
} else { } else {

13
designer/src/com/fr/design/webattr/EditReportServerParameterPane.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.ServerConfig;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
@ -12,7 +13,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -30,7 +31,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
//TODO 表单 //TODO 表单
// private FormToolBarPane formPane; // private FormToolBarPane formPane;
private WriteToolBarPane writePane; private WriteToolBarPane writePane;
private ReportWebConfig webAttr; private ReportWebAttr webAttr;
private WebCssPane cssPane; private WebCssPane cssPane;
@ -78,7 +79,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
// ProjectConstants.RESOURCES_NAME + // ProjectConstants.RESOURCES_NAME +
// File.separator + reportServerConfig.fileName()); // File.separator + reportServerConfig.fileName());
webAttr = (ReportWebConfig) ReportWebConfig.getInstance().clone(); webAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (webAttr != null) { if (webAttr != null) {
pagePane.populateBean(webAttr.getWebPage()); pagePane.populateBean(webAttr.getWebPage());
viewPane.populateBean(webAttr.getWebView()); viewPane.populateBean(webAttr.getWebView());
@ -95,7 +96,11 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
* Update. * Update.
*/ */
public void update(ServerConfig reportServerConfig) { public void update(ServerConfig reportServerConfig) {
ReportWebConfig webAttr = ReportWebConfig.getInstance(); ReportWebAttr webAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (webAttr == null) {
webAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, webAttr);
}
webAttr.setWebPage(pagePane.updateBean()); webAttr.setWebPage(pagePane.updateBean());
webAttr.setWebView(viewPane.updateBean()); webAttr.setWebView(viewPane.updateBean());
webAttr.setWebWrite(writePane.updateBean()); webAttr.setWebWrite(writePane.updateBean());

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

@ -1,5 +1,6 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.config.Configuration; 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;
@ -18,7 +19,7 @@ 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.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -166,7 +167,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void editServerToolBarPane() { public void editServerToolBarPane() {
final PageToolBarPane serverPageToolBarPane = new PageToolBarPane(); final PageToolBarPane serverPageToolBarPane = new PageToolBarPane();
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr != null) { if (reportWebAttr != null) {
serverPageToolBarPane.populateBean(reportWebAttr.getWebPage()); serverPageToolBarPane.populateBean(reportWebAttr.getWebPage());
} }
@ -178,13 +179,17 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
public void run() { public void run() {
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr == null) {
reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebPage(serverPageToolBarPane.updateBean()); reportWebAttr.setWebPage(serverPageToolBarPane.updateBean());
} }
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class}; return new Class[]{ReportWebAttr.class};
} }
}); });

6
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.general.Inter;
import com.fr.report.web.ToolBarManager; import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebPage; import com.fr.report.web.WebPage;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
public class PageWebSettingPane extends WebSettingPane<WebPage> { public class PageWebSettingPane extends WebSettingPane<WebPage> {
private UIRadioButton centerRadioButton; private UIRadioButton centerRadioButton;
@ -119,7 +119,7 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
} }
@Override @Override
protected WebPage getWebContent(ReportWebConfig reportWebAttr) { protected WebPage getWebContent(ReportWebAttr reportWebAttr) {
return reportWebAttr == null ? null :reportWebAttr.getWebPage(); return reportWebAttr == null ? null :reportWebAttr.getWebPage();
} }
@ -129,7 +129,7 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
} }
@Override @Override
protected void setWebContent(ReportWebConfig reportWebAttr,WebPage webContent) { protected void setWebContent(ReportWebAttr reportWebAttr,WebPage webContent) {
reportWebAttr.setWebPage(webContent); reportWebAttr.setWebPage(webContent);
} }
} }

10
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.BackgroundPane;
import com.fr.design.style.background.BackgroundPane4Browser; import com.fr.design.style.background.BackgroundPane4Browser;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -18,7 +18,7 @@ import java.awt.*;
* ReportWebAttr Dialog * ReportWebAttr Dialog
*/ */
public class ReportWebAttrPane extends LoadingBasicPane { public class ReportWebAttrPane extends LoadingBasicPane {
private ReportWebConfig reportWebAttr; private ReportWebAttr reportWebAttr;
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private CommonPane commonPane; private CommonPane commonPane;
@ -60,9 +60,9 @@ public class ReportWebAttrPane extends LoadingBasicPane {
return Inter.getLocText("FR-Designer_Template_Web_Attributes"); return Inter.getLocText("FR-Designer_Template_Web_Attributes");
} }
public void populate(ReportWebConfig reportWebAttr) { public void populate(ReportWebAttr reportWebAttr) {
if (reportWebAttr == null) { if (reportWebAttr == null) {
reportWebAttr = ReportWebConfig.getInstance(); reportWebAttr = new ReportWebAttr();
} }
this.reportWebAttr = reportWebAttr; this.reportWebAttr = reportWebAttr;
@ -79,7 +79,7 @@ public class ReportWebAttrPane extends LoadingBasicPane {
} }
public ReportWebConfig update() { public ReportWebAttr update() {
reportWebAttr.setPrinter(this.serverPrintPane.update()); reportWebAttr.setPrinter(this.serverPrintPane.update());
pageWeb.update(reportWebAttr); pageWeb.update(reportWebAttr);
writeWeb.update(reportWebAttr); writeWeb.update(reportWebAttr);

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

@ -1,5 +1,6 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.config.Configuration; 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;
@ -17,7 +18,7 @@ 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.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -136,7 +137,7 @@ public class ViewToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void editServerToolBarPane() { public void editServerToolBarPane() {
final ViewToolBarPane serverPageToolBarPane = new ViewToolBarPane(); final ViewToolBarPane serverPageToolBarPane = new ViewToolBarPane();
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr != null) { if (reportWebAttr != null) {
serverPageToolBarPane.populateBean(reportWebAttr.getWebView()); serverPageToolBarPane.populateBean(reportWebAttr.getWebView());
} }
@ -148,13 +149,17 @@ public class ViewToolBarPane extends AbstractEditToolBarPane {
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
public void run() { public void run() {
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr == null) {
reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebView(serverPageToolBarPane.updateBean()); reportWebAttr.setWebView(serverPageToolBarPane.updateBean());
} }
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class}; return new Class[]{ReportWebAttr.class};
} }
}); });

6
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.general.Inter;
import com.fr.report.web.ToolBarManager; import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebView; import com.fr.report.web.WebView;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -73,7 +73,7 @@ public class ViewWebSettingPane extends WebSettingPane<WebView> {
} }
@Override @Override
protected WebView getWebContent(ReportWebConfig reportWebAttr) { protected WebView getWebContent(ReportWebAttr reportWebAttr) {
return reportWebAttr == null ? null : reportWebAttr.getWebView(); return reportWebAttr == null ? null : reportWebAttr.getWebView();
} }
@ -83,7 +83,7 @@ public class ViewWebSettingPane extends WebSettingPane<WebView> {
} }
@Override @Override
protected void setWebContent(ReportWebConfig reportWebAttr, WebView webContent) { protected void setWebContent(ReportWebAttr reportWebAttr, WebView webContent) {
reportWebAttr.setWebView(webContent); reportWebAttr.setWebView(webContent);
} }
@Override @Override

6
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.general.Inter;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
public class WebCssPane extends BasicPane { public class WebCssPane extends BasicPane {
private UITextField localText; private UITextField localText;
@ -98,7 +98,7 @@ public class WebCssPane extends BasicPane {
return Inter.getLocText("ReportServerP-Import_Css"); return Inter.getLocText("ReportServerP-Import_Css");
} }
public void populate(ReportWebConfig reportWebAttr) { public void populate(ReportWebAttr reportWebAttr) {
if (reportWebAttr == null) { if (reportWebAttr == null) {
centerPane.populateBean(new ArrayList<String>()); centerPane.populateBean(new ArrayList<String>());
return; return;
@ -113,7 +113,7 @@ public class WebCssPane extends BasicPane {
centerPane.populateBean(list); centerPane.populateBean(list);
} }
public void update(ReportWebConfig reportWebAttr) { public void update(ReportWebAttr reportWebAttr) {
List<String> valueList = centerPane.updateBean(); List<String> valueList = centerPane.updateBean();
reportWebAttr.clearCSSImportList(); reportWebAttr.clearCSSImportList();
for (int i = 0; i < valueList.size(); i++) { for (int i = 0; i < valueList.size(); i++) {

6
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.general.Inter;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
public class WebJsPane extends BasicPane { public class WebJsPane extends BasicPane {
private UITextField localText; private UITextField localText;
@ -260,7 +260,7 @@ public class WebJsPane extends BasicPane {
chooseFile.setEnabled(false); chooseFile.setEnabled(false);
} }
public void populate(ReportWebConfig reportWebAttr) { public void populate(ReportWebAttr reportWebAttr) {
if (reportWebAttr == null) { if (reportWebAttr == null) {
editingPane.populateBean(new ArrayList<String>()); editingPane.populateBean(new ArrayList<String>());
return; return;
@ -274,7 +274,7 @@ public class WebJsPane extends BasicPane {
editingPane.populateBean(list); editingPane.populateBean(list);
} }
public void update(ReportWebConfig reportWebAttr) { public void update(ReportWebAttr reportWebAttr) {
List<String> valueList = editingPane.updateBean(); List<String> valueList = editingPane.updateBean();
reportWebAttr.clearJSImportList(); reportWebAttr.clearJSImportList();
for (int i = 0; i < valueList.size(); i++) { for (int i = 0; i < valueList.size(); i++) {

25
designer/src/com/fr/design/webattr/WebSettingPane.java

@ -1,5 +1,6 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -12,8 +13,9 @@ import com.fr.form.event.Listener;
import com.fr.general.Inter; import com.fr.general.Inter;
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.base.ConfigManagerProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -22,7 +24,7 @@ import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane<ReportWebConfig> { public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane<ReportWebAttr> {
private static final String[] CHOOSEITEM = new String[] { private static final String[] CHOOSEITEM = new String[] {
Inter.getLocText("FR-Designer_I_Want_To_Set_Single"), Inter.getLocText("FR-Designer_I_Want_To_Set_Single"),
Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings") Inter.getLocText("FR-Designer_Using_Server_Report_View_Settings")
@ -31,7 +33,7 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
private EventPane eventPane; private EventPane eventPane;
private ToolBarDragPane dragToolBarPane; private ToolBarDragPane dragToolBarPane;
private UIComboBox choseComboBox; private UIComboBox choseComboBox;
private static final int SINGLE_SET = 0; private static final int SINGLE_SET = 0;
private static final int SERVER_SET = 1; private static final int SERVER_SET = 1;
private static final int ZERO = 0; private static final int ZERO = 0;
@ -117,7 +119,7 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
protected abstract String[] getEventNames(); protected abstract String[] getEventNames();
@Override @Override
public void populateBean(ReportWebConfig reportWebAttr) { public void populateBean(ReportWebAttr reportWebAttr) {
if (reportWebAttr == null || this.getWebContent(reportWebAttr) == null) {// 如果是空值就说明采用服务器配置了 if (reportWebAttr == null || this.getWebContent(reportWebAttr) == null) {// 如果是空值就说明采用服务器配置了
choseComboBox.removeItemListener(itemListener); choseComboBox.removeItemListener(itemListener);
choseComboBox.setSelectedIndex(SERVER_SET); choseComboBox.setSelectedIndex(SERVER_SET);
@ -145,7 +147,7 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
} }
public void update(ReportWebConfig reportWebAttr) { public void update(ReportWebAttr reportWebAttr) {
if (this.choseComboBox.getSelectedIndex() == SERVER_SET) { if (this.choseComboBox.getSelectedIndex() == SERVER_SET) {
setWebContent(reportWebAttr, null); setWebContent(reportWebAttr, null);
reportWebAttr = is_Null_ReportWebAttr(reportWebAttr) ? null : reportWebAttr; reportWebAttr = is_Null_ReportWebAttr(reportWebAttr) ? null : reportWebAttr;
@ -155,11 +157,11 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
} }
@Override @Override
public ReportWebConfig updateBean() { public ReportWebAttr updateBean() {
return null; return null;
} }
private ReportWebConfig TemplateupdateBean(ReportWebConfig reportWebAttr) { private ReportWebAttr TemplateupdateBean(ReportWebAttr reportWebAttr) {
T webContent = updateSubWebSettingBean(); T webContent = updateSubWebSettingBean();
ToolBarManager[] toolBarManagers = dragToolBarPane.updateBean(); ToolBarManager[] toolBarManagers = dragToolBarPane.updateBean();
webContent.setToolBarManagers(toolBarManagers); webContent.setToolBarManagers(toolBarManagers);
@ -171,13 +173,13 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
return reportWebAttr; return reportWebAttr;
} }
protected abstract T getWebContent(ReportWebConfig reportWebAttr); protected abstract T getWebContent(ReportWebAttr reportWebAttr);
protected abstract void populateSubWebSettingrBean(T ob); protected abstract void populateSubWebSettingrBean(T ob);
protected abstract T updateSubWebSettingBean(); protected abstract T updateSubWebSettingBean();
protected abstract void setWebContent(ReportWebConfig reportWebAttr, T ob); protected abstract void setWebContent(ReportWebAttr reportWebAttr, T ob);
protected abstract WidgetOption[] getToolBarInstance(); protected abstract WidgetOption[] getToolBarInstance();
@ -189,7 +191,8 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
} }
private void populateServerSettings() { private void populateServerSettings() {
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ConfigManagerProvider configManager = ConfigManager.getProviderInstance();
ReportWebAttr reportWebAttr = ((ReportWebAttr)configManager.getGlobalAttribute(ReportWebAttr.class));
T webContent = this.getWebContent(reportWebAttr); T webContent = this.getWebContent(reportWebAttr);
if(webContent == null){ if(webContent == null){
return; return;
@ -214,7 +217,7 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
* *
* @return 模板web属性书否为空 * @return 模板web属性书否为空
*/ */
public static boolean is_Null_ReportWebAttr(ReportWebConfig reportWebAttr) { public static boolean is_Null_ReportWebAttr(ReportWebAttr reportWebAttr) {
if (reportWebAttr == null) { if (reportWebAttr == null) {
return true; return true;
} }

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

@ -1,6 +1,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.config.Configuration; 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;
@ -22,7 +23,7 @@ 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.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
@ -253,7 +254,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
@Override @Override
public void editServerToolBarPane() { public void editServerToolBarPane() {
final WriteToolBarPane serverPageToolBarPane = new WriteToolBarPane(); final WriteToolBarPane serverPageToolBarPane = new WriteToolBarPane();
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr != null) { if (reportWebAttr != null) {
serverPageToolBarPane.populateBean(reportWebAttr.getWebWrite()); serverPageToolBarPane.populateBean(reportWebAttr.getWebWrite());
} }
@ -265,13 +266,17 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
public void run() { public void run() {
ReportWebConfig reportWebAttr = ReportWebConfig.getInstance(); ReportWebAttr reportWebAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class));
if (reportWebAttr == null) {
reportWebAttr = new ReportWebAttr();
ConfigManager.getProviderInstance().putGlobalAttribute(ReportWebAttr.class, reportWebAttr);
}
reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean()); reportWebAttr.setWebWrite(serverPageToolBarPane.updateBean());
} }
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{ReportWebConfig.class}; return new Class[]{ReportWebAttr.class};
} }
}); });

6
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.ToolBarManager;
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.web.attr.ReportWebConfig; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -180,7 +180,7 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
} }
@Override @Override
protected WebWrite getWebContent(ReportWebConfig reportWebAttr) { protected WebWrite getWebContent(ReportWebAttr reportWebAttr) {
return reportWebAttr == null ? null : reportWebAttr.getWebWrite(); return reportWebAttr == null ? null : reportWebAttr.getWebWrite();
} }
@ -190,7 +190,7 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
} }
@Override @Override
protected void setWebContent(ReportWebConfig reportWebAttr, WebWrite webContent) { protected void setWebContent(ReportWebAttr reportWebAttr, WebWrite webContent) {
reportWebAttr.setWebWrite(webContent); reportWebAttr.setWebWrite(webContent);
} }

Loading…
Cancel
Save