Browse Source

Merging in latest from upstream (BA/design:refs/heads/9.0)

* commit '283e484661b4d2fc81b8a324f35aa76f57916905': (346 commits)
  2
  1
  无JIRA任务, 冲突修正
  2
  1
  ct
  fix
  fix
  remove unused code
  fix
  fix
  fix
  ..
  fix PMD
  fix REPORT-2600
  无jira任务 应用补丁的时候有一个没有删除
  移到designer_base
  pmd
  REPORT-2213 设计器右上角使用qq登录后,登录界面关不掉 & 这部分的代码质量
  REPORT-2335 插件管理界面以及右上角的登录界面,多次点击后,页面无法关闭
  ...
master
xiaoxia 8 years ago
parent
commit
325163b49f
  1. 3
      .gitignore
  2. 9
      designer/designer.iml
  3. 73
      designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj
  4. 2
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  5. 252
      designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  6. 15
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  7. 830
      designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java
  8. 2
      designer/src/com/fr/design/mainframe/InformationCollector.java
  9. 1
      designer/src/com/fr/design/mainframe/JPolyWorkBook.java
  10. 20
      designer/src/com/fr/design/mainframe/JWorkBook.java
  11. 9
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  12. 52
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  13. 74
      designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java
  14. 4
      designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  15. 4
      designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java
  16. 2
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  17. 60
      designer/src/com/fr/design/webattr/EditToolBar.java
  18. 6
      designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java
  19. 139
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  20. 4
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  21. 6
      designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  22. 9
      designer/src/com/fr/grid/Grid.java
  23. 6
      designer/src/com/fr/grid/selection/CellSelection.java
  24. 6
      designer/src/com/fr/grid/selection/FloatSelection.java
  25. 2
      designer/src/com/fr/grid/selection/Selection.java
  26. 4
      designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java
  27. 21
      designer/src/com/fr/start/ReportSplashPane.java
  28. 21
      designer_base/build.dev.gradle
  29. 70
      designer_base/build.dev.gradle.bak
  30. 20
      designer_base/build.master.gradle
  31. 89
      designer_base/build.master.gradle.bak
  32. 23
      designer_base/build.release.gradle
  33. 60
      designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj
  34. 70
      designer_base/src/com/fr/design/actions/edit/CopyAction.java
  35. 62
      designer_base/src/com/fr/design/actions/file/LocalePane.java
  36. 31
      designer_base/src/com/fr/design/actions/help/AboutPane.java
  37. 10
      designer_base/src/com/fr/design/actions/help/TutorialAction.java
  38. 345
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  39. 4
      designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
  40. 64
      designer_base/src/com/fr/design/beans/location/MoveUtils.java
  41. 48
      designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java
  42. 75
      designer_base/src/com/fr/design/data/DesignTableDataManager.java
  43. 2
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  44. 266
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  45. 324
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
  46. 155
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  47. 15
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java
  48. 1
      designer_base/src/com/fr/design/dialog/BasicDialog.java
  49. 24
      designer_base/src/com/fr/design/dialog/BasicPane.java
  50. 8
      designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java
  51. 19
      designer_base/src/com/fr/design/extra/LoginDialog.java
  52. 152
      designer_base/src/com/fr/design/extra/LoginPane.java
  53. 151
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  54. 14
      designer_base/src/com/fr/design/extra/LoginWebPane.java
  55. 7
      designer_base/src/com/fr/design/extra/PluginHelper.java
  56. 10
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  57. 4
      designer_base/src/com/fr/design/extra/QQLoginDialog.java
  58. 145
      designer_base/src/com/fr/design/extra/QQLoginPane.java
  59. 131
      designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
  60. 129
      designer_base/src/com/fr/design/extra/QQLoginWebPane.java
  61. 36
      designer_base/src/com/fr/design/extra/ReuseWebBridge.java
  62. 54
      designer_base/src/com/fr/design/extra/ReuseWebPane.java
  63. 58
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  64. 385
      designer_base/src/com/fr/design/formula/FormulaPane.java
  65. 51
      designer_base/src/com/fr/design/formula/FunctionConstants.java
  66. 2
      designer_base/src/com/fr/design/formula/FunctionDefNAD.java
  67. 14
      designer_base/src/com/fr/design/formula/FunctionManagerPane.java
  68. 13
      designer_base/src/com/fr/design/formula/VariableResolverAdapter.java
  69. 3
      designer_base/src/com/fr/design/fun/ConnectionProvider.java
  70. 41
      designer_base/src/com/fr/design/fun/ExtraButtonToolBarProvider.java
  71. 2
      designer_base/src/com/fr/design/fun/HyperlinkProvider.java
  72. 19
      designer_base/src/com/fr/design/fun/impl/AbstractExtraButtonToolBarProvider.java
  73. 5
      designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java
  74. 3
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  75. 33
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  76. 8
      designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java
  77. 54
      designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java
  78. 10
      designer_base/src/com/fr/design/gui/itable/PropertyGroup.java
  79. 52
      designer_base/src/com/fr/design/gui/style/BorderPane.java
  80. BIN
      designer_base/src/com/fr/design/images/control/tab/end.png
  81. BIN
      designer_base/src/com/fr/design/images/control/tab/end_not.png
  82. BIN
      designer_base/src/com/fr/design/images/control/tab/first.png
  83. BIN
      designer_base/src/com/fr/design/images/control/tab/first_not.png
  84. BIN
      designer_base/src/com/fr/design/images/control/tab/next.png
  85. BIN
      designer_base/src/com/fr/design/images/control/tab/next_not.png
  86. BIN
      designer_base/src/com/fr/design/images/control/tab/prev.png
  87. BIN
      designer_base/src/com/fr/design/images/control/tab/prev_not.png
  88. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/$$$.txt
  89. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/$$page_number.txt
  90. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/$$totalPage_number.txt
  91. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_authority.txt
  92. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_username.txt
  93. 4
      designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_userposition.txt
  94. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/NOFILTER.txt
  95. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/NULL.txt
  96. 4
      designer_base/src/com/fr/design/insert/formula/variable/cn/contextPath.txt
  97. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/curReport.txt
  98. 4
      designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt
  99. 2
      designer_base/src/com/fr/design/insert/formula/variable/cn/fr_submitinfo.txt
  100. 4
      designer_base/src/com/fr/design/insert/formula/variable/cn/reportName.txt
  101. Some files were not shown because too many files have changed in this diff Show More

3
.gitignore vendored

@ -3,3 +3,6 @@ designer_base/bin
designer_chart/bin
designer_form/bin
*.iml
designer_base/src/com/fr/design/locale/.idea

9
designer/designer.iml

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="jdk1.8" jdkType="JavaSDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="module" module-name="designer_form" />
<orderEntry type="module" module-name="designer_chart" />
</component>
</module>

73
designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj

@ -0,0 +1,73 @@
package com.fr.aspectj.designer;
/**
* 记录模板过程
* Created by plough on 2017/3/3.
*/
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.grid.Grid;
import org.aspectj.lang.reflect.SourceLocation;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.util.Date;
public aspect TemplateProcessTracker {
//声明一个pointcut,匹配你需要的方法
pointcut onMouseClicked(MouseEvent e) :
execution(* mouseClicked(MouseEvent)) && args(e);
pointcut onMousePressed(MouseEvent e) :
execution(* mousePressed(MouseEvent)) && args(e);
pointcut onMouseReleased(MouseEvent e) :
execution(* mouseReleased(MouseEvent)) && args(e);
pointcut onActionPerformed(ActionEvent e) :
execution(* actionPerformed(ActionEvent)) && args(e);
pointcut onSetValueAt(Object v, int r, int c) :
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c);
pointcut onSetValue4EditingElement(Grid g, Object v) :
call(* setValue4EditingElement(java.lang.Object)) && target(g) && args(v);
//before表示之前的意思
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = "";
TemplateInfoCollector.appendProcess(log);
}
//同上
before(ActionEvent e) : onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) {
return;
}
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = "";
TemplateInfoCollector.appendProcess(log);
}
//同上
before(Object v, int r, int c) : onSetValueAt(v, r, c) {
SourceLocation sl = thisJoinPoint.getSourceLocation();
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c);
String log = "";
TemplateInfoCollector.appendProcess(log);
}
//同上
before(Grid g, Object v) : onSetValue4EditingElement(g, v) {
SourceLocation sl = thisJoinPoint.getSourceLocation();
// String v = "test";
//String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement());
String log = "";
TemplateInfoCollector.appendProcess(log);
}
}

2
designer/src/com/fr/design/cell/editor/RichTextToolBar.java

@ -134,7 +134,7 @@ public class RichTextToolBar extends BasicPane{
}
private void bindListener(){
FRFont defaultFont = RichTextPane.DEFAUL_FONT;
FRFont defaultFont = (this.textPane != null) ? FRFont.getInstance(this.textPane.getFont()) : RichTextPane.DEFAUL_FONT;
fontNameComboBox.addItemListener(fontNameItemListener);
fontNameComboBox.setSelectedItem(defaultFont.getFontName());
fontSizeComboBox.addItemListener(fontSizeItemListener);

252
designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java

File diff suppressed because one or more lines are too long

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

@ -102,12 +102,25 @@ public class CellElementPropertyPane extends DockingView {
return element;
}
public void removeAll() {
this.remove(titlePane);
this.remove(cellElementEditPane);
}
public void reInit(ElementCasePane ePane) {
if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示
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

830
designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java

File diff suppressed because one or more lines are too long

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

@ -10,6 +10,7 @@ import com.fr.data.core.db.dml.Delete;
import com.fr.data.core.db.dml.Select;
import com.fr.data.core.db.dml.Table;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
@ -315,6 +316,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}
sendFunctionsInfo();
sendUserInfo();
TemplateInfoCollector.getInstance().sendTemplateInfo();
}
});
sendThread.start();

1
designer/src/com/fr/design/mainframe/JPolyWorkBook.java

@ -24,7 +24,6 @@ public class JPolyWorkBook extends JWorkBook {
super(new WorkBook(new PolyWorkSheet()), DEFAULT_NAME);
populateReportParameterAttr();
}
/**
* 创建sheet名称tab面板

20
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
@ -26,6 +27,8 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.*;
import com.fr.design.module.DesignModuleFactory;
@ -54,7 +57,10 @@ import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.cellcase.CellCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.Report;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
@ -66,10 +72,7 @@ import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* JWorkBook used to edit WorkBook.
@ -129,6 +132,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return centerPane;
}
public TemplateProcessInfo getProcessInfo() {
if (processInfo == null) {
processInfo = new JWorkBookProcessInfo(template);
}
return processInfo;
}
/**
* 判断sheet权限
*
@ -463,7 +473,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
*/
public ShortCut[] shortCuts4Authority() {
return new ShortCut[]{
new NameSeparator(Inter.getLocText(new String[]{"DashBoard-Potence", "Edit"})),
new NameSeparator(Inter.getLocText("FR-Designer_Permissions_Edition")),
BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this),
};

9
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -5,7 +5,6 @@ package com.fr.design.mainframe.bbs;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
@ -103,17 +102,13 @@ public class UserInfoLabel extends UILabel {
if (StableUtils.getMajorJavaVersion() == 8) {
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
}
QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this);
LoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this);
UserLoginContext.addLoginContextListener(new LoginContextListener() {
@Override
public void showLoginContext() {
LoginPane managerPane = new LoginPane();
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), managerPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
WebViewDlgHelper.createLoginDialog();
LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
QQLoginWebBridge.getHelper().setLoginlabel();
qqdlg.setVisible(true);
clearLoginInformation();
updateInfoPane();
}

52
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -3,7 +3,9 @@ package com.fr.design.mainframe.cell.settingpane;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Locale;
import com.fr.base.FRContext;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
@ -76,23 +78,23 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
double p = TableLayout.PREFERRED;
double[] rowSize1 = {p, p, p, p, p, p, p};
double[] columnSize1 = {p, f};
UILabel autoAdjustLabel = new UILabel(Inter.getLocText("Auto_Adjust_Size") + ":", SwingConstants.RIGHT);
UILabel autoAdjustLabel = new UILabel(Inter.getLocText("FR-Designer_Auto_Adjust_Size") + ":", SwingConstants.RIGHT);
autoAdjustLabel.setVerticalAlignment(UILabel.TOP);
Component[][] components1 = new Component[][]{
new Component[]{autoAdjustLabel, autoshrik},
new Component[]{new UILabel(Inter.getLocText("Preview") + ":", SwingConstants.RIGHT), previewCellContent},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Preview") + ":", SwingConstants.RIGHT), previewCellContent},
new Component[]{new UILabel(Inter.getLocText("CellWrite-Print_Export") + ":", SwingConstants.RIGHT), printAndExportContent},
new Component[]{null, printAndExportBackground},
new Component[]{new UILabel(Inter.getLocText("Show_Content") + ":", SwingConstants.RIGHT), showContent},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content") + ":", SwingConstants.RIGHT), showContent},
new Component[]{null, fileNamePane},
new Component[]{new UILabel(Inter.getLocText("CellWrite-ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField},
};
JPanel northContentPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] rowSize2 = {p, p, p, p, p, p};
double[] columnSize2 = {p, f};
Component[][] components2 = new Component[][]{
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null},
new Component[]{new UILabel(Inter.getLocText("Pagination")), null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Pagination")), null},
new Component[]{pageBeforeRowCheckBox, pageAfterRowCheckBox},
new Component[]{pageBeforeColumnCheckBox, pageAfterColumnCheckBox},
new Component[]{canBreakOnPaginateCheckBox, null},
@ -121,22 +123,28 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private JPanel createNormal() {
String[] AjustRowTypes = new String[]{
Inter.getLocText("No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("Default")};
Inter.getLocText("FR-Designer_No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("FR-Designer_DEFAULT")};
autoshrik = new UIButtonGroup(AjustRowTypes);
autoshrik.setTwoLine();
autoshrik.setLayout(new GridLayout(2, 2, 1, 1));
if (FRContext.getLocale().equals(Locale.US)) {
// 英文显示不全,故每行一个按钮
autoshrik.setFourLine();
autoshrik.setLayout(new GridLayout(4, 1, 1, 1));
} else {
autoshrik.setTwoLine();
autoshrik.setLayout(new GridLayout(2, 2, 1, 1));
}
previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content"));
printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content"));
printAndExportBackground = new UICheckBox(Inter.getLocText("CellWrite-Print_Background"));
showContent = new UIComboBox(new String[]{Inter.getLocText("Default"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"),
Inter.getLocText("ShowAsDownload")});
showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"),
Inter.getLocText("FR-Designer_Show_As_Download")});
final CardLayout fileNameLayout = new CardLayout();
final JPanel fileNamePane = new JPanel(fileNameLayout);
JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0));
fileNameCCPane.add(new UILabel(Inter.getLocText("FileNameForDownload")), BorderLayout.WEST);
fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST);
fileNameTextField = new UITextField();
tooltipTextField = new UITextField();
@ -186,13 +194,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
private void initAllNames() {
autoshrik.setGlobalName(Inter.getLocText("Auto_Adjust_Size"));
previewCellContent.setGlobalName(Inter.getLocText("Preview"));
autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size"));
previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview"));
printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content"));
printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background"));
showContent.setGlobalName(Inter.getLocText("Show_Content"));
fileNameTextField.setGlobalName(Inter.getLocText("Show_Content"));
tooltipTextField.setGlobalName(Inter.getLocText("CellWrite-ToolTip"));
showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip"));
pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Row"));
pageAfterRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Row"));
pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Column"));
@ -224,10 +232,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} else if (cellGUIAttr.isShowAsHTML()) {
showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_HTML"));
} else if (cellGUIAttr.isShowAsDownload()) {
showContent.setSelectedItem(Inter.getLocText("ShowAsDownload"));
showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download"));
fileNameTextField.setText(cellGUIAttr.getFileName());
} else {
showContent.setSelectedItem(Inter.getLocText("Default"));
showContent.setSelectedItem(Inter.getLocText("FR-Designer_DEFAULT"));
}
tooltipTextField.setText(cellGUIAttr.getTooltipText());
CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页
@ -272,11 +280,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr = new CellGUIAttr();
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Auto_Adjust_Size"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) {
cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex());
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Preview"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) {
cellGUIAttr.setPreviewContent(previewCellContent.isSelected());
}
@ -288,7 +296,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected());
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Show_Content"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Show_Content"))) {
cellGUIAttr.setShowAsDefault(showContent.getSelectedIndex() == 0);
cellGUIAttr.setShowAsImage(showContent.getSelectedIndex() == 1);
cellGUIAttr.setShowAsHTML(showContent.getSelectedIndex() == 2);
@ -300,7 +308,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-ToolTip"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_ToolTip"))) {
if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) {
cellGUIAttr.setTooltipText(fieldName);
} else {

74
designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java

@ -0,0 +1,74 @@
package com.fr.design.mainframe.templateinfo;
import com.fr.base.parameter.ParameterUI;
import com.fr.main.impl.WorkBook;
import com.fr.report.cellcase.CellCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
import java.util.Iterator;
/**
* Created by plough on 2017/3/17.
*/
public class JWorkBookProcessInfo extends TemplateProcessInfo<WorkBook> {
public JWorkBookProcessInfo(WorkBook wb) {
super(wb);
}
// 获取模板类型
public int getReportType() {
return template.isElementCaseBook() ? 0 : 1;
}
// 获取模板格子数
public int getCellCount() {
int cellCount = 0;
if (template.isElementCaseBook()) { // 如果是普通报表
for (int i = 0; i < template.getReportCount(); i++) {
WorkSheet r = (WorkSheet) template.getReport(i);
CellCase cc = r.getBlock().getCellCase();
for (int j = 0; j < cc.getRowCount(); j++) {
Iterator iter = cc.getRow(j);
while (iter.hasNext()) {
cellCount ++;
iter.next();
}
}
}
}
return cellCount;
}
// 获取模板悬浮元素个数
public int getFloatCount() {
int chartCount = 0;
if (template.isElementCaseBook()) { // 如果是普通报表
for (int i = 0; i < template.getReportCount(); i++) {
WorkSheet r = (WorkSheet) template.getReport(i);
Iterator fiter = r.getBlock().floatIterator();
while (fiter.hasNext()) {
chartCount ++;
fiter.next();
}
}
}
return chartCount;
}
// 获取模板聚合块个数
public int getBlockCount() {
int blockCount = 0;
if (!template.isElementCaseBook()) { // 如果是聚合报表
for (int i = 0; i < template.getReportCount(); i++) {
PolyWorkSheet r = (PolyWorkSheet) template.getReport(i);
blockCount += r.getBlockCount();
}
}
return blockCount;
}
// 获取模板控件数
public int getWidgetCount() {
ParameterUI pui = template.getReportParameterAttr().getParameterUI();
return pui == null ? 0 : (pui.getAllWidgets().length - 1);
}
}

4
designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -10,7 +10,7 @@ import javax.swing.event.ChangeListener;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.WebDialog;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
@ -553,7 +553,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
public void actionPerformed(ActionEvent e) {
try {
//Desktop.getDesktop().browse(new URI(url));
WebDialog.createPluginDialog();
WebViewDlgHelper.createPluginDialog();
RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false);
} catch (Exception exp) {

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

@ -7,6 +7,10 @@ import com.fr.report.mobile.ElementCaseMobileAttr;
* Created by kunsnat on 2016/8/3.
*/
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<ElementCaseMobileAttr> {
public MobileUseHtmlGroupPane(String annotation) {
super(annotation);
}
@Override
public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {

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

@ -34,7 +34,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
jPanel.add(appFitBrowserPane);
jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane());
jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane(Inter.getLocText("FR-Designer_Mobile_Report_Analysis_Annotation")));
jPanel.add(mobileToolBarPane = new MobileToolBarPane());

60
designer/src/com/fr/design/webattr/EditToolBar.java

@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.ExportToolBarProvider;
import com.fr.design.fun.ExtraButtonToolBarProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -199,7 +200,7 @@ public class EditToolBar extends BasicPane {
toolBarButton.setWidget(widget);
if (widget instanceof Button) {
String iconname = ((Button) widget).getIconName();
if (!StringUtils.isBlank(iconname)) {
if (StringUtils.isNotBlank(iconname)) {
Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname);
toolBarButton.setIcon(new ImageIcon(iimage));
}
@ -326,17 +327,18 @@ public class EditToolBar extends BasicPane {
private IconDefinePane iconPane;
private UIButton button;
private JavaScriptActionPane javaScriptPane;
private ExportToolBarProvider[] exportToolBarProviders;
private ExportToolBarProvider[] exportToolBarProviders;
private ChangeListener changeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
private ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isVerify.isSelected()) {
failSubmit.setVisible(true);
} else {
failSubmit.setVisible(false);
failSubmit.setSelected(false);
}
}
};
public ButtonPane() {
@ -386,6 +388,11 @@ public class EditToolBar extends BasicPane {
centerPane.add(getCpane(), "appendcount");
centerPane.add(getSubmitPane(), "submit");
Set<ExtraButtonToolBarProvider> extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG);
for (ExtraButtonToolBarProvider provider : extraButtonSet) {
provider.updateCenterPane(centerPane);
}
this.add(centerPane, BorderLayout.CENTER);
}
@ -475,11 +482,10 @@ public class EditToolBar extends BasicPane {
submitPane.add(isVerify);
submitPane.add(failSubmit);
submitPane.add(isCurSheet);
isVerify.addChangeListener(changeListener);
isVerify.addActionListener(actionListener);
return submitPane;
}
@Override
protected String title4PopupWindow() {
return "Button";
@ -528,13 +534,18 @@ public class EditToolBar extends BasicPane {
} else if (widget instanceof CustomToolBarButton) {
populateCustomToolBarButton();
}
}
Set<ExtraButtonToolBarProvider> extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG);
for (ExtraButtonToolBarProvider provider : extraButtonSet) {
provider.populate(widget, card, centerPane);
}
}
private void populateAppendColumnRow(){
card.show(centerPane, "appendcount");
count.setValue(((AppendColumnRow) widget).getCount());
}
private void populateExport(){
card.show(centerPane, "export");
Export export = (Export) widget;
@ -550,7 +561,7 @@ public class EditToolBar extends BasicPane {
}
}
}
private void populateCustomToolBarButton(){
card.show(centerPane, "custom");
CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget;
@ -558,21 +569,24 @@ public class EditToolBar extends BasicPane {
this.javaScriptPane.populateBean(customToolBarButton.getJSImpl());
}
}
private void populateSubmit(){
card.show(centerPane, "submit");
Submit submit = ((Submit) widget);
this.isVerify.setSelected(submit.isVerify());
if (!submit.isVerify()) {
this.failSubmit.setVisible(false);
}
this.failSubmit.setSelected(submit.isFailVerifySubmit());
this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
}
private void populatePDFPrint(){
card.show(centerPane, "pdfprint");
PDFPrint pdfPrint = (PDFPrint) widget;
this.isPopup.setSelected(pdfPrint.isPopup());
}
private void populatePrint(){
card.show(centerPane, "print");
Print print = (Print) widget;
@ -581,7 +595,7 @@ public class EditToolBar extends BasicPane {
this.flashPrint.setSelected(print.isFlashPrint());
this.serverPrint.setSelected(print.isServerPrint());
}
private void populateDefault(){
Button button = (Button) widget;
this.icon.setSelected(button.isShowIcon());
@ -592,7 +606,7 @@ public class EditToolBar extends BasicPane {
/**
* 更新
*
*
* @return 对应组件
*/
public Widget update() {
@ -613,23 +627,29 @@ public class EditToolBar extends BasicPane {
if (widget instanceof Button) {
updateDefault();
}
Set<ExtraButtonToolBarProvider> extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG);
for (ExtraButtonToolBarProvider provider : extraButtonSet) {
provider.update(widget);
}
return widget;
}
private void updateDefault(){
((Button) widget).setShowIcon(this.icon.isSelected());
((Button) widget).setShowText(this.text.isSelected());
((Button) widget).setText(this.nameField.getText());
((Button) widget).setIconName(this.iconPane.update());
}
private void updateSubmit(){
Submit submit = ((Submit) widget);
submit.setVerify(this.isVerify.isSelected());
submit.setFailVerifySubmit(this.failSubmit.isSelected());
submit.setOnlySubmitSelect(this.isCurSheet.isSelected());
}
private void updatePrint(){
Print print = (Print) widget;
print.setAppletPrint(this.appletPrint.isSelected());
@ -637,7 +657,7 @@ public class EditToolBar extends BasicPane {
print.setPDFPrint(this.pdfPrint.isSelected());
print.setServerPrint(this.serverPrint.isSelected());
}
private void updateExport(){
Export export = (Export) widget;
export.setPdfAvailable(this.pdf.isSelected());

6
designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java

@ -78,13 +78,13 @@ public class ReportWebWidgetConstants {
public static final WidgetOption EDIT = WidgetOptionFactory.createByWidgetClass("Edit", Edit.class);
// 导出成Excel 分页导出
public static final WidgetOption EXCELP = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "Export-Excel-Page"}, new String[]{"(", ")"}),
public static final WidgetOption EXCELP = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "FR-Designer_Export_Excel_Page"}, new String[]{"(", ")"}),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelP.class);
// 导出成Excel 原样导出
public static final WidgetOption EXCELO = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "Export-Excel-Simple"}, new String[]{"(", ")"}),
public static final WidgetOption EXCELO = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "FR-Designer_Export_Excel_Simple"}, new String[]{"(", ")"}),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelO.class);
// 导出成Excel 分页分Sheet导出
public static final WidgetOption EXCELS = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "Export-Excel-PageToSheet"}, new String[]{"(", ")"}),
public static final WidgetOption EXCELS = WidgetOptionFactory.createByWidgetClass(Inter.getLocText(new String[]{"Excel", "FR-Designer_Export_Excel_PageToSheet"}, new String[]{"(", ")"}),
BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelS.class);
// 导出成Word

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

@ -20,24 +20,28 @@ import java.awt.*;
* carl :单独弄出来
*/
public class CellWidgetCardPane extends BasicPane {
// 当前的编辑器属性定义面板
//当前的编辑器属性定义面板
private DataModify<? extends Widget> currentEditorDefinePane;
//属性配置切换面板
private JTabbedPane tabbedPane;
private BasicWidgetPropertySettingPane widgetPropertyPane;
private JPanel attriPane;
private JPanel cardPane;
private CardLayout card;
private JPanel presPane;
private JPanel cardPaneForPresent;
private CardLayout cardForPresent;
//通用属性容器
private JPanel attriTabPane;
private JPanel attriCardPane;
private CardLayout attriCardLayout;
private JPanel cardPaneForTreeSetting;
//数字字典属性容器
private JPanel dictTabPane;
private JPanel dictCardPane;
private CardLayout dictCardLayout;
private JPanel formPane;
private WidgetEventPane eventTabPane;
//构建树属性容器
private JPanel treeTabPane;
//事件属性容器
private JPanel eventTabPane;
private WidgetEventPane eventPane;
public CellWidgetCardPane(ElementCasePane pane) {
this.initComponents(pane);
@ -47,26 +51,31 @@ public class CellWidgetCardPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new UITabbedPane();
this.add(tabbedPane, BorderLayout.CENTER);
attriPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
formPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eventTabPane = new WidgetEventPane(pane);
formPane.add(eventTabPane, BorderLayout.CENTER);
tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriPane);
tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), formPane);
attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eventPane = new WidgetEventPane(pane);
eventTabPane.add(eventPane, BorderLayout.CENTER);
tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriTabPane);
tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), eventTabPane);
presPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
cardPaneForPresent = FRGUIPaneFactory.createCardLayout_S_Pane();
presPane.add(cardPaneForPresent, BorderLayout.CENTER);
cardForPresent = new CardLayout();
cardPaneForPresent.setLayout(cardForPresent);
dictTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dictCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
dictTabPane.add(dictCardPane, BorderLayout.CENTER);
dictCardLayout = new CardLayout();
dictCardPane.setLayout(dictCardLayout);
cardPaneForTreeSetting = FRGUIPaneFactory.createBorderLayout_L_Pane();
treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
widgetPropertyPane = new BasicWidgetPropertySettingPane();
attriPane.add(widgetPropertyPane, BorderLayout.NORTH);
cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
attriPane.add(cardPane, BorderLayout.CENTER);
card = (CardLayout) cardPane.getLayout();
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties"));
northPane.add(basic);
basic.add(widgetPropertyPane);
attriTabPane.add(northPane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
attriTabPane.add(attriCardPane, BorderLayout.CENTER);
attriCardLayout = (CardLayout) attriCardPane.getLayout();
this.setPreferredSize(new Dimension(600, 450));
}
@ -84,49 +93,44 @@ public class CellWidgetCardPane extends BasicPane {
this.tabbedPane.setEnabled(true);
}
attriPane.remove(widgetPropertyPane);
widgetPropertyPane = new BasicWidgetPropertySettingPane();
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties"));
northPane.add(basic);
basic.add(widgetPropertyPane);
attriPane.add(northPane, BorderLayout.NORTH);
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() {
@Override
public void did(DataCreatorUI ui, String cardName) {
if (ui == null) {
addPresPane(false);
addTreeSettingPane(false);
removeDictAttriPane();
removeTreeAttriPane();
}
if (ui instanceof DictionaryPane) {
removeDictAttriPane();
removeTreeAttriPane();
showDictPane(ui, cardName);
} else if (ui instanceof TreeSettingPane) {
removeDictAttriPane();
removeTreeAttriPane();
showTreePane(ui);
}
}
});
DataModify<? extends Widget> definePane = rn.getDefinePane();
cardPane.add(definePane.toSwingComponent(), rn.getCardName());
card.show(cardPane, rn.getCardName());
attriCardPane.add(definePane.toSwingComponent(), rn.getCardName());
attriCardLayout.show(attriCardPane, rn.getCardName());
currentEditorDefinePane = definePane;
eventTabPane.populate(cellWidget);
eventPane.populate(cellWidget);
widgetPropertyPane.populate(cellWidget);
tabbedPane.setSelectedIndex(0);
}
private void showDictPane(DataCreatorUI ui, String cardName) {
cardPaneForPresent.removeAll();
cardPaneForPresent.add(ui.toSwingComponent(), cardName);
cardForPresent.show(cardPaneForPresent, cardName);
addPresPane(true);
dictCardPane.removeAll();
dictCardPane.add(ui.toSwingComponent(), cardName);
dictCardLayout.show(dictCardPane, cardName);
addDictAttriPane();
}
private void showTreePane(DataCreatorUI ui) {
cardPaneForTreeSetting.removeAll();
cardPaneForTreeSetting.add(ui.toSwingComponent());
addTreeSettingPane(true);
treeTabPane.removeAll();
treeTabPane.add(ui.toSwingComponent());
addTreeAttriPane();
}
public Widget update() {
@ -139,7 +143,7 @@ public class CellWidgetCardPane extends BasicPane {
}
widgetPropertyPane.update(widget);
Listener[] listener = eventTabPane == null ? new Listener[0] : eventTabPane.updateListeners();
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners();
widget.clearListeners();
for (Listener l : listener) {
widget.addListener(l);
@ -155,25 +159,26 @@ public class CellWidgetCardPane extends BasicPane {
*/
public void checkValid() throws Exception {
currentEditorDefinePane.checkValid();
eventTabPane.checkValid();
eventPane.checkValid();
}
//:jackie 如果选择的项有形态,则将形态面板加入tab面板
private void addPresPane(boolean add) {
if (add) {
tabbedPane.add(this.presPane, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary"));
} else {
tabbedPane.remove(presPane);
}
private void addDictAttriPane() {
tabbedPane.add(this.dictTabPane, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary"));
}
private void addTreeSettingPane(boolean add) {
if (add) {
tabbedPane.add(this.cardPaneForTreeSetting, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree"));
} else {
tabbedPane.remove(this.cardPaneForTreeSetting);
}
private void addTreeAttriPane() {
tabbedPane.add(this.treeTabPane, 1);
tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree"));
}
private void removeDictAttriPane() {
tabbedPane.remove(this.dictTabPane);
}
}
private void removeTreeAttriPane() {
tabbedPane.remove(this.treeTabPane);
}
}

4
designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -20,7 +20,7 @@ import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Blank") + 30;
private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30;
private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30;
private UICheckBox allowBlankCheckBox;
// richer:错误信息,是所有控件共有的属性,所以放到这里来
@ -39,7 +39,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
initRegErrorMsgTextField();
//JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Blank"));
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT));
allowBlankCheckBox.addItemListener(new ItemListener() {

6
designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

@ -61,11 +61,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
regPane.getRegComboBox().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem();
if (!StringUtils.isNotEmpty(regExp.toRegText())) {
getRegErrorMsgTextField().setEnabled(false);
} else {
getRegErrorMsgTextField().setEnabled(true);
}
getRegErrorMsgTextField().setEnabled(regExp.errorMessageEditable());
}
});

9
designer/src/com/fr/grid/Grid.java

@ -10,6 +10,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.event.CellEditorEvent;
@ -35,6 +36,7 @@ import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
@ -1065,6 +1067,13 @@ public class Grid extends BaseGridComponent {
}
/**
* @return editingCellElement 的字符串表示
*/
public String getEditingCellElement() {
return editingCellElement.toString();
}
/**
* 将新值赋给editingCellElement
*

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

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

4
designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java

@ -161,7 +161,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
* @param isIntersects 是否重叠
*/
@Override
public void setWidgetsIntersects(boolean isIntersects) {
public void setWidgetsIntersected(boolean isIntersects) {
}
/**
@ -170,7 +170,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
* @return 重叠
*/
@Override
public boolean getWidgetsIntersects() {
public boolean isWidgetsIntersected() {
return false;
}

21
designer/src/com/fr/start/ReportSplashPane.java

@ -4,6 +4,7 @@
package com.fr.start;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.GeneralContext;
@ -18,6 +19,7 @@ import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.image.BufferedImage;
import java.util.Locale;
import java.util.Random;
import java.util.TimerTask;
@ -117,9 +119,22 @@ public class ReportSplashPane extends SplashPane{
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y);
//每次随机感谢一位论坛用户
splashG2d.setPaint(THANK_COLOR);
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST;
GraphHelper.drawString(splashG2d, content, THANK_INFO_X, y);
if (shouldShowThanks()) {
splashG2d.setPaint(THANK_COLOR);
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST;
GraphHelper.drawString(splashG2d, content, THANK_INFO_X, y);
}
}
// 是否显示鸣谢文字
private boolean shouldShowThanks() {
Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN};
for (Locale loc : hideLocales) {
if (FRContext.getLocale().equals(loc)) {
return false;
}
}
return true;
}
private static String getRandomUser(){

21
designer_base/build.dev.gradle

@ -1,8 +1,25 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.7
//jar包版本

70
designer_base/build.dev.gradle.bak

@ -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-core'
}
def srcDir="."
//
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:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.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:'../../../finereport-lib4build-stable',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

20
designer_base/build.master.gradle

@ -1,8 +1,26 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.7
//jar包版本

89
designer_base/build.master.gradle.bak

@ -0,0 +1,89 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
//
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:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.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:'../../../finereport-lib4build-stable',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

23
designer_base/build.release.gradle

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
buildscript {
repositories {
maven {
url "http://www.eveoh.nl/files/maven2"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.2"
}
}
ext.aspectjVersion = '1.7.4'
apply plugin: 'aspectj'
repositories {
mavenCentral()
}
//jdk版本
sourceCompatibility=1.8
//jar包版本

60
designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj

@ -0,0 +1,60 @@
package com.fr.aspectj.designerbase;
/**
* 记录模板过程
* Created by plough on 2017/3/3.
*/
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import org.aspectj.lang.reflect.SourceLocation;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.util.Date;
public aspect TemplateProcessTracker {
//声明一个pointcut,匹配你需要的方法
pointcut onMouseClicked(MouseEvent e) :
execution(* mouseClicked(MouseEvent)) && args(e);
pointcut onMousePressed(MouseEvent e) :
execution(* mousePressed(MouseEvent)) && args(e);
pointcut onMouseReleased(MouseEvent e) :
execution(* mouseReleased(MouseEvent)) && args(e);
pointcut onActionPerformed(ActionEvent e) :
execution(* actionPerformed(ActionEvent)) && args(e);
pointcut onSetValueAt(Object v, int r, int c) :
execution(* setValueAt(java.lang.Object, int, int)) && args(v, r, c);
//before表示之前的意思
//这整个表示在MouseAdapter的public void mouseXXX(MouseEvent)方法调用之前,你想要执行的代码
before(MouseEvent e) : onMouseClicked(e) || onMousePressed(e) || onMouseReleased(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation();//切面对应的代码位置
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = "";
TemplateInfoCollector.appendProcess(log);
}
//同上
before(ActionEvent e) : onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) {
return;
}
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = "";
TemplateInfoCollector.appendProcess(log);
}
//同上
before(Object v, int r, int c) : onSetValueAt(v, r, c) {
SourceLocation sl = thisJoinPoint.getSourceLocation();
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c);
String log = "";
TemplateInfoCollector.appendProcess(log);
}
}

70
designer_base/src/com/fr/design/actions/edit/CopyAction.java

@ -1,37 +1,35 @@
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.edit;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter;
/**
* Copy.
*/
public class CopyAction extends TemplateComponentAction {
public CopyAction(TargetComponent t) {
super(t);
this.setName(Inter.getLocText("M_Edit-Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK));
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc != null) {
tc.copy();
}
return false;
}
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Copy.
*/
public class CopyAction extends TemplateComponentAction {
public CopyAction(TargetComponent t) {
super(t);
this.setName(Inter.getLocText("M_Edit-Copy"));
this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK));
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc != null) {
tc.copy();
}
return false;
}
}

62
designer_base/src/com/fr/design/actions/file/LocalePane.java

@ -27,6 +27,8 @@ import com.fr.design.dialog.BasicPane;
import com.fr.file.filetree.FileNode;
import com.fr.general.*;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.project.ProjectConstants;
/**
@ -51,8 +53,8 @@ public class LocalePane extends BasicPane {
add(tabbedPane, BorderLayout.CENTER);
predefineTableModel = new DefaultTableModel() {
public boolean isCellEditable(int col, int row) {
return false;
public boolean isCellEditable(int row, int column) {
return column == 0;
}
};
@ -109,23 +111,39 @@ public class LocalePane extends BasicPane {
}
private void initPredefinedProperties() {
Map<Locale, LocalePackage> map = Inter.getPredefinedPackageMap();
LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE);
Map<Locale, String> supportLocaleMap = Inter.getSupportLocaleMap();
String[] localeFiles = StableFactory.getLocaleFiles();
List<String> sortKeys = new ArrayList<String>();
Set<ResourceBundle> bundles = chinese.getKindsOfResourceBundle();
for (ResourceBundle bundle : bundles) {
sortKeys.addAll(bundle.keySet());
for (String path : localeFiles) {
ResourceBundle chineseBundle = loadResourceBundle(path, Locale.SIMPLIFIED_CHINESE);
sortKeys.addAll(chineseBundle.keySet());
}
Collections.sort(sortKeys);
Map<Locale, List<ResourceBundle>> localeResourceBundleMap = new HashMap<Locale, List<ResourceBundle>>();
for (Map.Entry<Locale, String> entry : supportLocaleMap.entrySet()) {
Locale locale = entry.getKey();
List<ResourceBundle> list = new ArrayList<>();
for (String path : localeFiles) {
ResourceBundle chineseBundle = loadResourceBundle(path, locale);
list.add(chineseBundle);
}
localeResourceBundleMap.put(locale, list);
}
Map<Locale, Vector<String>> data = new HashMap<Locale, Vector<String>>();
for (Map.Entry<Locale, LocalePackage> entry : map.entrySet()) {
for (Map.Entry<Locale, List<ResourceBundle>> entry : localeResourceBundleMap.entrySet()) {
Vector<String> column = new Vector<String>();
List<ResourceBundle> rbs = entry.getValue();
for (String key : sortKeys) {
column.add(entry.getValue().getLocText(key));
column.add(readText(rbs, key));
}
data.put(entry.getKey(), column);
}
@ -140,6 +158,19 @@ public class LocalePane extends BasicPane {
}
}
private String readText(List<ResourceBundle> rbs, String key) {
for (ResourceBundle rb : rbs) {
if (rb.containsKey(key)) {
return rb.getString(key);
}
}
return null;
}
private ResourceBundle loadResourceBundle(String dir, Locale locale) {
return ResourceBundle.getBundle(dir, locale, Inter.class.getClassLoader());
}
private void initCustomProperties() throws Exception {
Env env = FRContext.getCurrentEnv();
if (env == null) {
@ -176,22 +207,9 @@ public class LocalePane extends BasicPane {
}
}
private Properties loadLocaleProperties(String name) {
Properties properties = new Properties();
InputStream inputStream = IOUtils.readResource("/com/fr/general/locale/" + name);
try {
properties.load(inputStream);
} catch (IOException e) {
FRLogger.getLogger().error(e.getMessage());
}
return properties;
}
/**
* 保存当前编辑的国际化
*
*
* @date 2014-9-30-下午3:10:30
*/
public void save() {
Env env = FRContext.getCurrentEnv();

31
designer_base/src/com/fr/design/actions/help/AboutPane.java

@ -68,10 +68,7 @@ public class AboutPane extends JPanel {
Inter.getLocText("FR-Designer-Basic_Activation_Key_Copy_OK")
}));
// 英文去掉服务电话和 QQ
if (FRContext.getLocale() == Locale.ENGLISH || FRContext.getLocale() == Locale.US || FRContext.getLocale() == Locale.UK){
// do nothing
} else {
if (shouldShowPhoneAndQQ()){
if(ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)){
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + ProductConstants.COMPARE_TELEPHONE);
contentPane.add(boxCenterAlignmentPane);
@ -80,13 +77,29 @@ public class AboutPane extends JPanel {
contentPane.add(boxCenterAlignmentPane);
}
BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website", ProductConstants.WEBSITE_URL));
BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("register.email", ProductConstants.SUPPORT_EMAIL));
BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL));
BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL));
contentPane.add(actionLabel);
contentPane.add(emailLabel);
addThankPane(contentPane);
if (shouldShowThanks()) {
addThankPane(contentPane);
}
}
// 是否显示服务电话和 qq
private boolean shouldShowPhoneAndQQ() {
return !FRContext.getLocale().equals(Locale.US);
}
// 是否显示鸣谢面板
private boolean shouldShowThanks() {
Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN};
for (Locale loc : hideLocales) {
if (FRContext.getLocale().equals(loc)) {
return false;
}
}
return true;
}
//添加鸣谢面板
@ -111,7 +124,7 @@ public class AboutPane extends JPanel {
private String getCopyRight(){
return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL,
ProductConstants.HISTORY, StringUtils.BLANK, ProductConstants.COMPANY_NAME);
ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME));
}
private String getBuildTitle() {

10
designer_base/src/com/fr/design/actions/help/TutorialAction.java

@ -59,18 +59,20 @@ public class TutorialAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
Locale locale = FRContext.getLocale();
if (ComparatorUtils.equals(locale, Locale.CHINA) || ComparatorUtils.equals(locale, Locale.TAIWAN)){
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("help"));
String helpURL = SiteCenter.getInstance().acquireUrlByKind("help." + FRContext.getLocale());
if (helpURL != null) {
HttpClient client = new HttpClient(helpURL);
if(client.getResponseCode() != -1) {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("help")));
Desktop.getDesktop().browse(new URI(helpURL));
return;
} catch (Exception e) {
//出了异常的话, 依然打开本地教程
}
}
}
if (OperatingSystem.isMacOS()) {
nativeExcuteMacInstallHomePrograms("helptutorial.app");
}

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

@ -1,171 +1,176 @@
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
import com.fr.data.impl.Connection;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
/**
* DatasourceList Action
*/
public class ConnectionListAction extends UpdateAction {
private static final int BYTENUM = 1444;
public ConnectionListAction() {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'D';
}
@Override
public String getMenuName() {
return Inter.getLocText("Server-Define_Data_Connection");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 执行动作
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
populate(datasourceManager);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
databaseListDialog.setVisible(true);
}
private void writeFile(DatasourceManagerProvider datasourceManager) {
Env currentEnv = FRContext.getCurrentEnv();
try {
boolean isSuccess = currentEnv.writeResource(datasourceManager);
if (!isSuccess) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
} catch (Exception e) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
/**
* 是否正常更新完datasourceManager
*
* @param datasourceManager
* @param databaseManagerPane
* @return
*/
private boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager backupManager,
ConnectionManagerPane databaseManagerPane, BasicDialog databaseListDialog) {
databaseManagerPane.update(datasourceManager);
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails();
modifyDetails.clear();
Env currentEnv = FRContext.getCurrentEnv();
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID());
boolean isFailed = false;
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) {
//如果是本地,并且有远程用户时则更新自己的修改表
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER);
} else {
if (!currentEnv.isSupportLocalFileOperate()) {
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION);
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) {
//有冲突,进行提示
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"});
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
//点击是,进行相应刷新去冲突
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION);
//要是有重命名冲突的,则对详细的修改表先进行修改
datasourceManager.doWithConnectionConflict(localModifiedTable);
localModifiedTable.removeConfilct();
modifyDetails.clear();
//更新面板
databaseManagerPane.populate(datasourceManager);
} else {
//更新失败,继续停留页面
isFailed = true;
}
}
}
}
//存在请重命名则不能更新
int index = datasourceManager.isConnectionMapContainsRename();
if (index != -1) {
isFailed = true;
databaseManagerPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
//如果修改成功,则去远程端增量修改修改表
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) {
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION);
localModifiedTable.clear();
modifyDetails.clear();
}
return !isFailed;
}
public void update() {
this.setEnabled(true);
}
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
import com.fr.data.impl.Connection;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
/**
* DatasourceList Action
*/
public class ConnectionListAction extends UpdateAction {
public ConnectionListAction() {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'D';
}
@Override
public String getMenuName() {
return Inter.getLocText("Server-Define_Data_Connection");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 执行动作
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
populate(datasourceManager);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
databaseListDialog.setVisible(true);
}
/**
* @param datasourceManager
*/
public static void writeFile(DatasourceManagerProvider datasourceManager) {
Env currentEnv = FRContext.getCurrentEnv();
try {
boolean isSuccess = currentEnv.writeResource(datasourceManager);
if (!isSuccess) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
} catch (Exception e) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
/**
* 更新datasourceManager
*
* @param datasourceManager datasource管理对象
* @param backupManager datasource管理对象备份
* @param connectionShowPane datasource面板
* @param databaseListDialog datasource管理对话框
* @return boolean 是否更新成功
*/
public static boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager
backupManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) {
connectionShowPane.update(datasourceManager);
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails();
modifyDetails.clear();
Env currentEnv = FRContext.getCurrentEnv();
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID());
boolean isFailed = false;
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) {
//如果是本地,并且有远程用户时则更新自己的修改表
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER);
} else {
if (!currentEnv.isSupportLocalFileOperate()) {
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION);
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) {
//有冲突,进行提示
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"});
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
//点击是,进行相应刷新去冲突
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION);
//要是有重命名冲突的,则对详细的修改表先进行修改
datasourceManager.doWithConnectionConflict(localModifiedTable);
localModifiedTable.removeConfilct();
modifyDetails.clear();
//更新面板
connectionShowPane.populate(datasourceManager);
} else {
//更新失败,继续停留页面
isFailed = true;
}
}
}
}
//存在请重命名则不能更新
int index = datasourceManager.isConnectionMapContainsRename();
if (index != -1) {
isFailed = true;
connectionShowPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
//如果修改成功,则去远程端增量修改修改表
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) {
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION);
localModifiedTable.clear();
modifyDetails.clear();
}
return !isFailed;
}
public void update() {
this.setEnabled(true);
}
}

4
designer_base/src/com/fr/design/actions/server/PluginManagerAction.java

@ -2,7 +2,7 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.extra.WebDialog;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
@ -25,7 +25,7 @@ public class PluginManagerAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
WebDialog.createPluginDialog();
WebViewDlgHelper.createPluginDialog();
}
public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() {

64
designer_base/src/com/fr/design/beans/location/MoveUtils.java

@ -16,10 +16,9 @@ import java.util.ArrayList;
public class MoveUtils {
public static final int SORPTION_UNIT = 5;
private static final int EQUIDISTANTLINE_UNIT = 4;
public static WidgetForbidWindow widgetForbidWindow = new WidgetForbidWindow();
public static ArrayList<EquidistantLine> equidistantLines = new ArrayList<>();
private static ArrayList<EquidistantLine> equidistantLines = new ArrayList<>();
private MoveUtils() {
@ -77,13 +76,13 @@ public class MoveUtils {
* 设置designer内部组件是否重叠的标志位
* @param isIntersects 是否重叠
*/
void setWidgetsIntersects(boolean isIntersects);
void setWidgetsIntersected(boolean isIntersects);
/**
* 获取designer内部组件是否重叠的标志位
* @return 重叠
*/
boolean getWidgetsIntersects();
boolean isWidgetsIntersected();
/**
* 获取designer相对屏幕的位置
@ -258,8 +257,7 @@ public class MoveUtils {
equidistantLineInfo.setReference(bounds.y);
equidistantLineInfo.setDirection(SwingConstants.BOTTOM);
}
}
else if ((leftMiddleY > bounds.getY()) && (leftMiddleY < (bounds.getY() + bounds.getHeight()))){
} else if ((leftMiddleY > bounds.getY()) && (leftMiddleY < (bounds.getY() + bounds.getHeight()))) {
//当前操作rec在bounds的右侧
if (left > (bounds.getX() + bounds.getWidth())){
equidistantLineInfo.setDistance(left - (bounds.x + bounds.width));
@ -278,13 +276,6 @@ public class MoveUtils {
}
}
public static void displayForbidWindow(int x, int y) {
widgetForbidWindow.showWindow(x, y);
}
public static void hideForbidWindow() {
widgetForbidWindow.hideWindow();
}
/**
* 吸附
@ -317,25 +308,16 @@ public class MoveUtils {
RectangleIterator iterator = designer.createRectangleIterator();
java.util.List<Rectangle> cacheRecs = new ArrayList<Rectangle>();
//是否存在控件重叠
boolean isWidgetsIntersects = false;
while (iterator.hasNext()) {
Rectangle bounds = iterator.nextRectangle();
cacheRecs.add(bounds);
boolean isIntersects = operatingRectangle.intersects(bounds);
findX(px, bounds, left, right, width);
findY(py, bounds, top, bottom, height);
if(!isParameterLayout){
if(isIntersects) {
isWidgetsIntersects = true;
}
else{
findEquidistantLine(bounds, left, top, height, width);
}
}
}
showForbiddenWindow(designer, x, y, isWidgetsIntersects);
while (iterator.hasNext()) {
Rectangle bounds = iterator.nextRectangle();
cacheRecs.add(bounds);
findX(px, bounds, left, right, width);
findY(py, bounds, top, bottom, height);
if (!isParameterLayout) {
findEquidistantLine(bounds, left, top, height, width);
}
}
createXAbsorptionline(px, designer, width, cacheRecs);
createYAbsorptionline(py, designer, height, cacheRecs);
@ -352,18 +334,6 @@ public class MoveUtils {
return sorptionPoint;
}
public static void showForbiddenWindow(RectangleDesigner designer, int x, int y, boolean isIntersects){
if (isIntersects){
if(designer.getDesignerLocationOnScreen() != null) {
displayForbidWindow(x + designer.getDesignerLocationOnScreen().x, y + designer.getDesignerLocationOnScreen().y);
}
designer.setWidgetsIntersects(true);
}
else{
designer.setWidgetsIntersects(false);
hideForbidWindow();
}
}
private static void createXAbsorptionline(PlacePointing px, RectangleDesigner designer, int width, java.util.List<Rectangle> cacheRecs) {
Absorptionline line = null;
@ -479,10 +449,10 @@ public class MoveUtils {
}
private static void processEquidistantLinesList(PlacePointing pEquidistantX, PlacePointing pEquidistantY, Rectangle operatingRectangle){
EquidistantLine[] equidistantLines1 = new EquidistantLine[4];
EquidistantLine[] equidistantLines1 = new EquidistantLine[EQUIDISTANTLINE_UNIT];
//先按方向处理,只保留四个方向上距离最近
for(int count = 0; count < equidistantLines.size(); count++){
for (int direction = 0; direction < 4; direction++){
for (int direction = 0; direction < EQUIDISTANTLINE_UNIT; direction++){
if(equidistantLines.get(count).getDirection() == (direction + 1)){//direction 1,2,3,4 分别对应top,left,bottom,right
if(equidistantLines1[direction] != null
&& equidistantLines1[direction].getDistance() > equidistantLines.get(count).getDistance()

48
designer_base/src/com/fr/design/beans/location/WidgetForbidWindow.java

@ -1,48 +0,0 @@
package com.fr.design.beans.location;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants;
import com.fr.general.Inter;
import javax.swing.*;
/**
* Created by zhouping on 2016/7/24.
*/
public class WidgetForbidWindow extends JWindow {
private static final int WIDTH = 150;
private static final int HEIGHT = 20;
private UIButton promptButton = new UIButton(Inter.getLocText("FR-Designer_Forbid_Widgets_Intersects"), BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH));
/**
* 构造函数
*/
public WidgetForbidWindow() {
this.add(promptButton);
this.setSize(WIDTH, HEIGHT);
}
/**
* 在指定位置显示窗口, 默认将window的中心点放到指定位置上
*
* @param x x坐标
* @param y y坐标
*
*/
public void showWindow(int x, int y){
this.setLocation(x - WIDTH / 2, y - HEIGHT / 2);
this.setVisible(true);
}
/**
* 隐藏当前窗口
*
*/
public void hideWindow(){
this.setVisible(false);
}
}

75
designer_base/src/com/fr/design/data/DesignTableDataManager.java

@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
import java.text.Collator;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
/**
* 设计器管理操作数据集的类:
@ -59,7 +58,7 @@ public abstract class DesignTableDataManager {
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>();
// private static List<ChangeListener> dsListeners = new ArrayList<ChangeListener>();
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>();
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>();
public static String NO_PARAMETER = "no_paramater_pane";
@ -79,7 +78,7 @@ public abstract class DesignTableDataManager {
* 响应数据集改变.
*/
private static void fireDsChanged() {
for(Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) {
for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) {
List<ChangeListener> dsListeners = listenerEntry.getValue();
for (int i = 0; i < dsListeners.size(); i++) {
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
@ -91,8 +90,8 @@ public abstract class DesignTableDataManager {
}
}
public static void closeTemplate(JTemplate<?,?> template) {
if(template != null) {
public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) {
dsListenersMap.remove(template.getFullPathName());
}
}
@ -151,7 +150,7 @@ public abstract class DesignTableDataManager {
public static void addDsChangeListener(ChangeListener l) {
JTemplate<?, ?> template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
String key = StringUtils.EMPTY;
if(template != null) {
if (template != null) {
key = template.getFullPathName();
}
List<ChangeListener> dsListeners = dsListenersMap.get(key);
@ -180,7 +179,7 @@ public abstract class DesignTableDataManager {
* august:返回当前正在编辑的具有报表数据源的模板(基本报表聚合报表) 包括 : 图表模板
*
* @return TableDataSource
* attention:与这个方法有关系的静态组件不随着切换模板tab而变化的应该重新执行该方法再刷新组件
* attention:与这个方法有关系的静态组件不随着切换模板tab而变化的应该重新执行该方法再刷新组件
*/
public static TableDataSource getEditingTableDataSource() {
return DesignModelAdapter.getCurrentModelAdapter() == null ? null : DesignModelAdapter.getCurrentModelAdapter().getBook();
@ -319,7 +318,6 @@ public abstract class DesignTableDataManager {
}
private static void addStoreProcedureData(java.util.Map<String, TableDataWrapper> resMap) {
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance();
String[] namearray = new String[0];
@ -381,42 +379,34 @@ public abstract class DesignTableDataManager {
private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar();
Env currentEnv = FRContext.getCurrentEnv();
EmbeddedTableData embeddedTableData = null;
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata);
boolean isNullParameter = parameters == null || parameters.length == 0;
ParameterProvider[] tableDataParameter = tabledata.getParameters(Calculator.createCalculator());
boolean isOriginalNUllParameter = tableDataParameter == null || tableDataParameter.length == 0;
if (isNullParameter && !isOriginalNUllParameter) {
parameters = tableDataParameter;
}
boolean hasValue = true;
for (ParameterProvider parameter : parameters) {
if (parameter.getValue() == null || ComparatorUtils.equals(StringUtils.EMPTY, parameter.getValue())) {
hasValue = false;
break;
}
if (ArrayUtils.isEmpty(parameters)) {
parameters = tabledata.getParameters(Calculator.createCalculator());
}
final Map<String, Object> parameterMap = new HashMap<String, Object>();
if (!hasValue || isMustInputParameters) {
if (parameters != null && parameters.length > 0) {
final ParameterInputPane pPane = new ParameterInputPane(parameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
public void doOk() {
parameterMap.putAll(pPane.update());
}
}).setVisible(true);
}
final Map<String, Object> parameterMap = new HashMap<>();
if (needInputParams(isMustInputParameters, parameters)) {
final ParameterInputPane pPane = new ParameterInputPane(parameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());
}
}).setVisible(true);
} else {
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), parameters[i].getValue());
for (ParameterProvider parameter : parameters) {
parameterMap.put(parameter.getName(), parameter.getValue());
}
}
if (loadingBar != null && needLoadingBar) {
loadingBar.start();
}
try {
embeddedTableData = currentEnv.previewTableData(tabledata, parameterMap, rowCount);
for (ParameterProvider parameter : currentEnv.getTableDataParameters(tabledata)) {
if (parameterMap.containsKey(parameter.getName())) {
parameter.setValue(parameterMap.get(parameter.getName()));
}
}
return currentEnv.previewTableData(tabledata, parameterMap, rowCount);
} catch (TableDataException e) {
throw new TableDataException(e.getMessage(), e);
} finally {
@ -426,7 +416,18 @@ public abstract class DesignTableDataManager {
}
}, 100);
}
return embeddedTableData;
}
private static boolean needInputParams(boolean mustInputParameters, ParameterProvider[] parameters) {
if (mustInputParameters && ArrayUtils.isNotEmpty(parameters)) {
return true;
}
for (ParameterProvider parameter : parameters) {
if (parameter.getValue() == null || StringUtils.EMPTY.equals(parameter.getValue())) {
return true;
}
}
return false;
}
/**
@ -495,6 +496,4 @@ public abstract class DesignTableDataManager {
public static void setThreadLocal(String value) {
threadLocal.set(value);
}
}

2
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -84,7 +84,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
public void success(Status status) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}

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

@ -1,128 +1,140 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* 选择数据连接的下拉框
*
* @editor zhou
* @since 2012-3-28下午3:02:30
*/
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
private java.util.List<String> nameList = new ArrayList<String>();
public ConnectionComboBoxPanel(Class<? extends Connection> cls) {
super();
this.cls = cls;
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
this.itemComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String selected = ConnectionComboBoxPanel.this.getSelectedItem();
if (StringUtils.isNotBlank(selected)) {
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected);
}
}
});
refreshItems();
}
/*
* 刷新ComboBox.items
*/
protected java.util.Iterator<String> items() {
nameList = new ArrayList<String>();
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance();
java.util.Iterator<String> nameIt = mgr.getConnectionNameIterator();
while (nameIt.hasNext()) {
String conName = nameIt.next();
Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList);
}
return nameList.iterator();
}
protected void filterConnection(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
public int getConnectionSize() {
return nameList.size();
}
public String getConnection(int i) {
return nameList.get(i);
}
/*
* 弹出对话框编辑Items
*/
protected void editItems() {
final ConnectionListPane connectionListPane = new ConnectionListPane();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
connectionListPane.populate(datasourceManager);
BasicDialog connectionListDialog = connectionListPane.showLargeWindow(
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), new DialogActionAdapter() {
public void doOk() {
connectionListPane.update(datasourceManager);
// marks:保存数据
Env currentEnv = FRContext.getCurrentEnv();
try {
currentEnv.writeResource(datasourceManager);
} catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex);
}
}
});
connectionListDialog.setVisible(true);
refreshItems();
}
public void populate(com.fr.data.impl.Connection connection) {
editButton.setEnabled(FRContext.getCurrentEnv().isRoot());
if (connection instanceof NameDatabaseConnection) {
this.setSelectedItem(((NameDatabaseConnection) connection).getName());
} else {
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection();
if (StringUtils.isNotBlank(s)) {
for (int i = 0; i < this.getConnectionSize(); i++) {
String t = this.getConnection(i);
if (ComparatorUtils.equals(s, t)) {
this.setSelectedItem(s);
break;
}
}
}
// alex:如果这个ComboBox还是没有选中,那么选中第一个
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) {
this.setSelectedItem(this.getConnection(0));
}
}
}
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 选择数据连接的下拉框
*
* @editor zhou
* @since 2012-3-28下午3:02:30
*/
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
private List<String> nameList = new ArrayList<String>();
public ConnectionComboBoxPanel(Class<? extends Connection> cls) {
super();
this.cls = cls;
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
this.itemComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String selected = ConnectionComboBoxPanel.this.getSelectedItem();
if (StringUtils.isNotBlank(selected)) {
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected);
}
}
});
refreshItems();
}
/*
* 刷新ComboBox.items
*/
protected Iterator<String> items() {
nameList = new ArrayList<String>();
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance();
Iterator<String> nameIt = mgr.getConnectionNameIterator();
while (nameIt.hasNext()) {
String conName = nameIt.next();
Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList);
}
return nameList.iterator();
}
protected void filterConnection(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
public int getConnectionSize() {
return nameList.size();
}
public String getConnection(int i) {
return nameList.get(i);
}
/*
* 弹出对话框编辑Items
*/
protected void editItems() {
final ConnectionListPane connectionListPane = new ConnectionListPane();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
connectionListPane.populate(datasourceManager);
final BasicDialog connectionListDialog = connectionListPane.showLargeWindow(
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), null);
connectionListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!connectionListPane.isNamePermitted()) {
connectionListDialog.setDoOKSucceed(false);
return;
}
if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane,
connectionListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
ConnectionListAction.writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
connectionListDialog.setVisible(true);
refreshItems();
}
/**
* @param connection 数据库链接
*/
public void populate(Connection connection) {
editButton.setEnabled(FRContext.getCurrentEnv().isRoot());
if (connection instanceof NameDatabaseConnection) {
this.setSelectedItem(((NameDatabaseConnection) connection).getName());
} else {
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection();
if (StringUtils.isNotBlank(s)) {
for (int i = 0; i < this.getConnectionSize(); i++) {
String t = this.getConnection(i);
if (ComparatorUtils.equals(s, t)) {
this.setSelectedItem(s);
break;
}
}
}
// alex:如果这个ComboBox还是没有选中,那么选中第一个
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) {
this.setSelectedItem(this.getConnection(0));
}
}
}
}

324
designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,163 +1,163 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.*;
/**
* Connection List Pane.
*/
public class ConnectionListPane extends JListControlPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>();
public ConnectionListPane() {
renameMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
public void propertyChange() {
isNamePermitted = true;
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) {
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"};
String[] sign = new String[]{",", "!"};
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign));
setWarnigText(editingIndex);
isNamePermitted = false;
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"});
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setWarnigText(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {
rename(selectedName, tempName);
}
}
});
}
protected void rename(String oldName, String newName) {
if (renameMap.containsKey(selectedName)) {
renameMap.remove(selectedName);
}
renameMap.put(selectedName, newName);
}
/**
* 名字是否允许
*
* @return /
*/
public boolean isNamePermitted() {
return isNamePermitted;
}
/**
* 检查按钮可用状态 Check button enabled.
*/
public void checkButtonEnabled() {
super.checkButtonEnabled();
isNamePermitted = !isContainsRename();
}
public HashMap<String, String> getRenameMap() {
return renameMap;
}
/**
* 创建菜单项
*
* @return 菜单项
*/
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator(
"JDBC",
"/com/fr/design/images/data/source/jdbcTableData.png",
JDBCDatabaseConnection.class,
DatabaseConnectionPane.JDBC.class
), new NameObjectCreator(
"JNDI",
"/com/fr/design/images/data/source/jdbcTableData.png",
JNDIDatabaseConnection.class,
DatabaseConnectionPane.JNDI.class
)};
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG);
for (ConnectionProvider provider : pluginCreators) {
NameObjectCreator creator = new NameObjectCreator(
provider.nameForConnection(),
provider.iconPathForConnection(),
provider.classForConnection(),
provider.appearanceForConnection()
);
creators = ArrayUtils.add(creators, creator);
}
return creators;
}
@Override
protected String title4PopupWindow() {
return TITLE_NAME;
}
/**
* Populate.
*
* @param datasourceManager the new datasourceManager.
*/
public void populate(DatasourceManagerProvider datasourceManager) {
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) {
String name = nameIt.next();
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name)));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* Update.
*/
public void update(DatasourceManagerProvider datasourceManager) {
// Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array);
datasourceManager.clearAllConnection();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject());
}
}
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.*;
/**
* Connection List Pane.
*/
public class ConnectionListPane extends JListControlPane implements ConnectionShowPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>();
public ConnectionListPane() {
renameMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
public void propertyChange() {
isNamePermitted = true;
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) {
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"};
String[] sign = new String[]{",", "!"};
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign));
setWarnigText(editingIndex);
isNamePermitted = false;
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"});
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setWarnigText(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {
rename(selectedName, tempName);
}
}
});
}
protected void rename(String oldName, String newName) {
if (renameMap.containsKey(selectedName)) {
renameMap.remove(selectedName);
}
renameMap.put(selectedName, newName);
}
/**
* 名字是否允许
*
* @return /
*/
public boolean isNamePermitted() {
return isNamePermitted;
}
/**
* 检查按钮可用状态 Check button enabled.
*/
public void checkButtonEnabled() {
super.checkButtonEnabled();
isNamePermitted = !isContainsRename();
}
public HashMap<String, String> getRenameMap() {
return renameMap;
}
/**
* 创建菜单项
*
* @return 菜单项
*/
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator(
"JDBC",
"/com/fr/design/images/data/source/jdbcTableData.png",
JDBCDatabaseConnection.class,
DatabaseConnectionPane.JDBC.class
), new NameObjectCreator(
"JNDI",
"/com/fr/design/images/data/source/jdbcTableData.png",
JNDIDatabaseConnection.class,
DatabaseConnectionPane.JNDI.class
)};
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG);
for (ConnectionProvider provider : pluginCreators) {
NameObjectCreator creator = new NameObjectCreator(
provider.nameForConnection(),
provider.iconPathForConnection(),
provider.classForConnection(),
provider.appearanceForConnection()
);
creators = ArrayUtils.add(creators, creator);
}
return creators;
}
@Override
protected String title4PopupWindow() {
return TITLE_NAME;
}
/**
* Populate.
*
* @param datasourceManager the new datasourceManager.
*/
public void populate(DatasourceManagerProvider datasourceManager) {
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) {
String name = nameIt.next();
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name)));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* Update.
*/
public void update(DatasourceManagerProvider datasourceManager) {
// Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array);
datasourceManager.clearAllConnection();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject());
}
}
}

155
designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -1,78 +1,79 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.HashMap;
public class ConnectionManagerPane extends LoadingBasicPane {
private UITextField connectionTextField;
private ConnectionListPane connectionListPane;
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
container.add(connectionPathPane, BorderLayout.NORTH);
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2));
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST);
this.connectionTextField = new UITextField();
connectionPathPane.add(connectionTextField, BorderLayout.CENTER);
this.connectionTextField.setEditable(false);
connectionListPane = new ConnectionListPane(){
protected void rename(String oldName,String newName) {
super.rename(oldName,newName);
renameConnection(oldName,newName);
}
};
container.add(connectionListPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Server-Define_Data_Connection");
}
public HashMap<String, String> getRenameMap() {
return connectionListPane.getRenameMap();
}
public void populate(DatasourceManagerProvider datasourceManager) {
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager);
}
public void update(DatasourceManagerProvider datasourceManager) {
this.connectionListPane.update(datasourceManager);
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
this.connectionListPane.setSelectedIndex(index);
}
/**
* 名字是否允许
* @return 允许返回true
*/
public boolean isNamePermitted() {
return connectionListPane.isNamePermitted();
}
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.HashMap;
public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane {
private UITextField connectionTextField;
private ConnectionListPane connectionListPane;
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
container.add(connectionPathPane, BorderLayout.NORTH);
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2));
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST);
this.connectionTextField = new UITextField();
connectionPathPane.add(connectionTextField, BorderLayout.CENTER);
this.connectionTextField.setEditable(false);
connectionListPane = new ConnectionListPane() {
protected void rename(String oldName, String newName) {
super.rename(oldName, newName);
renameConnection(oldName, newName);
}
};
container.add(connectionListPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Server-Define_Data_Connection");
}
public HashMap<String, String> getRenameMap() {
return connectionListPane.getRenameMap();
}
public void populate(DatasourceManagerProvider datasourceManager) {
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager);
}
public void update(DatasourceManagerProvider datasourceManager) {
this.connectionListPane.update(datasourceManager);
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
this.connectionListPane.setSelectedIndex(index);
}
/**
* 名字是否允许
*
* @return 允许返回true
*/
public boolean isNamePermitted() {
return connectionListPane.isNamePermitted();
}
}

15
designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java

@ -0,0 +1,15 @@
package com.fr.design.data.datapane.connect;
import com.fr.file.DatasourceManagerProvider;
/**
* Created by yaoh.wu on 2017/4/22.
* 数据链接显示面板
*/
public interface ConnectionShowPane {
void update(DatasourceManagerProvider datasourceManager);
void populate(DatasourceManagerProvider datasourceManager);
void setSelectedIndex(int index);
}

1
designer_base/src/com/fr/design/dialog/BasicDialog.java

@ -13,6 +13,7 @@ public abstract class BasicDialog extends UIDialog {
public static final Dimension CHART = new Dimension(760, 560);
public static final Dimension MAP_SIZE = new Dimension(760, 450);
public static final Dimension UPDATE_ONLINE_SIZE = new Dimension(600,300);
public static final Dimension TOOLBAR_SIZE = new Dimension(660, 327);
public BasicDialog(Frame parent) {
super(parent);

24
designer_base/src/com/fr/design/dialog/BasicPane.java

@ -251,6 +251,30 @@ public abstract class BasicPane extends JPanel {
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showToolBarWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.TOOLBAR_SIZE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
protected abstract String title4PopupWindow();
public String getTitle() {

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

@ -23,11 +23,11 @@ public abstract class MobileUseHtmlGroupBeanPane<T> extends BasicBeanPane<T> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupBeanPane() {
initComponents();
public MobileUseHtmlGroupBeanPane(String annotation) {
initComponents(annotation);
}
private void initComponents() {
private void initComponents(String annotation) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
@ -43,7 +43,7 @@ public abstract class MobileUseHtmlGroupBeanPane<T> extends BasicBeanPane<T> {
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}
new Component[]{new UILabel(annotation), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));

19
designer/src/com/fr/design/mainframe/bbs/LoginDialog.java → designer_base/src/com/fr/design/extra/LoginDialog.java

@ -1,32 +1,29 @@
package com.fr.design.mainframe.bbs;
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by zhaohehe on 16/7/26.
* Created by vito on 2017/5/5.
*/
public class LoginDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(401, 201);
public LoginDialog(Frame frame, BasicPane pane) {
public LoginDialog(Frame frame, Component pane) {
super(frame);
setUndecorated(true);
if (StableUtils.getMajorJavaVersion() == 8) {
setUndecorated(true);
}
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this);
setResizable(false);
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager"));
}
@Override

152
designer_base/src/com/fr/design/extra/LoginPane.java

@ -1,152 +0,0 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.ExecutionException;
/**
* Created by zhaohehe on 16/7/27.
*/
public class LoginPane extends BasicPane {
private static final String LATEST = "latest";
public LoginPane() {
setLayout(new BorderLayout());
if (StableUtils.getMajorJavaVersion() == 8) {
String installHome;
if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource("");
installHome = url.getPath();
addPane(installHome);
} else {
installHome = StableUtils.getInstallHome();
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts();
}
} else {
addPane(installHome);
updateShopScripts();
}
}
} else {
initTraditionalStore();
}
}
private void addPane(String installHome) {
LoginWebPane webPane = new LoginWebPane(new File(installHome).getAbsolutePath(),LoginPane.this);
add(webPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Plugin_Manager");
}
private void downloadShopScripts() {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
String id = "shop_scripts";
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
}
});
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(LoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return false;
}
return true;
}
@Override
protected void done() {
try {
if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
int rv = JOptionPane.showOptionDialog(
LoginPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
} catch (InterruptedException | ExecutionException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void updateShopScripts() {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) {
int rv = JOptionPane.showConfirmDialog(
LoginPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts();
}
}
}
return null;
}
}.execute();
}
private void initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.CENTER);
PluginInstalledPane installedPane = new PluginInstalledPane();
tabbedPane.addTab(installedPane.tabTitle(), installedPane);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
}
}

151
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -6,7 +6,6 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.ucenter.Client;
import com.fr.design.extra.ucenter.XMLHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
@ -14,10 +13,10 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javafx.scene.web.WebEngine;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import javax.swing.*;
import java.awt.*;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.LinkedList;
@ -47,50 +46,48 @@ public class LoginWebBridge {
//用户名,密码为空
private static final String LOGIN_INFO_EMPTY = "-5";
private static final int TIME_OUT = 10000;
private static final String LOGIN_SUCCESS = "ok";
private static final String LOGIN_FAILED = "failed";
private static com.fr.design.extra.LoginWebBridge helper;
private static LoginWebBridge helper;
private UILabel pluginuiLabel;
private UIDialog uiDialog;
private UIDialog qqDialog;
private UILabel uiLabel;
private String userName;
public int getMessageCount() {
return messageCount;
}
/**
* 测试论坛网络连接
* @return
*/
private boolean testConnection() {
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive();
public LoginWebBridge() {
String username = DesignerEnvManager.getEnvManager().getBBSName();
setUserName(username, uiLabel);
}
public static com.fr.design.extra.LoginWebBridge getHelper() {
public static LoginWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (com.fr.design.extra.LoginWebBridge.class) {
synchronized (LoginWebBridge.class) {
if (helper == null) {
helper = new com.fr.design.extra.LoginWebBridge();
helper = new LoginWebBridge();
}
return helper;
}
}
public static com.fr.design.extra.LoginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
public int getMessageCount() {
return messageCount;
}
private WebEngine webEngine;
public void setUILabelInPlugin(UILabel uiLabel) {
this.pluginuiLabel = uiLabel;
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
public void setQqDialog(UIDialog qqDialog) {
closeQQWindow();
this.qqDialog = qqDialog;
}
public void setDialogHandle(UIDialog uiDialog) {
closeWindow();
this.uiDialog = uiDialog;
}
@ -98,50 +95,56 @@ public class LoginWebBridge {
this.uiLabel = uiLabel;
}
public LoginWebBridge() {
String username = DesignerEnvManager.getEnvManager().getBBSName();
setUserName(username, uiLabel);
}
/**
* 设置显示的用户名
*
* @param userName 登录用户名
* @param label label显示
* @param label label显示
*/
public void setUserName(String userName, UILabel label) {
if (uiLabel == null) {
this.uiLabel = label;
}
if(StringUtils.isEmpty(userName)){
if (StringUtils.isEmpty(userName)) {
return;
}
if(!StringUtils.isEmpty(this.userName)){
if (StringUtils.isNotEmpty(this.userName)) {
updateMessageCount();
}
this.userName = userName;
}
/**
* 测试论坛网络连接
*
* @return
*/
private boolean testConnection() {
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive();
}
/**
* 定时取后台论坛消息
*/
public void updateMessageCount(){
public void updateMessageCount() {
//启动获取消息更新的线程
//登陆状态, 根据存起来的用户名密码, 每1分钟发起一次请求, 更新消息条数.
Thread updateMessageThread = new Thread(new Runnable() {
@Override
public void run() {
sleep(CHECK_MESSAGE_TIME);
while(StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())){
while (StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())) {
HashMap<String, String> para = new HashMap<>();
int uid = DesignerEnvManager.getEnvManager().getBbsUid();
para.put("uid", String.valueOf(uid));
HttpClient getMessage = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.message"), para);
getMessage.asGet();
if(getMessage.isServerAlive()){
if (getMessage.isServerAlive()) {
try {
String res = getMessage.getResponseText();
if (res.equals(FAILED_MESSAGE_STATUS)) {
}else {
} else {
JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message")));
@ -160,6 +163,7 @@ public class LoginWebBridge {
/**
* 设置获取的消息长度并设置显示
*
* @param count
*/
public void setMessageCount(int count) {
@ -177,7 +181,7 @@ public class LoginWebBridge {
uiLabel.setText(sb.toString());
}
private String encode(String str){
private String encode(String str) {
try {
return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8);
} catch (UnsupportedEncodingException e) {
@ -185,7 +189,7 @@ public class LoginWebBridge {
}
}
private void sleep(long millis){
private void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
@ -199,7 +203,7 @@ public class LoginWebBridge {
public void registerHref() {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register")));
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
}
@ -210,13 +214,14 @@ public class LoginWebBridge {
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset")));
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
}
/**
* 设计器端的用户登录
*
* @param username 用户名
* @param password 密码
* @return 登录信息标志
@ -227,9 +232,10 @@ public class LoginWebBridge {
/**
* 插件管理的用户登录部分
*
* @param username 用户名
* @param password 密码
* @param uiLabel 设计器端的label
* @param uiLabel 设计器端的label
* @return 登录信息标志
*/
public String pluginManageLogin(String username, String password, UILabel uiLabel) {
@ -238,9 +244,10 @@ public class LoginWebBridge {
/**
* 登录操作
*
* @param username 用户名
* @param password 密码
* @param uiLabel 两边的label显示
* @param uiLabel 两边的label显示
* @return 登录信息标志
*/
public String login(String username, String password, UILabel uiLabel) {
@ -271,8 +278,8 @@ public class LoginWebBridge {
/**
* 更新后台的用户信息
*
* @param username 用户名
* @param password 密码
*/
public void updateUserInfo(String username) {
this.userName = username;
@ -280,6 +287,7 @@ public class LoginWebBridge {
/**
* 关闭窗口并且重新赋值
*
* @param username
*/
public void loginSuccess(String username, UILabel uiLabel) {
@ -294,13 +302,7 @@ public class LoginWebBridge {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//弹出qq登录的窗口
QQLoginPane managerPane = new QQLoginPane();
UIDialog qqlog = new QQLoginDialog(DesignerContext.getDesignerFrame(),managerPane);
QQLoginWebBridge.getHelper().setDialogHandle(uiDialog);
QQLoginWebBridge.getHelper().setQQDialogHandle(qqlog);
QQLoginWebBridge.getHelper().setUILabel(uiLabel);
qqlog.setVisible(true);
WebViewDlgHelper.createQQLoginDialog();
}
});
}
@ -326,12 +328,55 @@ public class LoginWebBridge {
} else {
return UNKNOWN_ERROR;//未知错误,-3
}
}else {
} else {
return NET_FAILED;
}
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
return UNKNOWN_ERROR;
}
/**
* 关闭QQ授权窗口
*/
public void closeQQWindow() {
if (qqDialog != null) {
qqDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
qqDialog.setVisible(false);
}
}
/**
* 获取用户信息
*
* @param userInfo
*/
public void getLoginInfo(String userInfo) {
org.json.JSONObject jo = new org.json.JSONObject(userInfo);
String status = jo.get("status").toString();
if (status.equals(LOGIN_SUCCESS)) {
String username = jo.get("username").toString();
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString());
closeWindow();
closeQQWindow();
pluginuiLabel.setText(username);
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
} else if (status.equals(LOGIN_FAILED)) {
//账号没有QQ授权
closeQQWindow();
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding")));
} catch (Exception exp) {
}
}
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (url.indexOf("qqLogin.html") > 0) {
return;
}
}
}

14
designer_base/src/com/fr/design/extra/LoginWebPane.java

@ -17,11 +17,7 @@ import javax.swing.*;
*/
public class LoginWebPane extends JFXPanel {
private WebEngine webEngine;
private LoginPane loginPane;
public LoginWebPane(final String installHome,LoginPane loginPane) {
this.loginPane = loginPane;
public LoginWebPane(final String installHome) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
@ -30,7 +26,7 @@ public class LoginWebPane extends JFXPanel {
Scene scene = new Scene(root);
LoginWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
WebEngine webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/login.html");
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
@ -39,17 +35,13 @@ public class LoginWebPane extends JFXPanel {
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("LoginHelper", LoginWebBridge.getHelper(webEngine));
obj.setMember("LoginHelper", LoginWebBridge.getHelper());
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override

7
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.plugin.PluginConfigManager;
import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper;
@ -225,6 +226,8 @@ public class PluginHelper {
}
// 删除放解压文件的临时文件夹
StableUtils.deleteFile(new File(TEMP_PATH));
PluginConfigManager.getProviderInstance().pushNewPlugin(plugin);
PluginConfigManager.getProviderInstance().syncPluginConfig();
new SwingWorker<String, Void>() {
@Override
@ -256,7 +259,7 @@ public class PluginHelper {
if (PluginLoader.getLoader().isInstalled(plugin)) {
throw new com.fr.plugin.PluginVerifyException(Inter.getLocText("FR-Designer-Plugin_Has_Been_Installed"));
}
if (plugin.isJarExpired()) {
if (plugin.checkIfJarExpired()) {
String jarExpiredInfo = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed", ",", "FR-Designer-Plugin_Please_Update_Jar", plugin.getRequiredJarTime()});
FRLogger.getLogger().error(jarExpiredInfo);
throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo);
@ -319,6 +322,8 @@ public class PluginHelper {
if (plugin == null || env == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
//卸载前监听
plugin.preUninstall();
PluginLoader.getLoader().deletePlugin(plugin);
return env.deleteFileFromPluginAndLibFolder(plugin);
}

10
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -136,6 +136,7 @@ public class PluginWebBridge {
}
public void setDialogHandle(UIDialog uiDialog) {
closeWindow();
this.uiDialog = uiDialog;
}
@ -367,6 +368,7 @@ public class PluginWebBridge {
/**
* 获取系统登录的用户名
*
* @param callback
*/
public void getLoginInfo(final JSObject callback) {
@ -381,7 +383,7 @@ public class PluginWebBridge {
try {
String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
}catch (Exception exp) {
} catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage());
}
}
@ -493,13 +495,14 @@ public class PluginWebBridge {
/*-------------------------------登录部分的处理----------------------------------*/
/**
* 注册页面
*/
public void registerHref() {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register")));
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
}
@ -510,7 +513,7 @@ public class PluginWebBridge {
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset")));
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
}
@ -521,6 +524,7 @@ public class PluginWebBridge {
/**
* 登录操作的回调
*
* @param username
* @param password
* @return

4
designer_base/src/com/fr/design/extra/QQLoginDialog.java

@ -1,6 +1,5 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
@ -14,7 +13,7 @@ import java.awt.*;
public class QQLoginDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(700, 500);
public QQLoginDialog(Frame frame, BasicPane pane) {
public QQLoginDialog(Frame frame, Component pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
@ -24,7 +23,6 @@ public class QQLoginDialog extends UIDialog {
GUICoreUtils.centerWindow(this);
setResizable(false);
setTitle(Inter.getLocText("FR-Designer-Plugin_Manager"));
}
@Override

145
designer_base/src/com/fr/design/extra/QQLoginPane.java

@ -1,145 +0,0 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.ExecutionException;
/**
* Created by zhaohehe on 16/7/28.
*/
public class QQLoginPane extends BasicPane {
private static final String LATEST = "latest";
public QQLoginPane() {
setLayout(new BorderLayout());
if (StableUtils.getMajorJavaVersion() == 8) {
String installHome;
if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource("");
installHome = url.getPath();
addPane(installHome);
} else {
installHome = StableUtils.getInstallHome();
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts();
}
} else {
addPane(installHome);
updateShopScripts();
}
}
} else {
}
}
private void addPane(String installHome) {
QQLoginWebPane webPane = new QQLoginWebPane(new File(installHome).getAbsolutePath());
add(webPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer-Plugin_Manager");
}
private void downloadShopScripts() {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
String id = "shop_scripts";
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
}
});
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(QQLoginPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return false;
}
return true;
}
@Override
protected void done() {
try {
if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
int rv = JOptionPane.showOptionDialog(
QQLoginPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Installed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
} catch (InterruptedException | ExecutionException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void updateShopScripts() {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("store.version") + "&version=" + PluginStoreConstants.VERSION);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) {
int rv = JOptionPane.showConfirmDialog(
QQLoginPane.this,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts();
}
}
}
return null;
}
}.execute();
}
}

131
designer_base/src/com/fr/design/extra/QQLoginWebBridge.java

@ -1,131 +0,0 @@
package com.fr.design.extra;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import javafx.scene.web.WebEngine;
import org.json.JSONObject;
import netscape.javascript.JSObject;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
/**
* Created by lp on 2016/8/10.
*/
public class QQLoginWebBridge {
private static com.fr.design.extra.QQLoginWebBridge helper;
private WebEngine webEngine;
private static String LOGINSUCCESS = "ok";
private static String LOGINFAILED = "failed";
private UIDialog uiDialog;
private UILabel uiLabel;
private UILabel pluginuiLabel;
private UIDialog qqDialog;
private String username;
private QQLoginWebBridge() {
}
public static com.fr.design.extra.QQLoginWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (com.fr.design.extra.QQLoginWebBridge.class) {
if (helper == null) {
helper = new com.fr.design.extra.QQLoginWebBridge();
}
return helper;
}
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
public void setDialogHandle(UIDialog uiDialog) {
this.uiDialog = uiDialog;
}
public void setQQDialogHandle(UIDialog uiDialog) {
this.qqDialog = uiDialog;
}
public void setUILabel(UILabel uiLabel) {
this.uiLabel = uiLabel;
}
public void setUILabelInPlugin(UILabel uiLabel) {
this.pluginuiLabel = uiLabel;
}
public void setLoginlabel() {
username = DesignerEnvManager.getEnvManager().getBBSName();
}
private static JSObject window;
public static com.fr.design.extra.QQLoginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
/**
* 关闭QQ授权窗口
*/
public void closeQQWindow() {
if (qqDialog != null) {
qqDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
qqDialog.setVisible(false);
}
}
/**
* 关闭父窗口
*/
public void closeParentWindow() {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false);
}
}
/**
* 获取用户信息
* @param userInfo
*/
public void getLoginInfo(String userInfo) {
JSONObject jo = new JSONObject(userInfo);
String status = jo.get("status").toString();
if (status.equals(LOGINSUCCESS)) {
String username = jo.get("username").toString();
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString());
closeQQWindow();
closeParentWindow();
pluginuiLabel.setText(username);
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
}else if (status.equals(LOGINFAILED)){
//账号没有QQ授权
closeQQWindow();
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding")));
}catch (Exception exp) {
}
}
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (url.indexOf("qqLogin.html") > 0) {
return;
}
}
}

129
designer_base/src/com/fr/design/extra/QQLoginWebPane.java

@ -40,6 +40,7 @@ import java.awt.*;
public class QQLoginWebPane extends JFXPanel {
private WebEngine webEngine;
private String url;
private static JSObject window;
@ -50,7 +51,9 @@ public class QQLoginWebPane extends JFXPanel {
private static int DEFAULT_CONFIRM_HEIGHT = 160;
private static int DEFAULT_OFFEST = 20;
class Delta { double x, y; }
class Delta {
double x, y;
}
public QQLoginWebPane(final String installHome) {
Platform.setImplicitExit(false);
@ -62,7 +65,8 @@ public class QQLoginWebPane extends JFXPanel {
QQLoginWebPane.this.setScene(scene);
final WebView webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html");
url = "file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html";
webEngine.load(url);
final Stage primaryStage = new Stage();
@ -76,51 +80,56 @@ public class QQLoginWebPane extends JFXPanel {
primaryStage.setX(0);
primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT);
primaryStage.show();
}catch (Exception e) {
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());
}
webView.getEngine().setConfirmHandler(new Callback<String, Boolean>() {
@Override public Boolean call(String msg) {
Boolean confirmed = confirm(primaryStage, msg, installHome, webView);
return confirmed;
}
});
webEngine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(webEngine);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, "file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html") || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return;
}
QQLoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue);
}
});
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
webEngine.setConfirmHandler(new Callback<String, Boolean>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
public Boolean call(String msg) {
Boolean confirmed = confirm(primaryStage, msg, webView);
return confirmed;
}
});
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine));
}
}
}
);
configWebEngine();
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
private void configWebEngine() {
webEngine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(webEngine);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return;
}
LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue);
}
});
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", LoginWebBridge.getHelper());
}
}
}
);
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -138,7 +147,7 @@ public class QQLoginWebPane extends JFXPanel {
@Override
public void run() {
eng.executeScript("location.reload()");
QQLoginWebBridge.getHelper().closeQQWindow();
LoginWebBridge.getHelper().closeQQWindow();
}
});
} catch (Exception e) {
@ -146,12 +155,12 @@ public class QQLoginWebPane extends JFXPanel {
}
}
private Boolean confirm(final Stage parent, String msg, final String installHome,final WebView webView) {
private Boolean confirm(final Stage parent, String msg, final WebView webView) {
final BooleanProperty confirmationResult = new SimpleBooleanProperty();
// initialize the confirmation dialog
final Stage dialog = new Stage(StageStyle.UTILITY);
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth()/2 - DEFAULT_CONFIRM_WIDTH / 2 + DEFAULT_OFFEST);
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight()/2 + DEFAULT_OFFEST);
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2 + DEFAULT_OFFEST);
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST);
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH);
dialog.setIconified(false);
@ -162,7 +171,8 @@ public class QQLoginWebPane extends JFXPanel {
HBoxBuilder.create().styleClass("modal-dialog").children(
LabelBuilder.create().text(msg).build(),
ButtonBuilder.create().text(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")).defaultButton(true).onAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
@Override
public void handle(ActionEvent actionEvent) {
// take action and close the dialog.
confirmationResult.set(true);
webView.getEngine().reload();
@ -170,7 +180,8 @@ public class QQLoginWebPane extends JFXPanel {
}
}).build(),
ButtonBuilder.create().text(Inter.getLocText("FR-Engine_Cancel")).cancelButton(true).onAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionEvent) {
@Override
public void handle(ActionEvent actionEvent) {
// abort action and close the dialog.
confirmationResult.set(false);
dialog.close();
@ -180,35 +191,39 @@ public class QQLoginWebPane extends JFXPanel {
, Color.TRANSPARENT
)
);
configDrag(dialog);
// style and show the dialog.
dialog.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm());
dialog.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
event.consume();
dialog.close();
}
});
dialog.showAndWait();
return confirmationResult.get();
}
private void configDrag(final Stage dialog) {
// allow the dialog to be dragged around.
final Node root = dialog.getScene().getRoot();
final Delta dragDelta = new Delta();
root.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
@Override
public void handle(MouseEvent mouseEvent) {
// record a delta distance for the drag and drop operation.
dragDelta.x = dialog.getX() - mouseEvent.getScreenX();
dragDelta.y = dialog.getY() - mouseEvent.getScreenY();
}
});
root.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
@Override
public void handle(MouseEvent mouseEvent) {
dialog.setX(mouseEvent.getScreenX() + dragDelta.x);
dialog.setY(mouseEvent.getScreenY() + dragDelta.y);
}
});
// style and show the dialog.
dialog.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm());
dialog.setOnCloseRequest(new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent event){
event.consume();
dialog.close();
}
});
dialog.showAndWait();
return confirmationResult.get();
}
}

36
designer_base/src/com/fr/design/extra/ReuseWebBridge.java

@ -1,36 +0,0 @@
package com.fr.design.extra;
import javafx.scene.web.WebEngine;
/**
* Created by vito on 2016/9/28.
*/
public class ReuseWebBridge {
public static ReuseWebBridge helper;
private WebEngine webEngine;
public static ReuseWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (ReuseWebBridge.class) {
if (helper == null) {
helper = new ReuseWebBridge();
}
return helper;
}
}
public static ReuseWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
private ReuseWebBridge() {
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
}

54
designer_base/src/com/fr/design/extra/ReuseWebPane.java

@ -1,54 +0,0 @@
package com.fr.design.extra;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.*;
/**
* Created by vito on 2016/9/28.
*/
public class ReuseWebPane extends JFXPanel {
private WebEngine webEngine;
public ReuseWebPane(final String mainJs) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
ReuseWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("file:///" + mainJs);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(ReuseWebPane.this, message);
}
});
}
}

58
designer_base/src/com/fr/design/extra/WebDialog.java → designer_base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -24,14 +24,14 @@ import java.util.concurrent.ExecutionException;
/**
* Created by vito on 2016/9/28.
*/
public class WebDialog {
public class WebViewDlgHelper {
private static final String LATEST = "latest";
private static final String SHOP_SCRIPTS = "shop_scripts";
private static final int VERSION_8 = 8;
// 调试时,使用installHome = ClassLoader.getSystemResource("").getPath()代替下面
private static String installHome = StableUtils.getInstallHome();
public static void createPluginDialog() {
UIDialog dlg;
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String relativePath = "/scripts/store/web/index.html";
String mainJsPath = StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath);
@ -49,10 +49,7 @@ public class WebDialog {
}
} else {
updateShopScripts(SHOP_SCRIPTS);
BasicPane managerPane = new ShopManagerPane(new PluginWebPane(mainJsPath));
dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
showPluginDlg(mainJsPath);
}
} else {
BasicPane traditionalStorePane = new BasicPane() {
@ -63,21 +60,62 @@ public class WebDialog {
};
traditionalStorePane.setLayout(new BorderLayout());
traditionalStorePane.add(initTraditionalStore(), BorderLayout.CENTER);
dlg = new ShopDialog(DesignerContext.getDesignerFrame(), traditionalStorePane);
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), traditionalStorePane);
dlg.setVisible(true);
}
}
/**
* 以关键词打开设计器商店
* <p>
* // * @param keyword 关键词
*
* @param keyword 关键词
*/
public void createPluginDialog(String keyword) {
public static void createPluginDialog(String keyword) {
PluginWebBridge.getHelper().openWithSearch(keyword);
createPluginDialog();
}
public static void createLoginDialog() {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
} else {
showLoginDlg();
updateShopScripts(SHOP_SCRIPTS);
}
}
}
public static void createQQLoginDialog() {
QQLoginWebPane webPane = new QQLoginWebPane(new File(installHome).getAbsolutePath());
UIDialog qqlog = new QQLoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setQqDialog(qqlog);
qqlog.setVisible(true);
}
private static void showPluginDlg(String mainJsPath) {
BasicPane managerPane = new ShopManagerPane(new PluginWebPane(mainJsPath));
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
}
private static void showLoginDlg() {
LoginWebPane webPane = new LoginWebPane(new File(installHome).getAbsolutePath());
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true);
}
private static Component initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();

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

@ -22,6 +22,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression;
@ -32,16 +33,20 @@ 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
* @since 2012-3-29下午1:50:53
*/
public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea;
protected RSyntaxTextArea formulaTextArea;
@ -61,38 +66,26 @@ 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");
if(text.contains(tip)) {
//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;
formulaTextArea.setText(text);
}
}
});
}
private void initFormulaTextAreaMouseListener() {
formulaTextArea.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
insertPosition = formulaTextArea.getCaretPosition();
@ -115,24 +108,17 @@ 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) {
}
@ -146,21 +132,59 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
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 +193,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);
}
@ -254,10 +265,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
}
}
//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();
@ -440,10 +459,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
formulaTextArea.requestFocus();
insertPosition = formulaTextArea.getCaretPosition();
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FormulaD-Formula_Definition");
return Inter.getLocText("FormulaD-Formula_Definition");
}
/**
@ -461,7 +480,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,71 +569,66 @@ 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() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof FunctionGroup) {
this.setText(((FunctionGroup) value).getGroupName());
}
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);
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);
if (value instanceof FunctionGroup) {
this.setText(((FunctionGroup) value).getGroupName());
}
return this;
}
});
}
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 +640,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 +657,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 +671,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 +681,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,19 +716,41 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
}
});
variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
}
private StringBuilder getText(TextUserObject selectedValue, String path) throws IOException {
Reader desReader;
StringBuilder desBuf = new StringBuilder();
InputStream desInputStream = BaseUtils.readResource(path + ((TextUserObject) selectedValue).displayText + ".txt");
if (desInputStream == null) {
String description = "";
desReader = new StringReader(description);
} else {
desReader = new InputStreamReader(desInputStream, EncodeConstants.ENCODING_UTF_8);
}
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 {
Reader desReader;
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
@ -716,43 +758,42 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
path = "/com/fr/design/insert/formula/variable/en/";
}
if (selectedValue instanceof TextUserObject) {
InputStream desInputStream = BaseUtils.readResource(path
+ ((TextUserObject) selectedValue).displayText
+ ".txt");
if (desInputStream == null) {
String description = "";
desReader = new StringReader(description);
} else {
desReader = new InputStreamReader(
desInputStream);
}
BufferedReader reader = new BufferedReader(
desReader);
String lineText;
while ((lineText = reader.readLine()) != null) {
if (desBuf.length() > 0) {
desBuf.append('\n');
}
desBuf.append(lineText);
}
reader.close();
desReader.close();
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 +804,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"));
}
@ -776,10 +817,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
private void showPopupPane() {
BasicPane basicPane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Function_Detail");
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_FormulaPane_Function_Detail");
}
};
basicPane.setLayout(FRGUIPaneFactory.createBorderLayout());
UITextArea desArea = new UITextArea();
@ -869,52 +910,28 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
rootNode.add(bindCellNode);
}
{
MutableTreeNode tableTreeNode = new TextFolderUserObject(
Inter.getLocText("FormulaD-Data_Fields"),
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"),
variableResolver.resolveColumnNames()).createMutableTreeNode();
rootNode.add(new TextFolderUserObject(Inter.getLocText("FormulaD-Data_Fields"),
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"),
variableResolver.resolveColumnNames()).createMutableTreeNode());
rootNode.add(tableTreeNode);
}
// Set cutReport Variable
rootNode.add(new TextFolderUserObject(Inter.getLocText("FR-Designer_FormulaPane_Variables"),
BaseUtils.readIcon("/com/fr/design/images/dialog/variable.png"),
variableResolver.resolveCurReportVariables()).createMutableTreeNode());
{
// Set cutReport Variable
rootNode.add(new TextFolderUserObject(
Inter.getLocText("Variables"),
BaseUtils.readIcon("/com/fr/design/images/dialog/variable.png"),
variableResolver.resolveCurReportVariables()).createMutableTreeNode());
}
{
rootNode.add(new TextFolderUserObject(
Inter.getLocText(new String[]{"Datasource-Datasource", "Parameter"}),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode());
}
rootNode.add(new TextFolderUserObject(Inter.getLocText(new String[]{"Datasource-Datasource", "Parameter"}),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode());
rootNode.add(new TextFolderUserObject(Inter.getLocText("ParameterD-Report_Parameter"),
BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"),
variableResolver.resolveReportParameterVariables()).createMutableTreeNode());
{
MutableTreeNode reportParameterTreeNode = new TextFolderUserObject(
Inter.getLocText("ParameterD-Report_Parameter"),
BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"),
variableResolver.resolveReportParameterVariables()).createMutableTreeNode();
rootNode.add(reportParameterTreeNode);
}
{
MutableTreeNode globalParameterTreeNode = new TextFolderUserObject(
Inter.getLocText("M_Server-Global_Parameters"),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode();
rootNode.add(globalParameterTreeNode);
}
rootNode.add(new TextFolderUserObject(Inter.getLocText("M_Server-Global_Parameters"),
BaseUtils.readIcon("/com/fr/design/images/dialog/parameter.gif"),
variableResolver.resolveGlobalParameterVariables()).createMutableTreeNode());
variableModel.reload();
// Expand
for (int row = 0; row < this.variablesTree.getRowCount(); row++) {
this.variablesTree.expandRow(row);
@ -993,6 +1010,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;
}

14
designer_base/src/com/fr/design/formula/FunctionManagerPane.java

@ -20,6 +20,7 @@ import com.fr.file.FunctionManagerProvider;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.script.FunctionDef;
@ -159,10 +160,11 @@ public class FunctionManagerPane extends BasicPane {
descriptionArea.setWrapStyleWord(true);
descriptionArea.setLineWrap(true);
northPane.add(descriptionArea);
descriptionArea.setText(Inter.getLocText(new String[]{"Function-The_class_must_inherit","Fuction-The_compiled_class_should_be_copied_to",
"Function-J2EE_server", "Directory", "Function-Source_Code", "Example"},
new String[]{" \"com.fr.script.AbstractFunction\".", "\n", " \"" + File.separator + "WEB-INF" + File.separator + "classes\"",
",", ".\n", ":" + FRContext.getCurrentEnv().getPath() + File.separator + "classes"}));
String path1 = getEscapePath(File.separator + ProjectConstants.WEBINF_NAME + File.separator + ProjectConstants.CLASSES_NAME);
String path2 = getEscapePath(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.CLASSES_NAME);
descriptionArea.setText(Inter.getLocText("FR-Designer_Function_Description_Area_Text", path1, path2));
JPanel descriptionPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); //Description Pane
this.add(descriptionPane, BorderLayout.SOUTH);
descriptionPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
@ -170,6 +172,10 @@ public class FunctionManagerPane extends BasicPane {
this.descriptionTextArea = new UITextArea(6, 24);
descriptionPane.add(new JScrollPane(this.descriptionTextArea), BorderLayout.CENTER);
}
private String getEscapePath(String path) {
return path.replace("\\", "\\\\");
}
private ActionListener createEditorButtonActionListener() {
return new ActionListener() {

13
designer_base/src/com/fr/design/formula/VariableResolverAdapter.java

@ -4,12 +4,16 @@ import com.fr.base.ConfigManager;
import com.fr.base.Parameter;
import com.fr.design.DesignModelAdapter;
import com.fr.base.ConfigManagerProvider;
import com.fr.plugin.ExtraClassManager;
import com.fr.script.ScriptConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.fun.BuiltInParametersProvider;
import com.fr.stable.script.CalculatorProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class VariableResolverAdapter implements VariableResolver {
private static final int TABLE_DATA_PARA = 0;
@ -21,7 +25,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* @return 内置参数
*/
public String[] resolveCurReportVariables() {
return new String[] { ScriptConstants.SUMMARY_TAG + "page_number",
String [] variables = new String[] { ScriptConstants.SUMMARY_TAG + "page_number",
ScriptConstants.SUMMARY_TAG + "totalPage_number",
// 下面是权限相关的参数
ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_USERNAME, ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_AUTHORITY,
@ -32,6 +36,13 @@ public abstract class VariableResolverAdapter implements VariableResolver {
CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME,
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
};
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
for (BuiltInParametersProvider provider : set) {
return (String[]) ArrayUtils.addAll(variables, new String []{
ScriptConstants.DETAIL_TAG + provider.getParametersName()
});
}
return variables;
}
private Parameter[] getCurrentModeParameters(int type) {

3
designer_base/src/com/fr/design/fun/ConnectionProvider.java

@ -12,7 +12,8 @@ public interface ConnectionProvider extends Mutable {
public static final String XML_TAG = "ConnectionProvider";
int CURRENT_LEVEL = 1;
// 2016-12-14 1 -> 2 , 增加connection.feature方法导致不兼容.
int CURRENT_LEVEL = 2;
/**
* 数据连接弹出菜单的名字

41
designer_base/src/com/fr/design/fun/ExtraButtonToolBarProvider.java

@ -0,0 +1,41 @@
package com.fr.design.fun;
import com.fr.form.ui.Widget;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.*;
import java.awt.*;
/**
* 报表工具栏设计器端拓展用于配置按钮额外属性
* Created by harry on 2016-12-23.
*/
public interface ExtraButtonToolBarProvider extends Mutable {
String XML_TAG = "ExtraButtonToolBarProvider";
int CURRENT_LEVEL = 1;
/**
* 用于添加属性面板
*
* @param centerPane 面板
*/
void updateCenterPane(JPanel centerPane);
/**
* 更新界面
*
* @param widget 控件
* @param card 卡片布局
* @param centerPane 面板
*/
void populate(Widget widget, CardLayout card, JPanel centerPane);
/**
* 保存界面设置
*
* @param widget 控件
*/
void update(Widget widget);
}

2
designer_base/src/com/fr/design/fun/HyperlinkProvider.java

@ -10,7 +10,7 @@ import com.fr.stable.fun.mark.Mutable;
public interface HyperlinkProvider extends Mutable {
String XML_TAG = "HyperlinkProvider";
int CURRENT_LEVEL = 1;
int CURRENT_LEVEL = 2;
/**

19
designer_base/src/com/fr/design/fun/impl/AbstractExtraButtonToolBarProvider.java

@ -0,0 +1,19 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ExtraButtonToolBarProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* Created by harry on 2016-12-23.
*/
@API(level = ExtraButtonToolBarProvider.CURRENT_LEVEL)
public abstract class AbstractExtraButtonToolBarProvider extends AbstractProvider implements ExtraButtonToolBarProvider {
public int currentAPILevel() {
return ExtraButtonToolBarProvider.CURRENT_LEVEL;
}
public String mark4Provider() {
return getClass().getName();
}
}

5
designer_base/src/com/fr/design/gui/controlpane/JListControlPane.java

@ -109,6 +109,10 @@ public abstract class JListControlPane extends JControlPane {
}
protected void doBeforePopulate(ListModelElement el, Object obj) {
}
@Override
protected ShortCut4JControlPane addItemShortCut() {
ShortCut addItemShortCut;
@ -832,6 +836,7 @@ public abstract class JListControlPane extends JControlPane {
cardPane.add(updatePanes[i], String.valueOf(i));
}
card.show(cardPane, String.valueOf(i));
doBeforePopulate(el, ob2Populate);
updatePanes[i].populateBean(ob2Populate);
doWhenPopulate(updatePanes[i]);
break;

3
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -13,6 +13,7 @@ import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.PluginManager;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
import java.util.ArrayList;
@ -34,7 +35,7 @@ public class HyperlinkGroupPane extends JListControlPane {
* @return 返回Nameable按钮数组.
*/
public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new TreeMap<String, NameableCreator>();
Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
for (NameableCreator creator : creators) {
nameCreators.put(creator.menuName(), creator);

33
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -28,6 +28,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isTwoLine = false;
private boolean isFourLine = false;
private static final long serialVersionUID = 1L;
protected List<UIToggleButton> labelButtonList;
protected int selectedIndex = -1;
@ -176,6 +177,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
this.isTwoLine = true;
}
public void setFourLine() {
this.isFourLine = true;
}
/**
* paintComponent
*
@ -201,32 +206,40 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
}
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(UIConstants.LINE_COLOR);
if (!isTwoLine) {
if (isTwoLine) {
int width = 0;
for (int i = 0; i < labelButtonList.size() - 1; i++) {
int upCount = (labelButtonList.size() - 1) / 2 + 1;
for (int i = 0; i < upCount - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight();
int height = labelButtonList.get(i).getHeight() * 2 + 1;
g.drawLine(width, 0, width, height);
}
width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1;
width += labelButtonList.get(upCount).getWidth() + 1;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else if (isFourLine) {
// 4 * 1
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
for (int i = 1; i <= 3; i++) {
g2d.drawLine(0, getHeight() / 4 * i, getWidth() - 1, getHeight() / 4 * i);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else {
int width = 0;
int upCount = (labelButtonList.size() - 1) / 2 + 1;
for (int i = 0; i < upCount - 1; i++) {
for (int i = 0; i < labelButtonList.size() - 1; i++) {
width += labelButtonList.get(i).getWidth() + 1;
int height = labelButtonList.get(i).getHeight() * 2 + 1;
int height = labelButtonList.get(i).getHeight();
g.drawLine(width, 0, width, height);
}
width += labelButtonList.get(upCount).getWidth() + 1;
width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}

8
designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java

@ -160,6 +160,14 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
uiObserverListener = listener;
}
public void removeChangeListener(){
uiObserverListener = null;
}
public UIObserverListener getUiObserverListener(){
return uiObserverListener;
}
/**
* @return
*/

54
designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java

@ -26,32 +26,39 @@ import com.fr.general.Inter;
*/
public abstract class AbstractPropertyTable extends JTable {
// 属性分
// // 所有数据组, 把数据分组,一个可折叠的项里面的所有行 为一
protected ArrayList<PropertyGroup> groups;
protected TableModel default_table_model;
// 属性表被选中的行加一个浅蓝色的背景
public static final Color PROPERTY_SELECTION_BACKGROUND = new Color(153, 204, 255);
// 属性表的行高
public static final int PROPERTY_TABLE_ROW_HEIGHT = 22;
private static final int PROPERTY_ICON_WIDTH = 10;
public AbstractPropertyTable() {
this.setRowHeight(PROPERTY_TABLE_ROW_HEIGHT);
this.setTableProperties();
this.initPopup();
this.setModel(new DefaultTableModel());
}
private void setTableProperties() {
JTableHeader header = getTableHeader();
header.setReorderingAllowed(false);
header.setPreferredSize(new Dimension(0, PROPERTY_TABLE_ROW_HEIGHT));
header.setDefaultRenderer(new HeaderRenderer());
this.setRowHeight(PROPERTY_TABLE_ROW_HEIGHT);
this.setGridColor(new Color(212, 208, 200));
this.setSelectionBackground(PROPERTY_SELECTION_BACKGROUND);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setColumnSelectionAllowed(false);
this.setRowSelectionAllowed(true);
this.setFillsViewportHeight(true);
this.initPopup();
default_table_model = new DefaultTableModel();
this.setModel(default_table_model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
}
/**
* 在这个函数里面初始化表格数据再repaint
* @param source
*/
public abstract void initPropertyGroups(Object source);
public void fireValueChanged(Object old_value, boolean success, Object newValue) {
@ -64,12 +71,15 @@ public abstract class AbstractPropertyTable extends JTable {
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
//如果数据组不为空
if (groups != null) {
Point pIndex = getGroupIndex(row);
if (pIndex == null){
return super.getCellRenderer(row, column);
}
//拿出当前行所在的那个属性组
PropertyGroup group = groups.get(pIndex.x);
//如果是标题行
if (pIndex.y == 0) {
if (column == 0) {
return group.getFirstRenderer();
@ -77,11 +87,13 @@ public abstract class AbstractPropertyTable extends JTable {
return group.getSecondRenderer();
}
} else {
//如果是非标题行第一列,采用默认渲染器
if (column == 0) {
return super.getCellRenderer(row, column);
} else {
TableCellRenderer renderer = group.getModel().getRenderer(pIndex.y - 1);
if (renderer instanceof Component) {
//如果这个渲染器是继承自Component,根据当前行列是否可编辑决定该控件是否可用
((Component) renderer).setEnabled(isCellEditable(row, column));
}
return renderer;
@ -115,6 +127,12 @@ public abstract class AbstractPropertyTable extends JTable {
}
}
/**
* 看懂了写个注释先
* 获取当前row行的Point(x, y), x代表当前row行是属于groups中的第x个组y代表当前row行所在的第x组里面的第y行
* @param row
* @return
*/
private Point getGroupIndex(int row) {
int count = 0;
for (int i = 0; i < groups.size(); i++) {
@ -135,6 +153,10 @@ public abstract class AbstractPropertyTable extends JTable {
this.addMouseListener(new MouseAdapter() {
/**
* 如果点到标题行就要触发折叠事件
* @param e
*/
@Override
public void mouseClicked(MouseEvent e) {
if (!e.isPopupTrigger() && groups != null) {
@ -148,13 +170,18 @@ public abstract class AbstractPropertyTable extends JTable {
}
}
/**
* 这个mousePressed和上面的mouseClicked唯一不同的地方是单双击和e.getX() < 10 的判断
* 这个意思应该就是说点到图标加号减号立即触发折叠效果否则点其他处要双击才能触发
* @param e
*/
@Override
public void mousePressed(MouseEvent e) {
if (!e.isPopupTrigger() && groups != null) {
int row = AbstractPropertyTable.super.rowAtPoint(e.getPoint());
if (row != -1) {
Point pIndex = getGroupIndex(row);
if (pIndex.y == 0 && e.getClickCount() == 1 && e.getX() < 10) {
if (pIndex.y == 0 && e.getClickCount() == 1 && e.getX() < PROPERTY_ICON_WIDTH) {
toggleCollapse(pIndex.x);
}
}
@ -163,16 +190,27 @@ public abstract class AbstractPropertyTable extends JTable {
});
}
/**
* 切换属性组折叠属性true/false
* @param groupIndex
*/
private void toggleCollapse(int groupIndex) {
PropertyGroup group = groups.get(groupIndex);
group.setCollapsed(!group.isCollapsed());
//这里获取表格的父控件是为了当表格被折叠了后,装表格的父控件也要相应的重新布局一下
//比如折叠之后表格行数应该比原来的少,占用父容器空间应该小点,不重新布局父容器,表格大小不会改变
Container parent = AbstractPropertyTable.this.getParent();
if (parent != null) {
parent.doLayout();
// parent.doLayout(); // 这里还是用revalidate吧。。daLayout有时候会失效不知道为什么
parent.revalidate();
}
repaint();
}
/**
* BeanTableModel类提供表格数据
* 它的所有数据来源均来自PropertyGroup中的AbstractPropertyGroupModel中的descriptor
*/
public class BeanTableModel extends AbstractTableModel {
@Override

10
designer_base/src/com/fr/design/gui/itable/PropertyGroup.java

@ -4,11 +4,14 @@ import javax.swing.table.TableCellRenderer;
import com.fr.design.beans.GroupModel;
/**
* PropertyGroup类描述了属性表中一个属性分组
*/
public class PropertyGroup {
private GroupModel model;
private String name;
private boolean collapsed;
private GroupModel model; // 描述这个属性组中的数据model
private String name; // 这组属性的标题名称
private boolean collapsed; // 这组属性是否折叠
private GroupRenderer renderer1;
private GroupRenderer renderer2;
@ -55,4 +58,5 @@ public class PropertyGroup {
public TableCellRenderer getSecondRenderer() {
return renderer2;
}
}

52
designer_base/src/com/fr/design/gui/style/BorderPane.java

@ -51,34 +51,16 @@ public class BorderPane extends AbstractBasicStylePane {
}
protected void initComponents() {
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));
bottomToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"));
rightToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"));
horizontalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"));
verticalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"));
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.currentLineColorPane = new NewColorSelectBox(100);
initButtonsWithIcon();
this.setLayout(new BorderLayout(0, 6));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize1 = {p, f};
double[] rowSize1 = {p, p};
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
double[] columnSize1 = {p, f}, rowSize1 = {p, p};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Style") + ":"), currentLineCombo},
new Component[]{new UILabel(Inter.getLocText("Color") + ":"), currentLineColorPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + ":"), currentLineCombo},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + ":"), currentLineColorPane},
};
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] columnSize2 = {p, f};
double[] rowSize2 = {p, p};
double[] columnSize2 = {p, f}, rowSize2 = {p, p};
JPanel externalPane = new JPanel(new GridLayout(0, 4));
externalPane.add(topToggleButton);
externalPane.add(leftToggleButton);
@ -87,23 +69,15 @@ public class BorderPane extends AbstractBasicStylePane {
JPanel insidePane = new JPanel(new GridLayout(0, 2));
insidePane.add(horizontalToggleButton);
insidePane.add(verticalToggleButton);
Component[][] components2 = new Component[][]{
new Component[]{outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png")), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{externalPane, insidePane,}
};
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2);
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.currentLineColorPane.setSelectObject(Color.BLACK);
outerToggleButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
@ -113,9 +87,7 @@ public class BorderPane extends AbstractBasicStylePane {
rightToggleButton.setSelected(value);
}
});
innerToggleButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
@ -123,12 +95,22 @@ public class BorderPane extends AbstractBasicStylePane {
verticalToggleButton.setSelected(value);
}
});
}
private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
leftToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/left.png"));
bottomToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/bottom.png"));
rightToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/right.png"));
horizontalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/horizontal.png"));
verticalToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/vertical.png"));
this.currentLineCombo = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.currentLineColorPane = new NewColorSelectBox(100);
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("Border");
return Inter.getLocText("FR-Designer_Border");
}
public void populate(Style style) {

BIN
designer_base/src/com/fr/design/images/control/tab/end.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

BIN
designer_base/src/com/fr/design/images/control/tab/end_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

BIN
designer_base/src/com/fr/design/images/control/tab/first.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
designer_base/src/com/fr/design/images/control/tab/first_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
designer_base/src/com/fr/design/images/control/tab/next.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

BIN
designer_base/src/com/fr/design/images/control/tab/next_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

BIN
designer_base/src/com/fr/design/images/control/tab/prev.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

BIN
designer_base/src/com/fr/design/images/control/tab/prev_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

2
designer_base/src/com/fr/design/insert/formula/variable/cn/$$$.txt

@ -1 +1 @@
΅±Η°Φ΅
当前值

2
designer_base/src/com/fr/design/insert/formula/variable/cn/$$page_number.txt

@ -1 +1 @@
当前的页数。
当前的页数。

2
designer_base/src/com/fr/design/insert/formula/variable/cn/$$totalPage_number.txt

@ -1 +1 @@
总页数。
总页数。

2
designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_authority.txt

@ -1 +1 @@
使用权限时保存角色的参数
使用权限时保存角色的参数

2
designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_username.txt

@ -1 +1 @@
使用权限时保存用户名的参数
使用权限时保存用户名的参数

4
designer_base/src/com/fr/design/insert/formula/variable/cn/$fr_userposition.txt

@ -1,3 +1 @@
使用权限时,$fr_userposition就是部门角色,
格式如:{"departments":"销售","jobTitle":"销售经理"},
部门角色是以部门和职务组成的数组。
使用权限时,$fr_userposition就是部门角色,格式如:{"jobTitle":"销售经理","departments":"销售"},部门角色是以部门和职务组成的数组。

2
designer_base/src/com/fr/design/insert/formula/variable/cn/NOFILTER.txt

@ -1 +1 @@
NOFILTER是一个与任意值比较都为true的参数。
NOFILTER是一个与任意值比较都为true的参数。

2
designer_base/src/com/fr/design/insert/formula/variable/cn/NULL.txt

@ -1 +1 @@
空值的参数。
空值的参数。

4
designer_base/src/com/fr/design/insert/formula/variable/cn/contextPath.txt

@ -1,3 +1 @@
contextPath是指绝对路径的服务器别名,即虚拟目录.
假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,
contextPath是/WebReport
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport

2
designer_base/src/com/fr/design/insert/formula/variable/cn/curReport.txt

@ -1 +1 @@
当前报表。
当前报表。

4
designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt

@ -1,3 +1 @@
表单名字
假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,
formName就是Form1.frm
表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm

2
designer_base/src/com/fr/design/insert/formula/variable/cn/fr_submitinfo.txt

@ -1 +1 @@
提交入库事件的返回信息。 fr_submitinfo.success记录成功与否 fr_submitinfo.failinfo简单记录出错信息
提交入库事件的返回信息。fr_submitinfo.success记录成功与否fr_submitinfo.failinfo简单记录出错信息

4
designer_base/src/com/fr/design/insert/formula/variable/cn/reportName.txt

@ -1,3 +1 @@
报表名字
假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,
reportName就是WorkBook1.cpt
报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save