Browse Source

Merge pull request #39 in PF/design from ~JU/co-pf-9.0-design:9.0 to 9.0

* commit '9ab1c1c42dfc3612bb01ca0e45216c569756d911': (82 commits)
  fix
  fix
  调试几个设计器插件,挺多地方有缓存需要添加监听的
  插件改变时刷新
  插件改变时刷新
  插件改变时刷新
  bug fix遍历问题
  bug fix
  bug fix
  reformat
  bug fix 去重
  alphafine 猜您喜欢和本地常用去重
  bug fix
  bug fix
  alphafine bug fix
  格式化一下代码 没改东西
  bug fix
  bug fix ds 数据集搜索
  bug fix
  设置面板 alphafine
  ...
master
superman 8 years ago
parent
commit
9a0a82311d
  1. 8
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  2. 10
      designer/src/com/fr/design/actions/report/ReportEngineAttrAction.java
  3. 11
      designer/src/com/fr/design/actions/report/ReportExportAttrAction.java
  4. 4
      designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  5. 4
      designer/src/com/fr/design/actions/report/ReportPageAttrAction.java
  6. 13
      designer/src/com/fr/design/actions/report/ReportPageSetupAction.java
  7. 7
      designer/src/com/fr/design/actions/report/ReportWebAttrAction.java
  8. 10
      designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java
  9. 7
      designer/src/com/fr/design/actions/server/ServerConfigManagerAction.java
  10. 4
      designer/src/com/fr/design/actions/server/StyleListAction.java
  11. 30
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  12. 18
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  13. 41
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  14. 3
      designer/src/com/fr/design/mainframe/alphafine/CellType.java
  15. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java
  16. 28
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  17. 2
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  18. 2
      designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java
  19. 1
      designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java
  20. 24
      designer/src/com/fr/design/mainframe/alphafine/cell/model/NoResultModel.java
  21. 6
      designer/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  22. 20
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  23. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  24. 375
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  25. 33
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  26. 4
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java
  27. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/noresult.png
  28. 6
      designer/src/com/fr/design/mainframe/alphafine/listener/DocumentAdapter.java
  29. 21
      designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java
  30. 1
      designer/src/com/fr/design/mainframe/alphafine/model/SearchResult.java
  31. 33
      designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java
  32. 2
      designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java
  33. 10
      designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java
  34. 82
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  35. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaFineSearchProcessor.java
  36. 69
      designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java
  37. 76
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  38. 105
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  39. 127
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  40. 70
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  41. 53
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  42. 5
      designer/src/com/fr/design/module/DesignerModule.java
  43. 17
      designer/src/com/fr/design/report/UnitFieldPane.java
  44. 6
      designer/src/com/fr/design/webattr/EditReportServerParameterPane.java
  45. 11
      designer/src/com/fr/design/webattr/ReportWebAttrPane.java
  46. 2
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  47. 2
      designer/src/com/fr/start/Designer.java
  48. 25
      designer_base/build.9.0.gradle
  49. 35
      designer_base/build.9.0.gradle.bak
  50. 4
      designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj
  51. 23
      designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java
  52. 18
      designer_base/src/com/fr/design/DesignerEnvManager.java
  53. 116
      designer_base/src/com/fr/design/actions/UpdateAction.java
  54. 56
      designer_base/src/com/fr/design/actions/file/PreferenceAction.java
  55. 3
      designer_base/src/com/fr/design/actions/help/AboutAction.java
  56. 24
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java
  57. 9
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  58. 65
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  59. 40
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java
  60. 18
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java
  61. 29
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java
  62. 8
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java
  63. 3
      designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java
  64. 6
      designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java
  65. 6
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  66. 4
      designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java
  67. 29
      designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  68. 8
      designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java
  69. 8
      designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java
  70. 109
      designer_base/src/com/fr/design/fun/impl/GlobalListenerProviderManager.java
  71. 26
      designer_base/src/com/fr/design/gui/frpane/LoadingBasicPane.java
  72. 3
      designer_base/src/com/fr/design/gui/frpane/UITextPane.java
  73. 24
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  74. 16
      designer_base/src/com/fr/design/gui/itextfield/UINumberField.java
  75. 27
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  76. 11
      designer_base/src/com/fr/design/locale/designer.properties
  77. 27
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  78. 4
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  79. 4
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  80. 11
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  81. 9
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  82. 6
      designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java
  83. 21
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  84. 20
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  85. 39
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  86. 7
      designer_base/src/com/fr/start/BaseDesigner.java
  87. 25
      designer_chart/build.9.0.gradle
  88. 43
      designer_chart/build.9.0.gradle.bak
  89. 4
      designer_chart/src/com/fr/design/module/ChartPreStyleAction.java
  90. 35
      designer_form/build.9.0.gradle
  91. 52
      designer_form/build.9.0.gradle.bak
  92. 19
      designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java

8
designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java

@ -1,9 +1,10 @@
package com.fr.design.actions.insert.cell; package com.fr.design.actions.insert.cell;
import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.menu.KeySetUtils; import com.fr.design.dscolumn.DSColumnPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable {
@ -12,7 +13,8 @@ public class DSColumnCellAction extends AbstractCellAction implements WorkBookSu
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"));
this.setSearchText(new DSColumnPane());
} }
@Override @Override

10
designer/src/com/fr/design/actions/report/ReportEngineAttrAction.java

@ -1,13 +1,13 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction; import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.LayerReportPane; import com.fr.design.report.LayerReportPane;
import com.fr.design.dialog.BasicDialog; import com.fr.general.IOUtils;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> { public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> {
@ -17,7 +17,9 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setMenuKeySet(KeySetUtils.REPORT_ENGINE); this.setMenuKeySet(KeySetUtils.REPORT_ENGINE);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/reportEngineAttr.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportEngineAttr.png"));
this.setSearchText(new LayerReportPane(null));
} }
private boolean isChange; private boolean isChange;

11
designer/src/com/fr/design/actions/report/ReportExportAttrAction.java

@ -1,16 +1,16 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportExportAttrPane; import com.fr.design.report.ReportExportAttrPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import java.awt.event.ActionEvent;
public class ReportExportAttrAction extends JWorkBookAction { public class ReportExportAttrAction extends JWorkBookAction {
public ReportExportAttrAction(JWorkBook jwb) { public ReportExportAttrAction(JWorkBook jwb) {
@ -18,7 +18,8 @@ public class ReportExportAttrAction extends JWorkBookAction {
this.setMenuKeySet(KeySetUtils.REPORT_EXPORT_ATTR); this.setMenuKeySet(KeySetUtils.REPORT_EXPORT_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exportAttr.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/exportAttr.png"));
this.setSearchText(new ReportExportAttrPane());
} }
/** /**

4
designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.mobile.ReportMobileAttrPane; import com.fr.design.report.mobile.ReportMobileAttrPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.report.mobile.ElementCaseMobileAttr; import com.fr.report.mobile.ElementCaseMobileAttr;
@ -27,7 +28,8 @@ public class ReportMobileAttrAction extends JWorkBookAction{
this.setMenuKeySet(REPORT_APP_ATTR); this.setMenuKeySet(REPORT_APP_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/mobile.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/mobile.png"));
this.setSearchText(new ReportMobileAttrPane());
} }
/** /**

4
designer/src/com/fr/design/actions/report/ReportPageAttrAction.java

@ -12,6 +12,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.freeze.RepeatAndFreezeSettingPane; import com.fr.design.report.freeze.RepeatAndFreezeSettingPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
/** /**
@ -27,7 +28,8 @@ public class ReportPageAttrAction extends ReportComponentAction<WorkSheetDesigne
this.setMenuKeySet(KeySetUtils.REPORT_PAGE); this.setMenuKeySet(KeySetUtils.REPORT_PAGE);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png"));
this.setSearchText(new RepeatAndFreezeSettingPane());
} }
/** /**

13
designer/src/com/fr/design/actions/report/ReportPageSetupAction.java

@ -3,18 +3,18 @@
*/ */
package com.fr.design.actions.report; package com.fr.design.actions.report;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.ReportComponentAction; import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.ReportComponent; import com.fr.design.mainframe.ReportComponent;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.PageSetupPane; import com.fr.design.report.PageSetupPane;
import com.fr.design.dialog.BasicDialog; import com.fr.general.IOUtils;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import javax.swing.*;
/** /**
* PageSetup action. * PageSetup action.
*/ */
@ -27,7 +27,8 @@ public class ReportPageSetupAction extends ReportComponentAction<ReportComponent
this.setMenuKeySet(KeySetUtils.REPORT_PAGE_SETUP); this.setMenuKeySet(KeySetUtils.REPORT_PAGE_SETUP);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png"));
this.setSearchText(new PageSetupPane());
} }
/** /**

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

@ -3,8 +3,8 @@
*/ */
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
@ -14,8 +14,8 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWebAttrPane; import com.fr.design.webattr.ReportWebAttrPane;
import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.base.ConfigManagerProvider;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -29,7 +29,8 @@ public class ReportWebAttrAction extends JWorkBookAction {
this.setMenuKeySet(KeySetUtils.REPORT_WEB_ATTR); this.setMenuKeySet(KeySetUtils.REPORT_WEB_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/webreportattribute.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/webreportattribute.png"));
this.setSearchText(new ReportWebAttrPane().getAllComponents());
} }
/** /**

10
designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java

@ -1,14 +1,14 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction; import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWriteAttrPane; import com.fr.design.webattr.ReportWriteAttrPane;
import com.fr.design.dialog.BasicDialog; import com.fr.general.IOUtils;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
/** /**
@ -20,7 +20,9 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
this.setMenuKeySet(KeySetUtils.REPORT_WRITE); this.setMenuKeySet(KeySetUtils.REPORT_WRITE);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/reportWriteAttr.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportWriteAttr.png"));
this.setSearchText(new ReportWriteAttrPane(null).getAllComponents());
} }
// ben:用来判断是否update // ben:用来判断是否update

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

@ -3,8 +3,8 @@
*/ */
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -13,8 +13,8 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane; import com.fr.design.webattr.EditReportServerParameterPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -27,7 +27,8 @@ public class ServerConfigManagerAction extends UpdateAction {
this.setMenuKeySet(SERVER_CONFIG_MANAGER); this.setMenuKeySet(SERVER_CONFIG_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/edit.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/edit.png"));
this.setSearchText(new EditReportServerParameterPane().getAllComponents());
} }
/** /**

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

@ -10,6 +10,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -24,7 +25,8 @@ public class StyleListAction extends UpdateAction {
this.setMenuKeySet(PREDEFINED_STYLES); this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/style.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png"));
this.setSearchText(new StyleManagerPane());
} }
/** /**

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

@ -12,14 +12,22 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.fun.PresentKindProvider;
import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.cell.CellElementEditPane; import com.fr.design.mainframe.cell.CellElementEditPane;
import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
@ -35,6 +43,28 @@ import com.fr.report.elementcase.TemplateElementCase;
*/ */
public class CellElementPropertyPane extends DockingView { public class CellElementPropertyPane extends DockingView {
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
synchronized (CellElementPropertyPane.class) {
singleton = new CellElementPropertyPane();
}
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) ||
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
}
});
}
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); singleton = new CellElementPropertyPane();

18
designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -47,6 +47,8 @@ public class AlphaFineConstants {
public static final Color LIGHT_GRAY = new Color(0xcccccc); public static final Color LIGHT_GRAY = new Color(0xcccccc);
public static final Color MEDIUM_GRAY = new Color(0x999999);
public static final Color BLUE = new Color(0x3394f0); public static final Color BLUE = new Color(0x3394f0);
public static final Color BLACK = new Color(0x222222); public static final Color BLACK = new Color(0x222222);
@ -55,21 +57,13 @@ public class AlphaFineConstants {
public static final Color RED = new Color(0xf46c4c); public static final Color RED = new Color(0xf46c4c);
public static final Font SMALL_FONT = new Font("Song_TypeFace",0,10); public static final Font SMALL_FONT = new Font("Song_TypeFace", 0, 10);
public static final Font MEDIUM_FONT = new Font("Song_TypeFace",0,12);
public static final Font LARGE_FONT = new Font("Song_TypeFace",0,18);
public static final Font GREATER_FONT = new Font("Song_TypeFace",0,20);
public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12);
public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18);
public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20);
public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI");

41
designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -1,36 +1,50 @@
package com.fr.design.mainframe.alphafine; package com.fr.design.mainframe.alphafine;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.NoResultModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.search.manager.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.RecommendSearchManager;
import com.fr.general.Inter;
import com.fr.general.ProcessCanceledException;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.List;
/** /**
* Created by XiaXiang on 2017/5/8. * Created by XiaXiang on 2017/5/8.
*/ */
public class AlphaFineHelper { public class AlphaFineHelper {
private static AlphaFineDialog dialog; public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult"));
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed"));
/** /**
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
*/ */
public static void showAlphaFineDialog(boolean forceOpen) { public static void showAlphaFineDialog(boolean forceOpen) {
if (dialog == null) { AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen); final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
} manager.setNeedRemind(false);
dialog.setVisible(true); dialog.setVisible(true);
} }
/** /**
* 获取文件名上级目录 * 获取文件名上级目录
*
* @param text * @param text
* @return * @return
*/ */
public static String findFolderName (String text) { public static String findFolderName(String text) {
return getSplitText(text, 2); return getSplitText(text, 2);
} }
/** /**
* 分割字符串获取文件名文件名上级目录等 * 分割字符串获取文件名文件名上级目录等
*
* @param text * @param text
* @param index * @param index
* @return * @return
@ -47,14 +61,29 @@ public class AlphaFineHelper {
/** /**
* 获取文件名 * 获取文件名
*
* @param text * @param text
* @return * @return
*/ */
public static String findFileName (String text) { public static String findFileName(String text) {
return getSplitText(text, 1); return getSplitText(text, 1);
} }
/**
* 中断当前线程的搜索
*/
public static void checkCancel() {
if (Thread.interrupted()) {
throw new ProcessCanceledException();
}
}
public static List<AlphaCellModel> getFilterResult() {
List<AlphaCellModel> recentList = RecentSearchManager.getRecentSearchManger().getRecentModelList();
List<AlphaCellModel> recommendList = RecommendSearchManager.getRecommendSearchManager().getRecommendModelList();
recentList.addAll(recommendList);
return recentList;
}
} }

3
designer/src/com/fr/design/mainframe/alphafine/CellType.java

@ -4,7 +4,7 @@ package com.fr.design.mainframe.alphafine;
* Created by XiaXiang on 2017/4/27. * Created by XiaXiang on 2017/4/27.
*/ */
public enum CellType { public enum CellType {
RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5); RECOMMEND(0), ACTION(1), DOCUMENT(2), FILE(3), PLUGIN(4), REUSE(5), NO_RESULT(6);
private int typeValue; private int typeValue;
@ -21,6 +21,7 @@ public enum CellType {
return FILE; return FILE;
} }
public int getTypeValue() { public int getTypeValue() {
return typeValue; return typeValue;
} }

3
designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.cell; package com.fr.design.mainframe.alphafine.cell;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.*; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.search.manager.ActionSearchManager; import com.fr.design.mainframe.alphafine.search.manager.ActionSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.FileSearchManager; import com.fr.design.mainframe.alphafine.search.manager.FileSearchManager;
@ -13,6 +13,7 @@ import com.fr.json.JSONObject;
*/ */
public class CellModelHelper { public class CellModelHelper {
private static final String RESULT = "result"; private static final String RESULT = "result";
public static AlphaCellModel getModelFromJson(JSONObject object) { public static AlphaCellModel getModelFromJson(JSONObject object) {
int typeValue = object.optInt("cellType"); int typeValue = object.optInt("cellType");
AlphaCellModel cellModel = null; AlphaCellModel cellModel = null;

28
designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -6,7 +6,6 @@ import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import javax.swing.*; import javax.swing.*;
import java.io.Serializable;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
@ -14,12 +13,18 @@ import java.io.Serializable;
public class ActionModel extends AlphaCellModel { public class ActionModel extends AlphaCellModel {
private Action action; private Action action;
private String actionName; private String className;
public ActionModel(String name, String content, CellType type) { public ActionModel(String name, String content, CellType type) {
super(name, content, type); super(name, content, type);
} }
public ActionModel(String name, String description, Action action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) { if (this == o) {
@ -38,17 +43,6 @@ public class ActionModel extends AlphaCellModel {
return action != null ? action.hashCode() : 0; return action != null ? action.hashCode() : 0;
} }
public ActionModel(String name, String description, Action action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
}
public ActionModel(String name, Action action) {
super(name, null, CellType.ACTION);
this.action = action;
}
public Action getAction() { public Action getAction() {
return action; return action;
} }
@ -70,14 +64,14 @@ public class ActionModel extends AlphaCellModel {
@Override @Override
public String getStoreInformation() { public String getStoreInformation() {
return getActionName(); return getClassName();
} }
public String getActionName() { public String getClassName() {
return getAction().getClass().getName(); return getAction().getClass().getName();
} }
public void setActionName(String actionName) { public void setClassName(String className) {
this.actionName = actionName; this.className = className;
} }
} }

2
designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java

@ -62,6 +62,7 @@ public abstract class AlphaCellModel {
/** /**
* model转json * model转json
*
* @return * @return
* @throws JSONException * @throws JSONException
*/ */
@ -69,6 +70,7 @@ public abstract class AlphaCellModel {
/** /**
* 获取需要保存到云中心的信息 * 获取需要保存到云中心的信息
*
* @return * @return
*/ */
abstract public String getStoreInformation(); abstract public String getStoreInformation();

2
designer/src/com/fr/design/mainframe/alphafine/cell/model/FileModel.java

@ -9,7 +9,7 @@ import com.fr.json.JSONObject;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class FileModel extends AlphaCellModel{ public class FileModel extends AlphaCellModel {
private String filePath; private String filePath;
public FileModel(String name, String content, CellType type) { public FileModel(String name, String content, CellType type) {

1
designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java

@ -29,6 +29,7 @@ public class MoreModel {
this.name = name; this.name = name;
this.isLoading = true; this.isLoading = true;
} }
public MoreModel(String name, boolean isLoading) { public MoreModel(String name, boolean isLoading) {
this.name = name; this.name = name;
this.isLoading = isLoading; this.isLoading = isLoading;

24
designer/src/com/fr/design/mainframe/alphafine/cell/model/NoResultModel.java

@ -0,0 +1,24 @@
package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
/**
* Created by XiaXiang on 2017/6/8.
*/
public class NoResultModel extends AlphaCellModel {
public NoResultModel(String name) {
super(name, null, CellType.NO_RESULT);
}
@Override
public JSONObject ModelToJson() throws JSONException {
return null;
}
@Override
public String getStoreInformation() {
return null;
}
}

6
designer/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java

@ -10,6 +10,8 @@ import com.fr.json.JSONObject;
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class PluginModel extends AlphaCellModel { public class PluginModel extends AlphaCellModel {
private static final String PLUGIN_INFORMATION_URL = "http://shop.finereport.com/ShopServer?pg=plugin&pid=";
private static final String REUSE_INFORMATION_URL = "http://shop.finereport.com/reuses/";
private String pluginUrl; private String pluginUrl;
private String imageUrl; private String imageUrl;
private String version; private String version;
@ -18,12 +20,11 @@ public class PluginModel extends AlphaCellModel {
private String informationUrl; private String informationUrl;
private int pluginId; private int pluginId;
private int price; private int price;
private static final String PLUGIN_INFORMATION_URL = "http://shop.finereport.com/ShopServer?pg=plugin&pid=";
private static final String REUSE_INFORMATION_URL = "http://shop.finereport.com/reuses/";
public PluginModel(String name, String content, CellType type) { public PluginModel(String name, String content, CellType type) {
super(name, content, type); super(name, content, type);
} }
public PluginModel(String name, String content, String imageUrl, String version, String jartime, String link, CellType type, int price, int pluginId) { public PluginModel(String name, String content, String imageUrl, String version, String jartime, String link, CellType type, int price, int pluginId) {
super(name, content); super(name, content);
this.link = link; this.link = link;
@ -130,7 +131,6 @@ public class PluginModel extends AlphaCellModel {
} }
public int getPluginId() { public int getPluginId() {
return pluginId; return pluginId;
} }

20
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -2,9 +2,11 @@ package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -15,6 +17,7 @@ import java.awt.*;
public class ContentCellRender implements ListCellRenderer<Object> { public class ContentCellRender implements ListCellRenderer<Object> {
private UILabel name; private UILabel name;
private UILabel content; private UILabel content;
public ContentCellRender() { public ContentCellRender() {
this.name = new UILabel(); this.name = new UILabel();
this.content = new UILabel(); this.content = new UILabel();
@ -23,24 +26,31 @@ public class ContentCellRender implements ListCellRenderer<Object> {
@Override @Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value instanceof MoreModel) { if (value instanceof MoreModel) {
return new TitleCellRender().getListCellRendererComponent(list, value,index,isSelected,cellHasFocus); return new TitleCellRender().getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
} }
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(Color.white); panel.setBackground(Color.white);
if (isSelected) { if (isSelected) {
panel.setBackground(AlphaFineConstants.BLUE); panel.setBackground(AlphaFineConstants.BLUE);
} }
panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
AlphaCellModel model = (AlphaCellModel) value; AlphaCellModel model = (AlphaCellModel) value;
name.setText(model.getName()); name.setText(model.getName());
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
name.setIcon(IOUtils.readIcon(iconUrl)); name.setIcon(IOUtils.readIcon(iconUrl));
if (model.getType() == CellType.NO_RESULT) {
name.setIcon(null);
name.setForeground(AlphaFineConstants.MEDIUM_GRAY);
} else {
name.setIcon(new ImageIcon(getClass().getResource(iconUrl)));
name.setForeground(AlphaFineConstants.BLACK);
}
name.setFont(AlphaFineConstants.MEDIUM_FONT); name.setFont(AlphaFineConstants.MEDIUM_FONT);
name.setForeground(AlphaFineConstants.BLACK);
name.setVerticalTextPosition(SwingConstants.CENTER); name.setVerticalTextPosition(SwingConstants.CENTER);
name.setHorizontalTextPosition(SwingConstants.RIGHT); name.setHorizontalTextPosition(SwingConstants.RIGHT);
if (model.getDescription() != null) { String description = model.getDescription();
content.setText("-" + model.getDescription()); if (StringUtils.isNotBlank(description)) {
content.setText("-" + description);
content.setForeground(AlphaFineConstants.LIGHT_GRAY); content.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(content, BorderLayout.CENTER); panel.add(content, BorderLayout.CENTER);
} }

7
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -19,12 +19,13 @@ public class TitleCellRender implements ListCellRenderer<Object> {
this.name = new UILabel(); this.name = new UILabel();
this.more = new UILabel(); this.more = new UILabel();
} }
@Override @Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
MoreModel moreModel = (MoreModel)value; MoreModel moreModel = (MoreModel) value;
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(AlphaFineConstants.WHITE); panel.setBackground(AlphaFineConstants.WHITE);
panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
name.setText(moreModel.getName()); name.setText(moreModel.getName());
name.setFont(AlphaFineConstants.SMALL_FONT); name.setFont(AlphaFineConstants.SMALL_FONT);
more.setFont(AlphaFineConstants.SMALL_FONT); more.setFont(AlphaFineConstants.SMALL_FONT);
@ -33,7 +34,7 @@ public class TitleCellRender implements ListCellRenderer<Object> {
more.setForeground(AlphaFineConstants.DARK_GRAY); more.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(name, BorderLayout.WEST); panel.add(name, BorderLayout.WEST);
if (moreModel.isNeedMore()) { if (moreModel.isNeedMore()) {
this.more.setBorder(BorderFactory.createEmptyBorder(0,0,0,10)); this.more.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
panel.add(this.more, BorderLayout.EAST); panel.add(this.more, BorderLayout.EAST);
} }
if (moreModel.isLoading()) { if (moreModel.isLoading()) {

375
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -16,6 +16,7 @@ import com.fr.design.mainframe.alphafine.listener.ComponentHandler;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.alphafine.model.SearchListModel; import com.fr.design.mainframe.alphafine.model.SearchListModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane;
import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane;
import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; import com.fr.design.mainframe.alphafine.preview.FilePreviewPane;
import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane; import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane;
@ -59,6 +60,31 @@ import java.util.concurrent.ExecutionException;
* Created by XiaXiang on 2017/3/21. * Created by XiaXiang on 2017/3/21.
*/ */
public class AlphaFineDialog extends UIDialog { public class AlphaFineDialog extends UIDialog {
private static final String ACTION_MARK_SHORT = "k:1 ";
private static final String ACTION_MARK = "k:setting ";
private static final String DOCUMENT_MARK_SHORT = "k:2 ";
private static final String DOCUMENT_MARK = "k:help ";
private static final String FILE_MARK_SHORT = "k:3 ";
private static final String FILE_MARK = "k:reportlets ";
private static final String CPT_MARK = "k:cpt ";
private static final String FRM_MARK = "k:frm ";
private static final String DS_MARK = "k:ds ";
private static final String DS_NAME = "dsname=\"";
private static final String PLUGIN_MARK_SHORT = "k:4 ";
private static final String PLUGIN_MARK = "k:shop ";
private AlphaFineTextField searchTextField; private AlphaFineTextField searchTextField;
private UIButton closeButton; private UIButton closeButton;
private JPanel searchResultPane; private JPanel searchResultPane;
@ -69,16 +95,52 @@ public class AlphaFineDialog extends UIDialog {
private SearchListModel searchListModel; private SearchListModel searchListModel;
private SwingWorker searchWorker; private SwingWorker searchWorker;
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下 //是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean foreOpen; private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean foreOpen) {
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent); super(parent);
this.forceOpen = forceOpen;
initProperties(); initProperties();
initListener(); initListener();
initComponents(); initComponents();
} }
/**
* 全局快捷键
*
* @return
*/
public static AWTEventListener listener() {
return new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
if (event instanceof KeyEvent) {
KeyEvent e = (KeyEvent) event;
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore();
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFinePane.getAlphaFinePane().isVisible()) {
doClickAction();
}
}
}
};
}
private static void doClickAction() {
AlphaFineHelper.showAlphaFineDialog(false);
}
/**
* 初始化全部组件
*/
private void initComponents() { private void initComponents() {
searchTextField = new AlphaFineTextField("AlphaFine"); searchTextField = new AlphaFineTextField("AlphaFine");
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.white); searchTextField.setBackground(Color.white);
@ -92,9 +154,11 @@ public class AlphaFineDialog extends UIDialog {
topPane.add(iconLabel, BorderLayout.WEST); topPane.add(iconLabel, BorderLayout.WEST);
topPane.add(searchTextField, BorderLayout.CENTER); topPane.add(searchTextField, BorderLayout.CENTER);
closeButton = new UIButton() { closeButton = new UIButton() {
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
g.setColor( Color.white );
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width, getSize().height); g.fillRect(0, 0, getSize().width, getSize().height);
super.paintComponent(g); super.paintComponent(g);
} }
@ -104,8 +168,10 @@ public class AlphaFineDialog extends UIDialog {
closeButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/alphafine_close.png")); closeButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"));
closeButton.set4ToolbarButton(); closeButton.set4ToolbarButton();
closeButton.addActionListener(new ActionListener() { closeButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
dispose(); dispose();
} }
}); });
@ -116,21 +182,34 @@ public class AlphaFineDialog extends UIDialog {
topPane.add(borderLabel, BorderLayout.SOUTH); topPane.add(borderLabel, BorderLayout.SOUTH);
add(topPane, BorderLayout.CENTER); add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() { searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override @Override
protected void textChanged(DocumentEvent e) { protected void textChanged(DocumentEvent e) {
doSearch(searchTextField.getText()); doSearch(searchTextField.getText());
} }
}); });
} }
/**
*
*/
private void initProperties() { private void initProperties() {
setUndecorated(true); setUndecorated(true);
addComponentListener(new ComponentHandler()); addComponentListener(new ComponentHandler());
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
centerWindow(this); centerWindow(this);
} }
/**
* 设置面板位置
*
* @param win
*/
private void centerWindow(Window win) { private void centerWindow(Window win) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension winSize = win.getSize(); Dimension winSize = win.getSize();
@ -142,22 +221,43 @@ public class AlphaFineDialog extends UIDialog {
winSize.width = screenSize.width; winSize.width = screenSize.width;
} }
//这里设置位置:水平居中,竖直偏上 //这里设置位置:水平居中,竖直偏上
win.setLocation((screenSize.width - winSize.width ) / 2, (screenSize.height - winSize.height) / AlphaFineConstants.SHOW_SIZE); win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / AlphaFineConstants.SHOW_SIZE);
} }
// TODO: 2017/5/8 xiaxiang: 窗体圆角setShape()有毛边,重写paint方法可以解决毛边问题,但带来了别的问题,处理比较麻烦,暂用setShape();
// public void paint(Graphics g){
//
// Graphics2D g2 = (Graphics2D) g.create();
// RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// qualityHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
// g2.setRenderingHints(qualityHints);
// g2.setPaint(Color.WHITE);
// g2.fillRoundRect(0, 0, getWidth(), getHeight(), 25, 25);
// g2.dispose();
// }
/**
* 执行搜索
*
* @param text
*/
private void doSearch(String text) { private void doSearch(String text) {
if (text.length() < 2 || text.contains("'")) {
return;
}
if (StringUtils.isBlank(text) || text.equals("AlphaFine")) { if (StringUtils.isBlank(text) || text.equals("AlphaFine")) {
removeSearchResult(); removeSearchResult();
} else if (text.contains("'")) {
return;
} else { } else {
showSearchResult(text); showSearchResult();
} }
} }
/**
* 移除搜索结果
*/
private void removeSearchResult() { private void removeSearchResult() {
if (searchResultPane != null) { if (searchResultPane != null) {
remove(searchResultPane); remove(searchResultPane);
searchResultPane = null; searchResultPane = null;
@ -166,30 +266,25 @@ public class AlphaFineDialog extends UIDialog {
repaint(); repaint();
} }
// TODO: 2017/5/8 xiaxiang: 窗体圆角setShape()有毛边,重写paint方法可以解决毛边问题,但带来了别的问题,处理比较麻烦,暂用setShape(); /**
// public void paint(Graphics g){ * 展示搜索结果
// */
// Graphics2D g2 = (Graphics2D) g.create(); private void showSearchResult() {
// RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// qualityHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
// g2.setRenderingHints(qualityHints);
// g2.setPaint(Color.WHITE);
// g2.fillRoundRect(0, 0, getWidth(), getHeight(), 25, 25);
// g2.dispose();
// }
private void showSearchResult(String searchText) {
if (searchResultPane == null) { if (searchResultPane == null) {
initSearchResultComponents(); initSearchResultComponents();
initListListener(searchText); initListListener();
} }
initSearchWorker(searchText); initSearchWorker();
} }
/**
* 初始化搜索面板
*/
private void initSearchResultComponents() { private void initSearchResultComponents() {
searchResultList = new JList(); searchResultList = new JList();
searchListModel = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModel);
searchResultPane = new JPanel(); searchResultPane = new JPanel();
searchResultPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); searchResultPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE);
searchResultPane.setLayout(new BorderLayout()); searchResultPane.setLayout(new BorderLayout());
@ -198,7 +293,7 @@ public class AlphaFineDialog extends UIDialog {
leftSearchResultPane = new UIScrollPane(searchResultList); leftSearchResultPane = new UIScrollPane(searchResultList);
leftSearchResultPane.setBackground(Color.white); leftSearchResultPane.setBackground(Color.white);
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
rightSearchResultPane = new JPanel(); rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.white); rightSearchResultPane.setBackground(Color.white);
@ -209,42 +304,143 @@ public class AlphaFineDialog extends UIDialog {
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
} }
private void initSearchWorker(final String searchText) { /**
searchResultList.setModel(new SearchListModel(AlphaSearchManager.getSearchManager().showDefaultSearchResult())); * 异步加载搜索结果
*/
private void initSearchWorker() {
if (this.searchWorker != null && !this.searchWorker.isDone()) { if (this.searchWorker != null && !this.searchWorker.isDone()) {
this.searchWorker.cancel(true); this.searchWorker.cancel(true);
this.searchWorker = null; this.searchWorker = null;
} }
this.searchWorker = new SwingWorker<SearchListModel, String>() { this.searchWorker = new SwingWorker() {
@Override @Override
protected SearchListModel doInBackground() { protected Object doInBackground() throws Exception {
return setListModel(new SearchListModel(AlphaSearchManager.getSearchManager().getLessSearchResult(searchText)));
rebuildList(searchTextField.getText().toLowerCase());
return null;
} }
@Override @Override
protected void done() { protected void done() {
try {
if (!isCancelled()) {
searchResultList.setModel(get());
searchResultList.validate();
searchResultList.repaint();
validate();
repaint();
}
} catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage());
} catch (ExecutionException e) {
FRLogger.getLogger().error(e.getMessage());
}
if (!isCancelled() && searchListModel.getSize() > 0) {
searchResultList.setSelectedIndex(1);
showResult(searchResultList.getSelectedIndex(), searchResultList.getSelectedValue());
}
} }
}; };
this.searchWorker.execute(); this.searchWorker.execute();
} }
private void initListListener(final String searchText) { /**
* 重新构建搜索结果列表
* 先根据输入判断是不是隐藏的搜索功能
*
* @param searchText
*/
private void rebuildList(String searchText) {
searchListModel.removeAllElements();
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
getActionList(searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()));
return;
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
getDocumentList(searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()));
return;
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
getFileList(searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()));
return;
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
getFileList(searchText);
return;
} else if (searchText.startsWith(DS_MARK)) {
getFileList(DS_NAME + searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()));
return;
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
getPluginList(searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()));
return;
}
doNormalSearch(searchText.trim());
}
/**
* 普通搜索
*
* @param searchText
*/
private void doNormalSearch(String searchText) {
getRecentList(searchText);
getRecommendList(searchText);
getActionList(searchText);
getFileList(searchText);
getDocumentList(searchText);
getPluginList(searchText);
}
private synchronized void getDocumentList(final String searchText) {
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText);
for (Object object : documentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private synchronized void getFileList(final String searchText) {
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText);
for (Object object : fileModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private synchronized void getActionList(final String searchText) {
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText);
for (Object object : actionModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private synchronized void getPluginList(final String searchText) {
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText);
for (Object object : pluginModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private synchronized void getRecommendList(final String searchText) {
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText);
for (Object object : recommendModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
private synchronized void getRecentList(final String searchText) {
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText);
for (Object object : recentModelList) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
}
/**
* 初始化监听器
*/
private void initListListener() {
/**
* 鼠标监听器
*/
searchResultList.addMouseListener(new MouseAdapter() { searchResultList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -263,7 +459,9 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
// TODO: 2017/5/8 xiaxiang: e.getClickCount() == 1 时,偶发性的不能触发,所以先放到valueChanged /**
*单击时触发右侧面板展示搜索结果
*/
searchResultList.addListSelectionListener(new ListSelectionListener() { searchResultList.addListSelectionListener(new ListSelectionListener() {
@Override @Override
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
@ -274,6 +472,9 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
/**
* 键盘监听器
*/
searchResultList.addKeyListener(new KeyAdapter() { searchResultList.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
@ -400,7 +601,10 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker.execute(); this.searchWorker.execute();
} else if (selectedValue instanceof ActionModel) { } else if (selectedValue instanceof ActionModel) {
showDefaultPreviewPane(); rightSearchResultPane.removeAll();
rightSearchResultPane.add(new ActionPreviewPane());
validate();
repaint();
} }
} }
@ -432,16 +636,24 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 窗口拖拽
*/
private void initMouseListener() { private void initMouseListener() {
addMouseMotionListener(new MouseMotionAdapter() { addMouseMotionListener(new MouseMotionAdapter() {
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
doMouseDragged(e); doMouseDragged(e);
} }
}); });
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
doMousePressed(e); doMousePressed(e);
} }
@ -483,44 +695,17 @@ public class AlphaFineDialog extends UIDialog {
if (SwingUtilities.isLeftMouseButton(k)) { if (SwingUtilities.isLeftMouseButton(k)) {
Point p = k.getLocationOnScreen(); Point p = k.getLocationOnScreen();
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); Rectangle dialogRectangle = AlphaFineDialog.this.getBounds();
Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize()); Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !foreOpen) { if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
foreOpen = false; forceOpen = false;
} }
} }
} }
} }
}, AWTEvent.MOUSE_EVENT_MASK|AWTEvent.KEY_EVENT_MASK); }, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
}
/**
* 全局快捷键
* @return
*/
public static AWTEventListener listener() {
return new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
if (event instanceof KeyEvent) {
KeyEvent e = (KeyEvent) event;
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphafineConfigManager().getShortCutKeyStore();
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString())) {
doClickAction();
}
}
}
};
}
private static void doClickAction() {
AlphaFineHelper.showAlphaFineDialog(false);
} }
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
@ -532,7 +717,7 @@ public class AlphaFineDialog extends UIDialog {
if (value instanceof ActionModel) { if (value instanceof ActionModel) {
((ActionModel) value).getAction().actionPerformed(null); ((ActionModel) value).getAction().actionPerformed(null);
} else if (value instanceof FileModel) { } else if (value instanceof FileModel) {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(((FileModel)value).getFilePath(), false))); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(((FileModel) value).getFilePath(), false)));
} else if (value instanceof PluginModel) { } else if (value instanceof PluginModel) {
String url = ((PluginModel) value).getPluginUrl(); String url = ((PluginModel) value).getPluginUrl();
try { try {
@ -558,6 +743,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 保存本地本地常用 * 保存本地本地常用
*
* @param cellModel * @param cellModel
*/ */
private void saveHistory(AlphaCellModel cellModel) { private void saveHistory(AlphaCellModel cellModel) {
@ -571,6 +757,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 上传数据到服务器 * 上传数据到服务器
*
* @param searchKey * @param searchKey
* @param cellModel * @param cellModel
*/ */
@ -601,15 +788,22 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 点击显示更多时添加对应的model到list点击收起是移除model
*
* @param index
* @param selectedValue
*/
private void rebuildShowMoreList(int index, MoreModel selectedValue) { private void rebuildShowMoreList(int index, MoreModel selectedValue) {
SearchResult moreResult = getMoreResult(selectedValue); SearchResult moreResult = getMoreResult(selectedValue);
if((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) { if ((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) {
for (int i = 0; i < moreResult.size(); i++) { for (int i = 0; i < moreResult.size(); i++) {
this.searchListModel.insertElementAt(moreResult.get(i), index + AlphaFineConstants.SHOW_SIZE -1 + i); this.searchListModel.add(index + AlphaFineConstants.SHOW_SIZE + 1 + i, moreResult.get(i));
} }
} else { } else {
for (int i = 0; i < moreResult.size(); i++) { for (int i = 0; i < moreResult.size(); i++) {
this.searchListModel.removeElementAt(index + AlphaFineConstants.SHOW_SIZE - 1); this.searchListModel.remove(index + AlphaFineConstants.SHOW_SIZE + 1);
} }
} }
@ -643,7 +837,7 @@ public class AlphaFineDialog extends UIDialog {
moreResult = ActionSearchManager.getActionSearchManager().getMoreSearchResult(); moreResult = ActionSearchManager.getActionSearchManager().getMoreSearchResult();
break; break;
default: default:
moreResult = AlphaSearchManager.getSearchManager().getMoreSearchResult(); moreResult = new SearchResult();
} }
return moreResult; return moreResult;
} }
@ -666,11 +860,14 @@ public class AlphaFineDialog extends UIDialog {
} }
public boolean isForeOpen() { public boolean isForceOpen() {
return foreOpen;
return forceOpen;
} }
public void setForeOpen(boolean foreOpen) { public void setForceOpen(boolean forceOpen) {
this.foreOpen = foreOpen;
this.forceOpen = forceOpen;
} }
} }

33
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,12 +1,12 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphafineContext; import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphafineListener; import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -20,20 +20,14 @@ import java.awt.event.ActionListener;
public class AlphaFinePane extends BasicPane { public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane; private static AlphaFinePane alphaFinePane;
public static AlphaFinePane createAlphaFinePane() {
if (alphaFinePane == null) {
alphaFinePane = new AlphaFinePane();
}
return alphaFinePane;
}
public AlphaFinePane() { public AlphaFinePane() {
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14)); setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14));
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK);
} }
UIButton refreshButton = new UIButton(); UIButton refreshButton = new UIButton();
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Alphafine")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton(); refreshButton.set4ToolbarButton();
this.add(refreshButton); this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@ -42,14 +36,27 @@ public class AlphaFinePane extends BasicPane {
AlphaFineHelper.showAlphaFineDialog(false); AlphaFineHelper.showAlphaFineDialog(false);
} }
}); });
AlphafineContext.addAlphafineContextListener(new AlphafineListener() { AlphaFineContext.addAlphaFineListener(new AlphaFineListener() {
@Override @Override
public void showDialog() { public void showDialog() {
AlphaFineHelper.showAlphaFineDialog(true); AlphaFineHelper.showAlphaFineDialog(true);
} }
@Override
public void setEnable(boolean isEnable) {
alphaFinePane.setVisible(isEnable);
}
}); });
} }
public static AlphaFinePane getAlphaFinePane() {
if (alphaFinePane == null) {
alphaFinePane = new AlphaFinePane();
}
return alphaFinePane;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "AlphaFine"; return "AlphaFine";

4
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java

@ -6,7 +6,8 @@ import com.fr.report.web.button.Image;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import static java.awt.event.KeyEvent.VK_ESCAPE; import static java.awt.event.KeyEvent.VK_ESCAPE;
@ -64,6 +65,7 @@ public class AlphaFineTextField extends UITextField {
/** /**
* 添加键盘监听器 * 添加键盘监听器
*
* @param component * @param component
*/ */
public void initKeyListener(final Component component) { public void initKeyListener(final Component component) {

BIN
designer/src/com/fr/design/mainframe/alphafine/images/noresult.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

6
designer/src/com/fr/design/mainframe/alphafine/listener/DocumentAdapter.java

@ -25,17 +25,17 @@ public abstract class DocumentAdapter implements DocumentListener {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
textChanged(e); textChanged(e);
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
textChanged(e); textChanged(e);
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
textChanged(e); textChanged(e);
} }
protected abstract void textChanged(DocumentEvent e); protected abstract void textChanged(DocumentEvent e);

21
designer/src/com/fr/design/mainframe/alphafine/model/SearchListModel.java

@ -8,13 +8,15 @@ import javax.swing.*;
public class SearchListModel extends DefaultListModel { public class SearchListModel extends DefaultListModel {
SearchResult myDelegate; SearchResult myDelegate;
public SearchListModel( SearchResult searchResult) { public SearchListModel(SearchResult searchResult) {
this.myDelegate = searchResult; this.myDelegate = searchResult;
} }
@Override @Override
public void addElement(Object element) { public void addElement(Object element) {
int index = myDelegate.size();
myDelegate.add(element); myDelegate.add(element);
fireContentsChanged(this, index, index);
} }
@Override @Override
@ -23,17 +25,26 @@ public class SearchListModel extends DefaultListModel {
} }
@Override @Override
public void insertElementAt(Object element, int index) { public void add(int index, Object element) {
this.myDelegate.add(index, element); myDelegate.add(index, element);
fireIntervalAdded(this, index, index);
} }
@Override @Override
public void removeElementAt(int index) { public Object remove(int index) {
this.myDelegate.remove(index); Object object = myDelegate.get(index);
myDelegate.remove(object);
fireIntervalRemoved(this, index, index);
return object;
} }
@Override @Override
public int getSize() { public int getSize() {
return this.myDelegate.size(); return this.myDelegate.size();
} }
@Override
public void removeAllElements() {
this.myDelegate.clear();
}
} }

1
designer/src/com/fr/design/mainframe/alphafine/model/SearchResult.java

@ -9,7 +9,6 @@ public class SearchResult extends ArrayList<Object> {
private boolean needMore; private boolean needMore;
public boolean isNeedMore() { public boolean isNeedMore() {
return needMore; return needMore;
} }

33
designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java

@ -1,8 +1,37 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/** /**
* Created by XiaXiang on 2017/5/5. * Created by XiaXiang on 2017/5/5.
*/ */
public class ActionPreviewPane { public class ActionPreviewPane extends JPanel {
//todo:还没确定要不要使用面板截图 private static final Font NAME = new Font("Song_TypeFace", 0, 14);
public ActionPreviewPane() {
setLayout(new BorderLayout());
setBackground(null);
setBorder(BorderFactory.createEmptyBorder(135, 0, 0, 0));
UILabel image = new UILabel();
image.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER);
image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"));
UILabel description = new UILabel(Inter.getLocText("FR-Designer_NoResult"));
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(NAME);
description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
this.add(image, BorderLayout.CENTER);
this.add(description, BorderLayout.SOUTH);
}
} }

2
designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java

@ -20,7 +20,7 @@ public class DocumentPreviewPane extends JPanel {
UITextArea contentArea = new UITextArea(summary); UITextArea contentArea = new UITextArea(summary);
titleArea.setOpaque(false); titleArea.setOpaque(false);
contentArea.setOpaque(false); contentArea.setOpaque(false);
titleArea.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); titleArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
titleArea.setForeground(AlphaFineConstants.BLUE); titleArea.setForeground(AlphaFineConstants.BLUE);
contentArea.setForeground(AlphaFineConstants.BLACK); contentArea.setForeground(AlphaFineConstants.BLACK);
titleArea.setPreferredSize(new Dimension(360, 30)); titleArea.setPreferredSize(new Dimension(360, 30));

10
designer/src/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java

@ -15,7 +15,7 @@ import java.awt.*;
public class PluginPreviewPane extends JPanel { public class PluginPreviewPane extends JPanel {
public PluginPreviewPane(String title, Image image, String version, String jartime, CellType type, int price) { public PluginPreviewPane(String title, Image image, String version, String jartime, CellType type, int price) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(50,0,0,0)); setBorder(BorderFactory.createEmptyBorder(50, 0, 0, 0));
setBackground(Color.white); setBackground(Color.white);
UILabel imageLabel = new UILabel(); UILabel imageLabel = new UILabel();
image = image.getScaledInstance(200, 200, Image.SCALE_SMOOTH); image = image.getScaledInstance(200, 200, Image.SCALE_SMOOTH);
@ -26,17 +26,17 @@ public class PluginPreviewPane extends JPanel {
nameLabel.setBackground(Color.yellow); nameLabel.setBackground(Color.yellow);
nameLabel.setHorizontalAlignment(SwingConstants.CENTER); nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
JPanel line = new JPanel(); JPanel line = new JPanel();
line.setPreferredSize(new Dimension(200,1)); line.setPreferredSize(new Dimension(200, 1));
line.setBackground(AlphaFineConstants.GRAY); line.setBackground(AlphaFineConstants.GRAY);
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(Color.white); panel.setBackground(Color.white);
JPanel bottomPane = new JPanel(new BorderLayout()); JPanel bottomPane = new JPanel(new BorderLayout());
bottomPane.setBackground(Color.white); bottomPane.setBackground(Color.white);
bottomPane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); bottomPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
if (type == CellType.PLUGIN) { if (type == CellType.PLUGIN) {
UILabel versionLabel = new UILabel("V" + version); UILabel versionLabel = new UILabel("V" + version);
versionLabel.setHorizontalAlignment(SwingConstants.CENTER); versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
versionLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); versionLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
versionLabel.setForeground(AlphaFineConstants.DARK_GRAY); versionLabel.setForeground(AlphaFineConstants.DARK_GRAY);
versionLabel.setFont(AlphaFineConstants.MEDIUM_FONT); versionLabel.setFont(AlphaFineConstants.MEDIUM_FONT);
panel.add(versionLabel, BorderLayout.CENTER); panel.add(versionLabel, BorderLayout.CENTER);
@ -47,7 +47,7 @@ public class PluginPreviewPane extends JPanel {
} }
nameLabel.setFont(AlphaFineConstants.LARGE_FONT); nameLabel.setFont(AlphaFineConstants.LARGE_FONT);
nameLabel.setBackground(AlphaFineConstants.BLUE); nameLabel.setBackground(AlphaFineConstants.BLUE);
nameLabel.setBorder(BorderFactory.createEmptyBorder(20,20,10,20)); nameLabel.setBorder(BorderFactory.createEmptyBorder(20, 20, 10, 20));
line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0)); line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));
String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price); String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price);
UILabel priceLabel = new UILabel(price0); UILabel priceLabel = new UILabel(price0);

82
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -1,16 +1,17 @@
package com.fr.design.mainframe.alphafine.search.manager; package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel; import com.fr.design.mainframe.toolbar.UpdateActionModel;
import com.fr.general.FRLogger; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import java.util.List; import java.util.List;
@ -18,6 +19,7 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class ActionSearchManager implements AlphaFineSearchProcessor { public class ActionSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION);
private static ActionSearchManager actionSearchManager = null; private static ActionSearchManager actionSearchManager = null;
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
@ -30,34 +32,58 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
return actionSearchManager; return actionSearchManager;
} }
/**
* 根据类名获取对象
*
* @param actionName
* @return
*/
public static ActionModel getModelFromCloud(String actionName) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
if (ComparatorUtils.equals(actionName, updateActionModel.getClassName())) {
return new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction());
}
}
return null;
}
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
filterModelList = new SearchResult(); filterModelList = new SearchResult();
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (updateActionModel.getActionName() != null) { if (StringUtils.isNotBlank(updateActionModel.getSearchKey())) {
if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) { if (updateActionModel.getSearchKey().contains(searchText) && updateActionModel.getAction().isEnabled()) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
} }
} }
} }
if (filterModelList != null && filterModelList.size() > 0) { SearchResult result = new SearchResult();
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size()); for (Object object : filterModelList) {
for (int i = 0; i < length; i++) { if (!AlphaFineHelper.getFilterResult().contains(object)) {
lessModelList.add(filterModelList.get(i)); result.add(object);
} }
for (int i = length; i < filterModelList.size(); i++) {
moreModelList.add(filterModelList.get(i)); }
} if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION)); if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); lessModelList.addAll(result);
} }
} else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION));
lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE));
moreModelList.addAll(result.subList(AlphaFineConstants.SHOW_SIZE, result.size()));
} }
} }
@ -68,26 +94,4 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
public SearchResult getMoreSearchResult() { public SearchResult getMoreSearchResult() {
return moreModelList; return moreModelList;
} }
/**
* 根据类名反射获取对象
* @param actionName
* @return
*/
public static ActionModel getModelFromCloud(String actionName ) {
UpdateAction action = null;
String name = null;
try {
Class<?> className = Class.forName(actionName);
action = (UpdateAction) className.newInstance();
name = action.getName();
} catch (ClassNotFoundException e) {
FRLogger.getLogger().error(e.getMessage());
} catch (IllegalAccessException e) {
FRLogger.getLogger().error(e.getMessage());
} catch (InstantiationException e) {
FRLogger.getLogger().error(e.getMessage());
}
return new ActionModel(name, action);
}
} }

2
designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaFineSearchProcessor.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
public interface AlphaFineSearchProcessor { public interface AlphaFineSearchProcessor {
/** /**
* 获取默认显示条数 * 获取默认显示条数
*
* @param searchText * @param searchText
* @return * @return
*/ */
@ -15,6 +16,7 @@ public interface AlphaFineSearchProcessor {
/** /**
* 获取剩余条数 * 获取剩余条数
*
* @return * @return
*/ */
SearchResult getMoreSearchResult(); SearchResult getMoreSearchResult();

69
designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java

@ -1,69 +0,0 @@
package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.Inter;
/**
* Created by XiaXiang on 2017/3/28.
*/
public class AlphaSearchManager implements AlphaFineSearchProcessor {
private static AlphaSearchManager searchManager;
private static PluginSearchManager pluginSearchManager;
private static DocumentSearchManager documentSearchManager;
private static FileSearchManager fileSearchManager;
private static ActionSearchManager actionSearchManager;
private static RecommendSearchManager recommendSearchManager;
private static RecentSearchManager recentSearchManager;
public synchronized static AlphaSearchManager getSearchManager() {
init();
return searchManager;
}
private synchronized static void init() {
if (searchManager == null) {
searchManager = new AlphaSearchManager();
pluginSearchManager = PluginSearchManager.getPluginSearchManager();
documentSearchManager = DocumentSearchManager.getDocumentSearchManager();
fileSearchManager = FileSearchManager.getFileSearchManager();
actionSearchManager = ActionSearchManager.getActionSearchManager();
recommendSearchManager = RecommendSearchManager.getRecommendSearchManager();
recentSearchManager = RecentSearchManager.getRecentSearchManger();
}
}
@Override
public synchronized SearchResult getLessSearchResult(String searchText) {
SearchResult recentModelList = recentSearchManager.getLessSearchResult(searchText);
SearchResult recommendModelList = recommendSearchManager.getLessSearchResult(searchText);
SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText);
SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText);
SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText);
SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText);
recentModelList.addAll(recommendModelList);
recentModelList.addAll(actionModelList);
recentModelList.addAll(fileModelList);
recentModelList.addAll(documentModelList);
recentModelList.addAll(pluginModelList);
return recentModelList;
}
public SearchResult showDefaultSearchResult() {
SearchResult searchResult = new SearchResult();
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest")));
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude")));
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_Set")));
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_Templates")));
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
searchResult.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
return searchResult;
}
@Override
public SearchResult getMoreSearchResult() {
return null;
}
}

76
designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
@ -12,11 +13,13 @@ import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
/** /**
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class DocumentSearchManager implements AlphaFineSearchProcessor { public class DocumentSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT);
private static DocumentSearchManager documentSearchManager = null; private static DocumentSearchManager documentSearchManager = null;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
@ -29,62 +32,81 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
return documentSearchManager; return documentSearchManager;
} }
/**
* 根据json信息获取文档model
*
* @param object
* @return
*/
public static DocumentModel getModelFromCloud(JSONObject object) {
String name = object.optString("title");
String content = object.optString("summary");
int documentId = object.optInt("did");
return new DocumentModel(name, content, documentId);
}
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainDocument()) { if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
String result; String result;
String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1"; String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1";
HttpClient httpClient = new HttpClient(url); HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000); httpClient.setTimeout(5000);
httpClient.asGet(); httpClient.asGet();
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return lessModelList; return getNoConnectList();
} }
result = httpClient.getResponseText(); result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try { try {
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("docdata"); JSONArray jsonArray = jsonObject.optJSONArray("docdata");
if (jsonArray != null && jsonArray.length() > 0) { if (jsonArray != null) {
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length()); SearchResult searchResult = new SearchResult();
for (int i = 0; i < length; i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i));
this.lessModelList.add(cellModel); if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
searchResult.add(cellModel);
}
} }
for (int i = length; i < jsonArray.length(); i++) { if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i)); lessModelList.add(0, TITLE_MODEL);
this.moreModelList.add(cellModel); if (searchResult.size() == 0) {
} lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT)); lessModelList.addAll(searchResult);
} else { }
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT)); } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.DOCUMENT));
lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE));
moreModelList.addAll(searchResult.subList(AlphaFineConstants.SHOW_SIZE, searchResult.size()));
} }
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error("document search error: " + e.getMessage());
return lessModelList; return lessModelList;
} }
} }
return lessModelList; return lessModelList;
} }
/** /**
* 根据json信息获取文档model * 无连接
* @param object *
* @return * @return
*/ */
public static DocumentModel getModelFromCloud(JSONObject object) { private SearchResult getNoConnectList() {
String name = object.optString("title"); SearchResult result = new SearchResult();
String content = object.optString("summary"); result.add(0, TITLE_MODEL);
int documentId = object.optInt("did"); result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return new DocumentModel(name, content, documentId); return result;
} }
@Override @Override

105
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -10,9 +10,11 @@ import com.fr.design.mainframe.alphafine.cell.model.FileModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import java.io.*; import java.io.*;
@ -23,11 +25,17 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class FileSearchManager implements AlphaFineSearchProcessor { public class FileSearchManager implements AlphaFineSearchProcessor {
private static final int MARK_LENGTH = 6;
private static final String DS_NAME = "dsname=\"";
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Templates"), CellType.FILE);
private static FileSearchManager fileSearchManager = null;
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
private List<FileNode> fileNodes = null; private List<FileNode> fileNodes = null;
private static FileSearchManager fileSearchManager = null; //隐藏的搜索功能,可根据特殊的字符标记判断搜索分类
private boolean isContainCpt = true;
private boolean isContainFrm = true;
public synchronized static FileSearchManager getFileSearchManager() { public synchronized static FileSearchManager getFileSearchManager() {
init(); init();
@ -40,13 +48,38 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} }
} }
/**
* 根据文件路径获取文件模型
*
* @param filePath
* @return
*/
public static FileModel getModelFromCloud(String filePath) {
String name = AlphaFineHelper.findFileName(filePath);
return new FileModel(name, filePath);
}
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
this.filterModelList = new SearchResult(); this.filterModelList = new SearchResult();
this.lessModelList = new SearchResult(); this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
if (searchText.startsWith("k:frm ")) {
isContainCpt = false;
searchText = searchText.substring(MARK_LENGTH, searchText.length());
} else if (searchText.startsWith("k:cpt ")) {
isContainFrm = false;
searchText = searchText.substring(MARK_LENGTH, searchText.length());
}
if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) {
lessModelList.add(TITLE_MODEL);
return lessModelList;
}
Env env = FRContext.getCurrentEnv(); Env env = FRContext.getCurrentEnv();
fileNodes = new ArrayList<>(); fileNodes = new ArrayList<>();
fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true);
isContainCpt = true;
isContainFrm = true;
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {
boolean isAlreadyContain = false; boolean isAlreadyContain = false;
String fileEnvPath = node.getEnvPath(); String fileEnvPath = node.getEnvPath();
@ -55,36 +88,43 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
searchFileContent(searchText, node, isAlreadyContain, filePath); searchFileContent(searchText, node, isAlreadyContain, filePath);
} }
SearchResult result = new SearchResult();
for (Object object : filterModelList) {
if (!AlphaFineHelper.getFilterResult().contains(object)) {
result.add(object);
}
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size());
for (int i = 0; i < length; i++) {
lessModelList.add(filterModelList.get(i));
}
for (int i = length; i< filterModelList.size(); i++) {
moreModelList.add(filterModelList.get(i));
} }
if (filterModelList.size() > 0) { if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { lessModelList.add(0, TITLE_MODEL);
lessModelList.add(0,new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.FILE)); if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {
lessModelList.add(0,new MoreModel(Inter.getLocText("FR-Designer_Templates"), CellType.FILE)); lessModelList.addAll(result);
} }
} else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE));
lessModelList.addAll(result.subList(0, AlphaFineConstants.SHOW_SIZE));
moreModelList.addAll(result.subList(AlphaFineConstants.SHOW_SIZE, result.size()));
} }
return this.lessModelList; return this.lessModelList;
} }
/** /**
* 搜索文件内容 * 搜索文件内容
*
* @param searchText * @param searchText
* @param node * @param node
* @param isAlreadyContain * @param isAlreadyContain
* @param filePath * @param filePath
*/ */
private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, String filePath) { private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, String filePath) {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainFileContent()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
try { try {
BufferedReader reader = new BufferedReader(new FileReader(filePath)); InputStreamReader isr = new InputStreamReader(new FileInputStream(new File(filePath)), "UTF-8");
BufferedReader reader = new BufferedReader(isr);
String line; String line;
int columnNumber; int columnNumber;
boolean isFoundInContent = false; boolean isFoundInContent = false;
@ -92,6 +132,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
columnNumber = line.toLowerCase().indexOf(searchText); columnNumber = line.toLowerCase().indexOf(searchText);
if (columnNumber != -1) { if (columnNumber != -1) {
isFoundInContent = true; isFoundInContent = true;
break;
} }
} }
if (isFoundInContent && !isAlreadyContain) { if (isFoundInContent && !isAlreadyContain) {
@ -109,14 +150,15 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
/** /**
* 搜索模板 * 搜索模板
*
* @param searchText * @param searchText
* @param node * @param node
* @param isAlreadyContain * @param isAlreadyContain
* @return * @return
*/ */
private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) { private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainTemplate()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
if (node.getName().toLowerCase().contains(searchText.toLowerCase())) { if (node.getName().toLowerCase().contains(searchText)) {
FileModel model = new FileModel(node.getName(), node.getEnvPath()); FileModel model = new FileModel(node.getName(), node.getEnvPath());
this.filterModelList.add(model); this.filterModelList.add(model);
isAlreadyContain = true; isAlreadyContain = true;
@ -132,6 +174,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
/** /**
* 获取工作目录下所有符合要求的模板 * 获取工作目录下所有符合要求的模板
*
* @param env * @param env
* @param rootFilePath * @param rootFilePath
* @param recurse * @param recurse
@ -142,13 +185,14 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
try { try {
listAll(env, rootFilePath, fileNodeList, recurse); listAll(env, rootFilePath, fileNodeList, recurse);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error("file search error: " + e.getMessage(), e);
} }
return fileNodeList; return fileNodeList;
} }
/** /**
* 获取当前工作目录下所有模板 * 获取当前工作目录下所有模板
*
* @param env * @param env
* @param rootFilePath * @param rootFilePath
* @param nodeList * @param nodeList
@ -165,20 +209,37 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} else { } else {
nodeList.add(fns[i]); nodeList.add(fns[i]);
} }
} else { } else if (isContainCpt && fileNode.isFileType("cpt")) {
nodeList.add(fileNode);
} else if (isContainFrm && fileNode.isFileType("frm")) {
nodeList.add(fileNode); nodeList.add(fileNode);
} }
} }
} }
/** /**
* 根据文件路径获取文件模型 * 是否包含cpt
* @param filePath *
* @return * @return
*/ */
public static FileModel getModelFromCloud(String filePath) { public boolean isContainCpt() {
String name = AlphaFineHelper.findFileName(filePath); return isContainCpt;
return new FileModel(name, filePath);
} }
public void setContainCpt(boolean containCpt) {
isContainCpt = containCpt;
}
/**
* 是否包含frm
*
* @return
*/
public boolean isContainFrm() {
return isContainFrm;
}
public void setContainFrm(boolean containFrm) {
isContainFrm = containFrm;
}
} }

127
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -2,16 +2,19 @@ package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -20,10 +23,12 @@ import java.net.URLEncoder;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class PluginSearchManager implements AlphaFineSearchProcessor { public class PluginSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN);
private static PluginSearchManager pluginSearchManager = null; private static PluginSearchManager pluginSearchManager = null;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
public synchronized static PluginSearchManager getPluginSearchManager() { public synchronized static PluginSearchManager getPluginSearchManager() {
if (pluginSearchManager == null) { if (pluginSearchManager == null) {
pluginSearchManager = new PluginSearchManager(); pluginSearchManager = new PluginSearchManager();
@ -32,58 +37,13 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
} }
@Override
public synchronized SearchResult getLessSearchResult(String searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainPlugin()) {
String result;
try {
String encodedKey = URLEncoder.encode(searchText, "UTF-8");
String url = AlphaFineConstants.PLUGIN_SEARCH_URL + "?keyword=" + encodedKey;
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return lessModelList;
}
result = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("result");
if (jsonArray != null && jsonArray.length() > 0) {
int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length());
for (int i = 0; i < length; i++) {
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
this.lessModelList.add(cellModel);
}
for (int i = length; i < jsonArray.length(); i++) {
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
this.moreModelList.add(cellModel);
}
if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.PLUGIN));
} else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), CellType.PLUGIN));
}
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
return lessModelList;
}
}
return this.lessModelList;
}
private static PluginModel getPluginModel(JSONObject object, boolean isFromCloud) { private static PluginModel getPluginModel(JSONObject object, boolean isFromCloud) {
String name = object.optString("name"); String name = object.optString("name");
String content = object.optString("description"); String content = object.optString("description");
int pluginId = object.optInt("id"); int pluginId = object.optInt("id");
String imageUrl = null; String imageUrl = null;
try { try {
imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); imageUrl = isFromCloud ? AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.optString("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8") : object.optString("pic");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
@ -92,7 +52,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
CellType type; CellType type;
String link = object.optString("link"); String link = object.optString("link");
if (ComparatorUtils.equals(link, "plugin")) { if (ComparatorUtils.equals(link, "plugin")) {
version = isFromCloud? object.optString("pluginversion") : object.optString("version"); version = isFromCloud ? object.optString("pluginversion") : object.optString("version");
jartime = object.optString("jartime"); jartime = object.optString("jartime");
type = CellType.PLUGIN; type = CellType.PLUGIN;
} else { } else {
@ -102,27 +62,84 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
return new PluginModel(name, content, imageUrl, version, jartime, link, type, price, pluginId); return new PluginModel(name, content, imageUrl, version, jartime, link, type, price, pluginId);
} }
@Override
public SearchResult getMoreSearchResult() {
return this.moreModelList;
}
/** /**
* 根据json获取对应的插件model * 根据json获取对应的插件model
*
* @param object * @param object
* @return * @return
*/ */
public static PluginModel getModelFromCloud(JSONObject object) { public static PluginModel getModelFromCloud(JSONObject object) {
JSONObject jsonObject = object.optJSONObject("result"); JSONObject jsonObject = object.optJSONObject("result");
if (jsonObject != null) { if (jsonObject != null) {
return getPluginModel(jsonObject, true); return getPluginModel(jsonObject, true);
} else { } else {
return getPluginModel(object, false); return getPluginModel(object, false);
} }
} }
@Override
public synchronized SearchResult getLessSearchResult(String searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
String result;
try {
String encodedKey = URLEncoder.encode(searchText, "UTF-8");
String url = AlphaFineConstants.PLUGIN_SEARCH_URL + "?keyword=" + encodedKey;
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return getNoConnectList();
}
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("result");
if (jsonArray != null) {
SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) {
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
searchResult.add(cellModel);
}
}
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
lessModelList.addAll(searchResult);
}
} else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.PLUGIN));
lessModelList.addAll(searchResult.subList(0, AlphaFineConstants.SHOW_SIZE));
moreModelList.addAll(searchResult.subList(AlphaFineConstants.SHOW_SIZE, searchResult.size()));
}
}
} catch (JSONException e) {
FRLogger.getLogger().error("plugin search json error :" + e.getMessage());
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error("plugin search encode error :" + e.getMessage());
}
}
return this.lessModelList;
}
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL);
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@Override
public SearchResult getMoreSearchResult() {
return this.moreModelList;
}
} }

70
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -3,7 +3,10 @@ package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
@ -24,10 +27,7 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created by XiaXiang on 2017/5/15. * Created by XiaXiang on 2017/5/15.
@ -38,11 +38,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
private static final int MAX_SIZE = 3; private static final int MAX_SIZE = 3;
private static RecentSearchManager recentSearchManager = null; private static RecentSearchManager recentSearchManager = null;
private static File recentFile = null; private static File recentFile = null;
private List<String> fileList;
private List<String> actionList;
private List<String> documentList;
private SearchResult modelList; private SearchResult modelList;
private List<String> pluginList;
private List<AlphaCellModel> recentModelList = new ArrayList<>(); private List<AlphaCellModel> recentModelList = new ArrayList<>();
private Map<String, List<AlphaCellModel>> recentKVModelMap = new HashMap<>(); private Map<String, List<AlphaCellModel>> recentKVModelMap = new HashMap<>();
@ -95,17 +91,19 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
} }
} }
private void addModelToList(List<AlphaCellModel> list, String name) { private void addModelToList(List<AlphaCellModel> list, String name) {
try { try {
AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name)); AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name));
if (model != null) { if (model != null) {
list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); list.add(model);
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
} }
@Override @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG); writer.startTAG(XML_TAG);
@ -135,40 +133,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
return "alphafine_recent.xml"; return "alphafine_recent.xml";
} }
public List<String> getFileList() {
return fileList;
}
public void setFileList(List<String> fileList) {
this.fileList = fileList;
}
public List<String> getActionList() {
return actionList;
}
public void setActionList(List<String> actionList) {
this.actionList = actionList;
}
public List<String> getDocumentList() {
return documentList;
}
public void setDocumentList(List<String> documentList) {
this.documentList = documentList;
}
public List<String> getPluginList() {
return pluginList;
}
public void setPluginList(List<String> pluginList) {
this.pluginList = pluginList;
}
/** /**
* 获取xml * 获取xml
*
* @return * @return
*/ */
private File getRecentFile() { private File getRecentFile() {
@ -183,12 +151,12 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
if (!envFile.exists()) { if (!envFile.exists()) {
createRecentFile(envFile); createRecentFile(envFile);
} }
return envFile; return envFile;
} }
/** /**
* 创建XML * 创建XML
*
* @param envFile * @param envFile
*/ */
private void createRecentFile(File envFile) { private void createRecentFile(File envFile) {
@ -244,19 +212,30 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
/** /**
* 根据搜索字段获取对应的model列表 * 根据搜索字段获取对应的model列表
*
* @param searchText * @param searchText
* @return * @return
*/ */
public List<AlphaCellModel> getRecentModelList(String searchText) { public synchronized List<AlphaCellModel> getRecentModelList(String searchText) {
recentModelList = new ArrayList<>(); recentModelList = new ArrayList<>();
for (String key : recentKVModelMap.keySet()) { for (String key : recentKVModelMap.keySet()) {
AlphaFineHelper.checkCancel();
if (ComparatorUtils.equals(key, searchText)) { if (ComparatorUtils.equals(key, searchText)) {
recentModelList = recentKVModelMap.get(searchText); recentModelList = recentKVModelMap.get(searchText);
int size = recentModelList.size(); List<AlphaCellModel> resultModelList = new ArrayList<>(recentModelList);
Iterator<AlphaCellModel> modelIterator = resultModelList.iterator();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
}
}
int size = resultModelList.size();
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
return recentModelList.subList(size - MAX_SIZE, size); return resultModelList.subList(size - MAX_SIZE, size);
} }
return recentModelList; return resultModelList;
} }
} }
return recentModelList; return recentModelList;
@ -264,6 +243,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
/** /**
* 将搜索结果加入到当前MAP中 * 将搜索结果加入到当前MAP中
*
* @param searchKey * @param searchKey
* @param cellModel * @param cellModel
*/ */

53
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -1,7 +1,10 @@
package com.fr.design.mainframe.alphafine.search.manager; package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
@ -13,14 +16,19 @@ import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/** /**
* Created by XiaXiang on 2017/3/31. * Created by XiaXiang on 2017/3/31.
*/ */
public class RecommendSearchManager implements AlphaFineSearchProcessor { public class RecommendSearchManager implements AlphaFineSearchProcessor {
private static RecommendSearchManager recommendSearchManager = null;
private SearchResult modelList;
//todo:for test //todo:for test
private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey="; private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey=";
private static RecommendSearchManager recommendSearchManager = null;
private SearchResult modelList;
private List<AlphaCellModel> recommendModelList = new ArrayList<>();
public synchronized static RecommendSearchManager getRecommendSearchManager() { public synchronized static RecommendSearchManager getRecommendSearchManager() {
if (recommendSearchManager == null) { if (recommendSearchManager == null) {
@ -28,46 +36,73 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
} }
return recommendSearchManager; return recommendSearchManager;
} }
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
this.modelList = new SearchResult(); this.modelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) { this.recommendModelList = new ArrayList<>();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
String result; String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet(); httpClient.asGet();
httpClient.setTimeout(5000); httpClient.setTimeout(5000);
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {
return modelList; return getNoConnectList();
} }
result = httpClient.getResponseText(); result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try { try {
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
if (jsonObject.optString("status").equals("success")) { if (jsonObject.optString("status").equals("success")) {
JSONArray jsonArray = jsonObject.optJSONArray("result"); JSONArray jsonArray = jsonObject.optJSONArray("result");
if (jsonArray != null && jsonArray.length() > 0) { if (jsonArray != null && jsonArray.length() > 0) {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { if (alphaCellModel != null && !RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) {
this.modelList.add(alphaCellModel); this.recommendModelList.add(alphaCellModel);
} }
} }
} }
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error("data transform error! :" + e.getMessage()); FRLogger.getLogger().error("recommend search error! :" + e.getMessage());
}
Iterator<AlphaCellModel> modelIterator = recommendModelList.iterator();
while (modelIterator.hasNext()) {
AlphaCellModel model = modelIterator.next();
if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) {
modelIterator.remove();
}
} }
if (modelList.size() > 0) { if (recommendModelList.size() > 0) {
modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));
modelList.addAll(recommendModelList);
} }
} }
return modelList; return modelList;
} }
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@Override @Override
public SearchResult getMoreSearchResult() { public SearchResult getMoreSearchResult() {
return new SearchResult(); return new SearchResult();
} }
public List<AlphaCellModel> getRecommendModelList() {
return recommendModelList;
}
public void setRecommendModelList(List<AlphaCellModel> recommendModelList) {
this.recommendModelList = recommendModelList;
}
} }

5
designer/src/com/fr/design/module/DesignerModule.java

@ -234,6 +234,11 @@ public class DesignerModule extends DesignModule {
public void process() { public void process() {
} }
@Override
public void undo() {
}
} }
@Override @Override

17
designer/src/com/fr/design/report/UnitFieldPane.java

@ -6,6 +6,8 @@ package com.fr.design.report;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSpinner; import javax.swing.JSpinner;
@ -41,13 +43,13 @@ public class UnitFieldPane extends JPanel {
} }
public void setUnitType(int unitType) { public void setUnitType(int unitType) {
if (unitType == Constants.UNIT_CM) { if (unitType == Constants.UNIT_CM) {
this.setText(Inter.getLocText("Unit_CM")); this.setText(Inter.getLocText("FR-Designer_Unit_CM"));
} else if (unitType == Constants.UNIT_INCH) { } else if (unitType == Constants.UNIT_INCH) {
this.setText(Inter.getLocText("PageSetup-inches")); this.setText(Inter.getLocText("FR-Designer_Unit_INCH"));
} else { } else {
this.setText(Inter.getLocText("PageSetup-mm")); this.setText(Inter.getLocText("FR-Designer_Unit_MM-mm"));
} }
//ajust the heigt of unitLabel. //ajust the heigt of unitLabel.
Dimension unitDimension = new Dimension(this.getPreferredSize().width, Dimension unitDimension = new Dimension(this.getPreferredSize().width,
@ -67,6 +69,7 @@ public class UnitFieldPane extends JPanel {
valueSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); valueSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
textField = ((JSpinner.DefaultEditor) valueSpinner.getEditor()).getTextField(); textField = ((JSpinner.DefaultEditor) valueSpinner.getEditor()).getTextField();
textField.setColumns(4); textField.setColumns(4);
InputEventBaseOnOS.addBasicEditInputMap(textField);
this.add(valueSpinner); this.add(valueSpinner);
unitLable = new UnitLabel(unitType, valueSpinner.getPreferredSize().height); unitLable = new UnitLabel(unitType, valueSpinner.getPreferredSize().height);
this.add(unitLable); this.add(unitLable);

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

@ -4,6 +4,7 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
@ -12,7 +13,6 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
@ -33,7 +33,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
//TODO 表单 //TODO 表单
// private FormToolBarPane formPane; // private FormToolBarPane formPane;
private WriteToolBarPane writePane; private WriteToolBarPane writePane;
private ReportWebAttr webAttr ; private ReportWebAttr webAttr;
private WebCssPane cssPane; private WebCssPane cssPane;
@ -43,7 +43,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
@Override @Override
protected void initComponents(JPanel container) { protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container; JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout()); defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());

11
designer/src/com/fr/design/webattr/ReportWebAttrPane.java

@ -3,18 +3,17 @@
*/ */
package com.fr.design.webattr; package com.fr.design.webattr;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundPane;
import com.fr.design.style.background.BackgroundPane4Browser; import com.fr.design.style.background.BackgroundPane4Browser;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.style.background.BackgroundPane;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.*;
import java.awt.*;
/** /**
* ReportWebAttr Dialog * ReportWebAttr Dialog
*/ */
@ -37,7 +36,7 @@ public class ReportWebAttrPane extends LoadingBasicPane {
@Override @Override
protected void initComponents(JPanel container) { protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container; JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout()); defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());

2
designer/src/com/fr/design/webattr/ReportWriteAttrPane.java

@ -25,7 +25,7 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
} }
@Override @Override
protected void initComponents(JPanel container) { protected synchronized void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout()); container.setLayout(FRGUIPaneFactory.createBorderLayout());
final UITabbedPane tabbedPane = new UITabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); final UITabbedPane tabbedPane = new UITabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
container.add(tabbedPane, BorderLayout.CENTER); container.add(tabbedPane, BorderLayout.CENTER);

2
designer/src/com/fr/start/Designer.java

@ -346,7 +346,7 @@ public class Designer extends BaseDesigner {
* @return 面板组件 * @return 面板组件
*/ */
public Component createAlphafinePane() { public Component createAlphafinePane() {
return AlphaFinePane.createAlphaFinePane(); return AlphaFinePane.getAlphaFinePane();
} }

25
designer_base/build.9.0.gradle

@ -1,3 +1,4 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
@ -35,15 +36,21 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
// delete(dir:"src/main")
sourceSets{ mkdir(dir:"src/main/java")
main{ move(todir:"src/main/java"){
java{ fileset(dir:"src",includes:"com/**")
srcDirs=["${srcDir}/src"]
}
} }
} }
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src"]
// }
// }
//}
// //
FileTree files =fileTree(dir:'./',include:'build.*.gradle') FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -59,7 +66,7 @@ dependencies{
//.java文件到classes文件夹下参与打包 //.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){ task copyFile(type:Copy,dependsOn:compileJava){
copy{ copy{
from ("${srcDir}/src"){ from ("${srcDir}/src/main/java"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
} }
into 'build/classes/main' into 'build/classes/main'
@ -76,7 +83,7 @@ task compressJS{
} }
} }
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }

35
designer_base/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java' apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本
@ -15,7 +36,13 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"src",includes:"com/**")
}
}
// //
sourceSets{ sourceSets{
main{ main{
@ -39,7 +66,7 @@ dependencies{
//.java文件到classes文件夹下参与打包 //.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){ task copyFile(type:Copy,dependsOn:compileJava){
copy{ copy{
from ("${srcDir}/src"){ from ("${srcDir}/src/main/java"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
} }
into 'build/classes/main' into 'build/classes/main'
@ -56,7 +83,7 @@ task compressJS{
} }
} }
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }

4
designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj

@ -1,7 +1,7 @@
package com.fr.aspectj.designerbase; package com.fr.aspectj.designerbase;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphafineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.help.alphafine.RemindDialog; import com.fr.design.actions.help.alphafine.RemindDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -30,7 +30,7 @@ public aspect AlphaFineReminder {
* 判断是否弹出广告框 * 判断是否弹出广告框
*/ */
private static void remind() { private static void remind() {
AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (manager.isNeedRemind()) { if (manager.isNeedRemind()) {
if (manager.getOperateCount() > 4) { if (manager.getOperateCount() > 4) {

23
designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java

@ -2,9 +2,13 @@ package com.fr.common.inputevent;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Created by hzzz on 2017/5/26. * Created by hzzz on 2017/5/26.
*/ */
@ -18,4 +22,23 @@ public class InputEventBaseOnOS {
public static boolean isControlDown(KeyEvent e) { public static boolean isControlDown(KeyEvent e) {
return IS_MACOS ? e.isMetaDown() : e.isControlDown(); return IS_MACOS ? e.isMetaDown() : e.isControlDown();
} }
public static void addBasicEditInputMap(JComponent jComponent) {
InputMap inputMap = jComponent.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
}
} }

18
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -5,7 +5,7 @@ package com.fr.design;
import com.fr.base.*; import com.fr.base.*;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.actions.help.alphafine.AlphafineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;
@ -108,7 +108,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/** /**
* alphafine * alphafine
*/ */
private AlphafineConfigManager alphafineConfigManager = new AlphafineConfigManager(); private AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
public static final String CAS_CERTIFICATE_PATH = "certificatePath"; public static final String CAS_CERTIFICATE_PATH = "certificatePath";
@ -1344,7 +1344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
private void readAlphaFineAttr(XMLableReader reader) { private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphafineConfigManager = new AlphafineConfigManager()); reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager());
} }
private void readHttpsParas(XMLableReader reader){ private void readHttpsParas(XMLableReader reader){
@ -1551,8 +1551,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
private void writeAlphaFineAttr(XMLPrintWriter writer) { private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphafineConfigManager != null) { if (this.alphaFineConfigManager != null) {
this.alphafineConfigManager.writeXML(writer); this.alphaFineConfigManager.writeXML(writer);
} }
} }
@ -1830,11 +1830,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return env; return env;
} }
public AlphafineConfigManager getAlphafineConfigManager() { public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphafineConfigManager; return alphaFineConfigManager;
} }
public void setAlphafineConfigManager(AlphafineConfigManager alphafineConfigManager) { public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphafineConfigManager = alphafineConfigManager; this.alphaFineConfigManager = alphaFineConfigManager;
} }
} }

116
designer_base/src/com/fr/design/actions/UpdateAction.java

@ -15,8 +15,12 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@ -50,6 +54,10 @@ public abstract class UpdateAction extends ShortCut implements Action {
*/ */
private Map<String, Object> componentMap; private Map<String, Object> componentMap;
private String searchText = StringUtils.EMPTY;
/** /**
* Constructor * Constructor
*/ */
@ -425,4 +433,112 @@ public abstract class UpdateAction extends ShortCut implements Action {
return menuItem; return menuItem;
} }
public void setSearchText(JPanel panel) {
this.searchText = getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer());
}
/**
* 获取搜索匹配字符串
* @return
*/
public String getSearchText() {
return searchText;
}
/**
* 遍历面板中所有控件,获取text用于alphafine的action搜索,考虑分词拼音首字母检索
* @param panel
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
* @return
*/
public String getComponentTexts(JPanel panel, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) {
Border border = panel.getBorder();
if (border instanceof TitledBorder) {
String title = ((TitledBorder) border).getTitle();
text.append(title).append(separator);
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE)).append(separator);
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
Component[] components = panel.getComponents();
for (Component component : components) {
if (component instanceof JPanel) {
getComponentTexts((JPanel) component, separator, text, pinyin, shortPinyin);
} else if (component instanceof JScrollPane) {
Component childComponent = ((JScrollPane) component).getViewport().getView();
if (childComponent instanceof JPanel) {
getComponentTexts((JPanel) childComponent, separator, text, pinyin, shortPinyin);
}
} else if (component instanceof JLabel) {
String title = ((JLabel) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JCheckBox) {
String title = ((JCheckBox) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JButton) {
String title = ((JButton) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JRadioButton) {
String title = ((JRadioButton) component).getText();
handleSearchText(separator, text, pinyin, shortPinyin, title);
} else if (component instanceof JComboBox) {
for (int i = 0; i < ((JComboBox) component).getItemCount(); i++) {
text.append(((JComboBox) component).getItemAt(i));
String title = String.valueOf(((JComboBox) component).getItemAt(i));
handleSearchText(separator, text, pinyin, shortPinyin, title);
}
} else if (component instanceof JTabbedPane) {
getTabPaneTexts((JTabbedPane) component, separator, text, pinyin, shortPinyin);
}
}
return String.valueOf(text.append(pinyin).append(shortPinyin));
}
/**
* 递归遍历tabbedPane
* @param component
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
*/
private synchronized void getTabPaneTexts(JTabbedPane component, String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin) {
for (int i = 0; i < component.getTabCount(); i++) {
String title = component.getTitleAt(i);
handleSearchText(separator, text, pinyin, shortPinyin, title);
Component tabComponent = component.getComponentAt(i);
if (tabComponent instanceof JPanel) {
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} else if (tabComponent instanceof JTabbedPane) {
getTabPaneTexts((JTabbedPane) tabComponent, separator, text, pinyin, shortPinyin);
}
}
}
/**
* 将text,pinyin,pinyin首字母拼接到一起
* @param separator
* @param text
* @param pinyin
* @param shortPinyin
* @param title
*/
private void handleSearchText(String separator, StringBuffer text, StringBuffer pinyin, StringBuffer shortPinyin, String title) {
if (StringUtils.isBlank(title)) {
return;
}
text.append(title).append(separator);
pinyin.append(PinyinHelper.convertToPinyinString(title, "", PinyinFormat.WITHOUT_TONE));
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
} }

56
designer_base/src/com/fr/design/actions/file/PreferenceAction.java

@ -1,47 +1,49 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import java.awt.event.ActionEvent;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import java.awt.event.ActionEvent;
public class PreferenceAction extends UpdateAction { public class PreferenceAction extends UpdateAction {
public PreferenceAction() { public PreferenceAction() {
this.setMenuKeySet(KeySetUtils.PREFERENCE); this.setMenuKeySet(KeySetUtils.PREFERENCE);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
} this.setSearchText(new PreferencePane());
}
/** /**
* 动作 * 动作
*
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final PreferencePane preferencePane = new PreferencePane(); final PreferencePane preferencePane = new PreferencePane();
preferencePane.populate(DesignerEnvManager.getEnvManager()); preferencePane.populate(DesignerEnvManager.getEnvManager());
BasicDialog basicDialog = preferencePane.showWindow(designerFrame); BasicDialog basicDialog = preferencePane.showWindow(designerFrame);
basicDialog.addDialogActionListener(new DialogActionAdapter() { basicDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
preferencePane.update(DesignerEnvManager.getEnvManager()); preferencePane.update(DesignerEnvManager.getEnvManager());
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jt.refreshToolArea(); jt.refreshToolArea();
preferencePane.showRestartDialog(); preferencePane.showRestartDialog();
} }
}); });
basicDialog.setVisible(true); basicDialog.setVisible(true);
} }
} }

3
designer_base/src/com/fr/design/actions/help/AboutAction.java

@ -47,4 +47,7 @@ public class AboutAction extends UpdateAction {
return null; return null;
} }
}; };
} }

24
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.BaseUtils; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -9,6 +9,7 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -16,12 +17,13 @@ import java.awt.event.ActionEvent;
/** /**
* Created by XiaXiang on 2017/4/1. * Created by XiaXiang on 2017/4/1.
*/ */
public class AlphafineAction extends UpdateAction { public class AlphaFineAction extends UpdateAction {
public AlphafineAction() { public AlphaFineAction() {
this.setMenuKeySet(ALPHAFINE); this.setMenuKeySet(ALPHAFINE);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
this.setSearchText(new AlphaFineConfigPane());
} }
public static final MenuKeySet ALPHAFINE = new MenuKeySet() { public static final MenuKeySet ALPHAFINE = new MenuKeySet() {
@ -47,15 +49,19 @@ public class AlphafineAction extends UpdateAction {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final AlphafineConfigPane alphafineConfigPane = new AlphafineConfigPane(); final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane();
alphafineConfigPane.populate(DesignerEnvManager.getEnvManager().getAlphafineConfigManager()); final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!FRContext.isChineseEnv()) {
manager.setSearchOnLine(false);
}
alphaFineConfigPane.populate(manager);
DialogActionListener dialogActionListener = new DialogActionAdapter() { DialogActionListener dialogActionListener = new DialogActionAdapter() {
public void doOk() { public void doOk() {
alphafineConfigPane.update(); alphaFineConfigPane.update();
designerFrame.refreshToolbar(); AlphaFineContext.fireAlphaFineEnable(manager.isEnabled());
} }
}; };
BasicDialog basicDialog = alphafineConfigPane.showMediumWindow(designerFrame, dialogActionListener); BasicDialog basicDialog = alphaFineConfigPane.showMediumWindow(designerFrame, dialogActionListener);
basicDialog.setVisible(true); basicDialog.setVisible(true);
} }
} }

9
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -11,7 +11,7 @@ import javax.swing.*;
/** /**
* Created by XiaXiang on 2017/4/5. * Created by XiaXiang on 2017/4/5.
*/ */
public class AlphafineConfigManager implements XMLable { public class AlphaFineConfigManager implements XMLable {
/** /**
* 是否开启alphafine * 是否开启alphafine
@ -80,10 +80,10 @@ public class AlphafineConfigManager implements XMLable {
private static AlphafineConfigManager alphafineConfigManager = new AlphafineConfigManager(); private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
public static AlphafineConfigManager getInstance() { public static AlphaFineConfigManager getInstance() {
return alphafineConfigManager; return alphaFineConfigManager;
} }
@Override @Override
@ -95,6 +95,7 @@ public class AlphafineConfigManager implements XMLable {
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (reader.isAttr()) { if (reader.isAttr()) {
this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); this.setEnabled(reader.getAttrAsBoolean("isEnabled", true));
this.setSearchOnLine(reader.getAttrAsBoolean("isSearchOnline", true));
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true)); this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));

65
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigPane.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -20,7 +21,7 @@ import java.awt.event.KeyEvent;
/** /**
* Created by XiaXiang on 2017/4/6. * Created by XiaXiang on 2017/4/6.
*/ */
public class AlphafineConfigPane extends BasicPane { public class AlphaFineConfigPane extends BasicPane {
private static final String TYPE = "pressed"; private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+"; private static final String DISPLAY_TYPE = "+";
private static final String BACK_SLASH = "BACK_SLASH"; private static final String BACK_SLASH = "BACK_SLASH";
@ -56,7 +57,7 @@ public class AlphafineConfigPane extends BasicPane {
private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox;
private UITextField shortcutsField; private UITextField shortcutsField;
public AlphafineConfigPane() { public AlphaFineConfigPane() {
this.initComponents(); this.initComponents();
} }
@ -71,7 +72,7 @@ public class AlphafineConfigPane extends BasicPane {
} }
private Component[][] initsearchRangeComponents() { private Component[][] initSearchRangeComponents() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox},
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox}
@ -85,13 +86,13 @@ public class AlphafineConfigPane extends BasicPane {
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange")); JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange"));
isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude")); isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Recommend"));
isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set")); isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set"));
isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon")); isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon"));
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates")); isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates"));
isContainFileContentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates_Content")); isContainFileContentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates_Content"));
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initsearchRangeComponents(), rowSize, columnSize); JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize);
northPane.add(searchConfigPane); northPane.add(searchConfigPane);
contentPane.add(northPane); contentPane.add(northPane);
} }
@ -154,34 +155,36 @@ public class AlphafineConfigPane extends BasicPane {
return "AlphaFine"; return "AlphaFine";
} }
public void populate(AlphafineConfigManager alphafineConfigManager) { public void populate(AlphaFineConfigManager alphaFineConfigManager) {
this.isEnabledCheckbox.setSelected(alphafineConfigManager.isEnabled()); this.isEnabledCheckbox.setSelected(alphaFineConfigManager.isEnabled());
this.isSearchOnlineCheckbox.setSelected(alphafineConfigManager.isSearchOnLine()); this.isSearchOnlineCheckbox.setEnabled(FRContext.isChineseEnv());
this.isContainActionCheckbox.setSelected(alphafineConfigManager.isContainAction()); this.isSearchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine());
this.isContainTemplateCheckbox.setSelected(alphafineConfigManager.isContainTemplate()); this.isContainActionCheckbox.setSelected(alphaFineConfigManager.isContainAction());
this.isContainDocumentCheckbox.setSelected(alphafineConfigManager.isContainDocument() && alphafineConfigManager.isSearchOnLine()); this.isContainTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate());
this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); this.isContainDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainDocumentCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts())); this.isContainRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine());
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); this.isContainRecommendCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
} }
public void update() { public void update() {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
AlphafineConfigManager alphafineConfigManager = designerEnvManager.getAlphafineConfigManager(); AlphaFineConfigManager alphaFineConfigManager = designerEnvManager.getAlphaFineConfigManager();
alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); alphaFineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected());
alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); alphaFineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected());
alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); alphaFineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected());
alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); alphaFineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected());
alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); alphaFineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected());
alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); alphaFineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected());
alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); alphaFineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected());
alphafineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected()); alphaFineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected());
alphafineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
designerEnvManager.setAlphafineConfigManager(alphafineConfigManager); designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager);
try { try {
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
@ -192,8 +195,8 @@ public class AlphafineConfigPane extends BasicPane {
} }
private String getDisplayShortCut(String shotrCut) { private String getDisplayShortCut(String shortCut) {
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) return shortCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH)
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET)
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE)
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND); .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND);

40
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineContext.java

@ -0,0 +1,40 @@
package com.fr.design.actions.help.alphafine;
import java.util.ArrayList;
import java.util.List;
/**
* Created by XiaXiang on 2017/5/27.
*/
public class AlphaFineContext {
private static List<AlphaFineListener> fireAlphaFineListener = new ArrayList<AlphaFineListener>();
/**
* 触发AlphaFine弹窗
*/
public static void fireAlphaFineShowDialog() {
for (AlphaFineListener l : fireAlphaFineListener) {
l.showDialog();
}
}
/**
* 触发开启或关闭AlphaFine功能
* @param isEnable
*/
public static void fireAlphaFineEnable(boolean isEnable) {
for (AlphaFineListener l : fireAlphaFineListener) {
l.setEnable(isEnable);
}
}
/**
* 添加一个AlphaFine的监听事件
*
* @param l AlphaFine监听事件
*/
public static void addAlphaFineListener(AlphaFineListener l) {
fireAlphaFineListener.add(l);
}
}

18
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineListener.java

@ -0,0 +1,18 @@
package com.fr.design.actions.help.alphafine;
/**
* Created by XiaXiang on 2017/5/27.
* AlphaFine监听器
*/
public interface AlphaFineListener {
/**
* 显示dialog
*/
void showDialog();
/**
* 设置可用性
* @param isEnable
*/
void setEnable(boolean isEnable);
}

29
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java

@ -1,29 +0,0 @@
package com.fr.design.actions.help.alphafine;
import java.util.ArrayList;
import java.util.List;
/**
* Created by XiaXiang on 2017/5/27.
*/
public class AlphafineContext {
private static List<AlphafineListener> fireLoginContextListener = new ArrayList<AlphafineListener>();
/**
* 触发AlphaFine弹窗
*/
public static void fireAlphaFineContextListener() {
for (AlphafineListener l : fireLoginContextListener) {
l.showDialog();
}
}
/**
* 添加一个弹出AlphaFine的监听事件
*
* @param l AlphaFine框弹出监听事件
*/
public static void addAlphafineContextListener(AlphafineListener l) {
fireLoginContextListener.add(l);
}
}

8
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java

@ -1,8 +0,0 @@
package com.fr.design.actions.help.alphafine;
/**
* Created by XiaXiang on 2017/5/27.
*/
public interface AlphafineListener {
void showDialog();
}

3
designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java

@ -8,6 +8,7 @@ import java.awt.*;
/** /**
* Created by XiaXiang on 2017/5/26. * Created by XiaXiang on 2017/5/26.
* 提示弹窗
*/ */
public class RemindDialog extends UIDialog { public class RemindDialog extends UIDialog {
private RemindPane remindPane; private RemindPane remindPane;
@ -22,7 +23,7 @@ public class RemindDialog extends UIDialog {
} }
private void initComponent() { private void initComponent() {
final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager(); final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
remindPane = new RemindPane(manager, this); remindPane = new RemindPane(manager, this);
this.add(remindPane); this.add(remindPane);

6
designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java

@ -42,7 +42,7 @@ public class RemindPane extends JPanel {
} }
}; };
public RemindPane(AlphafineConfigManager manager, UIDialog remindDialog) { public RemindPane(AlphaFineConfigManager manager, UIDialog remindDialog) {
this.setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
initUI(manager, remindDialog); initUI(manager, remindDialog);
this.setLayout(getAbsoluteLayout()); this.setLayout(getAbsoluteLayout());
@ -53,7 +53,7 @@ public class RemindPane extends JPanel {
* @param manager * @param manager
* @param dialog * @param dialog
*/ */
private void initUI(final AlphafineConfigManager manager, final UIDialog dialog) { private void initUI(final AlphaFineConfigManager manager, final UIDialog dialog) {
openButton = new UIButton(); openButton = new UIButton();
openButton.setIcon(openIcon); openButton.setIcon(openIcon);
@ -63,7 +63,7 @@ public class RemindPane extends JPanel {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
manager.setOperateCount(0); manager.setOperateCount(0);
dialog.dispose(); dialog.dispose();
AlphafineContext.fireAlphaFineContextListener(); AlphaFineContext.fireAlphaFineShowDialog();
} }
}); });

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

@ -1,6 +1,5 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ModifiedTable; import com.fr.base.ModifiedTable;
@ -9,6 +8,7 @@ import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane; import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -16,6 +16,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -31,7 +32,8 @@ public class ConnectionListAction extends UpdateAction {
this.setMenuKeySet(DEFINE_DATA_CONNECTION); this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
this.setSearchText(new DatabaseConnectionPane.JDBC());
} }
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() { public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {

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

@ -14,6 +14,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.FunctionManager; import com.fr.file.FunctionManager;
import com.fr.file.FunctionManagerProvider; import com.fr.file.FunctionManagerProvider;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -28,7 +29,8 @@ public class FunctionManagerAction extends UpdateAction {
this.setMenuKeySet(FUNCTION_MANAGER); this.setMenuKeySet(FUNCTION_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/function.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/function.png"));
this.setSearchText(new FunctionManagerPane());
} }
/** /**

29
designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -5,20 +5,15 @@ import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.*; import com.fr.data.impl.*;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.tabledata.tabledatapane.*; import com.fr.design.data.tabledata.tabledatapane.*;
import com.fr.design.fun.TableDataCreatorProvider;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
/** /**
@ -33,6 +28,8 @@ public abstract class TableDataFactory {
*/ */
private static Map<String, TableDataNameObjectCreator> map = new java.util.LinkedHashMap<String, TableDataNameObjectCreator>(); private static Map<String, TableDataNameObjectCreator> map = new java.util.LinkedHashMap<String, TableDataNameObjectCreator>();
private static Map<String, TableDataNameObjectCreator> extraMap = new LinkedHashMap<>();
/** /**
* 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了 * 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了
*/ */
@ -54,11 +51,27 @@ public abstract class TableDataFactory {
* @param clazz 数据集类 * @param clazz 数据集类
* @param creator 组件 * @param creator 组件
*/ */
public static void register(Class<? extends TableData> clazz, TableDataNameObjectCreator creator) { public static void registerExtra(Class<? extends TableData> clazz, TableDataNameObjectCreator creator) {
map.put(clazz.getName(), creator);
extraMap.put(clazz.getName(), creator);
}
public static void removeExtra(Class<? extends TableData> clazz) {
extraMap.remove(clazz.getName());
} }
private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) { private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) {
TableDataNameObjectCreator creator = getFrom(tabledata, extraMap);
if (creator == null) {
creator = getFrom(tabledata, map);
}
return creator;
}
private static TableDataNameObjectCreator getFrom(TableData tabledata, Map<String, TableDataNameObjectCreator> map) {
TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName()); TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName());
if (tableDataNameObjectCreator == null) { if (tableDataNameObjectCreator == null) {
tableDataNameObjectCreator = map.get(tabledata.getClass().getSuperclass().getName()); tableDataNameObjectCreator = map.get(tabledata.getClass().getSuperclass().getName());

8
designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java

@ -34,6 +34,12 @@ public abstract class AbstractServerTableDataDefineProvider extends AbstractProv
classForInitTableData(), classForInitTableData(),
appearanceForTableData() appearanceForTableData()
); );
TableDataFactory.register(classForTableData(), creator); TableDataFactory.registerExtra(classForTableData(), creator);
}
@Override
public void undo() {
TableDataFactory.removeExtra(classForTableData());
} }
} }

8
designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java

@ -34,6 +34,12 @@ public abstract class AbstractTableDataDefineProvider extends AbstractProvider i
classForInitTableData(), classForInitTableData(),
appearanceForTableData() appearanceForTableData()
); );
TableDataFactory.register(classForTableData(), creator); TableDataFactory.registerExtra(classForTableData(), creator);
}
@Override
public void undo() {
TableDataFactory.removeExtra(classForTableData());
} }
} }

109
designer_base/src/com/fr/design/fun/impl/GlobalListenerProviderManager.java

@ -0,0 +1,109 @@
package com.fr.design.fun.impl;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GlobalListenerProvider;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by juhaoyu on 2017/6/15.
* 管理正在运行中插件的GlobalListenerProvider接口
*/
public class GlobalListenerProviderManager {
private static final GlobalListenerProviderManager INSTANCE = new GlobalListenerProviderManager();
private Map<GlobalListenerProvider, AWTEventListener> map = new HashMap<>();
private GlobalListenerProviderManager() {}
public static GlobalListenerProviderManager getInstance() {
return INSTANCE;
}
public void init() {
Set<GlobalListenerProvider> providers = ExtraDesignClassManager.getInstance().getArray(GlobalListenerProvider.XML_TAG);
addAWTEventListeners(providers);
listenPlugin();
}
private void listenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, GlobalListenerProvider.XML_TAG);
}
};
PluginEventListener onRun = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
Set<GlobalListenerProvider> providers = runtime.get(PluginModule.ExtraDesign, GlobalListenerProvider.XML_TAG);
addAWTEventListeners(providers);
}
};
PluginEventListener onStop = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
Set<GlobalListenerProvider> providers = runtime.get(PluginModule.ExtraDesign, GlobalListenerProvider.XML_TAG);
removeAWTEventListeners(providers);
}
};
GeneralContext.listenPlugin(PluginEventType.AfterRun, onRun, filter);
GeneralContext.listenPlugin(PluginEventType.BeforeStop, onStop, filter);
}
private void addAWTEventListeners(Set<GlobalListenerProvider> providers) {
AWTEventListener listener;
for (GlobalListenerProvider provider : providers) {
listener = provider.listener();
Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
add(provider, listener);
}
}
private void removeAWTEventListeners(Set<GlobalListenerProvider> providers) {
AWTEventListener listener;
for (GlobalListenerProvider provider : providers) {
listener = pop(provider);
Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
}
}
private synchronized void add(GlobalListenerProvider provider, AWTEventListener listener) {
map.put(provider, listener);
}
private synchronized AWTEventListener pop(GlobalListenerProvider provider) {
return map.remove(provider);
}
}

26
designer_base/src/com/fr/design/gui/frpane/LoadingBasicPane.java

@ -3,19 +3,14 @@
*/ */
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import java.awt.BorderLayout; import com.fr.design.dialog.BasicPane;
import java.awt.CardLayout;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/** /**
* @author richer * @author richer
@ -46,6 +41,7 @@ public abstract class LoadingBasicPane extends BasicPane {
}.execute(); }.execute();
} }
private void initCards() { private void initCards() {
card = new CardLayout(); card = new CardLayout();
setLayout(card); setLayout(card);
@ -74,6 +70,16 @@ public abstract class LoadingBasicPane extends BasicPane {
} }
/**
* 为了alphafine搜索使用预加载面板控件获取全部控件的信息
* @return
*/
public JPanel getAllComponents() {
JPanel panel = new JPanel();
initComponents(panel);
return panel;
}
/** /**
* 完成时 * 完成时
*/ */

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

@ -1,5 +1,6 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -22,11 +23,13 @@ public class UITextPane extends JTextPane implements UIObserver {
public UITextPane() { public UITextPane() {
super(); super();
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener(); iniListener();
} }
public UITextPane(StyledDocument doc) { public UITextPane(StyledDocument doc) {
super(doc); super(doc);
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener(); iniListener();
} }

24
designer_base/src/com/fr/design/gui/itextarea/UITextArea.java

@ -1,5 +1,6 @@
package com.fr.design.gui.itextarea; package com.fr.design.gui.itextarea;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -7,33 +8,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class UITextArea extends JTextArea implements UIObserver { public class UITextArea extends JTextArea implements UIObserver {
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
public UITextArea(int i, int j) { public UITextArea(int i, int j) {
super(i, j); super(i, j);
InputMap inputMap = this.getInputMap(); InputEventBaseOnOS.addBasicEditInputMap(this);
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
initComponents(); initComponents();
} }
@ -44,11 +26,13 @@ public class UITextArea extends JTextArea implements UIObserver {
public UITextArea() { public UITextArea() {
super(); super();
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents(); initComponents();
} }
public UITextArea(String s) { public UITextArea(String s) {
super(s); super(s);
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents(); initComponents();
} }

16
designer_base/src/com/fr/design/gui/itextfield/UINumberField.java

@ -1,20 +1,17 @@
package com.fr.design.gui.itextfield; package com.fr.design.gui.itextfield;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
/** /**
* Number Field. * Number Field.
*/ */
@ -54,7 +51,6 @@ public class UINumberField extends UITextField {
this.maxDecimalLength = maxDecimalLength; this.maxDecimalLength = maxDecimalLength;
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
setFieldDocument(); setFieldDocument();
} }

27
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -1,5 +1,6 @@
package com.fr.design.gui.itextfield; package com.fr.design.gui.itextfield;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
@ -10,12 +11,8 @@ import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* @author Jerry * @author Jerry
@ -31,42 +28,32 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() { public UITextField() {
super(); super();
InputMap inputMap = this.getInputMap(); InputEventBaseOnOS.addBasicEditInputMap(this);
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
initListener(); initListener();
} }
public UITextField(int columns) { public UITextField(int columns) {
super(columns); super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }
public UITextField(String text, int columns) { public UITextField(String text, int columns) {
super(text, columns); super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }
public UITextField(String text) { public UITextField(String text) {
super(text); super(text);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }
public UITextField(Document doc, String text, int columns) { public UITextField(Document doc, String text, int columns) {
super(doc, text, columns); super(doc, text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener(); initListener();
} }

11
designer_base/src/com/fr/design/locale/designer.properties

@ -543,7 +543,6 @@ FR-Designer_Allow_Null=Allow null
FR-Designer_PageSetup_Page=Page FR-Designer_PageSetup_Page=Page
FR-Designer_Custom_Job_Description=Description FR-Designer_Custom_Job_Description=Description
FR-Designer_Property=Property FR-Designer_Property=Property
FR-Designer_ClassName=Class Name
FR-Designer_Polyblock_Edit=Polyblock Edit FR-Designer_Polyblock_Edit=Polyblock Edit
FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2}} FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R2}}
FR-Designer_PageSetup_Horizontal=Horizontal FR-Designer_PageSetup_Horizontal=Horizontal
@ -559,10 +558,6 @@ FR-Designer_Show_As_Download=Display the binary content using download link
FR-Designer_File_Name_For_Download=File Name For Download FR-Designer_File_Name_For_Download=File Name For Download
FR-Designer_No=No FR-Designer_No=No
FR-Designer_Pagination=Page Break FR-Designer_Pagination=Page Break
FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_DS_TableData=Data Set FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
@ -1997,7 +1992,7 @@ FR-Designer_AlphaFine_EnableInternet=Designer_AlphaFine_EnableInternet
FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine
FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config
FR-Designer_AlphaFine_SearchRange=Search Range FR-Designer_AlphaFine_SearchRange=Search Range
FR-Designer_AlphaFine_Conclude=Conclude FR-Designer_AlphaFine_Recommend=Recommend
FR-Designer-Plugin_Addon=Plugin Addon FR-Designer-Plugin_Addon=Plugin Addon
FR-Designer_Templates=FR-Designer_Templates FR-Designer_Templates=FR-Designer_Templates
FR-Designer_Templates_Content=Templates Contents FR-Designer_Templates_Content=Templates Contents
@ -2006,6 +2001,7 @@ FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_Alphafine=AlphaFine FR-Designer_Alphafine=AlphaFine
FR-Designer-Alphafine_No_Remind= FR-Designer-Alphafine_No_Remind=
<<<<<<< HEAD
FR-Designer-Plugin_Install_Success= FR-Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence= FR-Designer-Plugin_Install_Dependence=
@ -2079,3 +2075,6 @@ FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer= FR-Designer-Plugin-Store_Developer=
FR-Designer-Plugin-Store_Jar= FR-Designer-Plugin-Store_Jar=
FR-Designer-Plugin-Store_Disconnected= FR-Designer-Plugin-Store_Disconnected=
FR-Designer_AlphaFine_NoResult=no results
FR-Designer_ConnectionFailed=connection failed
FR-Designer_NoResult=No results

27
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -115,7 +115,6 @@ FR-Designer_Format_explan=Format explain
FR-Designer_Allow-Blank=Allow Blank FR-Designer_Allow-Blank=Allow Blank
FR-Designer_Formula=Formula FR-Designer_Formula=Formula
FR-Designer_Forum=Forum FR-Designer_Forum=Forum
FR-Designer_Get-CubeGetting cube=
FR-Designer_Help=Help FR-Designer_Help=Help
FR-Designer_Hide=Hide FR-Designer_Hide=Hide
FR-Designer_Hyperlink=Hyperlink FR-Designer_Hyperlink=Hyperlink
@ -559,10 +558,6 @@ FR-Designer_Show_As_Download=Display the binary content using download link
FR-Designer_File_Name_For_Download=File Name For Download FR-Designer_File_Name_For_Download=File Name For Download
FR-Designer_No=No FR-Designer_No=No
FR-Designer_Pagination=Page Break FR-Designer_Pagination=Page Break
FR-Designer-Move_Tab_First=move to first
FR-Designer-Move_Tab_End=move to end
FR-Designer-Move_Tab_Next=move to next
FR-Designer-Move_Tab_Prev=move to previous
FR-Designer_DS_TableData=Data Set FR-Designer_DS_TableData=Data Set
FR-Designer_Parameter-Formula=Formula FR-Designer_Parameter-Formula=Formula
FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update.
@ -1043,7 +1038,7 @@ FR-Designer-Tree_Width=Tree Width
Record=Record Record=Record
Poly-Report_Component=Aggregate Report Component Poly-Report_Component=Aggregate Report Component
Options=Options Options=Options
NS-war-remote=Error codes\:1117 Compression deployment does not support remote design NS-war-remote=Error codes\:11100017 Compression deployment does not support remote design
Sche-Minute=Minute Sche-Minute=Minute
Three_Rows_Of_Three_Grid=A grid with 3 rows and 3 columns Three_Rows_Of_Three_Grid=A grid with 3 rows and 3 columns
WorkSheet=Free Report WorkSheet=Free Report
@ -1411,7 +1406,7 @@ Rename=Rename
Widget-Load_By_Async=Async load Widget-Load_By_Async=Async load
Shape=Shape Shape=Shape
BindColumn-This_Condition_has_been_existed=The Condition Already Exists BindColumn-This_Condition_has_been_existed=The Condition Already Exists
NS-exception_readError=Error codes\:1305 Template file parsing error NS-exception_readError=Error codes\:11300005 Template file parsing error
Set_Column_Title_Start=Set Duplicate Title Columns Set_Column_Title_Start=Set Duplicate Title Columns
Fri=Fri Fri=Fri
M_Report-Report_Parameter=Report Parameter M_Report-Report_Parameter=Report Parameter
@ -1992,17 +1987,18 @@ FR-Designer_Permissions=Permissions
FR-Designer_Form_Button=Button FR-Designer_Form_Button=Button
FR-Designer_WF_Name=Name FR-Designer_WF_Name=Name
FR-Designer_AlphaFine_Enable=Enable FR-Designer_AlphaFine_Enable=Enable
FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine FR-Designer_AlphaFine_EnableInternetSearch=Search OnLine
FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config
FR-Designer_AlphaFine_SearchRange=Search Range FR-Designer_AlphaFine_SearchRange=Search Range
FR-Designer_AlphaFine_Conclude=Conclude FR-Designer_AlphaFine_Recommend=Recommend
FR-Designer-Plugin_Addon=Plugin Addon FR-Designer-Plugin_Addon=Plugin Addon
FR-Designer_Templates=Templates FR-Designer_Templates=Files
FR-Designer_Templates_Content=Template'Contents FR-Designer_Templates_Content=Files'contents
FR-Designer_AlphaFine_ShowAll=show all FR-Designer_AlphaFine_ShowAll=Show all
FR-Designer_AlphaFine_Latest=Recent FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=show less FR-Designer_AlphaFine_ShowLess=Show less
FR-Designer_Alphafine=AlphaFine FR-Designer_Alphafine=AlphaFine
<<<<<<< HEAD
FR-Designer-Alphafine_No_Remind=don't remind FR-Designer-Alphafine_No_Remind=don't remind
Designer-Plugin_Install_Success= Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed= FR-Designer-Plugin_Install_Failed=
@ -2077,3 +2073,8 @@ FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer= FR-Designer-Plugin-Store_Developer=
FR-Designer-Plugin-Store_Jar= FR-Designer-Plugin-Store_Jar=
FR-Designer-Plugin-Store_Disconnected= FR-Designer-Plugin-Store_Disconnected=
FR-Designer_AlphaFine_NoResult=No results
FR-Designer_ConnectionFailed=Connection failed
FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine
FR-Designer_AlphaFine_EnableInternet=Internet
FR-Designer_NoResult=No results

4
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1038,7 +1038,7 @@ FR-Designer-Tree_Width=\u5E45
Record=\u8A18\u9332 Record=\u8A18\u9332
Poly-Report_Component=\u805A\u5408\u5E33\u7968\u30A2\u30BB\u30F3\u30D6\u30EA Poly-Report_Component=\u805A\u5408\u5E33\u7968\u30A2\u30BB\u30F3\u30D6\u30EA
Options=\u30AA\u30D7\u30B7\u30E7\u30F3 Options=\u30AA\u30D7\u30B7\u30E7\u30F3
NS-war-remote=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1117 \u5727\u7E2E\u914D\u7F6E\u306F\u9060\u9694\u30C7\u30B6\u30A4\u30F3\u306B\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093 NS-war-remote=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11100017 \u5727\u7E2E\u914D\u7F6E\u306F\u9060\u9694\u30C7\u30B6\u30A4\u30F3\u306B\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093
Sche-Minute=\u5206 Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=3\u4E57\u306E3\u3064\u306E\u884C Three_Rows_Of_Three_Grid=3\u4E57\u306E3\u3064\u306E\u884C
WorkSheet=\u30EF\u30FC\u30AF\u30B7\u30FC\u30C8 WorkSheet=\u30EF\u30FC\u30AF\u30B7\u30FC\u30C8
@ -1406,7 +1406,7 @@ Rename=\u540D\u79F0\u306E\u5909\u66F4
Widget-Load_By_Async=\u975E\u540C\u671F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9 Widget-Load_By_Async=\u975E\u540C\u671F\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9
Shape=\u56F3\u5F62 Shape=\u56F3\u5F62
BindColumn-This_Condition_has_been_existed=\u5F53\u8A72\u6761\u4EF6\u306F\u5B58\u5728\u3057\u3066\u3044\u307E\u3059 BindColumn-This_Condition_has_been_existed=\u5F53\u8A72\u6761\u4EF6\u306F\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:1305 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F NS-exception_readError=\u30A8\u30E9\u30FC\u30B3\u30FC\u30C9\:11300005 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u89E3\u6790\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F
Set_Column_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217\u3092\u8A2D\u5B9A Set_Column_Title_Start=\u91CD\u8907\u3059\u308B\u6A19\u984C\u5217\u3092\u8A2D\u5B9A
Fri=\u91D1 Fri=\u91D1
M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC M_Report-Report_Parameter=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC

4
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1039,7 +1039,7 @@ FR-Designer-Tree_Width=\uB108\uBE44
Record=\uB808\uCF54\uB4DC Record=\uB808\uCF54\uB4DC
Poly-Report_Component=\uCDE8\uD569\uBB38\uC11C\uC5B4\uC148\uBE14\uB9AC Poly-Report_Component=\uCDE8\uD569\uBB38\uC11C\uC5B4\uC148\uBE14\uB9AC
Options=\uC635\uC158 Options=\uC635\uC158
NS-war-remote=\uC624\uB958\uCF54\uB4DC\:1117 \uC555\uCD95\uC124\uCE58\uB97C\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. \uC6D0\uACA9\uB514\uC790\uC778 NS-war-remote=\uC624\uB958\uCF54\uB4DC\:11100017 \uC555\uCD95\uC124\uCE58\uB97C\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. \uC6D0\uACA9\uB514\uC790\uC778
Sche-Minute=\uBD84 Sche-Minute=\uBD84
Three_Rows_Of_Three_Grid=3\uD589 3\uC5F4\uC758\uADF8\uB9AC\uB4DC Three_Rows_Of_Three_Grid=3\uD589 3\uC5F4\uC758\uADF8\uB9AC\uB4DC
WorkSheet=\uC790\uC720\uBB38\uC11C WorkSheet=\uC790\uC720\uBB38\uC11C
@ -1407,7 +1407,7 @@ Rename=\uB9AC\uB124\uC784
Widget-Load_By_Async=\uBE44\uB3D9\uAE30\uB85C\uB529 Widget-Load_By_Async=\uBE44\uB3D9\uAE30\uB85C\uB529
Shape=\uADF8\uB798\uD504 Shape=\uADF8\uB798\uD504
BindColumn-This_Condition_has_been_existed=\uC774\uC870\uAC74\uC740\uC774\uBBF8\uC874\uC7AC\uD569\uB2C8\uB2E4. BindColumn-This_Condition_has_been_existed=\uC774\uC870\uAC74\uC740\uC774\uBBF8\uC874\uC7AC\uD569\uB2C8\uB2E4.
NS-exception_readError=\uC624\uB958\uCF54\uB4DC\:1305 \uD15C\uD50C\uB9BF\uD30C\uC77C\uD574\uC11D\uC624\uB958 NS-exception_readError=\uC624\uB958\uCF54\uB4DC\:11300005 \uD15C\uD50C\uB9BF\uD30C\uC77C\uD574\uC11D\uC624\uB958
Set_Column_Title_Start=\uC911\uBCF5\uC81C\uBAA9\uC5F4\uC124\uC815 Set_Column_Title_Start=\uC911\uBCF5\uC81C\uBAA9\uC5F4\uC124\uC815
Fri=5 Fri=5
M_Report-Report_Parameter=\uD15C\uD50C\uB9BF\uB9E4\uAC1C\uBCC0\uC218 M_Report-Report_Parameter=\uD15C\uD50C\uB9BF\uB9E4\uAC1C\uBCC0\uC218

11
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1038,7 +1038,7 @@ FR-Designer-Tree_Width=\u5BBD\u5EA6
Record=\u8BB0\u5F55 Record=\u8BB0\u5F55
Poly-Report_Component=\u805A\u5408\u62A5\u8868\u7EC4\u4EF6 Poly-Report_Component=\u805A\u5408\u62A5\u8868\u7EC4\u4EF6
Options=\u9009\u9879 Options=\u9009\u9879
NS-war-remote=\u9519\u8BEF\u4EE3\u7801\:1117 \u538B\u7F29\u90E8\u7F72\u4E0D\u652F\u6301\u8FDC\u7A0B\u8BBE\u8BA1 NS-war-remote=\u9519\u8BEF\u4EE3\u7801\:11100017 \u538B\u7F29\u90E8\u7F72\u4E0D\u652F\u6301\u8FDC\u7A0B\u8BBE\u8BA1
Sche-Minute=\u5206 Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=\u4E09\u884C\u4E09\u5217\u7684\u683C\u5B50 Three_Rows_Of_Three_Grid=\u4E09\u884C\u4E09\u5217\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u62A5\u8868 WorkSheet=\u81EA\u7531\u62A5\u8868
@ -1405,7 +1405,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u5F02\u6B65\u52A0\u8F7D Widget-Load_By_Async=\u5F02\u6B65\u52A0\u8F7D
Shape=\u56FE\u5F62 Shape=\u56FE\u5F62
BindColumn-This_Condition_has_been_existed=\u6B64\u6761\u4EF6\u5DF2\u7ECF\u5B58\u5728 BindColumn-This_Condition_has_been_existed=\u6B64\u6761\u4EF6\u5DF2\u7ECF\u5B58\u5728
NS-exception_readError=\u9519\u8BEF\u4EE3\u7801\:1305 \u6A21\u677F\u6587\u4EF6\u89E3\u6790\u51FA\u9519 NS-exception_readError=\u9519\u8BEF\u4EE3\u7801\:11300005 \u6A21\u677F\u6587\u4EF6\u89E3\u6790\u51FA\u9519
Set_Column_Title_Start=\u8BBE\u7F6E\u91CD\u590D\u6807\u9898\u5217 Set_Column_Title_Start=\u8BBE\u7F6E\u91CD\u590D\u6807\u9898\u5217
Fri=\u4E94 Fri=\u4E94
M_Report-Report_Parameter=\u6A21\u677F\u53C2\u6570 M_Report-Report_Parameter=\u6A21\u677F\u53C2\u6570
@ -1984,7 +1984,6 @@ FR-Designer_Role=\u89D2\u8272
FR-Designer_Permissions=\u6743\u9650 FR-Designer_Permissions=\u6743\u9650
FR-Designer_Form_Button=\u6309\u94AE FR-Designer_Form_Button=\u6309\u94AE
FR-Designer_WF_Name=\u540D\u79F0 FR-Designer_WF_Name=\u540D\u79F0
FR-Designer_ClassName=\u7C7B\u540D
FR-Designer_AlphaFine_Enable=\u5F00\u542F FR-Designer_AlphaFine_Enable=\u5F00\u542F
FR-Designer_AlphaFine_EnableAlphaFine=\u5F00\u542FAlphaFine\u529F\u80FD FR-Designer_AlphaFine_EnableAlphaFine=\u5F00\u542FAlphaFine\u529F\u80FD
FR-Designer_AlphaFine_EnableInternet=\u8054\u7F51 FR-Designer_AlphaFine_EnableInternet=\u8054\u7F51
@ -1995,7 +1994,7 @@ FR-Designer-Plugin_Addon=\u5E94\u7528\u4E2D\u5FC3
FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5185\u5BB9 FR-Designer_Templates_Content=\u6A21\u677F\u5185\u5BB9
FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8 FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8
FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981
FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528 FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
@ -2073,3 +2072,7 @@ FR-Designer-Plugin-Store_Version=\u7248\u672C
FR-Designer-Plugin-Store_Developer=\u5F00\u53D1\u8005 FR-Designer-Plugin-Store_Developer=\u5F00\u53D1\u8005
FR-Designer-Plugin-Store_Jar=jar\u5305 FR-Designer-Plugin-Store_Jar=jar\u5305
FR-Designer-Plugin-Store_Disconnected=\u65E0\u6CD5\u8FDE\u63A5\u5E94\u7528\u4E2D\u5FC3 FR-Designer-Plugin-Store_Disconnected=\u65E0\u6CD5\u8FDE\u63A5\u5E94\u7528\u4E2D\u5FC3
FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9
FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25
FR-Designer_NoResult=\u6682\u4E0D\u652F\u6301\u663E\u793A
>>>>>>> d2de164e77196e797f514ec75b52974b32b99ac5

9
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1038,7 +1038,7 @@ FR-Designer-Tree_Width=\u5BEC\u5EA6
Record=\u8A18\u9304 Record=\u8A18\u9304
Poly-Report_Component=\u8907\u5408\u5F0F\u5831\u8868\u5143\u4EF6 Poly-Report_Component=\u8907\u5408\u5F0F\u5831\u8868\u5143\u4EF6
Options=\u9078\u9805 Options=\u9078\u9805
NS-war-remote=\u932F\u8AA4\u4EE3\u78BC\:1117 \u58D3\u7E2E\u90E8\u7F72\u4E0D\u652F\u6301\u9060\u7A0B\u8A2D\u8A08 NS-war-remote=\u932F\u8AA4\u4EE3\u78BC\:11100017 \u58D3\u7E2E\u90E8\u7F72\u4E0D\u652F\u6301\u9060\u7A0B\u8A2D\u8A08
Sche-Minute=\u5206 Sche-Minute=\u5206
Three_Rows_Of_Three_Grid=\u4E09\u5217\u4E09\u6B04\u7684\u683C\u5B50 Three_Rows_Of_Three_Grid=\u4E09\u5217\u4E09\u6B04\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u5831\u8868 WorkSheet=\u81EA\u7531\u5831\u8868
@ -1406,7 +1406,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u975E\u540C\u6B65\u8F09\u5165 Widget-Load_By_Async=\u975E\u540C\u6B65\u8F09\u5165
Shape=\u5716\u5F62 Shape=\u5716\u5F62
BindColumn-This_Condition_has_been_existed=\u6B64\u689D\u4EF6\u5DF2\u7D93\u5B58\u5728 BindColumn-This_Condition_has_been_existed=\u6B64\u689D\u4EF6\u5DF2\u7D93\u5B58\u5728
NS-exception_readError=\u932F\u8AA4\u4EE3\u78BC\:1305 \u6A21\u677F\u6A94\u6848\u89E3\u6790\u51FA\u932F NS-exception_readError=\u932F\u8AA4\u4EE3\u78BC\:11300005 \u6A21\u677F\u6A94\u6848\u89E3\u6790\u51FA\u932F
Set_Column_Title_Start=\u8A2D\u5B9A\u91CD\u8907\u6A19\u984C\u6B04 Set_Column_Title_Start=\u8A2D\u5B9A\u91CD\u8907\u6A19\u984C\u6B04
Fri=\u4E94 Fri=\u4E94
M_Report-Report_Parameter=\u6A21\u677F\u53C3\u6578 M_Report-Report_Parameter=\u6A21\u677F\u53C3\u6578
@ -1991,7 +1991,7 @@ FR-Designer_AlphaFine_EnableAlphaFine=\u958B\u555FAlphaFine\u529F\u80FD
FR-Designer_AlphaFine_EnableInternetSearch=\u806F\u7DB2\u641C\u7D22 FR-Designer_AlphaFine_EnableInternetSearch=\u806F\u7DB2\u641C\u7D22
FR-Designer_AlphaFine_Shortcut_Config=\u5FEB\u6377\u9375\u914D\u7F6E FR-Designer_AlphaFine_Shortcut_Config=\u5FEB\u6377\u9375\u914D\u7F6E
FR-Designer_AlphaFine_SearchRange=\u641C\u7D22\u7BC4\u570D FR-Designer_AlphaFine_SearchRange=\u641C\u7D22\u7BC4\u570D
FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Recommend=\u731C\u60A8\u9700\u8981
FR-Designer-Plugin_Addon=\u61C9\u7528\u4E2D\u5FC3 FR-Designer-Plugin_Addon=\u61C9\u7528\u4E2D\u5FC3
FR-Designer_Templates=\u6A21\u677F FR-Designer_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9 FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9
@ -2073,3 +2073,6 @@ FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer= FR-Designer-Plugin-Store_Developer=
FR-Designer-Plugin-Store_Jar= FR-Designer-Plugin-Store_Jar=
FR-Designer-Plugin-Store_Disconnected= FR-Designer-Plugin-Store_Disconnected=
FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9
FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557
FR-Designer_NoResult=\u66AB\u4E0D\u652F\u6301\u986F\u793A

6
designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java

@ -23,4 +23,10 @@ public abstract class AbstractAppProvider<T extends IOFile> extends AbstractProv
public void process() { public void process() {
DesignerFrame.registApp(this); DesignerFrame.registApp(this);
} }
@Override
public void undo() {
DesignerFrame.removeApp(this);
}
} }

21
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -150,6 +150,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
public static void removeApp(App<?> app) {
if (app != null) {
appList.remove(app);
}
}
protected DesktopCardPane getCenterTemplateCardPane() { protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane; return centerTemplateCardPane;
} }
@ -189,6 +196,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return context.contain(TitlePlaceProcessor.MARK_STRING); return context.contain(TitlePlaceProcessor.MARK_STRING);
} }
}); });
<<<<<<< HEAD
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
@ -199,6 +207,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
northEastPane.removeAll();
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) { if (processor == null) {
processor = new DefaultTitlePlace(); processor = new DefaultTitlePlace();
@ -210,6 +219,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
setName(DESIGNER_FRAME_NAME); setName(DESIGNER_FRAME_NAME);
this.ad = ad; this.ad = ad;
=======
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
}
return northEastPane;
}
public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME);
this.ad = ad;
>>>>>>> d2de164e77196e797f514ec75b52974b32b99ac5
this.initTitleIcon(); this.initTitleIcon();
this.setTitle();// james:因为有默认的了 this.setTitle();// james:因为有默认的了
// set this to context. // set this to context.

20
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -13,7 +13,7 @@ import com.fr.design.actions.file.*;
import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphafineAction; import com.fr.design.actions.help.alphafine.AlphaFineAction;
import com.fr.design.actions.server.*; import com.fr.design.actions.server.*;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
@ -41,6 +41,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -164,7 +165,7 @@ public abstract class ToolBarMenuDock {
private void addAllUpdateActionsToList(List<MenuDef> menuList) { private void addAllUpdateActionsToList(List<MenuDef> menuList) {
shortCutsList = new ArrayList<>(); shortCutsList = new ArrayList<>();
for (MenuDef menuDef : menuList) { for (MenuDef menuDef : menuList) {
addUpdateActionToList(menuDef); addUpdateActionToList(menuDef, 0);
} }
} }
@ -172,17 +173,20 @@ public abstract class ToolBarMenuDock {
* 递归获取所有UpdateAction * 递归获取所有UpdateAction
* @param menuDef * @param menuDef
*/ */
private void addUpdateActionToList(MenuDef menuDef) { private void addUpdateActionToList(MenuDef menuDef, int level) {
String ParentName = menuDef.getName();
if (menuDef instanceof OpenRecentReportMenuDef) { if (menuDef instanceof OpenRecentReportMenuDef) {
return; return;
} }
String parentName = StringUtils.EMPTY;
if (level > 0) {
parentName = menuDef.getName();
}
level++;
for (ShortCut shortCut : menuDef.getShortcutList()) { for (ShortCut shortCut : menuDef.getShortcutList()) {
if (shortCut instanceof UpdateAction) { if (shortCut instanceof UpdateAction) {
shortCutsList.add(new UpdateActionModel(ParentName, (UpdateAction) shortCut)); shortCutsList.add(new UpdateActionModel(parentName, (UpdateAction) shortCut));
} else if (shortCut instanceof MenuDef) { } else if (shortCut instanceof MenuDef) {
addUpdateActionToList((MenuDef) shortCut); addUpdateActionToList((MenuDef) shortCut, level);
} }
} }
} }
@ -377,7 +381,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AlphafineAction()); shortCuts.add(new AlphaFineAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }

39
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java

@ -1,6 +1,8 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
/** /**
* Created by XiaXiang on 2017/5/24. * Created by XiaXiang on 2017/5/24.
@ -10,14 +12,35 @@ import com.fr.design.actions.UpdateAction;
* action对象 * action对象
*/ */
public class UpdateActionModel { public class UpdateActionModel {
private static final String SEPARATOR = "/";
private String parentName; private String parentName;
private String actionName; private String actionName;
private String className;
private String searchKey;
private UpdateAction action; private UpdateAction action;
public UpdateActionModel(String parentName, UpdateAction action) { public UpdateActionModel(String parentName, UpdateAction action) {
this.parentName = parentName; this.parentName = parentName;
this.action = action; this.action = action;
this.actionName = action.getName(); this.actionName = action.getName();
setSearchKey(parentName, action);
}
/**
* 获取搜索关键字包括上级菜单名菜单名以及对应打开面板的所有文字信息使其能够支持模糊搜索
* @param parentName
* @param action
*/
private void setSearchKey(String parentName, UpdateAction action) {
StringBuffer buffer = new StringBuffer();
if (actionName == null) {
return;
}
buffer.append(parentName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE))
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(parentName)).append(SEPARATOR)
.append(actionName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE))
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(actionName)).append(action.getSearchText());
this.searchKey = buffer.toString().toLowerCase();
} }
/** /**
@ -55,4 +78,20 @@ public class UpdateActionModel {
public void setActionName(String actionName) { public void setActionName(String actionName) {
this.actionName = actionName; this.actionName = actionName;
} }
public String getSearchKey() {
return searchKey;
}
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
}
public String getClassName() {
return getAction().getClass().getName();
}
public void setClassName(String className) {
this.className = className;
}
} }

7
designer_base/src/com/fr/start/BaseDesigner.java

@ -13,6 +13,7 @@ import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider; import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane; import com.fr.design.mainframe.TemplatePane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -114,10 +115,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
private void bindGlobalListener() { private void bindGlobalListener() {
Set<GlobalListenerProvider> providers = ExtraDesignClassManager.getInstance().getArray(GlobalListenerProvider.XML_TAG);
for (GlobalListenerProvider provider : providers) { GlobalListenerProviderManager.getInstance().init();
Toolkit.getDefaultToolkit().addAWTEventListener(provider.listener(), AWTEvent.KEY_EVENT_MASK);
}
} }
private void showErrorPluginsMessage() { private void showErrorPluginsMessage() {

25
designer_chart/build.9.0.gradle

@ -1,3 +1,4 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
@ -35,15 +36,21 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
// delete(dir:"src/main")
sourceSets{ mkdir(dir:"src/main/java")
main{ move(todir:"src/main/java"){
java{ fileset(dir:"src",includes:"com/**")
srcDirs=["${srcDir}/src"]
}
} }
} }
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src"]
// }
// }
//}
// //
FileTree files =fileTree(dir:'./',include:'build.*.gradle') FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -59,7 +66,7 @@ dependencies{
//.java文件到classes文件夹下参与打包 //.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){ task copyFile(type:Copy,dependsOn:compileJava){
copy{ copy{
from ("${srcDir}/src"){ from ("${srcDir}/src/main/java"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
} }
into 'build/classes/main' into 'build/classes/main'
@ -76,7 +83,7 @@ task compressJS{
} }
} }
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }

43
designer_chart/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java' apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本
@ -15,15 +36,21 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
// delete(dir:"src/main")
sourceSets{ mkdir(dir:"src/main/java")
main{ move(todir:"src/main/java"){
java{ fileset(dir:"src",includes:"com/**")
srcDirs=["${srcDir}/src"]
}
} }
} }
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src"]
// }
// }
//}
// //
FileTree files =fileTree(dir:'./',include:'build.*.gradle') FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))

4
designer_chart/src/com/fr/design/module/ChartPreStyleAction.java

@ -9,6 +9,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -25,7 +26,8 @@ public class ChartPreStyleAction extends UpdateAction {
this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setMenuKeySet(CHART_DEFAULT_STYLE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/chart/ChartType.png")); this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/chart/ChartType.png"));
this.setSearchText(new ChartPreStyleManagerPane());
} }
/** /**

35
designer_form/build.9.0.gradle

@ -1,4 +1,4 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
@ -36,16 +36,23 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
// delete(dir:"src/main")
sourceSets{ mkdir(dir:"src/main/java")
main{ move(todir:"src/main/java"){
java{ fileset(dir:"../designer/src",includes:"com/**")
srcDirs=["${srcDir}/src", fileset(dir:"src",includes:"com/**")
"${srcDir}/../designer/src"]
}
} }
} }
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src",
// "${srcDir}/../designer/src"]
// }
// }
//}
// //
FileTree files =fileTree(dir:'./',include:'build.*.gradle') FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -71,8 +78,8 @@ def dataContent ={def dir ->
task copyFile(type:Copy,dependsOn:compileJava){ task copyFile(type:Copy,dependsOn:compileJava){
copy{ copy{
with dataContent.call("${srcDir}/src") with dataContent.call("${srcDir}/src/main/java")
with dataContent.call("${srcDir}/../designer/src") // with dataContent.call("${srcDir}/../designer/src")
into 'build/classes/main' into 'build/classes/main'
} }
@ -87,11 +94,7 @@ task compressJS{
} }
} }
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}
fileset (dir:"${srcDir}/../designer/src"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }

52
designer_form/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java' apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本
@ -15,16 +36,23 @@ jar{
def srcDir="." def srcDir="."
def baseDir=".." def baseDir=".."
ant{
// delete(dir:"src/main")
sourceSets{ mkdir(dir:"src/main/java")
main{ move(todir:"src/main/java"){
java{ fileset(dir:"../designer/src",includes:"com/**")
srcDirs=["${srcDir}/src", fileset(dir:"src",includes:"com/**")
"${srcDir}/../designer/src"]
}
} }
} }
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src",
// "${srcDir}/../designer/src"]
// }
// }
//}
// //
FileTree files =fileTree(dir:'./',include:'build.*.gradle') FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -66,11 +94,7 @@ task compressJS{
} }
} }
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){ fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}
fileset (dir:"${srcDir}/../designer/src"){
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }

19
designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java

@ -26,6 +26,7 @@ import com.fr.general.ComparatorUtils;
public class WidgetPropertyTable extends AbstractPropertyTable { public class WidgetPropertyTable extends AbstractPropertyTable {
private FormDesigner designer; private FormDesigner designer;
private static final int LEFT_COLUMN_WIDTH = 97; // "属性名"列的宽度
public WidgetPropertyTable(FormDesigner designer) { public WidgetPropertyTable(FormDesigner designer) {
super(); super();
@ -86,10 +87,19 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
setModel(model); setModel(model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
TableColumn tc = this.getColumn(this.getColumnName(0)); TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(30); tc.setMinWidth(LEFT_COLUMN_WIDTH);
tc.setMaxWidth(LEFT_COLUMN_WIDTH);
this.repaint(); this.repaint();
} }
private void setRightColumnWidth(boolean automode) {
int rightColumnWidth = this.getWidth() - LEFT_COLUMN_WIDTH;
TableColumn tcRight = this.getColumn(this.getColumnName(1));
tcRight.setMinWidth(automode ? 0 : rightColumnWidth);
tcRight.setMaxWidth(automode ? this.getWidth() : rightColumnWidth);
}
private void setDesigner(FormDesigner designer) { private void setDesigner(FormDesigner designer) {
this.designer = designer; this.designer = designer;
} }
@ -111,6 +121,13 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
return null; return null;
} }
@Override
public void columnMarginChanged(javax.swing.event.ChangeEvent e) {
setRightColumnWidth(false);
super.columnMarginChanged(e);
setRightColumnWidth(true);
}
/** /**
* 待说明 * 待说明
*/ */

Loading…
Cancel
Save