Browse Source

Merge pull request #673 in BA/design from ~NEIL/design:release to master

* commit '2169ef5cf934e5fbd589eb5780cb30aff2502f43': (87 commits)
  ct
  ct
  国际化翻译
  无JIRA任务 tab功能屏蔽
  REPORT-1814 表单tab块的改良bug 功能屏蔽
  xxx
  REPORT-1814 表单tab块的页签拖动新功能 bugfix
  pmd的国际化字符串问题
  pmd
  com.dr.data.SubmitJob接口提示更改
  REPORT-1808 字体,背景
  REPORT-1808 font空值判断给予默认值
  1
  REPORT-1808 设计器内tab bug修复
  REPORT-1390 设计器中,在选中“悬浮元素”时,隐藏右侧的“单元格属性表”面板
  遗漏了一个地方
  之前接口开得有问题,部署时算子初始化会出错【读不到函数,因为依赖中有designer的类】
  更改接口,分离原来的方法,单独成接口,为了方便算子生成时获取分组接口里面的函数。没有动FinctionGroup这个接口,因为动这里牵扯太广了,单独做一个接口专职获取公式就好
  REPORT-576 字体设置功能完善
  1
  ...
master
superman 8 years ago
parent
commit
e338a0198e
  1. 2
      .gitignore
  2. 75
      build.performance.gradle
  3. 76
      build.performance.gradle.bak
  4. 4
      designer/src/com/fr/design/actions/cell/NewPresentAction.java
  5. 13
      designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
  6. 8
      designer/src/com/fr/design/actions/file/export/PDFExportAction.java
  7. 110
      designer/src/com/fr/design/javascript/ListenerEditPane.java
  8. 13
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  9. 2
      designer/src/com/fr/design/mainframe/WorkBookModelAdapter.java
  10. 2
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  11. 2
      designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java
  12. 10
      designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java
  13. 106
      designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java
  14. 2
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  15. 11
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  16. 6
      designer/src/com/fr/grid/selection/CellSelection.java
  17. 6
      designer/src/com/fr/grid/selection/FloatSelection.java
  18. 2
      designer/src/com/fr/grid/selection/Selection.java
  19. 69
      designer_base/build.performance.gradle
  20. 69
      designer_base/build.performance.gradle.bak
  21. 22
      designer_base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java
  22. 13
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  23. 112
      designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java
  24. 15
      designer_base/src/com/fr/design/extra/PluginConstants.java
  25. 1
      designer_base/src/com/fr/design/extra/PluginHelper.java
  26. 24
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java
  27. 418
      designer_base/src/com/fr/design/formula/FormulaPane.java
  28. 51
      designer_base/src/com/fr/design/formula/FunctionConstants.java
  29. 2
      designer_base/src/com/fr/design/formula/FunctionDefNAD.java
  30. 7
      designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java
  31. 6
      designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java
  32. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H4.png
  33. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V4.png
  34. 23
      designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java
  35. 2
      designer_base/src/com/fr/design/write/submit/CustomJobPane.java
  36. 17
      designer_base/src/com/fr/env/RemoteEnv.java
  37. 69
      designer_chart/build.performance.gradle
  38. 69
      designer_chart/build.performance.gradle.bak
  39. 53
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  40. 31
      designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java
  41. 2
      designer_chart/src/com/fr/design/module/ChartDesignerModule.java
  42. 2
      designer_form/build.dev.gradle
  43. 2
      designer_form/build.dev.gradle.bak
  44. 70
      designer_form/build.performance.gradle
  45. 69
      designer_form/build.performance.gradle.bak
  46. 2
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  47. 21
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  48. 19
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  49. 197
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  50. 102
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  51. 12
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  52. 229
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  53. 8
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  54. 35
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  55. 29
      designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java
  56. 10
      designer_form/src/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java

2
.gitignore vendored

@ -3,3 +3,5 @@ designer_base/bin
designer_chart/bin designer_chart/bin
designer_form/bin designer_form/bin
*.iml *.iml

75
build.performance.gradle

@ -0,0 +1,75 @@
apply plugin: "java"
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
}
def basicDir="../"
def libDir="${basicDir}/lib"
task appletJar<<{
ant{
mkdir(dir:"./tmp")
mkdir(dir:"build/classes/main")
copy(todir:"build/classes/"){
fileset(dir:"${basicDir}/core/build/classes/main")
fileset(dir:"${basicDir}/chart/build/classes/main")
fileset(dir:"${basicDir}/report/build/classes/main")
fileset(dir:"${basicDir}/platform/build/classes/main")
}
unjar(src:"${libDir}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-8.0.jar"){
fileset(dir:"build/classes"){
exclude(name:"*.*")
exclude(name:"bin/*.*")
exclude(name:"classes/**")
exclude(name:"com/fr/schedule/**")
exclude(name:"com/fr/cell/**")
exclude(name:"com/fr/dialog/**")
exclude(name:"com/fr/view/**")
exclude(name:"com/fr/web/**")
exclude(name:"com/fr/fs/**")
exclude(name:"com/fr/design/**")
exclude(name:"com/fr/start/**")
exclude(name:"com/fr/process/**")
}
fileset(dir:"./tmp"){
include(name:"javax/mail/**")
include(name:"javax/servlet/**")
include(name:"org/freehep/**")
include(name:"com/fr/third/JAI/**")
include(name:"com/fr/third/antlr/**")
include(name:"com/fr/third/javax/**")
include(name:"com/sun/xml/**")
include(name:"javax/xml/**")
}
fileset(dir:"build/classes"){
include(name:"com/fr/web/*.class")
include(name:"com/fr/web/attr/*.class")
}
}
delete(dir:"./tmp")
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35"
def keystore="frapplet.store"
def keycert="fr.cert"
def keypassword="123456"
def keyalias="fr"
exec(executable:"${jdk6home}/bin/keytool"){
arg(line:"-genkey -dname &quot;CN=FineReport L=NanJing C=China&quot; -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}")
}
exec(executable:"${jdk6home}/bin/keytool"){
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}")
}
exec(executable:"${jdk6home}/bin/jarsigner"){
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}")
}
delete(file:"${keystore}")
delete(file:"${keycert}")
delete(dir:"build/classes")
}
}

76
build.performance.gradle.bak

@ -0,0 +1,76 @@
apply plugin: "java"
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
}
def basicDir="../"
def libDir="${basicDir}/lib"
task appletJar<<{
ant{
mkdir(dir:"./tmp")
mkdir(dir:"build/classes/main")
copy(todir:"build/classes/"){
fileset(dir:"${basicDir}/core/build/classes/main")
fileset(dir:"${basicDir}/chart/build/classes/main")
fileset(dir:"${basicDir}/report/build/classes/main")
fileset(dir:"${basicDir}/platform/build/classes/main")
fileset(dir:"${basicDir}/performance/build/classes/main")
}
unjar(src:"${libDir}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")
jar(jarfile:"build/libs/fr-applet-8.0.jar"){
fileset(dir:"build/classes"){
exclude(name:"*.*")
exclude(name:"bin/*.*")
exclude(name:"classes/**")
exclude(name:"com/fr/schedule/**")
exclude(name:"com/fr/cell/**")
exclude(name:"com/fr/dialog/**")
exclude(name:"com/fr/view/**")
exclude(name:"com/fr/web/**")
exclude(name:"com/fr/fs/**")
exclude(name:"com/fr/design/**")
exclude(name:"com/fr/start/**")
exclude(name:"com/fr/process/**")
}
fileset(dir:"./tmp"){
include(name:"javax/mail/**")
include(name:"javax/servlet/**")
include(name:"org/freehep/**")
include(name:"com/fr/third/JAI/**")
include(name:"com/fr/third/antlr/**")
include(name:"com/fr/third/javax/**")
include(name:"com/sun/xml/**")
include(name:"javax/xml/**")
}
fileset(dir:"build/classes"){
include(name:"com/fr/web/*.class")
include(name:"com/fr/web/attr/*.class")
}
}
delete(dir:"./tmp")
def jdk6home= "D:/FineReport/develop/java/jdk1.6u35"
def keystore="frapplet.store"
def keycert="fr.cert"
def keypassword="123456"
def keyalias="fr"
exec(executable:"${jdk6home}/bin/keytool"){
arg(line:"-genkey -dname &quot;CN=FineReport L=NanJing C=China&quot; -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}")
}
exec(executable:"${jdk6home}/bin/keytool"){
arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}")
}
exec(executable:"${jdk6home}/bin/jarsigner"){
arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}")
}
delete(file:"${keystore}")
delete(file:"${keycert}")
delete(dir:"build/classes")
}
}

4
designer/src/com/fr/design/actions/cell/NewPresentAction.java

@ -26,7 +26,7 @@ public class NewPresentAction extends PresentCheckBoxAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) {
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("Present"), this.itemName); CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer_Present"), this.itemName);
} else { } else {
TemplateCellElement ce = getSelectedCellElement(); TemplateCellElement ce = getSelectedCellElement();
// 只有原来ce设置了形态的情况下才有undo操作 // 只有原来ce设置了形态的情况下才有undo操作
@ -73,7 +73,7 @@ public class NewPresentAction extends PresentCheckBoxAction {
try { try {
Class clazz = GeneralUtils.classForName(itemName); Class clazz = GeneralUtils.classForName(itemName);
if (itemName.equals(currentPresent.getClass().getName())) { if (itemName.equals(currentPresent.getClass().getName())) {
return StableUtils.classInstanceOf(currentPresent.getClass(), clazz); return StableUtils.objectInstanceOf(currentPresent, clazz);
} }
} catch (Exception e) { } catch (Exception e) {
return "NOPRESENT".equals(itemName) && currentPresent == null; return "NOPRESENT".equals(itemName) && currentPresent == null;

13
designer/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.file.export;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.page.PageSetProvider; import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.gui.iprogressbar.FRProgressBar;
@ -94,10 +93,10 @@ public abstract class AbstractExportAction extends JWorkBookAction {
FRLogger.getLogger().error("Error In Make New File"); FRLogger.getLogger().error("Error In Make New File");
} }
fileChooserPane = null; fileChooserPane = null;
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!"); FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("FR-Designer_Prepare_Export") + "!");
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame,
Inter.getLocText("Exporting"), "", 0, 100)).start(); Inter.getLocText("FR-Designer_Exporting"), "", 0, 100)).start();
} }
} }
@ -117,13 +116,13 @@ public abstract class AbstractExportAction extends JWorkBookAction {
fileOutputStream.close(); fileOutputStream.close();
this.setProgress(100); this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!"); FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("Exported_successfully") + "\n" + filePath); Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath);
} catch (Exception exp) { } catch (Exception exp) {
this.setProgress(100); this.setProgress(100);
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath);
} }
return null; return null;
} }
@ -140,7 +139,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) { if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter; AppExporter appExporter = (AppExporter) exporter;
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter
|| exporter instanceof PDFExporter || exporter instanceof PDFStreamExporter || exporter instanceof WordExporter) { || exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)

8
designer/src/com/fr/design/actions/file/export/PDFExportAction.java

@ -9,8 +9,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.io.exporter.Exporter; import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporter; import com.fr.web.core.reserve.PDFExporterFactory;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
/** /**
* Export pdf * Export pdf
@ -29,12 +28,13 @@ public class PDFExportAction extends AbstractExportAction {
@Override @Override
protected Exporter getExporter() { protected Exporter getExporter() {
return new PDFStreamExporter();
return PDFExporterFactory.getPDFExporter();
} }
@Override @Override
protected ChooseFileFilter getChooseFileFilter() { protected ChooseFileFilter getChooseFileFilter() {
return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("Export-PDF")); return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("FR-Designer_Export-PDF"));
} }
@Override @Override

110
designer/src/com/fr/design/javascript/ListenerEditPane.java

@ -6,13 +6,15 @@ import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.fun.JavaScriptActionProvider;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -22,19 +24,14 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.Commit2DBJavaScript;
import com.fr.js.CustomActionJavaScript;
import com.fr.js.EmailJavaScript;
import com.fr.js.FormSubmitJavaScript;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.JavaScriptImpl;
public class ListenerEditPane extends BasicBeanPane<Listener> { public class ListenerEditPane extends BasicBeanPane<Listener> {
private UITextField nameText; private UITextField nameText;
private UIComboBox styleBox; private UIComboBox styleBox;
private CardLayout card; private CardLayout card;
private List<FurtherBasicBeanPane<? extends JavaScript>> cards;
private JPanel hyperlinkPane; private JPanel hyperlinkPane;
private JavaScriptImplPane javaScriptPane; private JavaScriptImplPane javaScriptPane;
@ -45,11 +42,11 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 发送邮件 // 发送邮件
private EmailPane emailPane; private EmailPane emailPane;
private static final String JS = Inter.getLocText("JavaScript"); private static final String JS = Inter.getLocText("FR-Designer_JavaScript");
private static final String FORMSUBMIT = Inter.getLocText("JavaScript-Form_Submit"); private static final String FORMSUBMIT = Inter.getLocText("FR-Designer_JavaScript_Form_Submit");
private static final String DBCOMMIT = Inter.getLocText("JavaScript-Commit_to_Database"); private static final String DBCOMMIT = Inter.getLocText("FR-Designer_JavaScript_Commit_to_Database");
private static final String CUSTOMACTION= Inter.getLocText(new String[]{"Custom", "RWA-Submit"}); private static final String CUSTOMACTION= Inter.getLocText(new String[]{"FR-Designer_JavaScript_Custom", "FR-Designer_RWA_Submit"});
private static final String EMAIL = Inter.getLocText("Email_sentEmail"); private static final String EMAIL = Inter.getLocText("FR-Designer_Email_sentEmail");
private Listener listener; private Listener listener;
@ -66,6 +63,7 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
* @param defaultArgs 初始化参数 * @param defaultArgs 初始化参数
*/ */
public void initComponents(String[] defaultArgs) { public void initComponents(String[] defaultArgs) {
cards = new ArrayList<FurtherBasicBeanPane<? extends JavaScript>>();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
nameText = new UITextField(8); nameText = new UITextField(8);
@ -74,19 +72,14 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL}; String[] style = {JS, DBCOMMIT, CUSTOMACTION,EMAIL};
styleBox = new UIComboBox(style); styleBox = new UIComboBox(style);
namePane.add(styleBox); namePane.add(styleBox);
namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + Inter.getLocText("Event_Name") + ":"), nameText, new UILabel(" " + Inter.getLocText("Event_Type") + ":"), styleBox}, FlowLayout.LEFT); namePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Event_Name") + ":"), nameText, new UILabel(" " + Inter.getLocText("FR-Designer_Event_Type") + ":"), styleBox}, FlowLayout.LEFT);
namePane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("Event_Name_Type"))); namePane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("FR-Designer_Event_Name_Type")));
this.add(namePane, BorderLayout.NORTH); this.add(namePane, BorderLayout.NORTH);
card = new CardLayout(); card = new CardLayout();
hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane(); hyperlinkPane = FRGUIPaneFactory.createCardLayout_S_Pane();
hyperlinkPane.setLayout(card); hyperlinkPane.setLayout(card);
// js
javaScriptPane = new JavaScriptImplPane(defaultArgs); javaScriptPane = new JavaScriptImplPane(defaultArgs);
hyperlinkPane.add(JS, javaScriptPane); hyperlinkPane.add(JS, javaScriptPane);
// formSubmitScriptPane = new FormSubmitJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane
// .createCallButton());
// hyperlinkPane.add(FORMSUBMIT, formSubmitScriptPane);
// 提交入库 // 提交入库
List dbmaniList = new ArrayList(); List dbmaniList = new ArrayList();
dbmaniList.add(autoCreateDBManipulationPane()); dbmaniList.add(autoCreateDBManipulationPane());
@ -96,21 +89,37 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 自定义事件 // 自定义事件
customActionPane = new CustomActionPane(); customActionPane = new CustomActionPane();
hyperlinkPane.add(CUSTOMACTION, customActionPane); hyperlinkPane.add(CUSTOMACTION, customActionPane);
// 发送邮件 // 发送邮件
emailPane = new EmailPane(); emailPane = new EmailPane();
hyperlinkPane.add(EMAIL,emailPane); hyperlinkPane.add(EMAIL,emailPane);
cards.add(javaScriptPane);
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("JavaScript_Set"))); cards.add(commit2DBJavaScriptPane);
cards.add(customActionPane);
cards.add(emailPane);
//其他事件
addOtherEvent();
hyperlinkPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("FR-Designer_JavaScript_Set")));
this.add(hyperlinkPane); this.add(hyperlinkPane);
styleBox.addItemListener(new ItemListener() { styleBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
card.show(hyperlinkPane, styleBox.getSelectedItem().toString()); card.show(hyperlinkPane, styleBox.getSelectedItem().toString());
} }
}); });
} }
private void addOtherEvent(){
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
for (JavaScriptActionProvider jsp : javaScriptActionProviders) {
FurtherBasicBeanPane pane = jsp.getJavaScriptActionPane();
String title = pane.title4PopupWindow();
styleBox.addItem(title);
hyperlinkPane.add(title, pane);
cards.add(pane);
}
}
}
/** /**
* 根据有无单元格创建 DBManipulationPane * 根据有无单元格创建 DBManipulationPane
* @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane * @return 有单元格有智能添加单元格等按钮返回 SmartInsertDBManipulationPane
@ -122,7 +131,7 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Event_Set"); return Inter.getLocText("FR-Designer_Event_Set");
} }
@Override @Override
@ -131,47 +140,28 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
if (this.listener == null) { if (this.listener == null) {
this.listener = new Listener(); this.listener = new Listener();
} }
this.nameText.setText(listener.getEventName()); this.nameText.setText(listener.getEventName());
JavaScript js = listener.getAction(); JavaScript js = listener.getAction();
if (js instanceof JavaScriptImpl) { for (int i = 0; i < this.cards.size(); i++) {
styleBox.setSelectedItem(JS); FurtherBasicBeanPane pane = cards.get(i);
card.show(hyperlinkPane, JS); if (pane.accept(js)) {
javaScriptPane.populateBean((JavaScriptImpl)js); styleBox.setSelectedItem(pane.title4PopupWindow());
} else if (js instanceof FormSubmitJavaScript){ card.show(hyperlinkPane, pane.title4PopupWindow());
styleBox.setSelectedItem(FORMSUBMIT); pane.populateBean(js);
card.show(hyperlinkPane, FORMSUBMIT); return;
formSubmitScriptPane.populateBean((FormSubmitJavaScript)js); }
} else if (js instanceof Commit2DBJavaScript) {
styleBox.setSelectedItem(DBCOMMIT);
card.show(hyperlinkPane, DBCOMMIT);
commit2DBJavaScriptPane.populateBean((Commit2DBJavaScript)js);
} else if (js instanceof EmailJavaScript){
styleBox.setSelectedItem(EMAIL);
card.show(hyperlinkPane, EMAIL);
emailPane.populateBean((EmailJavaScript)js);
} else if (js instanceof CustomActionJavaScript){
styleBox.setSelectedItem(CUSTOMACTION);
card.show(hyperlinkPane, CUSTOMACTION);
customActionPane.populateBean((CustomActionJavaScript) js);
} }
} }
public void checkValid() throws Exception{
this.cards.get(this.styleBox.getSelectedIndex()).checkValid();
}
@Override @Override
public Listener updateBean(){ public Listener updateBean(){
this.listener.setEventName(this.nameText.getText()); this.listener.setEventName(this.nameText.getText());
if (ComparatorUtils.equals(styleBox.getSelectedItem(), JS)) { FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(javaScriptPane.updateBean()); this.listener.setAction(pane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), FORMSUBMIT)) {
this.listener.setAction(formSubmitScriptPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), DBCOMMIT)) {
this.listener.setAction(commit2DBJavaScriptPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(),EMAIL)){
this.listener.setAction(emailPane.updateBean());
} else if (ComparatorUtils.equals(styleBox.getSelectedItem(), CUSTOMACTION)){
this.listener.setAction(customActionPane.updateBean());
}
return this.listener; return this.listener;
} }
} }

13
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -102,12 +102,23 @@ public class CellElementPropertyPane extends DockingView {
return element; return element;
} }
public void removeAll() {
this.remove(titlePane);
this.remove(cellElementEditPane);
}
public void reInit(ElementCasePane ePane) {
this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
cellElementEditPane.populate(ePane);
}
public void populate(ElementCasePane ePane) { public void populate(ElementCasePane ePane) {
TemplateElementCase elementCase = ePane.getEditingElementCase(); TemplateElementCase elementCase = ePane.getEditingElementCase();
if (elementCase == null) { if (elementCase == null) {
return; return;
} }
cellElementEditPane.populate(ePane); ePane.getSelection().populatePropertyPane(ePane);
} }
@Override @Override

2
designer/src/com/fr/design/mainframe/WorkBookModelAdapter.java

@ -52,7 +52,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
public Parameter[] getTableDataParameters() { public Parameter[] getTableDataParameters() {
TableDataSource source = this.getBook(); TableDataSource source = this.getBook();
Calculator c = Calculator.createCalculator(); Calculator c = Calculator.createCalculator();
c.setAttribute(TableDataSource.class, source); c.setAttribute(TableDataSource.KEY, source);
java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>(); java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>();
java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator(); java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {

2
designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java

@ -75,7 +75,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Fit-App"); return Inter.getLocText("FR-Designer_Fit");
} }
private ActionListener getAppPreviewActionListener() { private ActionListener getAppPreviewActionListener() {

2
designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java

@ -35,10 +35,12 @@ public class AppFitPreviewPane extends BasicPane{
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png"))); cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png"))); cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png"))); cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png")));
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V4.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png"))); cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png"))); cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png"))); cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png"))); cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png")));
} }
private void initComponents() { private void initComponents() {

10
designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java

@ -1,11 +1,11 @@
package com.fr.design.report.mobile; package com.fr.design.report.mobile;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -28,22 +28,22 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
private void initComponents(String title) { private void initComponents(String title) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {p, p, p, p, p}; double[] columnSize = {p, p, p, p, p, p};
UIRadioButton defaultRadio = new UIRadioButton(MobileFitAttrState.DEFAULT.description()); UIRadioButton defaultRadio = new UIRadioButton(MobileFitAttrState.DEFAULT.description());
defaultRadio.setSelected(true); defaultRadio.setSelected(true);
UIRadioButton horizonRadio = new UIRadioButton(MobileFitAttrState.HORIZONTAL.description()); UIRadioButton horizonRadio = new UIRadioButton(MobileFitAttrState.HORIZONTAL.description());
UIRadioButton verticalRadio = new UIRadioButton(MobileFitAttrState.VERTICAL.description()); UIRadioButton verticalRadio = new UIRadioButton(MobileFitAttrState.VERTICAL.description());
UIRadioButton bidirectionalRadio = new UIRadioButton(MobileFitAttrState.BIDIRECTIONAL.description());
UIRadioButton notFitRadio = new UIRadioButton(MobileFitAttrState.NONE.description()); UIRadioButton notFitRadio = new UIRadioButton(MobileFitAttrState.NONE.description());
addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio); addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(title), defaultRadio, horizonRadio, verticalRadio, notFitRadio} new Component[]{new UILabel(title), defaultRadio, horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio}
}; };
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(fitOpsPane); this.add(fitOpsPane);
} }

106
designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java

@ -1,109 +1,12 @@
package com.fr.design.report.mobile; package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr; import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by kunsnat on 2016/8/3. * Created by kunsnat on 2016/8/3.
*/ */
public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr> { public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<ElementCaseMobileAttr> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@Override @Override
public void populateBean(ElementCaseMobileAttr mobileAttr) { public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) { if(mobileAttr != null) {
@ -122,9 +25,4 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr>
mobileAttr.setUseHTML(getSelectRadioIndex() == 1); mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
} }
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
} }

2
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -65,6 +65,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Fit-App"); return Inter.getLocText("FR-Designer_Mobile-Attr");
} }
} }

11
designer/src/com/fr/design/widget/CellWidgetCardPane.java

@ -51,8 +51,8 @@ public class CellWidgetCardPane extends BasicPane {
formPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); formPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eventTabPane = new WidgetEventPane(pane); eventTabPane = new WidgetEventPane(pane);
formPane.add(eventTabPane, BorderLayout.CENTER); formPane.add(eventTabPane, BorderLayout.CENTER);
tabbedPane.add(Inter.getLocText("Attribute"), attriPane); tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriPane);
tabbedPane.add(Inter.getLocText("Form-Editing_Listeners"), formPane); tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), formPane);
presPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); presPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
cardPaneForPresent = FRGUIPaneFactory.createCardLayout_S_Pane(); cardPaneForPresent = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -88,7 +88,7 @@ public class CellWidgetCardPane extends BasicPane {
widgetPropertyPane = new BasicWidgetPropertySettingPane(); widgetPropertyPane = new BasicWidgetPropertySettingPane();
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8)); northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Form-Basic_Properties")); JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties"));
northPane.add(basic); northPane.add(basic);
basic.add(widgetPropertyPane); basic.add(widgetPropertyPane);
attriPane.add(northPane, BorderLayout.NORTH); attriPane.add(northPane, BorderLayout.NORTH);
@ -155,13 +155,14 @@ public class CellWidgetCardPane extends BasicPane {
*/ */
public void checkValid() throws Exception { public void checkValid() throws Exception {
currentEditorDefinePane.checkValid(); currentEditorDefinePane.checkValid();
eventTabPane.checkValid();
} }
//:jackie 如果选择的项有形态,则将形态面板加入tab面板 //:jackie 如果选择的项有形态,则将形态面板加入tab面板
private void addPresPane(boolean add) { private void addPresPane(boolean add) {
if (add) { if (add) {
tabbedPane.add(this.presPane, 1); tabbedPane.add(this.presPane, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("DS-Dictionary")); tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary"));
} else { } else {
tabbedPane.remove(presPane); tabbedPane.remove(presPane);
} }
@ -170,7 +171,7 @@ public class CellWidgetCardPane extends BasicPane {
private void addTreeSettingPane(boolean add) { private void addTreeSettingPane(boolean add) {
if (add) { if (add) {
tabbedPane.add(this.cardPaneForTreeSetting, 1); tabbedPane.add(this.cardPaneForTreeSetting, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("Create_Tree")); tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree"));
} else { } else {
tabbedPane.remove(this.cardPaneForTreeSetting); tabbedPane.remove(this.cardPaneForTreeSetting);
} }

6
designer/src/com/fr/grid/selection/CellSelection.java

@ -18,6 +18,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -684,4 +685,9 @@ public class CellSelection extends Selection {
editor.populate(tc); editor.populate(tc);
return editor; return editor;
} }
@Override
public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().reInit(ePane);
}
} }

6
designer/src/com/fr/grid/selection/FloatSelection.java

@ -20,6 +20,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -230,4 +231,9 @@ public class FloatSelection extends Selection {
editor.populate(tc); editor.populate(tc);
return editor; return editor;
} }
@Override
public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll();
}
} }

2
designer/src/com/fr/grid/selection/Selection.java

@ -87,6 +87,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
// //////////////////////////Just4CellSelection/////////////////////////////// // //////////////////////////Just4CellSelection///////////////////////////////
public abstract boolean containsColumnRow(ColumnRow cr); public abstract boolean containsColumnRow(ColumnRow cr);
public abstract void populatePropertyPane(ElementCasePane ePane);
@Override @Override

69
designer_base/build.performance.gradle

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

69
designer_base/build.performance.gradle.bak

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../${baseDir}/lib4build',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

22
designer_base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -50,7 +50,7 @@ public class PreviewTableModel extends AbstractTableModel {
maxRowCount = rowCount; maxRowCount = rowCount;
} }
final int finalRowCount = maxRowCount; final int finalRowCount = maxRowCount;
DataModel dm = new DataModel() { DataModel dm = new AbstractDataModel() {
@Override @Override
public void release() throws Exception { public void release() throws Exception {
@ -100,7 +100,7 @@ public class PreviewTableModel extends AbstractTableModel {
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return Inter.getLocText("Error"); return Inter.getLocText("FR-Designer_Error");
} }
} }
@ -149,7 +149,7 @@ public class PreviewTableModel extends AbstractTableModel {
} }
public String getColumnName(int column) { public String getColumnName(int column) {
return Inter.getLocText("Error"); return Inter.getLocText("FR-Designer_Error");
} }
public int getColumnCount() { public int getColumnCount() {
@ -166,7 +166,7 @@ public class PreviewTableModel extends AbstractTableModel {
private String checkType(int column) { private String checkType(int column) {
if (dateIndexs.contain(column)) { if (dateIndexs.contain(column)) {
String s = Inter.getLocText("Date"); String s = Inter.getLocText("FR-Designer_Date");
return ("(" + s + ")"); return ("(" + s + ")");
} }
@ -187,23 +187,23 @@ public class PreviewTableModel extends AbstractTableModel {
if (o == null) { if (o == null) {
s = "?"; s = "?";
} else if (o instanceof String) { } else if (o instanceof String) {
s = Inter.getLocText("Parameter-String"); s = Inter.getLocText("FR-Designer_Parameter_String");
if (FRContext.getCurrentEnv() instanceof RemoteEnv && dataModel instanceof EmbeddedTDDataModel) { if (FRContext.getCurrentEnv() instanceof RemoteEnv && dataModel instanceof EmbeddedTDDataModel) {
Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column); Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column);
if (Number.class.isAssignableFrom(clzz)) { if (Number.class.isAssignableFrom(clzz)) {
s = Inter.getLocText("Number");//bigdecimal s = Inter.getLocText("FR-Designer_Number");//bigdecimal
} else if (java.sql.Date.class.isAssignableFrom(clzz)) { } else if (java.sql.Date.class.isAssignableFrom(clzz)) {
s = Inter.getLocText("Date"); s = Inter.getLocText("FR-Designer_Date");
} }
} }
} else if (o instanceof Integer) { } else if (o instanceof Integer) {
s = Inter.getLocText("Integer"); s = Inter.getLocText("FR-Designer_Integer");
} else if (o instanceof Double || o instanceof Float) { } else if (o instanceof Double || o instanceof Float) {
s = Inter.getLocText("Double"); s = Inter.getLocText("FR-Designer_Double");
} else if (o instanceof java.sql.Date || o instanceof java.util.Date) { } else if (o instanceof java.sql.Date || o instanceof java.util.Date) {
s = Inter.getLocText("Date"); s = Inter.getLocText("FR-Designer_Date");
} else if (o instanceof Number) { } else if (o instanceof Number) {
s = Inter.getLocText("Number");//bigdecimal s = Inter.getLocText("FR-Designer_Number");//bigdecimal
} else { } else {
s = "?"; s = "?";
} }

13
designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -299,7 +299,6 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
text = StringUtils.EMPTY; text = StringUtils.EMPTY;
} }
text = text.trim(); text = text.trim();
String[] tableName = text.split("\\.");
String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
try { try {
String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text); String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text);
@ -307,16 +306,16 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
// 获取参数默认值,例如:NAME in varchar2 default 'SCOTT',默认值为SCOTT // 获取参数默认值,例如:NAME in varchar2 default 'SCOTT',默认值为SCOTT
String parameterDefaultValue = ""; String parameterDefaultValue = "";
if (StringUtils.isNotEmpty(procedureText)) { if (StringUtils.isNotEmpty(procedureText)) {
int index_begin = procedureText.indexOf("BEGIN"); int index_begin = procedureText.indexOf("BEGIN");
//from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值 //from sam: 默认值只会在begin之前声明, 不然会把所有的存储过程里带'xx'的都作为默认值
String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin); String defaulValueStr = index_begin == -1 ? procedureText : procedureText.substring(0, index_begin);
String[] strs = defaulValueStr.split("\'"); String[] strs = defaulValueStr.split("\'");
parameterDefaultValue = strs.length > 1 ? strs[1] : parameterDefaultValue; parameterDefaultValue = strs.length > 1 ? strs[1] : parameterDefaultValue;
} }
StoreProcedureParameter[] newparameters; StoreProcedureParameter[] newparameters;
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, tableName[tableName.length - 1], parameterDefaultValue); newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue);
editorPane.populate(newparameters); editorPane.populate(newparameters);

112
designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java

@ -0,0 +1,112 @@
package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 由于MobileUserHtmlGroupPane 现在在report和form中均会用到会出现重复代码故放入base中
* Created by fanglei on 2016/12/28.
*/
public abstract class MobileUseHtmlGroupBeanPane<T> extends BasicBeanPane<T> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupBeanPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
}

15
designer_base/src/com/fr/design/extra/PluginConstants.java

@ -1,15 +0,0 @@
package com.fr.design.extra;
/**
* @author richie
* @date 2015-03-11
* @since 8.0
*/
public class PluginConstants {
public static final int BYTES_NUM = 1024;
}

1
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -7,6 +7,7 @@ import com.fr.design.extra.plugindependence.DownLoadDependenceUI;
import com.fr.general.*; import com.fr.general.*;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper; import com.fr.plugin.PluginManagerHelper;
import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependence;

24
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -1,8 +1,8 @@
package com.fr.design.extra.plugindependence; package com.fr.design.extra.plugindependence;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginHelper; import com.fr.design.extra.PluginHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -12,6 +12,7 @@ import com.fr.plugin.dependence.PluginDependenceException;
import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.plugin.PluginConstants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -20,7 +21,9 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.List; import java.util.List;
@ -40,8 +43,12 @@ public class DownLoadDependenceUI implements ActionListener {
private boolean flag = true; private boolean flag = true;
// 定义加载窗口大小 // 定义加载窗口大小
private final int LOAD_WIDTH = 455; private static final int LOAD_WIDTH = 455;
private final int LOAD_HEIGHT = 295;
private static final int INCIDENT_WIDTH = 15;
private static final int LOAD_HEIGHT = 295;
//安装环境相关信息 //安装环境相关信息
private String currentID; private String currentID;
@ -68,8 +75,8 @@ public class DownLoadDependenceUI implements ActionListener {
// 创建标签,并在标签上放置一张图片 // 创建标签,并在标签上放置一张图片
BufferedImage image = IOUtils.readImage("/com/fr/design/extra/plugindependence/image/background.png"); BufferedImage image = IOUtils.readImage("/com/fr/design/extra/plugindependence/image/background.png");
ImageIcon imageIcon = new ImageIcon(image); ImageIcon imageIcon = new ImageIcon(image);
label = new JLabel(imageIcon); label = new UILabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - 15); label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - INCIDENT_WIDTH);
progressbar = new JProgressBar(); progressbar = new JProgressBar();
// 显示当前进度值信息 // 显示当前进度值信息
@ -80,7 +87,7 @@ public class DownLoadDependenceUI implements ActionListener {
progressbar.setForeground(new Color(0x38aef5)); progressbar.setForeground(new Color(0x38aef5));
// 设置进度条的背景色 // 设置进度条的背景色
progressbar.setBackground(new Color(188, 190, 194)); progressbar.setBackground(new Color(188, 190, 194));
progressbar.setBounds(0, LOAD_HEIGHT - 15, LOAD_WIDTH, 15); progressbar.setBounds(0, LOAD_HEIGHT - INCIDENT_WIDTH, LOAD_WIDTH, INCIDENT_WIDTH);
progressbar.setMinimum(0); progressbar.setMinimum(0);
progressbar.setMaximum(totalSize); progressbar.setMaximum(totalSize);
progressbar.setValue(0); progressbar.setValue(0);
@ -249,7 +256,8 @@ public class DownLoadDependenceUI implements ActionListener {
} }
public void installOnline()throws PluginDependenceException { public void installOnline()throws PluginDependenceException {
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Plugin_Plugin") + Inter.getLocText("FR-Designer-Need") + Inter.getLocText("FR-Designer-Dependence") + Inter.getLocText("FR-Designer-Support") + "," + Inter.getLocText("FR-Designer-Dependence_Need_Install") + "(" + showFileLength() + " m)?", "install tooltip", JOptionPane.YES_NO_OPTION);
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Plugin_DownLoadMessage", showFileLength()), "install tooltip", JOptionPane.YES_NO_OPTION);
if (choose == 0) {//下载安装 if (choose == 0) {//下载安装
if (!connectToServer()) { if (!connectToServer()) {
throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error")); throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error"));

418
designer_base/src/com/fr/design/formula/FormulaPane.java

@ -32,10 +32,12 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*; import javax.swing.tree.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.io.*; import java.io.*;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
/** /**
* 公式编辑面板 * 公式编辑面板
* @editor zhou * @editor zhou
@ -60,29 +62,16 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
public FormulaPane() { public FormulaPane() {
initComponents(); initComponents();
} }
protected void initComponents() { private void initFormulaTextAreaKeyListener(){
this.setLayout(new BorderLayout(4, 4)); formulaTextArea.addKeyListener(this);
formulaTextArea.addKeyListener(new KeyAdapter() {
// text
JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(textPane, BorderLayout.CENTER);
JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UILabel formulaLabel = new UILabel(Inter.getLocText("FormulaD-Input_formula_in_the_text_area_below") + ":"
+ " ");
formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
formulaTextArea = new RSyntaxTextArea();
configFormulaArea();
formulaTextArea.addKeyListener(this);
formulaTextArea.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
formulaTextArea.setForeground(Color.black); formulaTextArea.setForeground(Color.black);
String text = formulaTextArea.getText(); String text = formulaTextArea.getText();
// 判断在中文输入状态是否还包含提示符 要删掉 // 判断在中文输入状态是否还包含提示符 要删掉
String tip = "\n\n\n" + Inter.getLocText("Tips:You_Can_Input_B1_To_Input_The_Data_Of_The_First_Row_Second_Column"); //Tips:You_Can_Input_B1_To_Input_The_Data_Of_The_First_Row_Second_Column
String tip = "\n\n\n" + Inter.getLocText("FR-Designer_FormulaPane_Tips");
if(text.contains(tip)) { if(text.contains(tip)) {
text = text.substring(0, text.indexOf(tip)); text = text.substring(0, text.indexOf(tip));
insertPosition = 0; insertPosition = 0;
@ -90,9 +79,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
} }
} }
}); });
}
formulaTextArea.addMouseListener(new MouseAdapter() {
private void initFormulaTextAreaMouseListener(){
formulaTextArea.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
insertPosition = formulaTextArea.getCaretPosition(); insertPosition = formulaTextArea.getCaretPosition();
@ -115,52 +105,81 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
} }
} }
}); });
UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); }
formulaTextAreaScrollPane.setBorder(null);
textPane.add(formulaLabel, BorderLayout.NORTH); private void initFormulaTextArea(){
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); formulaTextArea = new RSyntaxTextArea();
textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); configFormulaArea();
initFormulaTextAreaKeyListener();
// tipsPane initFormulaTextAreaMouseListener();
JPanel tipsPane = new JPanel(new BorderLayout(4, 4)); }
this.add(tipsPane, BorderLayout.EAST);
private void initKeyWordTextFieldKeyListener(){
JPanel searchPane = new JPanel(new BorderLayout(4, 4)); keyWordTextField.addKeyListener(new KeyListener() {
searchPane.add(keyWordTextField, BorderLayout.CENTER);
UIButton searchButton = new UIButton(Inter.getLocText("Search"));
searchPane.add(searchButton, BorderLayout.EAST);
tipsPane.add(searchPane, BorderLayout.NORTH);
keyWordTextField.addKeyListener(new KeyListener() {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
String toFind = keyWordTextField.getText(); String toFind = keyWordTextField.getText();
search(toFind, false); search(toFind, false);
fixFunctionNameList(); fixFunctionNameList();
e.consume(); e.consume();
} }
} }
}); });
}
private void initTipsPane(){
// tipsPane
JPanel tipsPane = new JPanel(new BorderLayout(4, 4));
this.add(tipsPane, BorderLayout.EAST);
JPanel searchPane = new JPanel(new BorderLayout(4, 4));
searchPane.add(keyWordTextField, BorderLayout.CENTER);
UIButton searchButton = new UIButton(Inter.getLocText("FR-Designer_FormulaPane_Search"));
searchPane.add(searchButton, BorderLayout.EAST);
tipsPane.add(searchPane, BorderLayout.NORTH);
initKeyWordTextFieldKeyListener();
tipsList = new JList(listModel); tipsList = new JList(listModel);
tipsList.addMouseListener(new DoubleClick()); tipsList.addMouseListener(new DoubleClick());
UIScrollPane tipsScrollPane = new UIScrollPane(tipsList); UIScrollPane tipsScrollPane = new UIScrollPane(tipsList);
tipsScrollPane.setPreferredSize(new Dimension(170, 75)); tipsScrollPane.setPreferredSize(new Dimension(170, 75));
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
tipsPane.add(tipsScrollPane, BorderLayout.CENTER); tipsPane.add(tipsScrollPane, BorderLayout.CENTER);
searchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String toFind = keyWordTextField.getText();
search(toFind, false);
formulaTextArea.requestFocusInWindow();
fixFunctionNameList();
}
});
}
protected void initComponents() {
this.setLayout(new BorderLayout(4, 4));
// text
JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(textPane, BorderLayout.CENTER);
JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UILabel formulaLabel = new UILabel(Inter.getLocText("FormulaD-Input_formula_in_the_text_area_below") + ":"
+ " ");
formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
initFormulaTextArea();
UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea);
formulaTextAreaScrollPane.setBorder(null);
textPane.add(formulaLabel, BorderLayout.NORTH);
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER);
textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH);
initTipsPane();
UIButton checkValidButton = new UIButton(Inter.getLocText("FormulaD-Check_Valid")); UIButton checkValidButton = new UIButton(Inter.getLocText("FormulaD-Check_Valid"));
checkValidButton.addActionListener(checkValidActionListener); checkValidButton.addActionListener(checkValidActionListener);
@ -169,20 +188,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
checkBoxPane.setPreferredSize(new Dimension(450, 30)); checkBoxPane.setPreferredSize(new Dimension(450, 30));
checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST);
checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST);
extendCheckBoxPane(checkBoxPane); extendCheckBoxPane(checkBoxPane);
searchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String toFind = keyWordTextField.getText();
search(toFind, false);
formulaTextArea.requestFocusInWindow();
fixFunctionNameList();
}
});
variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea();
this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH);
} }
@ -253,11 +259,17 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
this.formulaTextArea.setText(StringUtils.EMPTY); this.formulaTextArea.setText(StringUtils.EMPTY);
} }
} }
//hugh:为啥会是10呢?搞不懂~~~
private static final int KEY_10 = 10;
//上下左右
private static final int KEY_37 = 37;
private static final int KEY_38 = 38;
private static final int KEY_39 = 39;
private static final int KEY_40 = 40;
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
int key = e.getKeyCode(); int key = e.getKeyCode();
if (key == 38 || key == 40 || key == 37 || key == 39 || key == 10) //如果是删除符号 ,为了可读性 没有和其他按键的程序相融合 if (key == KEY_38 || key == KEY_40 || key == KEY_37 || key == KEY_39 || key == KEY_10) //如果是删除符号 ,为了可读性 没有和其他按键的程序相融合
{ {
listModel.removeAllElements(); listModel.removeAllElements();
currentPosition = formulaTextArea.getCaretPosition(); currentPosition = formulaTextArea.getCaretPosition();
@ -461,7 +473,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
String content = formula.getContent(); String content = formula.getContent();
if (content.trim().equals("=")) { if (content.trim().equals("=")) {
this.formulaTextArea.setForeground(Color.gray); this.formulaTextArea.setForeground(Color.gray);
this.formulaTextArea.setText("\n\n\n" + Inter.getLocText("Tips:You_Can_Input_B1_To_Input_The_Data_Of_The_First_Row_Second_Column")); //Tips:You_Can_Input_B1_To_Input_The_Data_Of_The_First_Row_Second_Column
this.formulaTextArea.setText("\n\n\n" + Inter.getLocText("FR-Designer_FormulaPane_Tips"));
this.formulaTextArea.setCaretPosition(0); this.formulaTextArea.setCaretPosition(0);
ifHasBeenWriten = 0; ifHasBeenWriten = 0;
this.listModel.removeAllElements(); this.listModel.removeAllElements();
@ -548,22 +561,21 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
public VariableTreeAndDescriptionArea() { public VariableTreeAndDescriptionArea() {
this.initComponents(); this.initComponents();
} }
private void initComponents() { private void initFunctionTypeList(JPanel functionPane){
this.setLayout(new BorderLayout(4, 4)); functionTypeList = new QuickList(functionTypeListModel);
// Function
JPanel functionPane = new JPanel(new BorderLayout(4, 4));
this.add(functionPane, BorderLayout.WEST);
functionTypeList = new QuickList(functionTypeListModel);
UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList);
functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
functionTypeScrollPane.setPreferredSize(new Dimension(140, 200)); functionTypeScrollPane.setPreferredSize(new Dimension(140, 200));
functionPane.add(this.createNamePane(Inter.getLocText("FormulaD-Function_category") + ":", functionTypeScrollPane), BorderLayout.WEST); functionPane.add(this.createNamePane(Inter.getLocText("FormulaD-Function_category") + ":", functionTypeScrollPane), BorderLayout.WEST);
functionTypeList.setCellRenderer(new DefaultListCellRenderer() { initTypeListCellRenderer();
initGroupTypeModel();
initTypeListSelectionListener();
}
private void initTypeListCellRenderer(){
functionTypeList.setCellRenderer(
new DefaultListCellRenderer() {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@ -573,48 +585,44 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
return this; return this;
} }
}); });
}
functionTypeListModel.addElement(FunctionConstants.COMMON);
for (int i = 0; i < FunctionConstants.EMBFUNCTIONS.length; i++) { private void initTypeListSelectionListener(){
functionTypeListModel.addElement(FunctionConstants.EMBFUNCTIONS[i]); functionTypeList.addListSelectionListener(new ListSelectionListener() {
}
functionTypeListModel.addElement(FunctionConstants.ALL);
functionTypeListModel.addElement(FunctionConstants.CUSTOM);
functionTypeListModel.addElement(FunctionConstants.PLUGIN);
functionTypeList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) { public void valueChanged(ListSelectionEvent evt) {
Object selectedValue = ((JList) evt.getSource()).getSelectedValue(); Object selectedValue = ((JList) evt.getSource()).getSelectedValue();
if (!(selectedValue instanceof FunctionGroup)) { if (!(selectedValue instanceof FunctionGroup)) {
return; return;
} }
NameAndDescription[] nads = ((FunctionGroup) selectedValue).getDescriptions(); NameAndDescription[] nads = ((FunctionGroup) selectedValue).getDescriptions();
functionNameModel = (DefaultListModel) functionNameList.getModel(); functionNameModel = (DefaultListModel) functionNameList.getModel();
functionNameModel.clear(); functionNameModel.clear();
for (NameAndDescription nad : nads) { for (NameAndDescription nad : nads) {
functionNameModel.addElement(nad); functionNameModel.addElement(nad);
} }
if (functionNameModel.size() > 0) { if (functionNameModel.size() > 0) {
functionNameList.setSelectedIndex(0); functionNameList.setSelectedIndex(0);
functionNameList.ensureIndexIsVisible(0); functionNameList.ensureIndexIsVisible(0);
} }
} }
}); });
}
functionNameList = new JList(new DefaultListModel());
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); private void initGroupTypeModel(){
functionNameScrollPane.setPreferredSize(new Dimension(140, 200)); functionTypeListModel.addElement(FunctionConstants.COMMON);
functionPane.add( for (int i = 0; i < FunctionConstants.EMBFUNCTIONS.length; i++) {
this.createNamePane(Inter.getLocText("FormulaD-Function_name") + ":", functionNameScrollPane), functionTypeListModel.addElement(FunctionConstants.EMBFUNCTIONS[i]);
BorderLayout.CENTER); }
functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); functionTypeListModel.addElement(FunctionConstants.ALL);
functionTypeListModel.addElement(FunctionConstants.CUSTOM);
functionNameList.setCellRenderer(new DefaultListCellRenderer() { functionTypeListModel.addElement(FunctionConstants.PLUGIN);
//hugh: 从函数分组插件中添加分组
FunctionConstants.addFunctionGroupFromPlugins(functionTypeListModel);
}
private void initFunctionNameListCellRenderer(){
functionNameList.setCellRenderer(new DefaultListCellRenderer() {
@Override @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -625,8 +633,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
return this; return this;
} }
}); });
}
functionNameList.addListSelectionListener(new ListSelectionListener() {
private void initFunctionNameListSelectionListener(){
functionNameList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) { public void valueChanged(ListSelectionEvent evt) {
Object selectedValue = functionNameList.getSelectedValue(); Object selectedValue = functionNameList.getSelectedValue();
@ -640,11 +650,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
descriptionTextArea.moveCaretPosition(0); descriptionTextArea.moveCaretPosition(0);
} }
}); });
}
functionNameList.addMouseListener(new MouseAdapter() {
private void initFunctionNameListMouseListener(){
functionNameList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) { public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() >= 2) { if (evt.getClickCount() >= 2) {
Object selectedValue = functionNameList.getSelectedValue(); Object selectedValue = functionNameList.getSelectedValue();
if (!(selectedValue instanceof NameAndDescription)) { if (!(selectedValue instanceof NameAndDescription)) {
@ -654,7 +664,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
applyText(insert); applyText(insert);
} }
if (SwingUtilities.isRightMouseButton(evt)) { if (SwingUtilities.isRightMouseButton(evt)) {
JPopupMenu popupMenu = new JPopupMenu(); JPopupMenu popupMenu = new JPopupMenu();
LookDetailAction lookDetailAction = new LookDetailAction(); LookDetailAction lookDetailAction = new LookDetailAction();
@ -665,24 +674,28 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
} }
} }
}); });
}
// vairable.
variablesTree = new JTree(); private void initFunctionNameList(JPanel functionPane){
UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); functionNameList = new JList(new DefaultListModel());
variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList);
this.add(this.createNamePane( functionNameScrollPane.setPreferredSize(new Dimension(140, 200));
Inter.getLocText("Variables") + ":", variablesTreePane), BorderLayout.CENTER); functionPane.add(
variablesTree.setRootVisible(false); this.createNamePane(Inter.getLocText("FormulaD-Function_name") + ":", functionNameScrollPane),
variablesTree.setShowsRootHandles(true); BorderLayout.CENTER);
variablesTree.addMouseListener(applyTextMouseListener); functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
variablesTree.setCellRenderer(applyTreeCellRenderer); initFunctionNameListCellRenderer();
initFunctionNameListSelectionListener();
// Description initFunctionNameListMouseListener();
}
private void initDescriptionTextArea(){
// Description
descriptionTextArea = new UITextArea(16, 27); descriptionTextArea = new UITextArea(16, 27);
UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea); UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea);
desScrollPane.setBorder(null); desScrollPane.setBorder(null);
this.add(this.createNamePane(Inter.getLocText("Formula_Description") + ":", desScrollPane), BorderLayout.EAST); this.add(this.createNamePane(Inter.getLocText("FR-Designer_FormulaPane_Formula_Description") + ":", desScrollPane), BorderLayout.EAST);
descriptionTextArea.setBackground(new Color(255, 255, 225)); descriptionTextArea.setBackground(new Color(255, 255, 225));
descriptionTextArea.setLineWrap(true); descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true); descriptionTextArea.setWrapStyleWord(true);
@ -696,19 +709,41 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
} }
}); });
variablesTree.addTreeSelectionListener(new TreeSelectionListener() { }
public void valueChanged(TreeSelectionEvent e) { private StringBuilder getText(TextUserObject selectedValue,String path) throws IOException{
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject(); Reader desReader;
StringBuilder desBuf = new StringBuilder();
InputStream desInputStream = BaseUtils.readResource(path+ ((TextUserObject) selectedValue).displayText+".txt");
if (desInputStream == null) {
String description = "";
desReader = new StringReader(description);
} else {
desReader = new InputStreamReader(desInputStream);
}
BufferedReader reader = new BufferedReader(desReader);
String lineText;
while ((lineText = reader.readLine()) != null) {
if (desBuf.length() > 0) {
desBuf.append('\n');
}
desBuf.append(lineText);
}
reader.close();
desReader.close();
return desBuf;
}
private void initVariablesTreeSelectionListener(){
variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject();
if (selectedValue == null) { if (selectedValue == null) {
return; return;
} }
StringBuilder desBuf = new StringBuilder(); StringBuilder desBuf = new StringBuilder();
try { try {
Reader desReader;
String path; String path;
Locale locale = FRContext.getLocale(); Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) { if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/"; path = "/com/fr/design/insert/formula/variable/cn/";
@ -716,43 +751,42 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
path = "/com/fr/design/insert/formula/variable/en/"; path = "/com/fr/design/insert/formula/variable/en/";
} }
if (selectedValue instanceof TextUserObject) { if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject)selectedValue,path);
InputStream desInputStream = BaseUtils.readResource(path
+ ((TextUserObject) selectedValue).displayText
+ ".txt");
if (desInputStream == null) {
String description = "";
desReader = new StringReader(description);
} else {
desReader = new InputStreamReader(
desInputStream);
}
BufferedReader reader = new BufferedReader(
desReader);
String lineText;
while ((lineText = reader.readLine()) != null) {
if (desBuf.length() > 0) {
desBuf.append('\n');
}
desBuf.append(lineText);
}
reader.close();
desReader.close();
} }
} catch (IOException exp) { } catch (IOException exp) {
FRContext.getLogger().error(exp.getMessage(), exp); FRContext.getLogger().error(exp.getMessage(), exp);
} }
descriptionTextArea.setText(desBuf.toString()); descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0); descriptionTextArea.moveCaretPosition(0);
} }
}); });
}
private void initVariablesTree(){
// vairable.
variablesTree = new JTree();
UIScrollPane variablesTreePane = new UIScrollPane(variablesTree);
variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
this.add(this.createNamePane(
Inter.getLocText("FR-Designer_FormulaPane_Variables") + ":", variablesTreePane), BorderLayout.CENTER);
variablesTree.setRootVisible(false);
variablesTree.setShowsRootHandles(true);
variablesTree.addMouseListener(applyTextMouseListener);
variablesTree.setCellRenderer(applyTreeCellRenderer);
initDescriptionTextArea();
initVariablesTreeSelectionListener();
}
private void initComponents() {
this.setLayout(new BorderLayout(4, 4));
// Function
JPanel functionPane = new JPanel(new BorderLayout(4, 4));
this.add(functionPane, BorderLayout.WEST);
initFunctionTypeList(functionPane);
initFunctionNameList(functionPane);
initVariablesTree();
// 选择: // 选择:
functionTypeList.setSelectedIndex(0); functionTypeList.setSelectedIndex(0);
} }
@ -763,7 +797,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
private class LookDetailAction extends UpdateAction { private class LookDetailAction extends UpdateAction {
public LookDetailAction() { public LookDetailAction() {
this.setName(Inter.getLocText("Function_Detail")); this.setName(Inter.getLocText("FR-Designer_FormulaPane_Function_Detail"));
this.setMnemonic('L'); this.setMnemonic('L');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
} }
@ -778,7 +812,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
BasicPane basicPane = new BasicPane() { BasicPane basicPane = new BasicPane() {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Function_Detail"); return Inter.getLocText("FR-Designer_FormulaPane_Function_Detail");
} }
}; };
basicPane.setLayout(FRGUIPaneFactory.createBorderLayout()); basicPane.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -855,7 +889,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
return this; return this;
} }
}; };
public void populate(VariableResolver variableResolver) { public void populate(VariableResolver variableResolver) {
// varibale tree. // varibale tree.
DefaultTreeModel variableModel = (DefaultTreeModel) variablesTree.getModel(); DefaultTreeModel variableModel = (DefaultTreeModel) variablesTree.getModel();
@ -868,53 +902,29 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
DefaultMutableTreeNode bindCellNode = new DefaultMutableTreeNode(new TextUserObject("$$$")); DefaultMutableTreeNode bindCellNode = new DefaultMutableTreeNode(new TextUserObject("$$$"));
rootNode.add(bindCellNode); rootNode.add(bindCellNode);
} }
{ rootNode.add(new TextFolderUserObject(Inter.getLocText("FormulaD-Data_Fields"),
MutableTreeNode tableTreeNode = new TextFolderUserObject( BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"),
Inter.getLocText("FormulaD-Data_Fields"), variableResolver.resolveColumnNames()).createMutableTreeNode());
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"),
variableResolver.resolveColumnNames()).createMutableTreeNode(); // Set cutReport Variable
rootNode.add(new TextFolderUserObject(Inter.getLocText("FR-Designer_FormulaPane_Variables"),
rootNode.add(tableTreeNode); BaseUtils.readIcon("/com/fr/design/images/dialog/variable.png"),
} variableResolver.resolveCurReportVariables()).createMutableTreeNode());
{ rootNode.add(new TextFolderUserObject(Inter.getLocText(new String[]{"Datasource-Datasource", "Parameter"}),
// Set cutReport Variable BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
rootNode.add(new TextFolderUserObject( variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode());
Inter.getLocText("Variables"),
BaseUtils.readIcon("/com/fr/design/images/dialog/variable.png"), rootNode.add(new TextFolderUserObject(Inter.getLocText("ParameterD-Report_Parameter"),
variableResolver.resolveCurReportVariables()).createMutableTreeNode()); BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"),
} variableResolver.resolveReportParameterVariables()).createMutableTreeNode());
rootNode.add(new TextFolderUserObject(Inter.getLocText("M_Server-Global_Parameters"),
{ BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
rootNode.add(new TextFolderUserObject( variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode());
Inter.getLocText(new String[]{"Datasource-Datasource", "Parameter"}),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode());
}
{
MutableTreeNode reportParameterTreeNode = new TextFolderUserObject(
Inter.getLocText("ParameterD-Report_Parameter"),
BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"),
variableResolver.resolveReportParameterVariables()).createMutableTreeNode();
rootNode.add(reportParameterTreeNode);
}
{
MutableTreeNode globalParameterTreeNode = new TextFolderUserObject(
Inter.getLocText("M_Server-Global_Parameters"),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode();
rootNode.add(globalParameterTreeNode);
}
variableModel.reload(); variableModel.reload();
// Expand // Expand
for (int row = 0; row < this.variablesTree.getRowCount(); row++) { for (int row = 0; row < this.variablesTree.getRowCount(); row++) {
this.variablesTree.expandRow(row); this.variablesTree.expandRow(row);
@ -993,6 +1003,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
buffer.append("|"); buffer.append("|");
buffer.append("\n"); buffer.append("\n");
} }
System.out.println(buffer.toString()); FRContext.getLogger().debug(buffer.toString());
} }
} }

51
designer_base/src/com/fr/design/formula/FunctionConstants.java

@ -11,6 +11,8 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.FunctionDefContainer;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.script.Function; import com.fr.stable.script.Function;
import com.fr.stable.script.FunctionDef; import com.fr.stable.script.FunctionDef;
@ -23,8 +25,49 @@ import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import javax.swing.DefaultListModel;
public abstract class FunctionConstants { public abstract class FunctionConstants {
/**
* 将函数分组插件中的函数添加到对应的列表中
* @param listModel
*/
public static void addFunctionGroupFromPlugins(DefaultListModel listModel){
//hugh:自定义函数分组
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!containers.isEmpty()){
for(Mutable container : containers){
listModel.addElement(createFunctionGroup((FunctionDefContainer)container));
}
}
}
/**
* 创建一个新的分组
* @param container
* @return
*/
private static FunctionGroup createFunctionGroup(final FunctionDefContainer container){
return new FunctionGroup() {
@Override
public String getGroupName() {
return container.getGroupName();
}
@Override
public NameAndDescription[] getDescriptions() {
FunctionDef[] fs = container.getFunctionDefs();
int count = fs.length;
FunctionDefNAD[] nads = new FunctionDefNAD[count];
for (int i = 0; i < count; i ++) {
nads[i] = new FunctionDefNAD(fs[i]);
}
return nads;
}
};
}
public static FunctionGroup PLUGIN = new FunctionGroup() { public static FunctionGroup PLUGIN = new FunctionGroup() {
@Override @Override
public String getGroupName() { public String getGroupName() {
@ -96,7 +139,13 @@ public abstract class FunctionConstants {
} }
Collections.addAll(all, PLUGIN.getDescriptions()); Collections.addAll(all, PLUGIN.getDescriptions());
Collections.addAll(all, CUSTOM.getDescriptions()); Collections.addAll(all, CUSTOM.getDescriptions());
//hugh:自定义函数分组
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!containers.isEmpty()){
for(Mutable container : containers){
Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions());
}
}
java.util.Collections.sort(all, NameAndDescriptionComparator); java.util.Collections.sort(all, NameAndDescriptionComparator);
return all.toArray(new NameAndDescription[all.size()]); return all.toArray(new NameAndDescription[all.size()]);

2
designer_base/src/com/fr/design/formula/FunctionDefNAD.java

@ -6,7 +6,7 @@ import com.fr.stable.StringUtils;
public class FunctionDefNAD extends AbstractNameAndDescription { public class FunctionDefNAD extends AbstractNameAndDescription {
private FunctionDef def; private FunctionDef def;
FunctionDefNAD(FunctionDef def) { public FunctionDefNAD(FunctionDef def) {
this.def = def; this.def = def;
} }

7
designer_base/src/com/fr/design/gui/frpane/ListenerUpdatePane.java

@ -29,7 +29,7 @@ public abstract class ListenerUpdatePane extends BasicBeanPane<Listener> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Event"); return Inter.getLocText("FR-Designer_Event");
} }
@Override @Override
@ -45,4 +45,9 @@ public abstract class ListenerUpdatePane extends BasicBeanPane<Listener> {
return editing; return editing;
} }
@Override
public void checkValid() throws Exception{
actionPane.checkValid();
}
} }

6
designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java

@ -133,6 +133,12 @@ public abstract class UIComboBoxPane<T> extends BasicBeanPane<T> {
return cards.get(jcb.getSelectedIndex()).updateBean(); return cards.get(jcb.getSelectedIndex()).updateBean();
} }
@Override
public void checkValid() throws Exception {
cards.get(jcb.getSelectedIndex()).checkValid();
}
public int getSelectedIndex() { public int getSelectedIndex() {
return jcb.getSelectedIndex(); return jcb.getSelectedIndex();
} }

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

23
designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java

@ -43,15 +43,6 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
contentDBManiPane = new ArrayList(); contentDBManiPane = new ArrayList();
contentDBManiPane.add(createDBManipulationPane()); contentDBManiPane.add(createDBManipulationPane());
paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane)); paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane));
paneList.add(new ProcessJSImplPane() {
private static final long serialVersionUID = 1;
@Override
protected Editor[] getCorrespondEditors() {
return isForm() ? ValueEditorPaneFactory.formEditors() : ValueEditorPaneFactory.extendedEditors();
}
}
);
paneList.add(initEmaiPane()); paneList.add(initEmaiPane());
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) { if (javaScriptActionProviders != null) {
@ -84,14 +75,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* @return 返回按钮对象 * @return 返回按钮对象
*/ */
public UIButton createCallButton() { public UIButton createCallButton() {
UIButton callButton = new UIButton(Inter.getLocText("Set_Callback_Function")); UIButton callButton = new UIButton(Inter.getLocText("FR-Designer_Set_Callback_Function"));
callButton.addActionListener(new ActionListener() { callButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final JavaScriptActionPane callPane = new JavaScriptActionPane() { final JavaScriptActionPane callPane = new JavaScriptActionPane() {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function"); return Inter.getLocText("FR-Designer_Set_Callback_Function");
} }
@Override @Override
@ -162,7 +153,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function"); return Inter.getLocText("FR-Designer_Set_Callback_Function");
} }
@Override @Override
@ -179,10 +170,10 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* 生成界面默认的组建 * 生成界面默认的组建
* *
* @return 返回生成的面板 * @return 返回生成的面板
*/
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
*/
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
@Override @Override
public DBManipulationPane createDBManipulationPane() { public DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane(); return new DBManipulationPane();
@ -190,7 +181,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function"); return Inter.getLocText("FR-Designer_Set_Callback_Function");
} }
@Override @Override

2
designer_base/src/com/fr/design/write/submit/CustomJobPane.java

@ -1 +1 @@
package com.fr.design.write.submit; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Author : Shockway * Date: 13-7-29 * Time: 下午6:48 */ public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; public static final int DEFAULT_LENGTH = 30; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(getLengthOfTextField()); reportletNamePane.add(classNameTextField); UIButton browserButton = new UIButton(Inter.getLocText("Select")); browserButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); UIButton editButton = new UIButton(Inter.getLocText("Edit")); editButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); Select")); Select")); Select")); Select")); browserButton.setPreferredSize(new Dimension( public void actionPerformed(ActionEvent evt) { Select")); classNameTextField.getPreferredSize().height)); bPane.setClassPath(classNameTextField.getText()); Select")); UIButton editButton = new UIButton(Inter.getLocText("Edit")); SwingUtilities.getWindowAncestor(getWindowAncestor()), new DialogActionAdapter() { Select")); classNameTextField.getPreferredSize().height)); classNameTextField.setText(bPane.getClassPath()); checkAddButtonEnable(); } }).setVisible(true); } }); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), new DialogActionAdapter() { public void doOk() { classNameTextField.setText(javaEditorPane.getClassText()); browserButton.setPreferredSize(new Dimension( Select")); } }); javaEditorPane.addSaveActionListener(new ActionListener() { @Override browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, dlg.doOK(); } }); dlg.setVisible(true); } }); reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ClassName"), null)); this.add(reportletNamePane, BorderLayout.NORTH); objectProperiesPane = new ObjectProperiesPane(); objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Property"), null)); this.add(objectProperiesPane, BorderLayout.CENTER); UITextArea area = new UITextArea(2, 1); Select")); JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); browserButton.getPreferredSize().width, dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Description"), null)); this.add(dsPane, BorderLayout.SOUTH); checkAddButtonEnable(); } browserButton.getPreferredSize().width, return DEFAULT_LENGTH; } protected String title4PopupWindow() { UIButton editButton = new UIButton(Inter.getLocText("Edit")); Select")); } protected Component getWindowAncestor() { return this; } UIButton editButton = new UIButton(Inter.getLocText("Edit")); classNameTextField.getPreferredSize().height)); public void populateBean(Object ob) { if (ob instanceof AbstractClassJob) { AbstractClassJob cj = (AbstractClassJob) ob; UIButton editButton = new UIButton(Inter.getLocText("Edit")); browserButton.getPreferredSize().width, UIButton editButton = new UIButton(Inter.getLocText("Edit")); classNameTextField.getPreferredSize().height)); editButton.setPreferredSize(new Dimension( editButton.setPreferredSize(new Dimension( Select")); editButton.setPreferredSize(new Dimension( editButton.setPreferredSize(new Dimension( browserButton.setPreferredSize(new Dimension( * 添加按钮可用 */ public void checkAddButtonEnable() { objectProperiesPane.enableAddButton(!StringUtils.isEmpty(classNameTextField.getText())); } /** * 重置 */ public void reset() { this.classNameTextField.setText(null); this.checkAddButtonEnable(); } } package com.fr.design.write.submit; import com.fr.data.AbstractClassJob; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.frpane.ObjectProperiesPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Author : Shockway * Date: 13-7-29 * Time: 下午6:48 */ public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; public static final int DEFAULT_LENGTH = 30; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); classNameTextField = new UITextField(getLengthOfTextField()); reportletNamePane.add(classNameTextField); UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select_panel")); browserButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); browserButton.getPreferredSize().width, Select")); browserButton.getPreferredSize().width, browserButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, UIButton editButton = new UIButton(Inter.getLocText("Edit")); browserButton.getPreferredSize().width, editButton.setPreferredSize(new Dimension( browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); final ClassNameSelectPane bPane = new ClassNameSelectPane(); bPane.setClassPath(classNameTextField.getText()); bPane.showWindow( SwingUtilities.getWindowAncestor(getWindowAncestor()), new DialogActionAdapter() { classNameTextField.getPreferredSize().height)); classNameTextField.setText(bPane.getClassPath()); checkAddButtonEnable(); } }).setVisible(true); Select")); Select")); Select")); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reportletNamePane.add(browserButton); Select")); UIButton editButton = new UIButton(Inter.getLocText("Edit")); new DialogActionAdapter() { public void doOk() { classNameTextField.setText(javaEditorPane.getClassText()); checkAddButtonEnable(); } }); reportletNamePane.add(editButton); browserButton.setPreferredSize(new Dimension( Select")); public void actionPerformed(ActionEvent evt) { Select")); Select")); classNameTextField.getPreferredSize().height)); Select")); bPane.setClassPath(classNameTextField.getText()); Select")); Select")); UIButton editButton = new UIButton(Inter.getLocText("Edit")); Select")); SwingUtilities.getWindowAncestor(getWindowAncestor()), Select")); new DialogActionAdapter() { Select")); Select")); classNameTextField.getPreferredSize().height)); Select")); classNameTextField.setText(bPane.getClassPath()); Select")); checkAddButtonEnable(); Select")); } Select")); }).setVisible(true); Select")); } Select")); }); Select")); editButton.addActionListener(new ActionListener() { Select")); @Override Select")); public void actionPerformed(ActionEvent e) { Select")); final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB); Select")); final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this), Select")); new DialogActionAdapter() { Select")); public void doOk() { Select")); classNameTextField.setText(javaEditorPane.getClassText()); browserButton.getPreferredSize().width, Select")); Select")); } Select")); }); } Select")); javaEditorPane.addSaveActionListener(new ActionListener() { Select")); @Override public void actionPerformed(ActionEvent evt) { browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, Select")); protected Component getWindowAncestor() { Select")); dlg.doOK(); } Select")); } Select")); }); Select")); dlg.setVisible(true); Select")); } Select")); }); Select")); reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ClassName"), null)); Select")); this.add(reportletNamePane, BorderLayout.NORTH); Select")); objectProperiesPane = new ObjectProperiesPane(); Select")); browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, browserButton.getPreferredSize().width, Select")); Select")); classNameTextField.getPreferredSize().height)); browserButton.getPreferredSize().width, final ClassNameSelectPane bPane = new ClassNameSelectPane(); classNameTextField.getPreferredSize().height)); bPane.setClassPath(classNameTextField.getText()); Select")); Select")); Select")); browserButton.setPreferredSize(new Dimension( Empty(classNameTextField.getText())); } /** * 重置 */ public void reset() { this.classNameTextField.setText(null); this.checkAddButtonEnable(); } }

17
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -513,8 +513,10 @@ public class RemoteEnv implements Env {
} }
private void stopLogTimer() { private void stopLogTimer() {
logTimer.cancel(); if(logTimer != null) {
logTimer = null; logTimer.cancel();
logTimer = null;
}
} }
/** /**
@ -2063,6 +2065,17 @@ public class RemoteEnv implements Env {
} }
/**
* 获取插件的配置目录
*
* @param plugin
*/
public String getPluginFilePath(Plugin plugin) {
return StringUtils.EMPTY;
}
public void readPluginLicenses() throws Exception { public void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();

69
designer_chart/build.performance.gradle

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-chart'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

69
designer_chart/build.performance.gradle.bak

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-chart'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../${baseDir}/lib4build',includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

53
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -25,12 +25,18 @@ import com.fr.general.*;
import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginCollector;
import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginMessage; import com.fr.plugin.PluginMessage;
import com.fr.design.extra.ChartTypeInterfaceCloseableHandler;
import com.fr.plugin.proxy.PluginInstanceProxyFactory;
import com.fr.plugin.proxy.PluginInvocationHandler;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.collections.map.CloseableContainedMap;
import com.fr.stable.fun.Authorize; import com.fr.stable.fun.Authorize;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.stable.plugin.PluginReadListener; import com.fr.stable.plugin.PluginReadListener;
import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.plugin.PluginSimplify;
import com.fr.stable.plugin.closeable.Closeable;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -42,13 +48,12 @@ import java.util.*;
*/ */
public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider {
private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ClassLoader loader = Thread.currentThread().getContextClassLoader();
private static ChartTypeInterfaceManager classManager = null; private static ChartTypeInterfaceManager classManager = null;
private static LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>> chartTypeInterfaces = new LinkedHashMap<String, LinkedHashMap<String, IndependentChartUIProvider>>();
private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces =
new LinkedHashMap<>();
public synchronized static ChartTypeInterfaceManager getInstance() { public synchronized static ChartTypeInterfaceManager getInstance() {
if (classManager == null) { if (classManager == null) {
@ -85,7 +90,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
for (int i = 0; i < typeName.length; i++) { for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID(); String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if(rowChart == null) { if(ArrayUtils.isEmpty(rowChart)) {
continue; continue;
} }
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
@ -134,7 +139,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){ if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){
return; return;
} }
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>(); CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList =
new CloseableContainedMap<>(LinkedHashMap.class);
chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface());
chartUIList.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); chartUIList.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface());
@ -172,6 +178,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
} }
private String getIconPath(String priority, String plotID) { private String getIconPath(String priority, String plotID) {
if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) { if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) {
return chartTypeInterfaces.get(priority).get(plotID).getIconPath(); return chartTypeInterfaces.get(priority).get(plotID).getIconPath();
}else { }else {
@ -183,11 +190,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (chartTypeInterfaces != null){ if (chartTypeInterfaces != null){
if (!chartTypeInterfaces.containsKey(priority)){ if (!chartTypeInterfaces.containsKey(priority)){
//新建一个具体图表列表 //新建一个具体图表列表
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = new LinkedHashMap<String, IndependentChartUIProvider>(); CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList
= new CloseableContainedMap<>(LinkedHashMap.class);
chartUIList.put(plotID, provider); chartUIList.put(plotID, provider);
chartTypeInterfaces.put(priority, chartUIList); chartTypeInterfaces.put(priority, chartUIList);
}else { }else {
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority); Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
if (!chartUIList.containsKey(plotID)) { if (!chartUIList.containsKey(plotID)) {
chartUIList.put(plotID, provider); chartUIList.put(plotID, provider);
} }
@ -209,23 +217,27 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (authorize != null) { if (authorize != null) {
PluginLicenseManager.getInstance().registerPaid(authorize, simplify); PluginLicenseManager.getInstance().registerPaid(authorize, simplify);
} }
IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance(); IndependentChartUIProvider provider = getProxyObj(plotID, simplify, clazz);
if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName())) {
PluginMessage.remindUpdate(className); PluginMessage.remindUpdate(className);
} else { } else {
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID); addChartTypeInterface(provider, priority, plotID);
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage()); FRLogger.getLogger().error("class not found:" + e.getMessage());
} catch (IllegalAccessException | InstantiationException e) { } catch (IllegalAccessException | InstantiationException e) {
FRLogger.getLogger().error("object create error:" + e.getMessage()); FRLogger.getLogger().error("object create error:" + e.getMessage());
} catch (NoSuchMethodException e) {
FRLogger.getLogger().error(e.getMessage());
} }
} }
} }
//UI对应的chart如果没有加载,UI也不必加进去了 private IndependentChartUIProvider getProxyObj(String plotID, PluginSimplify simplify, Class<?> clazz) throws IllegalAccessException, InstantiationException, NoSuchMethodException {
private boolean containsChart(String plotID) {
return ChartTypeManager.getInstance().containsPlot(plotID); PluginInstanceProxyFactory factory = new PluginInstanceProxyFactory(clazz, simplify);
PluginInvocationHandler handler = new ChartTypeInterfaceCloseableHandler(plotID);
return (IndependentChartUIProvider) factory.addProxy(Closeable.class, handler).getProxyObj();
} }
@ -252,8 +264,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return getTitle4PopupWindow(); return getTitle4PopupWindow();
} }
String[] names = new String[getChartSize(priority)]; String[] names = new String[getChartSize(priority)];
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority); Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Iterator iterator = chartUIList.entrySet().iterator(); Iterator iterator = chartUIList.entrySet().iterator();
int i = 0; int i = 0;
while (iterator.hasNext()){ while (iterator.hasNext()){
@ -272,7 +284,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @return * @return
*/ */
public String getTitle4PopupWindow(String priority, String plotID){ public String getTitle4PopupWindow(String priority, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return provider.getPlotTypeTitle4PopupWindow(); return provider.getPlotTypeTitle4PopupWindow();
} }
@ -414,7 +427,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
private boolean plotInChart(String plotID, String priority) { private boolean plotInChart(String plotID, String priority) {
return chartTypeInterfaces != null return chartTypeInterfaces != null
&& chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.containsKey(priority)
&& chartTypeInterfaces.get(priority).containsKey(plotID); && chartTypeInterfaces.get(priority).containsKey(plotID);
} }
private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) { private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
@ -466,7 +479,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey(); String priority = (String) entry.getKey();
if (chartTypeInterfaces.get(priority).containsKey(plotID)){ if (chartTypeInterfaces.get(priority).containsKey(plotID)) {
return isUseDefaultPane(priority, plotID); return isUseDefaultPane(priority, plotID);
} }
} }
@ -474,7 +487,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return true; return true;
} }
private boolean isUseDefaultPane(String priority, String plotID){ private boolean isUseDefaultPane(String priority, String plotID) {
if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane(); return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane();

31
designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java

@ -0,0 +1,31 @@
package com.fr.design.extra;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.plugin.proxy.CloseableInvocationHandler;
/**
* Created by juhaoyu on 2016/12/27.
*/
public class ChartTypeInterfaceCloseableHandler extends CloseableInvocationHandler {
private final String plotID;
public ChartTypeInterfaceCloseableHandler(String plotID) throws NoSuchMethodException {
super();
this.plotID = plotID;
}
@Override
protected boolean invokeIsClosed() {
//UI对应的chart如果关闭或者不存在,则UI关闭
return super.invokeIsClosed() || !containsChart();
}
private boolean containsChart() {
return ChartTypeManager.getInstance().containsPlot(plotID);
}
}

2
designer_chart/src/com/fr/design/module/ChartDesignerModule.java

@ -1 +1 @@
package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App<?>[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App<?>[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart)) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } }

2
designer_form/build.dev.gradle

@ -20,7 +20,7 @@ sourceSets{
main{ main{
java{ java{
srcDirs=["${srcDir}/src", srcDirs=["${srcDir}/src",
"${srcDir}/../designer/src"] "${srcDir}/../designer/src"]
} }
} }
} }

2
designer_form/build.dev.gradle.bak

@ -34,7 +34,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//jar包 //jar包
FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
f.each{File file-> f.each{File file->
println "----${f.path}" println "----${file.path}"
} }
// //

70
designer_form/build.performance.gradle

@ -0,0 +1,70 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-report'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src",
"${srcDir}/../designer/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

69
designer_form/build.performance.gradle.bak

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-report'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

2
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -426,7 +426,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
*/ */
public boolean acceptType(Class<?>... acceptTypes) { public boolean acceptType(Class<?>... acceptTypes) {
for (Class<?> type : acceptTypes) { for (Class<?> type : acceptTypes) {
if (StableUtils.classInstanceOf(this.getClass(), type)) { if (StableUtils.objectInstanceOf(this, type)) {
return true; return true;
} }
} }

21
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -81,6 +81,27 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
}; };
} }
/**
* 控件名属性
* @return
* @throws IntrospectionException
*/
public CRPropertyDescriptor createWidgetNameDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name"));
}
/**
* 边距属性
* @return
* @throws IntrospectionException
*/
public CRPropertyDescriptor createMarginDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
}
/** /**
* 返回对应的wlayout * 返回对应的wlayout
* @return wlayout控件 * @return wlayout控件

19
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -1,13 +1,12 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import java.awt.Dimension; import java.awt.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.Icon; import javax.swing.Icon;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -32,7 +31,7 @@ public class XCardAddButton extends XButton{
private static final int START_INDEX = 3; private static final int START_INDEX = 3;
private static final int INDEX = 0; private static final int INDEX = 0;
private static final int DEFAULT_BUTTON_WIDTH = 80;
private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png"); private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png");
private Icon addIcon = ADD_ICON; private Icon addIcon = ADD_ICON;
@ -140,15 +139,15 @@ public class XCardAddButton extends XButton{
//新增tab //新增tab
private void addTab(int index){ private void addTab(int index){
Dimension dimension = new Dimension(); Dimension dimension = new Dimension();
XCardSwitchButton button = (XCardSwitchButton) this.tagLayout.getComponent(INDEX); dimension.width = DEFAULT_BUTTON_WIDTH;
dimension.width = button.getWidth();
String cardLayoutName = cardLayout.toData().getWidgetName(); String cardLayoutName = cardLayout.toData().getWidgetName();
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
//设置标题 //设置标题
titleButton.setText(getTabTitleName()); titleButton.setText(getTabTitleName());
XCardSwitchButton showButton = new XCardSwitchButton(titleButton,dimension,cardLayout,tagLayout); titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
titleButton.setCustomStyle(true); XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setCustomStyle(true);
titleButton.setShowButton(true); titleButton.setShowButton(true);
showButton.setBackupParent(tagLayout); showButton.setBackupParent(tagLayout);
@ -162,6 +161,8 @@ public class XCardAddButton extends XButton{
private void showNewTab(EditingMouseListener editingMouseListener,int index){ private void showNewTab(EditingMouseListener editingMouseListener,int index){
SelectionModel selectionModel = editingMouseListener.getSelectionModel(); SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index); XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout); selectionModel.setSelectedCreator(tabFitLayout);
} }
@ -188,4 +189,4 @@ public class XCardAddButton extends XButton{
public XLayoutContainer getTopLayout() { public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout(); return this.getBackupParent().getTopLayout();
} }
} }

197
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -3,17 +3,16 @@
*/ */
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import java.awt.Color; import java.awt.*;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.*;
import javax.swing.Icon; import javax.swing.*;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
@ -33,6 +32,7 @@ import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter;
/** /**
* *
@ -41,25 +41,40 @@ import com.fr.general.FRFont;
*/ */
public class XCardSwitchButton extends XButton { public class XCardSwitchButton extends XButton {
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
private static final int LEFT_GAP = 16; private static final int LEFT_GAP = 16;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
//设置的图片类型
private static final String COLORBACKGROUNDTYPE = "ColorBackground";
private static final String DEFAULTTYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color NORMAL_GRAL = new Color(236,236,236);
public static final Color CHOOSED_GRAL = new Color(222,222,222); public static final Color CHOOSED_GRAL = new Color(222,222,222);
private static final int MIN_SIZE = 1; private static final int MIN_SIZE = 1;
// 删除按钮识别区域偏移量 // 删除按钮识别区域偏移量
private static final int RIGHT_OFFSET = 15; private static final int RIGHT_OFFSET = 15;
private static final int TOP_OFFSET = 25; private static final int TOP_OFFSET = 25;
//这边先不计算button的高度,涉及到layout那边的整体高度,先用之前的固定高度
private static final int DEFAULT_BUTTON_HEIGHT = 36;
// tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量 // tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量
private static final int FONT_SIZE_ADJUST = 2; private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
private Background selectBackground;
private boolean isCustomStyle;
private UILabel label;
private Icon closeIcon = MOUSE_COLSE; private Icon closeIcon = MOUSE_COLSE;
public XWCardTagLayout getTagLayout() { public XWCardTagLayout getTagLayout() {
@ -78,6 +93,30 @@ public class XCardSwitchButton extends XButton {
this.cardLayout = cardLayout; this.cardLayout = cardLayout;
} }
public boolean isCustomStyle() {
return isCustomStyle;
}
public void setCustomStyle(boolean customStyle) {
isCustomStyle = customStyle;
}
public Background getSelectBackground() {
return selectBackground;
}
public void setSelectBackground(Background selectBackground) {
this.selectBackground = selectBackground;
}
public UILabel getLabel() {
return label;
}
public void setLabel(UILabel label) {
this.label = label;
}
public XCardSwitchButton(CardSwitchButton widget, Dimension initSize) { public XCardSwitchButton(CardSwitchButton widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
@ -133,6 +172,8 @@ public class XCardSwitchButton extends XButton {
// 切换到当前tab按钮对应的tabFitLayout // 切换到当前tab按钮对应的tabFitLayout
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index); XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout); selectionModel.setSelectedCreator(tabFitLayout);
if (editingMouseListener.stopEditing()) { if (editingMouseListener.stopEditing()) {
@ -141,11 +182,17 @@ public class XCardSwitchButton extends XButton {
editingMouseListener.startEditing(this, editingMouseListener.startEditing(this,
adapter.getDesignerEditor(), adapter); adapter.getDesignerEditor(), adapter);
} }
setTabsAndAdjust();
} }
//删除card,同时修改其他switchbutton和tabfit的index //删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){ private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
tagLayout.remove(button); tagLayout.remove(button);
// 先清除该tab内部组件,否在再显示上有样式的残留 // 先清除该tab内部组件,否在再显示上有样式的残留
XWTabFitLayout tabLayout = (XWTabFitLayout)cardLayout.getComponent(index); XWTabFitLayout tabLayout = (XWTabFitLayout)cardLayout.getComponent(index);
@ -206,7 +253,9 @@ public class XCardSwitchButton extends XButton {
Point position = button.getLocation(); Point position = button.getLocation();
int width = button.getWidth(); int width = button.getWidth();
int height = button.getHeight(); int height = button.getHeight();
ey = ey % DEFAULT_BUTTON_HEIGHT;
// 鼠标进入按钮右侧删除图标区域 // 鼠标进入按钮右侧删除图标区域
double recX = position.getX() + (width - RIGHT_OFFSET); double recX = position.getX() + (width - RIGHT_OFFSET);
double recY = position.getY() + (height - TOP_OFFSET); double recY = position.getY() + (height - TOP_OFFSET);
@ -225,6 +274,7 @@ public class XCardSwitchButton extends XButton {
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
setTabsAndAdjust();
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
drawBackgorund(); drawBackgorund();
drawTitle(); drawTitle();
@ -241,16 +291,22 @@ public class XCardSwitchButton extends XButton {
//画背景 //画背景
private void drawBackgorund(){ private void drawBackgorund(){
CardSwitchButton button = (CardSwitchButton)this.toData(); CardSwitchButton button = (CardSwitchButton)this.toData();
ColorBackground background; Background currentBackground;
if(button.isShowButton()){ currentBackground = this.getSelectBackground();
this.rebuid(); //这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断
background = ColorBackground.getInstance(CHOOSED_GRAL); String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULTTYPE;
this.setContentBackground(background); if (type.equals(COLORBACKGROUNDTYPE) || type.equals(DEFAULTTYPE)) {
}else{ ColorBackground background;
this.rebuid(); if(button.isShowButton()){
background = ColorBackground.getInstance(NORMAL_GRAL); this.rebuid();
this.setContentBackground(background); background = ColorBackground.getInstance(CHOOSED_GRAL);
} this.setContentBackground(background);
}else{
this.rebuid();
background = ColorBackground.getInstance(NORMAL_GRAL);
this.setContentBackground(background);
}
}
} }
//画标题 //画标题
@ -265,17 +321,22 @@ public class XCardSwitchButton extends XButton {
// 标题部分 // 标题部分
WidgetTitle title = style.getTitle(); WidgetTitle title = style.getTitle();
FRFont font = title.getFrFont(); FRFont font = button.getFont();
if (font == null) {
font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
label.setForeground(font.getForeground()); label.setForeground(font.getForeground());
Background background = title.getBackground(); Background background = title.getBackground();
if (background != null) { if (background != null) {
if(button.isShowButton()){ if(button.isShowButton() && selectBackground != null){
background = ColorBackground.getInstance(CHOOSED_GRAL); this.setContentBackground(selectBackground);
this.setContentBackground(background); }else if (button.isShowButton() && selectBackground == null){
}else{ background = ColorBackground.getInstance(CHOOSED_GRAL);
this.setContentBackground(background);
} else {
this.setContentBackground(background); this.setContentBackground(background);
} }
} }
@ -283,6 +344,12 @@ public class XCardSwitchButton extends XButton {
//删除tab布局 //删除tab布局
private void deleteTabLayout(SelectionModel selectionModel,FormDesigner designer){ private void deleteTabLayout(SelectionModel selectionModel,FormDesigner designer){
String titleName = this.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
XLayoutContainer mainLayout = this.cardLayout.getBackupParent(); XLayoutContainer mainLayout = this.cardLayout.getBackupParent();
if(mainLayout != null){ if(mainLayout != null){
selectionModel.setSelectedCreator(mainLayout); selectionModel.setSelectedCreator(mainLayout);
@ -298,4 +365,66 @@ public class XCardSwitchButton extends XButton {
return this.getBackupParent().getTopLayout(); return this.getBackupParent().getTopLayout();
} }
} public void setTabsAndAdjust() {
if (this.tagLayout == null) {
return;
}
int tabLength = this.tagLayout.getComponentCount();
Map<Integer, Integer> cardWidth = new HashMap<>();
Map<Integer, Integer> cardHeight = new HashMap<>();
for (int i = 0; i < tabLength; i++) {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton tempCard = (CardSwitchButton) temp.toData();
String tempText = tempCard.getText();
Font f = tempCard.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f);
cardWidth.put(i,fm.stringWidth(tempText));
cardHeight.put(i,fm.getHeight());
}
adjustTabs(tabLength, cardWidth, cardHeight);
}
public void adjustTabs(int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {
if (width == null) {
return;
}
int tempX = 0;
for (int i = 0; i < tabLength; i++) {
Rectangle rectangle = this.tagLayout.getComponent(i).getBounds();
Integer cardWidth = width.get(i) + SIDE_OFFSET;
//先用这边的固定高度
Integer cardHeight = DEFAULT_BUTTON_HEIGHT;
rectangle.setSize(cardWidth, cardHeight);
rectangle.setBounds(tempX, 0, cardWidth, cardHeight);
tempX += cardWidth;
this.tagLayout.getComponent(i).setBounds(rectangle);
Dimension dimension = new Dimension();
dimension.setSize(cardWidth, cardHeight);
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont();
if (frFont == null) {
frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
UILabel label = temp.getContentLabel();
label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));
label.setForeground(frFont.getForeground());
temp.setContentLabel(label);
temp.setSize(dimension);
temp.setPreferredSize(new Dimension(cardWidth, cardHeight));
}
}
@Override
public void doLayout() {
super.doLayout();
setTabsAndAdjust();
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
label = this.getContentLabel();
}
}

102
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -6,13 +6,16 @@ package com.fr.design.designer.creator.cardlayout;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.form.layout.FRCardLayout; import com.fr.design.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
@ -22,6 +25,7 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -39,6 +43,8 @@ public class XWCardLayout extends XLayoutContainer {
private CardLayout cardLayout; private CardLayout cardLayout;
private boolean initFlag = true; private boolean initFlag = true;
private static final int NORTH = 0; private static final int NORTH = 0;
private FormDesigner designer;
//默认蓝色标题背景 //默认蓝色标题背景
private static final Color TITLE_COLOR = new Color(51, 132, 240); private static final Color TITLE_COLOR = new Color(51, 132, 240);
@ -197,9 +203,9 @@ public class XWCardLayout extends XLayoutContainer {
CardSwitchButton firstBtn = new CardSwitchButton(widgetName); CardSwitchButton firstBtn = new CardSwitchButton(widgetName);
firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0); firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0);
firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE)); firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1),this,xTag);
firstBtn.setCustomStyle(true); firstBtn.setCustomStyle(true);
xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag);
xFirstBtn.setBackupParent(xTag); xFirstBtn.setBackupParent(xTag);
return xFirstBtn; return xFirstBtn;
@ -264,35 +270,75 @@ public class XWCardLayout extends XLayoutContainer {
public boolean hasTitleStyle() { public boolean hasTitleStyle() {
return true; return true;
} }
/** /**
* 得到属性名 * 得到属性名
* @return 属性名 * @return 属性名
* @throws IntrospectionException * @throws IntrospectionException
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { CRPropertyDescriptor[] crp = null;
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter return ArrayUtils.addAll(getDefaultDescriptor(), crp);
.getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){ }
@Override public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException {
public void propertyChange(){ return new CRPropertyDescriptor[] {
WCardLayout cardLayout = toData(); new CRPropertyDescriptor("carousel", this.data.getClass())
changeRalateSwitchCardname(cardLayout.getWidgetName()); .setEditorClass(BooleanEditor.class)
} .setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
}), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( .setPropertyChangeListener(new PropertyChangeAdapter() {
CardTagWLayoutBorderStyleEditor.class).setI18NName( @Override
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") public void propertyChange() {
.setPropertyChangeListener(new PropertyChangeAdapter() { designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}),
new CRPropertyDescriptor("carouselInterval", this.data.getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_carouselInterval"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
};
}
public CRPropertyDescriptor[] getisnotCarousel() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("carousel", this.data.getClass())
.setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_setCarousel"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Tab_carousel")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
})
};
}
public CRPropertyDescriptor[] getDefaultDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")).setPropertyChangeListener(new PropertyChangeAdapter(){
@Override
public void propertyChange(){
WCardLayout cardLayout = toData();
changeRalateSwitchCardname(cardLayout.getWidgetName());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
CardTagWLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); initStyle();
} }
}), })
}; };
} }
//初始化样式 //初始化样式

12
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -163,18 +163,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
* void * void
*/ */
public void adjustComponentWidth(){ public void adjustComponentWidth(){
int btnNum = this.getComponentCount();
int tagLayoutWidth = this.getWidth();
int allBtnWidth = btnNum * CardSwitchButton.DEF_WIDTH + btnNum;
int size = CardSwitchButton.DEF_WIDTH;
if(tagLayoutWidth - allBtnWidth < CardSwitchButton.DEF_WIDTH){
size = (tagLayoutWidth - CardSwitchButton.DEF_WIDTH - btnNum)/btnNum;
}
WCardTagLayout layout = (WCardTagLayout)this.toData();
for(int i=0;i<btnNum;i++){
CardSwitchButton button = layout.getSwitchButton(i);
layout.setWidthAtWidget(button, size);
}
} }

229
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -1,12 +1,12 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import java.awt.Component; import java.awt.*;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import javax.swing.border.Border; import javax.swing.border.Border;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
@ -14,19 +14,26 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.design.mainframe.widget.editors.FontEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
/** /**
* @author focus * @author focus
@ -37,8 +44,16 @@ public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 1; private static final int MIN_SIZE = 1;
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份 // 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236);
private static final String DEFAULT_FONT_NAME = "SimSun";
public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12);
public final static FRFont DEFAULT_FRFT = FRFont.getInstance(DEFAULT_FONT_NAME, 0, 9);
private Dimension referDim; private Dimension referDim;
private Background initialBackground;
private Background overBackground;
private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() { public Dimension getReferDim() {
return referDim; return referDim;
@ -48,6 +63,47 @@ public class XWTabFitLayout extends XWFitLayout {
this.referDim = referDim; this.referDim = referDim;
} }
public Background getInitialBackground() {
return initialBackground;
}
public void setInitialBackground(Background initialBackground) {
this.initialBackground = initialBackground;
}
public Background getOverBackground() {
return overBackground;
}
public void setOverBackground(Background overBackground) {
this.overBackground = overBackground;
}
public Background getClickBackground() {
return clickBackground;
}
public void setClickBackground(Background clickBackground) {
this.clickBackground = clickBackground;
}
@Override
public FRFont getFont() {
return font;
}
public void setFont(FRFont font) {
this.font = font;
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
}
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
}
public XWTabFitLayout(){ public XWTabFitLayout(){
this(new WTabFitLayout(), new Dimension()); this(new WTabFitLayout(), new Dimension());
} }
@ -55,22 +111,157 @@ public class XWTabFitLayout extends XWFitLayout {
public XWTabFitLayout(WTabFitLayout widget, Dimension initSize) { public XWTabFitLayout(WTabFitLayout widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
/** /**
* 得到属性名 * 得到属性名
* @return 属性名 * @return 属性名
* @throws IntrospectionException * @throws IntrospectionException
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { CRPropertyDescriptor[] crp = null;
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter return ArrayUtils.addAll(defaultDescriptor(), crp);
.getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
};
} }
protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
//标题样式
creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
}),
//初始背景
creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
initialBackground = ((WTabFitLayout) data).getInitialBackground();
xCardSwitchButton.setSelectBackground(null);
xCardSwitchButton.setSelectBackground(initialBackground);
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setInitialBackground(initialBackground);
}
}),
//鼠标浮动背景
creatNonListenerStyle(2).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
overBackground = ((WTabFitLayout) data).getOverBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setOverBackground(overBackground);
}
}),
//鼠标点击背景
creatNonListenerStyle(3).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
clickBackground = ((WTabFitLayout) data).getClickBackground();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setClickBackground(clickBackground);
}
}
),
//字体
creatNonListenerStyle(4).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
font = ((WTabFitLayout) data).getFont();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setFont(font);
UILabel uiLabel = xCardSwitchButton.getLabel();
uiLabel.setFont(font.applyResolutionNP(ScreenResolution.getScreenResolution()));
uiLabel.setForeground(font.getForeground());
xCardSwitchButton.setLabel(uiLabel);
}
}),
};
}
protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException {
return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
checkButonType();
}
})
};
}
protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{
CRPropertyDescriptor[] crPropertyDescriptors = {
new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass(
ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Initial")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Over")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
return crPropertyDescriptors[i];
}
protected CRPropertyDescriptor[] defaultDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crPropertyDescriptors = {
super.createWidgetNameDescriptor(),
super.createMarginDescriptor()
};
return crPropertyDescriptors;
}
private void checkButonType() {
if (this.xCardSwitchButton == null) {
return;
}
boolean isStyle = ((WTabFitLayout) data).isCustomStyle();
Background bg;
bg = ColorBackground.getInstance(NORMAL_GRAL);
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.getLabel().setFont(DEFAULTFT);
cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null);
cardSwitchButton.setFont(DEFAULT_FRFT);
} else {
Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true);
if (font != null) {
cardSwitchButton.setFont(font);
}
if (this.initialBackground != null){
this.xCardSwitchButton.setSelectBackground(this.initialBackground);
cardSwitchButton.setInitialBackground(this.initialBackground);
}
if (this.overBackground != null){
cardSwitchButton.setOverBackground(this.overBackground);
}
if (this.clickBackground != null) {
cardSwitchButton.setClickBackground(this.clickBackground);
}
}
}
@Override @Override
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
return new FRTabFitLayoutAdapter(this); return new FRTabFitLayoutAdapter(this);

8
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -50,15 +50,15 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class) .setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal")) .setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class) .setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical")) .setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit")),
new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class) new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict")) .setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.setRendererClass(BooleanRender.class) .setRendererClass(BooleanRender.class)
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit"))
}; };
List<CRPropertyDescriptor> defaultList = new ArrayList<>(); List<CRPropertyDescriptor> defaultList = new ArrayList<>();
@ -96,7 +96,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
} }
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer))); groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit"), xCreator, propertyTableEditor, designer)));
TableModel model = new BeanTableModel(); TableModel model = new BeanTableModel();
setModel(model); setModel(model);

35
designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -1,6 +1,7 @@
package com.fr.design.form.mobile; package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -15,22 +16,34 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器 //工具栏容器
private MobileToolBarPane mobileToolBarPane; private MobileToolBarPane mobileToolBarPane;
static final int paddingHeight = 10; //h5解析容器
private MobileUseHtmlGroupPane mobileUseHtmlGroupPane;
static final int PADDINGHEIGHT = 10;
public FormMobileAttrPane() { public FormMobileAttrPane() {
this.initComponents(); this.initComponents();
} }
//现在只有两个panel,填不满自适应对话框,只能为工具栏Panel和h5解析方式panel分别包裹上一层Panel再计算高度,不然会自动
//拉长两个Panel的高度去填满整个对话框。
private void initComponents() { private void initComponents() {
JPanel jPanel = new JPanel(); JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jPanel2.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.mobileToolBarPane = new MobileToolBarPane(); this.mobileToolBarPane = new MobileToolBarPane();
this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane();
//设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中
jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
jPanel.add("North", mobileToolBarPane); jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
this.add(jPanel); jPanel1.add("North", this.mobileUseHtmlGroupPane);
jPanel2.add("North", this.mobileToolBarPane);
this.add("North", jPanel1);
this.add("Center", jPanel2);
} }
@Override @Override
@ -39,13 +52,15 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
ob = new FormMobileAttr(); ob = new FormMobileAttr();
} }
this.mobileToolBarPane.populateBean(ob); this.mobileToolBarPane.populateBean(ob);
this.mobileUseHtmlGroupPane.populateBean(ob);
} }
@Override @Override
public FormMobileAttr updateBean() { public FormMobileAttr updateBean() {
FormMobileAttr caseMobileAttr = new FormMobileAttr(); FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(caseMobileAttr); this.mobileToolBarPane.updateBean(formMobileAttr);
return caseMobileAttr; this.mobileUseHtmlGroupPane.updateBean(formMobileAttr);
return formMobileAttr;
} }
@Override @Override

29
designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java

@ -0,0 +1,29 @@
package com.fr.design.form.mobile;
import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.form.main.mobile.FormMobileAttr;
/**
* 直接copyreport中的MobileUseHtmlGroupPane
* Created by fanglei on 2016/12/28.
*/
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<FormMobileAttr> {
@Override
public void populateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0);
}
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
}

10
designer_form/src/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java

@ -87,10 +87,10 @@ public class EmbeddedFormExportExportAction extends JTemplateAction<JForm>{
FRLogger.getLogger().error("Error In Make New File"); FRLogger.getLogger().error("Error In Make New File");
} }
fileChooserPane = null; fileChooserPane = null;
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!"); FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("FR-Designer_Prepare_Export") + "!");
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame,
Inter.getLocText("Exporting"), "", 0, 100)).start(); Inter.getLocText("FR-Designer_Exporting"), "", 0, 100)).start();
} }
private boolean isOk(int saveValue){ private boolean isOk(int saveValue){
@ -136,13 +136,13 @@ public class EmbeddedFormExportExportAction extends JTemplateAction<JForm>{
fileOutputStream.close(); fileOutputStream.close();
this.setProgress(100); this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!"); FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("Exported_successfully") + "\n" + filePath); Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath);
} catch (Exception exp) { } catch (Exception exp) {
this.setProgress(100); this.setProgress(100);
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath);
} }
return null; return null;
} }

Loading…
Cancel
Save