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. 106
      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. 3
      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. 330
      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. 19
      designer_base/src/com/fr/design/javascript/JavaScriptActionPane.java
  35. 2
      designer_base/src/com/fr/design/write/submit/CustomJobPane.java
  36. 13
      designer_base/src/com/fr/env/RemoteEnv.java
  37. 69
      designer_chart/build.performance.gradle
  38. 69
      designer_chart/build.performance.gradle.bak
  39. 43
      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.bak
  43. 70
      designer_form/build.performance.gradle
  44. 69
      designer_form/build.performance.gradle.bak
  45. 2
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  46. 21
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  47. 13
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  48. 155
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  49. 54
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  50. 12
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  51. 215
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  52. 8
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  53. 35
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  54. 29
      designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java
  55. 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_form/bin
*.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
public boolean executeActionReturnUndoRecordNeeded() {
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 {
TemplateCellElement ce = getSelectedCellElement();
// 只有原来ce设置了形态的情况下才有undo操作
@ -73,7 +73,7 @@ public class NewPresentAction extends PresentCheckBoxAction {
try {
Class clazz = GeneralUtils.classForName(itemName);
if (itemName.equals(currentPresent.getClass().getName())) {
return StableUtils.classInstanceOf(currentPresent.getClass(), clazz);
return StableUtils.objectInstanceOf(currentPresent, clazz);
}
} catch (Exception e) {
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.Parameter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction;
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");
}
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,
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();
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(),
Inter.getLocText("Exported_successfully") + "\n" + filePath);
Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath);
} catch (Exception exp) {
this.setProgress(100);
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;
}
@ -140,7 +139,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
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中的公式计算结果
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.general.Inter;
import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.web.core.reserve.PDFExporterFactory;
/**
* Export pdf
@ -29,12 +28,13 @@ public class PDFExportAction extends AbstractExportAction {
@Override
protected Exporter getExporter() {
return new PDFStreamExporter();
return PDFExporterFactory.getPDFExporter();
}
@Override
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

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

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

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

@ -102,12 +102,23 @@ public class CellElementPropertyPane extends DockingView {
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) {
TemplateElementCase elementCase = ePane.getEditingElementCase();
if (elementCase == null) {
return;
}
cellElementEditPane.populate(ePane);
ePane.getSelection().populatePropertyPane(ePane);
}
@Override

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

@ -52,7 +52,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
public Parameter[] getTableDataParameters() {
TableDataSource source = this.getBook();
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.Iterator<String> nameIt = this.getBook().getTableDataNameIterator();
while (nameIt.hasNext()) {

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

@ -75,7 +75,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Fit-App");
return Inter.getLocText("FR-Designer_Fit");
}
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/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/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/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/H3.png")));
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png")));
}
private void initComponents() {

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

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

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

@ -1,109 +1,12 @@
package com.fr.design.report.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 com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
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.
*/
public class MobileUseHtmlGroupPane extends BasicBeanPane<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);
}
}
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<ElementCaseMobileAttr> {
@Override
public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
@ -122,9 +25,4 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr>
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
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();
eventTabPane = new WidgetEventPane(pane);
formPane.add(eventTabPane, BorderLayout.CENTER);
tabbedPane.add(Inter.getLocText("Attribute"), attriPane);
tabbedPane.add(Inter.getLocText("Form-Editing_Listeners"), formPane);
tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriPane);
tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), formPane);
presPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
cardPaneForPresent = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -88,7 +88,7 @@ public class CellWidgetCardPane extends BasicPane {
widgetPropertyPane = new BasicWidgetPropertySettingPane();
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
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);
basic.add(widgetPropertyPane);
attriPane.add(northPane, BorderLayout.NORTH);
@ -155,13 +155,14 @@ public class CellWidgetCardPane extends BasicPane {
*/
public void checkValid() throws Exception {
currentEditorDefinePane.checkValid();
eventTabPane.checkValid();
}
//:jackie 如果选择的项有形态,则将形态面板加入tab面板
private void addPresPane(boolean add) {
if (add) {
tabbedPane.add(this.presPane, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("DS-Dictionary"));
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary"));
} else {
tabbedPane.remove(presPane);
}
@ -170,7 +171,7 @@ public class CellWidgetCardPane extends BasicPane {
private void addTreeSettingPane(boolean add) {
if (add) {
tabbedPane.add(this.cardPaneForTreeSetting, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("Create_Tree"));
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree"));
} else {
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.gui.imenu.UIMenu;
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.Clear;
import com.fr.design.mainframe.JTemplate;
@ -684,4 +685,9 @@ public class CellSelection extends Selection {
editor.populate(tc);
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.FloatElementsClip;
import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
@ -230,4 +231,9 @@ public class FloatSelection extends Selection {
editor.populate(tc);
return editor;
}
@Override
public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll();
}
}

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

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

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;
}
final int finalRowCount = maxRowCount;
DataModel dm = new DataModel() {
DataModel dm = new AbstractDataModel() {
@Override
public void release() throws Exception {
@ -100,7 +100,7 @@ public class PreviewTableModel extends AbstractTableModel {
} catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e);
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) {
return Inter.getLocText("Error");
return Inter.getLocText("FR-Designer_Error");
}
public int getColumnCount() {
@ -166,7 +166,7 @@ public class PreviewTableModel extends AbstractTableModel {
private String checkType(int column) {
if (dateIndexs.contain(column)) {
String s = Inter.getLocText("Date");
String s = Inter.getLocText("FR-Designer_Date");
return ("(" + s + ")");
}
@ -187,23 +187,23 @@ public class PreviewTableModel extends AbstractTableModel {
if (o == null) {
s = "?";
} 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) {
Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column);
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)) {
s = Inter.getLocText("Date");
s = Inter.getLocText("FR-Designer_Date");
}
}
} else if (o instanceof Integer) {
s = Inter.getLocText("Integer");
s = Inter.getLocText("FR-Designer_Integer");
} 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) {
s = Inter.getLocText("Date");
s = Inter.getLocText("FR-Designer_Date");
} else if (o instanceof Number) {
s = Inter.getLocText("Number");//bigdecimal
s = Inter.getLocText("FR-Designer_Number");//bigdecimal
} else {
s = "?";
}

3
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 = text.trim();
String[] tableName = text.split("\\.");
String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
try {
String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text);
@ -316,7 +315,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
StoreProcedureParameter[] newparameters;
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, tableName[tableName.length - 1], parameterDefaultValue);
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue);
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.http.HttpClient;
import com.fr.plugin.Plugin;
import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper;
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;
import com.fr.base.FRContext;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
@ -12,6 +12,7 @@ import com.fr.plugin.dependence.PluginDependenceException;
import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.plugin.PluginConstants;
import javax.swing.*;
import java.awt.*;
@ -20,7 +21,9 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
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.util.List;
@ -40,8 +43,12 @@ public class DownLoadDependenceUI implements ActionListener {
private boolean flag = true;
// 定义加载窗口大小
private final int LOAD_WIDTH = 455;
private final int LOAD_HEIGHT = 295;
private static final int LOAD_WIDTH = 455;
private static final int INCIDENT_WIDTH = 15;
private static final int LOAD_HEIGHT = 295;
//安装环境相关信息
private String currentID;
@ -68,8 +75,8 @@ public class DownLoadDependenceUI implements ActionListener {
// 创建标签,并在标签上放置一张图片
BufferedImage image = IOUtils.readImage("/com/fr/design/extra/plugindependence/image/background.png");
ImageIcon imageIcon = new ImageIcon(image);
label = new JLabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - 15);
label = new UILabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - INCIDENT_WIDTH);
progressbar = new JProgressBar();
// 显示当前进度值信息
@ -80,7 +87,7 @@ public class DownLoadDependenceUI implements ActionListener {
progressbar.setForeground(new Color(0x38aef5));
// 设置进度条的背景色
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.setMaximum(totalSize);
progressbar.setValue(0);
@ -249,7 +256,8 @@ public class DownLoadDependenceUI implements ActionListener {
}
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 (!connectToServer()) {
throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error"));

330
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.TreeSelectionListener;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.Locale;
import java.util.Set;
/**
* 公式编辑面板
* @editor zhou
@ -61,28 +63,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
initComponents();
}
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));
formulaTextArea = new RSyntaxTextArea();
configFormulaArea();
private void initFormulaTextAreaKeyListener(){
formulaTextArea.addKeyListener(this);
formulaTextArea.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
formulaTextArea.setForeground(Color.black);
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)) {
text = text.substring(0, text.indexOf(tip));
insertPosition = 0;
@ -90,9 +79,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
}
}
});
}
private void initFormulaTextAreaMouseListener(){
formulaTextArea.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
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);
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER);
textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH);
// 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("Search"));
searchPane.add(searchButton, BorderLayout.EAST);
tipsPane.add(searchPane, BorderLayout.NORTH);
private void initFormulaTextArea(){
formulaTextArea = new RSyntaxTextArea();
configFormulaArea();
initFormulaTextAreaKeyListener();
initFormulaTextAreaMouseListener();
}
private void initKeyWordTextFieldKeyListener(){
keyWordTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
String toFind = keyWordTextField.getText();
search(toFind, false);
fixFunctionNameList();
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.addMouseListener(new DoubleClick());
UIScrollPane tipsScrollPane = new UIScrollPane(tipsList);
tipsScrollPane.setPreferredSize(new Dimension(170, 75));
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
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"));
checkValidButton.addActionListener(checkValidActionListener);
@ -169,20 +188,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
checkBoxPane.setPreferredSize(new Dimension(450, 30));
checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST);
checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST);
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();
this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH);
}
@ -253,11 +259,17 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
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
public void keyReleased(KeyEvent e) {
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();
currentPosition = formulaTextArea.getCaretPosition();
@ -461,7 +473,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
String content = formula.getContent();
if (content.trim().equals("=")) {
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);
ifHasBeenWriten = 0;
this.listModel.removeAllElements();
@ -549,21 +562,20 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
this.initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout(4, 4));
// Function
JPanel functionPane = new JPanel(new BorderLayout(4, 4));
this.add(functionPane, BorderLayout.WEST);
private void initFunctionTypeList(JPanel functionPane){
functionTypeList = new QuickList(functionTypeListModel);
UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList);
functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
functionTypeScrollPane.setPreferredSize(new Dimension(140, 200));
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
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@ -573,47 +585,43 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
return this;
}
});
functionTypeListModel.addElement(FunctionConstants.COMMON);
for (int i = 0; i < FunctionConstants.EMBFUNCTIONS.length; i++) {
functionTypeListModel.addElement(FunctionConstants.EMBFUNCTIONS[i]);
}
functionTypeListModel.addElement(FunctionConstants.ALL);
functionTypeListModel.addElement(FunctionConstants.CUSTOM);
functionTypeListModel.addElement(FunctionConstants.PLUGIN);
private void initTypeListSelectionListener(){
functionTypeList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
Object selectedValue = ((JList) evt.getSource()).getSelectedValue();
if (!(selectedValue instanceof FunctionGroup)) {
return;
}
NameAndDescription[] nads = ((FunctionGroup) selectedValue).getDescriptions();
functionNameModel = (DefaultListModel) functionNameList.getModel();
functionNameModel.clear();
for (NameAndDescription nad : nads) {
functionNameModel.addElement(nad);
}
if (functionNameModel.size() > 0) {
functionNameList.setSelectedIndex(0);
functionNameList.ensureIndexIsVisible(0);
}
}
});
}
functionNameList = new JList(new DefaultListModel());
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList);
functionNameScrollPane.setPreferredSize(new Dimension(140, 200));
functionPane.add(
this.createNamePane(Inter.getLocText("FormulaD-Function_name") + ":", functionNameScrollPane),
BorderLayout.CENTER);
functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
private void initGroupTypeModel(){
functionTypeListModel.addElement(FunctionConstants.COMMON);
for (int i = 0; i < FunctionConstants.EMBFUNCTIONS.length; i++) {
functionTypeListModel.addElement(FunctionConstants.EMBFUNCTIONS[i]);
}
functionTypeListModel.addElement(FunctionConstants.ALL);
functionTypeListModel.addElement(FunctionConstants.CUSTOM);
functionTypeListModel.addElement(FunctionConstants.PLUGIN);
//hugh: 从函数分组插件中添加分组
FunctionConstants.addFunctionGroupFromPlugins(functionTypeListModel);
}
private void initFunctionNameListCellRenderer(){
functionNameList.setCellRenderer(new DefaultListCellRenderer() {
@Override
@ -625,7 +633,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
return this;
}
});
}
private void initFunctionNameListSelectionListener(){
functionNameList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
@ -640,11 +650,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
descriptionTextArea.moveCaretPosition(0);
}
});
}
private void initFunctionNameListMouseListener(){
functionNameList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() >= 2) {
Object selectedValue = functionNameList.getSelectedValue();
if (!(selectedValue instanceof NameAndDescription)) {
@ -654,7 +664,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
applyText(insert);
}
if (SwingUtilities.isRightMouseButton(evt)) {
JPopupMenu popupMenu = new JPopupMenu();
LookDetailAction lookDetailAction = new LookDetailAction();
@ -665,24 +674,28 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
}
}
});
}
// 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("Variables") + ":", variablesTreePane), BorderLayout.CENTER);
variablesTree.setRootVisible(false);
variablesTree.setShowsRootHandles(true);
variablesTree.addMouseListener(applyTextMouseListener);
variablesTree.setCellRenderer(applyTreeCellRenderer);
private void initFunctionNameList(JPanel functionPane){
functionNameList = new JList(new DefaultListModel());
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList);
functionNameScrollPane.setPreferredSize(new Dimension(140, 200));
functionPane.add(
this.createNamePane(Inter.getLocText("FormulaD-Function_name") + ":", functionNameScrollPane),
BorderLayout.CENTER);
functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
initFunctionNameListCellRenderer();
initFunctionNameListSelectionListener();
initFunctionNameListMouseListener();
}
private void initDescriptionTextArea(){
// Description
descriptionTextArea = new UITextArea(16, 27);
UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea);
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.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);
@ -696,63 +709,84 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
}
});
variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject();
if (selectedValue == null) {
return;
}
StringBuilder desBuf = new StringBuilder();
try {
private StringBuilder getText(TextUserObject selectedValue,String path) throws IOException{
Reader desReader;
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
} else {
path = "/com/fr/design/insert/formula/variable/en/";
}
if (selectedValue instanceof TextUserObject) {
InputStream desInputStream = BaseUtils.readResource(path
+ ((TextUserObject) selectedValue).displayText
+ ".txt");
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);
desReader = new InputStreamReader(desInputStream);
}
BufferedReader reader = new BufferedReader(
desReader);
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) {
return;
}
StringBuilder desBuf = new StringBuilder();
try {
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
} else {
path = "/com/fr/design/insert/formula/variable/en/";
}
if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject)selectedValue,path);
}
} catch (IOException exp) {
FRContext.getLogger().error(exp.getMessage(), exp);
}
descriptionTextArea.setText(desBuf.toString());
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);
}
@ -763,7 +797,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
private class LookDetailAction extends UpdateAction {
public LookDetailAction() {
this.setName(Inter.getLocText("Function_Detail"));
this.setName(Inter.getLocText("FR-Designer_FormulaPane_Function_Detail"));
this.setMnemonic('L');
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() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Function_Detail");
return Inter.getLocText("FR-Designer_FormulaPane_Function_Detail");
}
};
basicPane.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -869,52 +903,28 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
rootNode.add(bindCellNode);
}
{
MutableTreeNode tableTreeNode = new TextFolderUserObject(
Inter.getLocText("FormulaD-Data_Fields"),
rootNode.add(new TextFolderUserObject(Inter.getLocText("FormulaD-Data_Fields"),
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"),
variableResolver.resolveColumnNames()).createMutableTreeNode();
rootNode.add(tableTreeNode);
}
variableResolver.resolveColumnNames()).createMutableTreeNode());
{
// Set cutReport Variable
rootNode.add(new TextFolderUserObject(
Inter.getLocText("Variables"),
rootNode.add(new TextFolderUserObject(Inter.getLocText("FR-Designer_FormulaPane_Variables"),
BaseUtils.readIcon("/com/fr/design/images/dialog/variable.png"),
variableResolver.resolveCurReportVariables()).createMutableTreeNode());
}
{
rootNode.add(new TextFolderUserObject(
Inter.getLocText(new String[]{"Datasource-Datasource", "Parameter"}),
rootNode.add(new TextFolderUserObject(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"),
rootNode.add(new TextFolderUserObject(Inter.getLocText("ParameterD-Report_Parameter"),
BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"),
variableResolver.resolveReportParameterVariables()).createMutableTreeNode();
rootNode.add(reportParameterTreeNode);
}
variableResolver.resolveReportParameterVariables()).createMutableTreeNode());
{
MutableTreeNode globalParameterTreeNode = new TextFolderUserObject(
Inter.getLocText("M_Server-Global_Parameters"),
rootNode.add(new TextFolderUserObject(Inter.getLocText("M_Server-Global_Parameters"),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode();
rootNode.add(globalParameterTreeNode);
}
variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode());
variableModel.reload();
// Expand
for (int row = 0; row < this.variablesTree.getRowCount(); row++) {
this.variablesTree.expandRow(row);
@ -993,6 +1003,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
buffer.append("|");
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.StableUtils;
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.FunctionDef;
@ -23,8 +25,49 @@ import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.swing.DefaultListModel;
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() {
@Override
public String getGroupName() {
@ -96,7 +139,13 @@ public abstract class FunctionConstants {
}
Collections.addAll(all, PLUGIN.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);
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 {
private FunctionDef def;
FunctionDefNAD(FunctionDef def) {
public FunctionDefNAD(FunctionDef 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
protected String title4PopupWindow() {
return Inter.getLocText("Event");
return Inter.getLocText("FR-Designer_Event");
}
@Override
@ -45,4 +45,9 @@ public abstract class ListenerUpdatePane extends BasicBeanPane<Listener> {
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();
}
@Override
public void checkValid() throws Exception {
cards.get(jcb.getSelectedIndex()).checkValid();
}
public int 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

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

@ -43,15 +43,6 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
contentDBManiPane = new ArrayList();
contentDBManiPane.add(createDBManipulationPane());
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());
Set<JavaScriptActionProvider> javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG);
if (javaScriptActionProviders != null) {
@ -84,14 +75,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* @return 返回按钮对象
*/
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() {
@Override
public void actionPerformed(ActionEvent e) {
final JavaScriptActionPane callPane = new JavaScriptActionPane() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function");
return Inter.getLocText("FR-Designer_Set_Callback_Function");
}
@Override
@ -162,7 +153,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function");
return Inter.getLocText("FR-Designer_Set_Callback_Function");
}
@Override
@ -179,10 +170,10 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* 生成界面默认的组建
*
* @return 返回生成的面板
*/
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
@Override
public DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane();
@ -190,7 +181,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Set_Callback_Function");
return Inter.getLocText("FR-Designer_Set_Callback_Function");
}
@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(); } }

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

@ -513,9 +513,11 @@ public class RemoteEnv implements Env {
}
private void stopLogTimer() {
if(logTimer != null) {
logTimer.cancel();
logTimer = null;
}
}
/**
* 根据userID sign out
@ -2063,6 +2065,17 @@ public class RemoteEnv implements Env {
}
/**
* 获取插件的配置目录
*
* @param plugin
*/
public String getPluginFilePath(Plugin plugin) {
return StringUtils.EMPTY;
}
public void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
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

43
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.PluginLicenseManager;
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.StringUtils;
import com.fr.stable.collections.map.CloseableContainedMap;
import com.fr.stable.fun.Authorize;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.stable.plugin.PluginReadListener;
import com.fr.stable.plugin.PluginSimplify;
import com.fr.stable.plugin.closeable.Closeable;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -42,13 +48,12 @@ import java.util.*;
*/
public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider {
private static ClassLoader loader = Thread.currentThread().getContextClassLoader();
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() {
if (classManager == null) {
@ -85,7 +90,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if(rowChart == null) {
if(ArrayUtils.isEmpty(rowChart)) {
continue;
}
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
@ -134,7 +139,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){
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.LINE_CHART, new LineIndependentChartInterface());
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) {
if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) {
return chartTypeInterfaces.get(priority).get(plotID).getIconPath();
}else {
@ -183,11 +190,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (chartTypeInterfaces != null){
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);
chartTypeInterfaces.put(priority, chartUIList);
}else {
LinkedHashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
if (!chartUIList.containsKey(plotID)) {
chartUIList.put(plotID, provider);
}
@ -209,23 +217,27 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (authorize != null) {
PluginLicenseManager.getInstance().registerPaid(authorize, simplify);
}
IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance();
if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) {
IndependentChartUIProvider provider = getProxyObj(plotID, simplify, clazz);
if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName())) {
PluginMessage.remindUpdate(className);
} else {
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID);
addChartTypeInterface(provider, priority, plotID);
}
} catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage());
} catch (IllegalAccessException | InstantiationException e) {
FRLogger.getLogger().error("object create error:" + e.getMessage());
} catch (NoSuchMethodException e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
//UI对应的chart如果没有加载,UI也不必加进去了
private boolean containsChart(String plotID) {
return ChartTypeManager.getInstance().containsPlot(plotID);
private IndependentChartUIProvider getProxyObj(String plotID, PluginSimplify simplify, Class<?> clazz) throws IllegalAccessException, InstantiationException, NoSuchMethodException {
PluginInstanceProxyFactory factory = new PluginInstanceProxyFactory(clazz, simplify);
PluginInvocationHandler handler = new ChartTypeInterfaceCloseableHandler(plotID);
return (IndependentChartUIProvider) factory.addProxy(Closeable.class, handler).getProxyObj();
}
@ -253,7 +265,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
String[] names = new String[getChartSize(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();
int i = 0;
while (iterator.hasNext()){
@ -272,6 +284,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @return
*/
public String getTitle4PopupWindow(String priority, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return provider.getPlotTypeTitle4PopupWindow();

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.bak

@ -34,7 +34,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//jar包
FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
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) {
for (Class<?> type : acceptTypes) {
if (StableUtils.classInstanceOf(this.getClass(), type)) {
if (StableUtils.objectInstanceOf(this, type)) {
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
* @return wlayout控件

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

@ -1,13 +1,12 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.*;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
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 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 Icon addIcon = ADD_ICON;
@ -140,13 +139,13 @@ public class XCardAddButton extends XButton{
//新增tab
private void addTab(int index){
Dimension dimension = new Dimension();
XCardSwitchButton button = (XCardSwitchButton) this.tagLayout.getComponent(INDEX);
dimension.width = button.getWidth();
dimension.width = DEFAULT_BUTTON_WIDTH;
String cardLayoutName = cardLayout.toData().getWidgetName();
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
//设置标题
titleButton.setText(getTabTitleName());
titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
XCardSwitchButton showButton = new XCardSwitchButton(titleButton, dimension, cardLayout, tagLayout);
titleButton.setCustomStyle(true);
titleButton.setShowButton(true);
@ -162,6 +161,8 @@ public class XCardAddButton extends XButton{
private void showNewTab(EditingMouseListener editingMouseListener,int index){
SelectionModel selectionModel = editingMouseListener.getSelectionModel();
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout);
}

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

@ -3,17 +3,16 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.*;
import javax.swing.Icon;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
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.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
/**
*
@ -41,10 +41,15 @@ import com.fr.general.FRFont;
*/
public class XCardSwitchButton extends XButton {
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
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 CHOOSED_GRAL = new Color(222,222,222);
@ -54,12 +59,22 @@ public class XCardSwitchButton extends XButton {
private static final int RIGHT_OFFSET = 15;
private static final int TOP_OFFSET = 25;
//这边先不计算button的高度,涉及到layout那边的整体高度,先用之前的固定高度
private static final int DEFAULT_BUTTON_HEIGHT = 36;
// tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量
private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
private Background selectBackground;
private boolean isCustomStyle;
private UILabel label;
private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private Icon closeIcon = MOUSE_COLSE;
public XWCardTagLayout getTagLayout() {
@ -78,6 +93,30 @@ public class XCardSwitchButton extends XButton {
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) {
super(widget, initSize);
}
@ -133,6 +172,8 @@ public class XCardSwitchButton extends XButton {
// 切换到当前tab按钮对应的tabFitLayout
XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index);
XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index);
tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout);
if (editingMouseListener.stopEditing()) {
@ -141,11 +182,17 @@ public class XCardSwitchButton extends XButton {
editingMouseListener.startEditing(this,
adapter.getDesignerEditor(), adapter);
}
setTabsAndAdjust();
}
//删除card,同时修改其他switchbutton和tabfit的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);
// 先清除该tab内部组件,否在再显示上有样式的残留
XWTabFitLayout tabLayout = (XWTabFitLayout)cardLayout.getComponent(index);
@ -207,6 +254,8 @@ public class XCardSwitchButton extends XButton {
int width = button.getWidth();
int height = button.getHeight();
ey = ey % DEFAULT_BUTTON_HEIGHT;
// 鼠标进入按钮右侧删除图标区域
double recX = position.getX() + (width - RIGHT_OFFSET);
double recY = position.getY() + (height - TOP_OFFSET);
@ -225,6 +274,7 @@ public class XCardSwitchButton extends XButton {
public void paintComponent(Graphics g) {
super.paintComponent(g);
setTabsAndAdjust();
Graphics2D g2d = (Graphics2D) g;
drawBackgorund();
drawTitle();
@ -241,6 +291,11 @@ public class XCardSwitchButton extends XButton {
//画背景
private void drawBackgorund(){
CardSwitchButton button = (CardSwitchButton)this.toData();
Background currentBackground;
currentBackground = this.getSelectBackground();
//这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断
String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULTTYPE;
if (type.equals(COLORBACKGROUNDTYPE) || type.equals(DEFAULTTYPE)) {
ColorBackground background;
if(button.isShowButton()){
this.rebuid();
@ -252,6 +307,7 @@ public class XCardSwitchButton extends XButton {
this.setContentBackground(background);
}
}
}
//画标题
private void drawTitle() {
@ -265,14 +321,19 @@ public class XCardSwitchButton extends XButton {
// 标题部分
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);
UILabel label = this.getContentLabel();
label.setFont(newFont);
label.setForeground(font.getForeground());
Background background = title.getBackground();
if (background != null) {
if(button.isShowButton()){
if(button.isShowButton() && selectBackground != null){
this.setContentBackground(selectBackground);
}else if (button.isShowButton() && selectBackground == null){
background = ColorBackground.getInstance(CHOOSED_GRAL);
this.setContentBackground(background);
} else {
@ -283,6 +344,12 @@ public class XCardSwitchButton extends XButton {
//删除tab布局
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();
if(mainLayout != null){
selectionModel.setSelectedCreator(mainLayout);
@ -298,4 +365,66 @@ public class XCardSwitchButton extends XButton {
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();
}
}

54
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.design.designer.beans.LayoutAdapter;
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.creator.*;
import com.fr.design.form.layout.FRCardLayout;
import com.fr.design.form.util.XCreatorConstants;
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.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WBorderLayout;
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.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -39,6 +43,8 @@ public class XWCardLayout extends XLayoutContainer {
private CardLayout cardLayout;
private boolean initFlag = true;
private static final int NORTH = 0;
private FormDesigner designer;
//默认蓝色标题背景
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);
firstBtn.setText(Inter.getLocText("FR-Designer_Title") + 0);
firstBtn.setInitialBackground(ColorBackground.getInstance(Color.WHITE));
firstBtn.setCustomStyle(true);
xTag.setCurrentCard(firstBtn);
XCardSwitchButton xFirstBtn = new XCardSwitchButton(firstBtn, new Dimension(CardSwitchButton.DEF_WIDTH, -1), this, xTag);
firstBtn.setCustomStyle(true);
xFirstBtn.setBackupParent(xTag);
return xFirstBtn;
@ -265,13 +271,53 @@ public class XWCardLayout extends XLayoutContainer {
return true;
}
/**
* 得到属性名
* @return 属性名
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = null;
return ArrayUtils.addAll(getDefaultDescriptor(), crp);
}
public CRPropertyDescriptor[] getisCarousel() 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);
}
}),
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(){
@ -291,7 +337,7 @@ public class XWCardLayout extends XLayoutContainer {
public void propertyChange() {
initStyle();
}
}),
})
};
}

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

@ -163,18 +163,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
* void
*/
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);
}
}

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

@ -1,12 +1,12 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.*;
import java.beans.IntrospectionException;
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.adapters.layout.FRTabFitLayoutAdapter;
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.XLayoutContainer;
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.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
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.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
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.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
/**
* @author focus
@ -37,8 +44,16 @@ public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 1;
// 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 Background initialBackground;
private Background overBackground;
private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() {
return referDim;
@ -48,6 +63,47 @@ public class XWTabFitLayout extends XWFitLayout {
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(){
this(new WTabFitLayout(), new Dimension());
}
@ -62,13 +118,148 @@ public class XWTabFitLayout extends XWFitLayout {
* @throws IntrospectionException
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = null;
return ArrayUtils.addAll(defaultDescriptor(), crp);
}
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("widgetName", this.data.getClass()).setI18NName(Inter
.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"),
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

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)
.setRendererClass(MobileFitRender.class)
.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)
.setRendererClass(MobileFitRender.class)
.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)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.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<>();
@ -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();
setModel(model);

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

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

Loading…
Cancel
Save