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. 32
      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. 425
      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. 7
      designer/src/com/fr/design/module/DesignerModule.java
  43. 17
      designer/src/com/fr/design/report/UnitFieldPane.java
  44. 8
      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. 33
      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. 13
      designer_base/src/com/fr/design/locale/designer.properties
  77. 29
      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. 11
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  82. 6
      designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java
  83. 23
      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. 21
      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;
import com.fr.base.BaseUtils;
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.menu.KeySetUtils;
import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn;
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.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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

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

@ -1,13 +1,13 @@
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
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.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.LayerReportPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesigner> {
@ -17,7 +17,9 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setMenuKeySet(KeySetUtils.REPORT_ENGINE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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;

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

@ -1,16 +1,16 @@
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.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportExportAttrPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook;
import java.awt.event.ActionEvent;
public class ReportExportAttrAction extends JWorkBookAction {
public ReportExportAttrAction(JWorkBook jwb) {
@ -18,7 +18,8 @@ public class ReportExportAttrAction extends JWorkBookAction {
this.setMenuKeySet(KeySetUtils.REPORT_EXPORT_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
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.menu.MenuKeySet;
import com.fr.design.report.mobile.ReportMobileAttrPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook;
import com.fr.report.mobile.ElementCaseMobileAttr;
@ -27,7 +28,8 @@ public class ReportMobileAttrAction extends JWorkBookAction{
this.setMenuKeySet(REPORT_APP_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
/**
@ -27,7 +28,8 @@ public class ReportPageAttrAction extends ReportComponentAction<WorkSheetDesigne
this.setMenuKeySet(KeySetUtils.REPORT_PAGE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
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.menu.KeySetUtils;
import com.fr.design.report.PageSetupPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.report.TemplateReport;
import javax.swing.*;
/**
* PageSetup action.
*/
@ -27,7 +27,8 @@ public class ReportPageSetupAction extends ReportComponentAction<ReportComponent
this.setMenuKeySet(KeySetUtils.REPORT_PAGE_SETUP);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
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;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env;
import com.fr.base.FRContext;
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.menu.KeySetUtils;
import com.fr.design.webattr.ReportWebAttrPane;
import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook;
import com.fr.base.ConfigManagerProvider;
import java.awt.event.ActionEvent;
@ -29,7 +29,8 @@ public class ReportWebAttrAction extends JWorkBookAction {
this.setMenuKeySet(KeySetUtils.REPORT_WEB_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
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;
import com.fr.base.BaseUtils;
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.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWriteAttrPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
/**
@ -20,7 +20,9 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
this.setMenuKeySet(KeySetUtils.REPORT_WRITE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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

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

@ -3,8 +3,8 @@
*/
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.Env;
import com.fr.base.FRContext;
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.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -27,7 +27,8 @@ public class ServerConfigManagerAction extends UpdateAction {
this.setMenuKeySet(SERVER_CONFIG_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -24,7 +25,8 @@ public class StyleListAction extends UpdateAction {
this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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());
}
/**

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

@ -12,14 +12,22 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
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.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.cell.CellElementEditPane;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
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.Elem;
import com.fr.report.elementcase.TemplateElementCase;
@ -34,7 +42,29 @@ import com.fr.report.elementcase.TemplateElementCase;
* @since 2012-5-24下午1:50:21
*/
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() {
if (singleton == null) {
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 MEDIUM_GRAY = new Color(0x999999);
public static final Color BLUE = new Color(0x3394f0);
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 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 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 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;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
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.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 java.util.List;
/**
* Created by XiaXiang on 2017/5/8.
*/
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搜索面板
*/
public static void showAlphaFineDialog(boolean forceOpen) {
if (dialog == null) {
dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
}
AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
manager.setNeedRemind(false);
dialog.setVisible(true);
}
/**
* 获取文件名上级目录
*
* @param text
* @return
*/
public static String findFolderName (String text) {
public static String findFolderName(String text) {
return getSplitText(text, 2);
}
/**
* 分割字符串获取文件名文件名上级目录等
*
* @param text
* @param index
* @return
@ -47,14 +61,29 @@ public class AlphaFineHelper {
/**
* 获取文件名
*
* @param text
* @return
*/
public static String findFileName (String text) {
public static String findFileName(String text) {
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.
*/
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;
@ -21,6 +21,7 @@ public enum CellType {
return FILE;
}
public int getTypeValue() {
return typeValue;
}

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

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.cell;
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.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.FileSearchManager;
@ -13,6 +13,7 @@ import com.fr.json.JSONObject;
*/
public class CellModelHelper {
private static final String RESULT = "result";
public static AlphaCellModel getModelFromJson(JSONObject object) {
int typeValue = object.optInt("cellType");
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 javax.swing.*;
import java.io.Serializable;
/**
* Created by XiaXiang on 2017/4/20.
@ -14,12 +13,18 @@ import java.io.Serializable;
public class ActionModel extends AlphaCellModel {
private Action action;
private String actionName;
private String className;
public ActionModel(String name, String content, CellType 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
public boolean equals(Object o) {
if (this == o) {
@ -38,17 +43,6 @@ public class ActionModel extends AlphaCellModel {
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() {
return action;
}
@ -70,14 +64,14 @@ public class ActionModel extends AlphaCellModel {
@Override
public String getStoreInformation() {
return getActionName();
return getClassName();
}
public String getActionName() {
public String getClassName() {
return getAction().getClass().getName();
}
public void setActionName(String actionName) {
this.actionName = actionName;
public void setClassName(String className) {
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
*
* @return
* @throws JSONException
*/
@ -69,6 +70,7 @@ public abstract class AlphaCellModel {
/**
* 获取需要保存到云中心的信息
*
* @return
*/
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.
*/
public class FileModel extends AlphaCellModel{
public class FileModel extends AlphaCellModel {
private String filePath;
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.isLoading = true;
}
public MoreModel(String name, boolean isLoading) {
this.name = name;
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.
*/
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 imageUrl;
private String version;
@ -18,12 +20,11 @@ public class PluginModel extends AlphaCellModel {
private String informationUrl;
private int pluginId;
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) {
super(name, content, type);
}
public PluginModel(String name, String content, String imageUrl, String version, String jartime, String link, CellType type, int price, int pluginId) {
super(name, content);
this.link = link;
@ -130,7 +131,6 @@ public class PluginModel extends AlphaCellModel {
}
public int getPluginId() {
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.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.MoreModel;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
@ -15,6 +17,7 @@ import java.awt.*;
public class ContentCellRender implements ListCellRenderer<Object> {
private UILabel name;
private UILabel content;
public ContentCellRender() {
this.name = new UILabel();
this.content = new UILabel();
@ -23,24 +26,31 @@ public class ContentCellRender implements ListCellRenderer<Object> {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
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());
panel.setBackground(Color.white);
if (isSelected) {
panel.setBackground(AlphaFineConstants.BLUE);
}
panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0));
panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
AlphaCellModel model = (AlphaCellModel) value;
name.setText(model.getName());
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png";
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.setForeground(AlphaFineConstants.BLACK);
name.setVerticalTextPosition(SwingConstants.CENTER);
name.setHorizontalTextPosition(SwingConstants.RIGHT);
if (model.getDescription() != null) {
content.setText("-" + model.getDescription());
String description = model.getDescription();
if (StringUtils.isNotBlank(description)) {
content.setText("-" + description);
content.setForeground(AlphaFineConstants.LIGHT_GRAY);
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.more = new UILabel();
}
@Override
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());
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.setFont(AlphaFineConstants.SMALL_FONT);
more.setFont(AlphaFineConstants.SMALL_FONT);
@ -33,7 +34,7 @@ public class TitleCellRender implements ListCellRenderer<Object> {
more.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(name, BorderLayout.WEST);
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);
}
if (moreModel.isLoading()) {

425
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.model.SearchListModel;
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.FilePreviewPane;
import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane;
@ -59,6 +60,31 @@ import java.util.concurrent.ExecutionException;
* Created by XiaXiang on 2017/3/21.
*/
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 UIButton closeButton;
private JPanel searchResultPane;
@ -69,16 +95,52 @@ public class AlphaFineDialog extends UIDialog {
private SearchListModel searchListModel;
private SwingWorker searchWorker;
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean foreOpen;
public AlphaFineDialog(Frame parent, boolean foreOpen) {
private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent);
this.forceOpen = forceOpen;
initProperties();
initListener();
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() {
searchTextField = new AlphaFineTextField("AlphaFine");
searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.white);
@ -92,9 +154,11 @@ public class AlphaFineDialog extends UIDialog {
topPane.add(iconLabel, BorderLayout.WEST);
topPane.add(searchTextField, BorderLayout.CENTER);
closeButton = new UIButton() {
@Override
public void paintComponent(Graphics g) {
g.setColor( Color.white );
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width, getSize().height);
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.set4ToolbarButton();
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
@ -116,25 +182,38 @@ public class AlphaFineDialog extends UIDialog {
topPane.add(borderLabel, BorderLayout.SOUTH);
add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
doSearch(searchTextField.getText());
}
});
}
/**
*
*/
private void initProperties() {
setUndecorated(true);
addComponentListener(new ComponentHandler());
setSize(AlphaFineConstants.FIELD_SIZE);
centerWindow(this);
}
/**
* 设置面板位置
*
* @param win
*/
private void centerWindow(Window win) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension winSize = win.getSize();
if (winSize.height > screenSize.height) {
winSize.height = screenSize.height;
}
@ -142,22 +221,43 @@ public class AlphaFineDialog extends UIDialog {
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) {
if (text.length() < 2 || text.contains("'")) {
return;
}
if (StringUtils.isBlank(text) || text.equals("AlphaFine")) {
removeSearchResult();
} else if (text.contains("'")) {
return;
} else {
showSearchResult(text);
showSearchResult();
}
}
/**
* 移除搜索结果
*/
private void removeSearchResult() {
if (searchResultPane != null) {
remove(searchResultPane);
searchResultPane = null;
@ -165,40 +265,35 @@ public class AlphaFineDialog extends UIDialog {
setSize(AlphaFineConstants.FIELD_SIZE);
repaint();
}
// 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();
// }
private void showSearchResult(String searchText) {
/**
* 展示搜索结果
*/
private void showSearchResult() {
if (searchResultPane == null) {
initSearchResultComponents();
initListListener(searchText);
initListListener();
}
initSearchWorker(searchText);
initSearchWorker();
}
/**
* 初始化搜索面板
*/
private void initSearchResultComponents() {
searchResultList = new JList();
searchListModel = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModel);
searchResultPane = new JPanel();
searchResultPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE);
searchResultPane.setLayout(new BorderLayout());
searchResultList.setCellRenderer(new ContentCellRender());
searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT);
leftSearchResultPane = new UIScrollPane(searchResultList);
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));
rightSearchResultPane = new JPanel();
rightSearchResultPane.setBackground(Color.white);
@ -208,43 +303,144 @@ public class AlphaFineDialog extends UIDialog {
add(searchResultPane, BorderLayout.SOUTH);
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()) {
this.searchWorker.cancel(true);
this.searchWorker = null;
}
this.searchWorker = new SwingWorker<SearchListModel, String>() {
this.searchWorker = new SwingWorker() {
@Override
protected SearchListModel doInBackground() {
return setListModel(new SearchListModel(AlphaSearchManager.getSearchManager().getLessSearchResult(searchText)));
protected Object doInBackground() throws Exception {
rebuildList(searchTextField.getText().toLowerCase());
return null;
}
@Override
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();
}
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() {
@Override
public void mouseClicked(MouseEvent e) {
@ -262,8 +458,10 @@ public class AlphaFineDialog extends UIDialog {
}
}
});
// TODO: 2017/5/8 xiaxiang: e.getClickCount() == 1 时,偶发性的不能触发,所以先放到valueChanged
/**
*单击时触发右侧面板展示搜索结果
*/
searchResultList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
@ -273,7 +471,10 @@ public class AlphaFineDialog extends UIDialog {
}
}
});
/**
* 键盘监听器
*/
searchResultList.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
@ -400,7 +601,10 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker.execute();
} else if (selectedValue instanceof ActionModel) {
showDefaultPreviewPane();
rightSearchResultPane.removeAll();
rightSearchResultPane.add(new ActionPreviewPane());
validate();
repaint();
}
}
@ -431,20 +635,28 @@ public class AlphaFineDialog extends UIDialog {
initMouseListener();
}
/**
* 窗口拖拽
*/
private void initMouseListener() {
addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
doMouseDragged(e);
}
});
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
doMousePressed(e);
}
});
}
@ -483,44 +695,17 @@ public class AlphaFineDialog extends UIDialog {
if (SwingUtilities.isLeftMouseButton(k)) {
Point p = k.getLocationOnScreen();
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds();
Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !foreOpen) {
Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) {
AlphaFineDialog.this.dispose();
foreOpen = false;
forceOpen = false;
}
}
}
}
}, 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);
}, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
}
@Override
public void checkValid() throws Exception {
@ -532,7 +717,7 @@ public class AlphaFineDialog extends UIDialog {
if (value instanceof ActionModel) {
((ActionModel) value).getAction().actionPerformed(null);
} 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) {
String url = ((PluginModel) value).getPluginUrl();
try {
@ -558,6 +743,7 @@ public class AlphaFineDialog extends UIDialog {
/**
* 保存本地本地常用
*
* @param cellModel
*/
private void saveHistory(AlphaCellModel cellModel) {
@ -571,6 +757,7 @@ public class AlphaFineDialog extends UIDialog {
/**
* 上传数据到服务器
*
* @param searchKey
* @param cellModel
*/
@ -600,24 +787,31 @@ public class AlphaFineDialog extends UIDialog {
}
}
/**
* 点击显示更多时添加对应的model到list点击收起是移除model
*
* @param index
* @param selectedValue
*/
private void rebuildShowMoreList(int index, MoreModel 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++) {
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 {
for (int i = 0; i < moreResult.size(); i++) {
this.searchListModel.removeElementAt(index + AlphaFineConstants.SHOW_SIZE - 1);
this.searchListModel.remove(index + AlphaFineConstants.SHOW_SIZE + 1);
}
}
this.searchResultList.validate();
this.searchResultList.repaint();
validate();
repaint();
}
private void rebuildList() {
@ -643,7 +837,7 @@ public class AlphaFineDialog extends UIDialog {
moreResult = ActionSearchManager.getActionSearchManager().getMoreSearchResult();
break;
default:
moreResult = AlphaSearchManager.getSearchManager().getMoreSearchResult();
moreResult = new SearchResult();
}
return moreResult;
}
@ -664,13 +858,16 @@ public class AlphaFineDialog extends UIDialog {
public void setSearchWorker(SwingWorker searchWorker) {
this.searchWorker = searchWorker;
}
public boolean isForeOpen() {
return foreOpen;
public boolean isForceOpen() {
return forceOpen;
}
public void setForeOpen(boolean foreOpen) {
this.foreOpen = foreOpen;
public void setForceOpen(boolean forceOpen) {
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;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphafineContext;
import com.fr.design.actions.help.alphafine.AlphafineListener;
import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -20,20 +20,14 @@ import java.awt.event.ActionListener;
public class AlphaFinePane extends BasicPane {
private static AlphaFinePane alphaFinePane;
public static AlphaFinePane createAlphaFinePane() {
if (alphaFinePane == null) {
alphaFinePane = new AlphaFinePane();
}
return alphaFinePane;
}
public AlphaFinePane() {
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);
}
UIButton refreshButton = new UIButton();
refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Alphafine"));
refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine"));
refreshButton.set4ToolbarButton();
this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() {
@ -42,14 +36,27 @@ public class AlphaFinePane extends BasicPane {
AlphaFineHelper.showAlphaFineDialog(false);
}
});
AlphafineContext.addAlphafineContextListener(new AlphafineListener() {
AlphaFineContext.addAlphaFineListener(new AlphaFineListener() {
@Override
public void showDialog() {
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
protected String title4PopupWindow() {
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 java.awt.*;
import java.awt.event.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import static java.awt.event.KeyEvent.VK_ESCAPE;
@ -64,6 +65,7 @@ public class AlphaFineTextField extends UITextField {
/**
* 添加键盘监听器
*
* @param 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
public void insertUpdate(DocumentEvent e) {
textChanged(e);
textChanged(e);
}
@Override
public void removeUpdate(DocumentEvent e) {
textChanged(e);
textChanged(e);
}
@Override
public void changedUpdate(DocumentEvent e) {
textChanged(e);
textChanged(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 {
SearchResult myDelegate;
public SearchListModel( SearchResult searchResult) {
public SearchListModel(SearchResult searchResult) {
this.myDelegate = searchResult;
}
@Override
public void addElement(Object element) {
int index = myDelegate.size();
myDelegate.add(element);
fireContentsChanged(this, index, index);
}
@Override
@ -23,17 +25,26 @@ public class SearchListModel extends DefaultListModel {
}
@Override
public void insertElementAt(Object element, int index) {
this.myDelegate.add(index, element);
public void add(int index, Object element) {
myDelegate.add(index, element);
fireIntervalAdded(this, index, index);
}
@Override
public void removeElementAt(int index) {
this.myDelegate.remove(index);
public Object remove(int index) {
Object object = myDelegate.get(index);
myDelegate.remove(object);
fireIntervalRemoved(this, index, index);
return object;
}
@Override
public int getSize() {
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;
public boolean isNeedMore() {
return needMore;
}

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

@ -1,8 +1,37 @@
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.
*/
public class ActionPreviewPane {
//todo:还没确定要不要使用面板截图
public class ActionPreviewPane extends JPanel {
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);
titleArea.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);
contentArea.setForeground(AlphaFineConstants.BLACK);
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 PluginPreviewPane(String title, Image image, String version, String jartime, CellType type, int price) {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(50,0,0,0));
setBorder(BorderFactory.createEmptyBorder(50, 0, 0, 0));
setBackground(Color.white);
UILabel imageLabel = new UILabel();
image = image.getScaledInstance(200, 200, Image.SCALE_SMOOTH);
@ -26,17 +26,17 @@ public class PluginPreviewPane extends JPanel {
nameLabel.setBackground(Color.yellow);
nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
JPanel line = new JPanel();
line.setPreferredSize(new Dimension(200,1));
line.setPreferredSize(new Dimension(200, 1));
line.setBackground(AlphaFineConstants.GRAY);
JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(Color.white);
JPanel bottomPane = new JPanel(new BorderLayout());
bottomPane.setBackground(Color.white);
bottomPane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
bottomPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
if (type == CellType.PLUGIN) {
UILabel versionLabel = new UILabel("V" + version);
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.setFont(AlphaFineConstants.MEDIUM_FONT);
panel.add(versionLabel, BorderLayout.CENTER);
@ -47,7 +47,7 @@ public class PluginPreviewPane extends JPanel {
}
nameLabel.setFont(AlphaFineConstants.LARGE_FONT);
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));
String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price);
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;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
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.model.MoreModel;
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.toolbar.UpdateActionManager;
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.stable.StringUtils;
import java.util.List;
@ -18,6 +19,7 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27.
*/
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 SearchResult filterModelList;
private SearchResult lessModelList;
@ -30,34 +32,58 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
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
public synchronized SearchResult getLessSearchResult(String searchText) {
filterModelList = new SearchResult();
lessModelList = 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();
for (UpdateActionModel updateActionModel : updateActions) {
if (updateActionModel.getActionName() != null) {
if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) {
if (StringUtils.isNotBlank(updateActionModel.getSearchKey())) {
if (updateActionModel.getSearchKey().contains(searchText) && updateActionModel.getAction().isEnabled()) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
}
}
}
if (filterModelList != null && filterModelList.size() > 0) {
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size());
for (int i = 0; i < length; i++) {
lessModelList.add(filterModelList.get(i));
SearchResult result = new SearchResult();
for (Object object : filterModelList) {
if (!AlphaFineHelper.getFilterResult().contains(object)) {
result.add(object);
}
for (int i = length; i < filterModelList.size(); i++) {
moreModelList.add(filterModelList.get(i));
}
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.ACTION));
}
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} 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() {
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 {
/**
* 获取默认显示条数
*
* @param searchText
* @return
*/
@ -15,6 +16,7 @@ public interface AlphaFineSearchProcessor {
/**
* 获取剩余条数
*
* @return
*/
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.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
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.JSONException;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
/**
* Created by XiaXiang on 2017/3/27.
*/
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 SearchResult lessModelList;
private SearchResult moreModelList;
@ -29,62 +32,81 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
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
public synchronized SearchResult getLessSearchResult(String searchText) {
lessModelList = 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 url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText + "-1";
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return lessModelList;
return getNoConnectList();
}
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try {
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("docdata");
if (jsonArray != null && jsonArray.length() > 0) {
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, jsonArray.length());
for (int i = 0; i < length; i++) {
if (jsonArray != null) {
SearchResult searchResult = new SearchResult();
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
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++) {
DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i));
this.moreModelList.add(cellModel);
}
if (jsonArray.length() > AlphaFineConstants.SHOW_SIZE) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.DOCUMENT));
} else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"), CellType.DOCUMENT));
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_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) {
FRLogger.getLogger().error(e.getMessage());
FRLogger.getLogger().error("document search error: " + e.getMessage());
return lessModelList;
}
}
return lessModelList;
}
/**
* 根据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);
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL);
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@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.model.SearchResult;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import java.io.*;
@ -23,11 +25,17 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27.
*/
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 lessModelList;
private SearchResult moreModelList;
private List<FileNode> fileNodes = null;
private static FileSearchManager fileSearchManager = null;
//隐藏的搜索功能,可根据特殊的字符标记判断搜索分类
private boolean isContainCpt = true;
private boolean isContainFrm = true;
public synchronized static FileSearchManager getFileSearchManager() {
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) {
this.filterModelList = new SearchResult();
this.lessModelList = 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();
fileNodes = new ArrayList<>();
fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true);
isContainCpt = true;
isContainFrm = true;
for (FileNode node : fileNodes) {
boolean isAlreadyContain = false;
String fileEnvPath = node.getEnvPath();
@ -55,36 +88,43 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
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 (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) {
lessModelList.add(0,new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"),true, CellType.FILE));
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL);
if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} 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;
}
/**
* 搜索文件内容
*
* @param searchText
* @param node
* @param isAlreadyContain
* @param filePath
*/
private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, String filePath) {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainFileContent()) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
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;
int columnNumber;
boolean isFoundInContent = false;
@ -92,6 +132,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
columnNumber = line.toLowerCase().indexOf(searchText);
if (columnNumber != -1) {
isFoundInContent = true;
break;
}
}
if (isFoundInContent && !isAlreadyContain) {
@ -109,14 +150,15 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
/**
* 搜索模板
*
* @param searchText
* @param node
* @param isAlreadyContain
* @return
*/
private boolean searchFile(String searchText, FileNode node, boolean isAlreadyContain) {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainTemplate()) {
if (node.getName().toLowerCase().contains(searchText.toLowerCase())) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
if (node.getName().toLowerCase().contains(searchText)) {
FileModel model = new FileModel(node.getName(), node.getEnvPath());
this.filterModelList.add(model);
isAlreadyContain = true;
@ -132,6 +174,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
/**
* 获取工作目录下所有符合要求的模板
*
* @param env
* @param rootFilePath
* @param recurse
@ -142,13 +185,14 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
try {
listAll(env, rootFilePath, fileNodeList, recurse);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FRContext.getLogger().error("file search error: " + e.getMessage(), e);
}
return fileNodeList;
}
/**
* 获取当前工作目录下所有模板
*
* @param env
* @param rootFilePath
* @param nodeList
@ -165,20 +209,37 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} else {
nodeList.add(fns[i]);
}
} else {
} else if (isContainCpt && fileNode.isFileType("cpt")) {
nodeList.add(fileNode);
} else if (isContainFrm && fileNode.isFileType("frm")) {
nodeList.add(fileNode);
}
}
}
/**
* 根据文件路径获取文件模型
* @param filePath
* 是否包含cpt
*
* @return
*/
public static FileModel getModelFromCloud(String filePath) {
String name = AlphaFineHelper.findFileName(filePath);
return new FileModel(name, filePath);
public boolean isContainCpt() {
return isContainCpt;
}
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.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
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.PluginModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@ -20,10 +23,12 @@ import java.net.URLEncoder;
* Created by XiaXiang on 2017/3/27.
*/
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 SearchResult lessModelList;
private SearchResult moreModelList;
public synchronized static PluginSearchManager getPluginSearchManager() {
if (pluginSearchManager == null) {
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) {
String name = object.optString("name");
String content = object.optString("description");
int pluginId = object.optInt("id");
String imageUrl = null;
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) {
FRLogger.getLogger().error(e.getMessage());
}
@ -92,7 +52,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
CellType type;
String link = object.optString("link");
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");
type = CellType.PLUGIN;
} else {
@ -102,27 +62,84 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
return new PluginModel(name, content, imageUrl, version, jartime, link, type, price, pluginId);
}
@Override
public SearchResult getMoreSearchResult() {
return this.moreModelList;
}
/**
* 根据json获取对应的插件model
*
* @param object
* @return
*/
public static PluginModel getModelFromCloud(JSONObject object) {
JSONObject jsonObject = object.optJSONObject("result");
if (jsonObject != null) {
return getPluginModel(jsonObject, true);
return getPluginModel(jsonObject, true);
} else {
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.Utils;
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.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
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 java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 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 RecentSearchManager recentSearchManager = null;
private static File recentFile = null;
private List<String> fileList;
private List<String> actionList;
private List<String> documentList;
private SearchResult modelList;
private List<String> pluginList;
private List<AlphaCellModel> recentModelList = new ArrayList<>();
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) {
try {
AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name));
if (model != null) {
list.add(CellModelHelper.getModelFromJson(new JSONObject(name)));
list.add(model);
}
} catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage());
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
@ -135,40 +133,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
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
*
* @return
*/
private File getRecentFile() {
@ -183,12 +151,12 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
if (!envFile.exists()) {
createRecentFile(envFile);
}
return envFile;
}
/**
* 创建XML
*
* @param envFile
*/
private void createRecentFile(File envFile) {
@ -244,19 +212,30 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
/**
* 根据搜索字段获取对应的model列表
*
* @param searchText
* @return
*/
public List<AlphaCellModel> getRecentModelList(String searchText) {
public synchronized List<AlphaCellModel> getRecentModelList(String searchText) {
recentModelList = new ArrayList<>();
for (String key : recentKVModelMap.keySet()) {
AlphaFineHelper.checkCancel();
if (ComparatorUtils.equals(key, 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) {
return recentModelList.subList(size - MAX_SIZE, size);
return resultModelList.subList(size - MAX_SIZE, size);
}
return recentModelList;
return resultModelList;
}
}
return recentModelList;
@ -264,6 +243,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
/**
* 将搜索结果加入到当前MAP中
*
* @param searchKey
* @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;
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.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
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.stable.CodeUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by XiaXiang on 2017/3/31.
*/
public class RecommendSearchManager implements AlphaFineSearchProcessor {
private static RecommendSearchManager recommendSearchManager = null;
private SearchResult modelList;
//todo:for test
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() {
if (recommendSearchManager == null) {
@ -28,46 +36,73 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
}
return recommendSearchManager;
}
@Override
public synchronized SearchResult getLessSearchResult(String searchText) {
this.modelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) {
this.recommendModelList = new ArrayList<>();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet();
httpClient.setTimeout(5000);
if (!httpClient.isServerAlive()) {
return modelList;
return getNoConnectList();
}
result = httpClient.getResponseText();
AlphaFineHelper.checkCancel();
try {
JSONObject jsonObject = new JSONObject(result);
if (jsonObject.optString("status").equals("success")) {
JSONArray jsonArray = jsonObject.optJSONArray("result");
if (jsonArray != null && jsonArray.length() > 0) {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) {
this.modelList.add(alphaCellModel);
if (alphaCellModel != null && !RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) {
this.recommendModelList.add(alphaCellModel);
}
}
}
}
} 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) {
modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false));
if (recommendModelList.size() > 0) {
modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false));
modelList.addAll(recommendModelList);
}
}
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
public SearchResult getMoreSearchResult() {
return new SearchResult();
}
public List<AlphaCellModel> getRecommendModelList() {
return recommendModelList;
}
public void setRecommendModelList(List<AlphaCellModel> recommendModelList) {
this.recommendModelList = recommendModelList;
}
}

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

@ -212,7 +212,7 @@ public class DesignerModule extends DesignModule {
}
});
}
private static abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override
@ -234,6 +234,11 @@ public class DesignerModule extends DesignModule {
public void process() {
}
@Override
public void undo() {
}
}
@Override

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

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

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

@ -4,6 +4,7 @@
package com.fr.design.webattr;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
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.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.base.ConfigManagerProvider;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr;
@ -33,17 +33,17 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
//TODO 表单
// private FormToolBarPane formPane;
private WriteToolBarPane writePane;
private ReportWebAttr webAttr ;
private ReportWebAttr webAttr;
private WebCssPane cssPane;
private WebJsPane jsPane;
private ErrorTemplatePane errorTemplatePane;
@Override
protected void initComponents(JPanel container) {
protected synchronized void initComponents(JPanel container) {
JPanel defaultPane = container;
defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout());

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

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

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

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

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

@ -346,7 +346,7 @@ public class Designer extends BaseDesigner {
* @return 面板组件
*/
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){
options.encoding = 'UTF-8'
}
@ -35,15 +36,21 @@ jar{
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"src",includes:"com/**")
}
}
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src"]
// }
// }
//}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -59,7 +66,7 @@ dependencies{
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
from ("${srcDir}/src/main/java"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
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'){
fileset (dir:"${srcDir}/src"){
fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}

35
designer_base/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
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版本
sourceCompatibility=1.7
//jar包版本
@ -15,7 +36,13 @@ jar{
def srcDir="."
def baseDir=".."
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"src",includes:"com/**")
}
}
//
sourceSets{
main{
@ -39,7 +66,7 @@ dependencies{
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
from ("${srcDir}/src/main/java"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
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'){
fileset (dir:"${srcDir}/src"){
fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}

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

@ -1,7 +1,7 @@
package com.fr.aspectj.designerbase;
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.mainframe.DesignerContext;
@ -30,7 +30,7 @@ public aspect AlphaFineReminder {
* 判断是否弹出广告框
*/
private static void remind() {
AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager();
AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (manager.isNeedRemind()) {
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 javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* Created by hzzz on 2017/5/26.
*/
@ -18,4 +22,23 @@ public class InputEventBaseOnOS {
public static boolean isControlDown(KeyEvent e) {
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.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.env.RemoteEnv;
import com.fr.env.SignIn;
@ -108,7 +108,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* alphafine
*/
private AlphafineConfigManager alphafineConfigManager = new AlphafineConfigManager();
private AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
public static final String CAS_CERTIFICATE_PATH = "certificatePath";
@ -1344,7 +1344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphafineConfigManager = new AlphafineConfigManager());
reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager());
}
private void readHttpsParas(XMLableReader reader){
@ -1551,8 +1551,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphafineConfigManager != null) {
this.alphafineConfigManager.writeXML(writer);
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);
}
}
@ -1830,11 +1830,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return env;
}
public AlphafineConfigManager getAlphafineConfigManager() {
return alphafineConfigManager;
public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphaFineConfigManager;
}
public void setAlphafineConfigManager(AlphafineConfigManager alphafineConfigManager) {
this.alphafineConfigManager = alphafineConfigManager;
public void setAlphaFineConfigManager(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.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeListener;
@ -50,6 +54,10 @@ public abstract class UpdateAction extends ShortCut implements Action {
*/
private Map<String, Object> componentMap;
private String searchText = StringUtils.EMPTY;
/**
* Constructor
*/
@ -425,4 +433,112 @@ public abstract class UpdateAction extends ShortCut implements Action {
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;
import java.awt.event.ActionEvent;
import com.fr.design.DesignerEnvManager;
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.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate;
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 PreferenceAction() {
public PreferenceAction() {
this.setMenuKeySet(KeySetUtils.PREFERENCE);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
}
this.setSearchText(new PreferencePane());
}
/**
* 动作
*
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final PreferencePane preferencePane = new PreferencePane();
preferencePane.populate(DesignerEnvManager.getEnvManager());
BasicDialog basicDialog = preferencePane.showWindow(designerFrame);
basicDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
preferencePane.update(DesignerEnvManager.getEnvManager());
DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jt.refreshToolArea();
preferencePane.showRestartDialog();
}
});
basicDialog.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final PreferencePane preferencePane = new PreferencePane();
preferencePane.populate(DesignerEnvManager.getEnvManager());
BasicDialog basicDialog = preferencePane.showWindow(designerFrame);
basicDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
preferencePane.update(DesignerEnvManager.getEnvManager());
DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jt.refreshToolArea();
preferencePane.showRestartDialog();
}
});
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;
}
};
}

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;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -16,12 +17,13 @@ import java.awt.event.ActionEvent;
/**
* Created by XiaXiang on 2017/4/1.
*/
public class AlphafineAction extends UpdateAction {
public AlphafineAction() {
public class AlphaFineAction extends UpdateAction {
public AlphaFineAction() {
this.setMenuKeySet(ALPHAFINE);
this.setName(getMenuKeySet().getMenuName());
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() {
@ -47,15 +49,19 @@ public class AlphafineAction extends UpdateAction {
public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final AlphafineConfigPane alphafineConfigPane = new AlphafineConfigPane();
alphafineConfigPane.populate(DesignerEnvManager.getEnvManager().getAlphafineConfigManager());
final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane();
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!FRContext.isChineseEnv()) {
manager.setSearchOnLine(false);
}
alphaFineConfigPane.populate(manager);
DialogActionListener dialogActionListener = new DialogActionAdapter() {
public void doOk() {
alphafineConfigPane.update();
designerFrame.refreshToolbar();
alphaFineConfigPane.update();
AlphaFineContext.fireAlphaFineEnable(manager.isEnabled());
}
};
BasicDialog basicDialog = alphafineConfigPane.showMediumWindow(designerFrame, dialogActionListener);
BasicDialog basicDialog = alphaFineConfigPane.showMediumWindow(designerFrame, dialogActionListener);
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.
*/
public class AlphafineConfigManager implements XMLable {
public class AlphaFineConfigManager implements XMLable {
/**
* 是否开启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() {
return alphafineConfigManager;
public static AlphaFineConfigManager getInstance() {
return alphaFineConfigManager;
}
@Override
@ -95,6 +95,7 @@ public class AlphafineConfigManager implements XMLable {
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
this.setEnabled(reader.getAttrAsBoolean("isEnabled", true));
this.setSearchOnLine(reader.getAttrAsBoolean("isSearchOnline", true));
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", 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;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -20,7 +21,7 @@ import java.awt.event.KeyEvent;
/**
* 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 DISPLAY_TYPE = "+";
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 UITextField shortcutsField;
public AlphafineConfigPane() {
public AlphaFineConfigPane() {
this.initComponents();
}
@ -71,7 +72,7 @@ public class AlphafineConfigPane extends BasicPane {
}
private Component[][] initsearchRangeComponents() {
private Component[][] initSearchRangeComponents() {
Component[][] components = new Component[][]{
new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox},
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox}
@ -85,13 +86,13 @@ public class AlphafineConfigPane extends BasicPane {
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
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"));
isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon"));
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
isContainTemplateCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Templates"));
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);
contentPane.add(northPane);
}
@ -154,34 +155,36 @@ public class AlphafineConfigPane extends BasicPane {
return "AlphaFine";
}
public void populate(AlphafineConfigManager alphafineConfigManager) {
this.isEnabledCheckbox.setSelected(alphafineConfigManager.isEnabled());
this.isSearchOnlineCheckbox.setSelected(alphafineConfigManager.isSearchOnLine());
this.isContainActionCheckbox.setSelected(alphafineConfigManager.isContainAction());
this.isContainTemplateCheckbox.setSelected(alphafineConfigManager.isContainTemplate());
this.isContainDocumentCheckbox.setSelected(alphafineConfigManager.isContainDocument() && alphafineConfigManager.isSearchOnLine());
this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts());
public void populate(AlphaFineConfigManager alphaFineConfigManager) {
this.isEnabledCheckbox.setSelected(alphaFineConfigManager.isEnabled());
this.isSearchOnlineCheckbox.setEnabled(FRContext.isChineseEnv());
this.isSearchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine());
this.isContainActionCheckbox.setSelected(alphaFineConfigManager.isContainAction());
this.isContainTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate());
this.isContainFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.isContainDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine());
this.isContainDocumentCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine());
this.isContainRecommendCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
}
public void update() {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
AlphafineConfigManager alphafineConfigManager = designerEnvManager.getAlphafineConfigManager();
alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected());
alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected());
alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected());
alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected());
alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected());
alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected());
alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected());
alphafineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected());
alphafineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
designerEnvManager.setAlphafineConfigManager(alphafineConfigManager);
AlphaFineConfigManager alphaFineConfigManager = designerEnvManager.getAlphaFineConfigManager();
alphaFineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected());
alphaFineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected());
alphaFineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected());
alphaFineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected());
alphaFineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected());
alphaFineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected());
alphaFineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected());
alphaFineConfigManager.setContainFileContent(this.isContainFileContentCheckbox.isSelected());
alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager);
try {
DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile();
@ -192,8 +195,8 @@ public class AlphafineConfigPane extends BasicPane {
}
private String getDisplayShortCut(String shotrCut) {
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH)
private String getDisplayShortCut(String shortCut) {
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(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);

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.
* 提示弹窗
*/
public class RemindDialog extends UIDialog {
private RemindPane remindPane;
@ -22,7 +23,7 @@ public class RemindDialog extends UIDialog {
}
private void initComponent() {
final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager();
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
remindPane = new RemindPane(manager, this);
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));
initUI(manager, remindDialog);
this.setLayout(getAbsoluteLayout());
@ -53,7 +53,7 @@ public class RemindPane extends JPanel {
* @param manager
* @param dialog
*/
private void initUI(final AlphafineConfigManager manager, final UIDialog dialog) {
private void initUI(final AlphaFineConfigManager manager, final UIDialog dialog) {
openButton = new UIButton();
openButton.setIcon(openIcon);
@ -63,7 +63,7 @@ public class RemindPane extends JPanel {
public void mousePressed(MouseEvent e) {
manager.setOperateCount(0);
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;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
@ -9,6 +8,7 @@ import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
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.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -31,7 +32,8 @@ public class ConnectionListAction extends UpdateAction {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
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() {

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.file.FunctionManager;
import com.fr.file.FunctionManagerProvider;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -28,7 +29,8 @@ public class FunctionManagerAction extends UpdateAction {
this.setMenuKeySet(FUNCTION_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
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());
}
/**

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

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

@ -34,6 +34,12 @@ public abstract class AbstractServerTableDataDefineProvider extends AbstractProv
classForInitTableData(),
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(),
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;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import com.fr.design.dialog.BasicPane;
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.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* @author richer
@ -46,6 +41,7 @@ public abstract class LoadingBasicPane extends BasicPane {
}.execute();
}
private void initCards() {
card = new CardLayout();
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;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
@ -22,11 +23,13 @@ public class UITextPane extends JTextPane implements UIObserver {
public UITextPane() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener();
}
public UITextPane(StyledDocument doc) {
super(doc);
InputEventBaseOnOS.addBasicEditInputMap(this);
iniListener();
}

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

@ -1,5 +1,6 @@
package com.fr.design.gui.itextarea;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
@ -7,33 +8,14 @@ import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
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 {
private UIObserverListener uiObserverListener;
public UITextArea(int i, int j) {
super(i, j);
InputMap inputMap = this.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);
}
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}
@ -44,11 +26,13 @@ public class UITextArea extends JTextArea implements UIObserver {
public UITextArea() {
super();
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}
public UITextArea(String s) {
super(s);
InputEventBaseOnOS.addBasicEditInputMap(this);
initComponents();
}

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

@ -1,20 +1,17 @@
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.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants;
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.
*/
@ -54,7 +51,6 @@ public class UINumberField extends UITextField {
this.maxDecimalLength = maxDecimalLength;
this.minValue = minValue;
this.maxValue = maxValue;
setFieldDocument();
}

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

@ -1,5 +1,6 @@
package com.fr.design.gui.itextfield;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
@ -10,12 +11,8 @@ import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* @author Jerry
@ -31,42 +28,32 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() {
super();
InputMap inputMap = this.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);
}
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(int columns) {
super(columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(String text, int columns) {
super(text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(String text) {
super(text);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}
public UITextField(Document doc, String text, int columns) {
super(doc, text, columns);
InputEventBaseOnOS.addBasicEditInputMap(this);
initListener();
}

13
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_Custom_Job_Description=Description
FR-Designer_Property=Property
FR-Designer_ClassName=Class Name
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_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_No=No
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_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.
@ -1997,7 +1992,7 @@ FR-Designer_AlphaFine_EnableInternet=Designer_AlphaFine_EnableInternet
FR-Designer_AlphaFine_EnableInternetSearch=SearchOnLine
FR-Designer_AlphaFine_Shortcut_Config=Shortcut Config
FR-Designer_AlphaFine_SearchRange=Search Range
FR-Designer_AlphaFine_Conclude=Conclude
FR-Designer_AlphaFine_Recommend=Recommend
FR-Designer-Plugin_Addon=Plugin Addon
FR-Designer_Templates=FR-Designer_Templates
FR-Designer_Templates_Content=Templates Contents
@ -2006,6 +2001,7 @@ FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_Alphafine=AlphaFine
FR-Designer-Alphafine_No_Remind=
<<<<<<< HEAD
FR-Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
FR-Designer-Plugin_Install_Dependence=
@ -2078,4 +2074,7 @@ FR-Designer-Plugin-Store_Finereport=
FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer=
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

29
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_Formula=Formula
FR-Designer_Forum=Forum
FR-Designer_Get-CubeGetting cube=
FR-Designer_Help=Help
FR-Designer_Hide=Hide
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_No=No
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_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.
@ -1043,7 +1038,7 @@ FR-Designer-Tree_Width=Tree Width
Record=Record
Poly-Report_Component=Aggregate Report Component
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
Three_Rows_Of_Three_Grid=A grid with 3 rows and 3 columns
WorkSheet=Free Report
@ -1411,7 +1406,7 @@ Rename=Rename
Widget-Load_By_Async=Async load
Shape=Shape
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
Fri=Fri
M_Report-Report_Parameter=Report Parameter
@ -1992,17 +1987,18 @@ FR-Designer_Permissions=Permissions
FR-Designer_Form_Button=Button
FR-Designer_WF_Name=Name
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_SearchRange=Search Range
FR-Designer_AlphaFine_Conclude=Conclude
FR-Designer_AlphaFine_Recommend=Recommend
FR-Designer-Plugin_Addon=Plugin Addon
FR-Designer_Templates=Templates
FR-Designer_Templates_Content=Template'Contents
FR-Designer_AlphaFine_ShowAll=show all
FR-Designer_Templates=Files
FR-Designer_Templates_Content=Files'contents
FR-Designer_AlphaFine_ShowAll=Show all
FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_AlphaFine_ShowLess=Show less
FR-Designer_Alphafine=AlphaFine
<<<<<<< HEAD
FR-Designer-Alphafine_No_Remind=don't remind
Designer-Plugin_Install_Success=
FR-Designer-Plugin_Install_Failed=
@ -2076,4 +2072,9 @@ FR-Designer-Plugin-Store_Finereport=
FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer=
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
Poly-Report_Component=\u805A\u5408\u5E33\u7968\u30A2\u30BB\u30F3\u30D6\u30EA
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
Three_Rows_Of_Three_Grid=3\u4E57\u306E3\u3064\u306E\u884C
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
Shape=\u56F3\u5F62
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
Fri=\u91D1
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
Poly-Report_Component=\uCDE8\uD569\uBB38\uC11C\uC5B4\uC148\uBE14\uB9AC
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
Three_Rows_Of_Three_Grid=3\uD589 3\uC5F4\uC758\uADF8\uB9AC\uB4DC
WorkSheet=\uC790\uC720\uBB38\uC11C
@ -1407,7 +1407,7 @@ Rename=\uB9AC\uB124\uC784
Widget-Load_By_Async=\uBE44\uB3D9\uAE30\uB85C\uB529
Shape=\uADF8\uB798\uD504
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
Fri=5
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
Poly-Report_Component=\u805A\u5408\u62A5\u8868\u7EC4\u4EF6
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
Three_Rows_Of_Three_Grid=\u4E09\u884C\u4E09\u5217\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u62A5\u8868
@ -1405,7 +1405,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u5F02\u6B65\u52A0\u8F7D
Shape=\u56FE\u5F62
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
Fri=\u4E94
M_Report-Report_Parameter=\u6A21\u677F\u53C2\u6570
@ -1984,7 +1984,6 @@ FR-Designer_Role=\u89D2\u8272
FR-Designer_Permissions=\u6743\u9650
FR-Designer_Form_Button=\u6309\u94AE
FR-Designer_WF_Name=\u540D\u79F0
FR-Designer_ClassName=\u7C7B\u540D
FR-Designer_AlphaFine_Enable=\u5F00\u542F
FR-Designer_AlphaFine_EnableAlphaFine=\u5F00\u542FAlphaFine\u529F\u80FD
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_Content=\u6A21\u677F\u5185\u5BB9
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_ShowLess=\u6536\u8D77
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_Jar=jar\u5305
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

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

@ -1038,7 +1038,7 @@ FR-Designer-Tree_Width=\u5BEC\u5EA6
Record=\u8A18\u9304
Poly-Report_Component=\u8907\u5408\u5F0F\u5831\u8868\u5143\u4EF6
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
Three_Rows_Of_Three_Grid=\u4E09\u5217\u4E09\u6B04\u7684\u683C\u5B50
WorkSheet=\u81EA\u7531\u5831\u8868
@ -1406,7 +1406,7 @@ Rename=\u91CD\u547D\u540D
Widget-Load_By_Async=\u975E\u540C\u6B65\u8F09\u5165
Shape=\u5716\u5F62
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
Fri=\u4E94
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_Shortcut_Config=\u5FEB\u6377\u9375\u914D\u7F6E
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_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5167\u5BB9
@ -2072,4 +2072,7 @@ FR-Designer-Plugin-Store_Finereport=
FR-Designer-Plugin-Store_Version=
FR-Designer-Plugin-Store_Developer=
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() {
DesignerFrame.registApp(this);
}
@Override
public void undo() {
DesignerFrame.removeApp(this);
}
}

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

@ -149,6 +149,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
appList.add(app);
}
}
public static void removeApp(App<?> app) {
if (app != null) {
appList.remove(app);
}
}
protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane;
@ -189,6 +196,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return context.contain(TitlePlaceProcessor.MARK_STRING);
}
});
<<<<<<< HEAD
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
@ -198,7 +206,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
northEastPane.removeAll();
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
@ -210,6 +219,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
setName(DESIGNER_FRAME_NAME);
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.setTitle();// james:因为有默认的了
// 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.TutorialAction;
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.file.NewTemplatePane;
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.stable.ArrayUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
@ -164,7 +165,7 @@ public abstract class ToolBarMenuDock {
private void addAllUpdateActionsToList(List<MenuDef> menuList) {
shortCutsList = new ArrayList<>();
for (MenuDef menuDef : menuList) {
addUpdateActionToList(menuDef);
addUpdateActionToList(menuDef, 0);
}
}
@ -172,17 +173,20 @@ public abstract class ToolBarMenuDock {
* 递归获取所有UpdateAction
* @param menuDef
*/
private void addUpdateActionToList(MenuDef menuDef) {
String ParentName = menuDef.getName();
private void addUpdateActionToList(MenuDef menuDef, int level) {
if (menuDef instanceof OpenRecentReportMenuDef) {
return;
}
String parentName = StringUtils.EMPTY;
if (level > 0) {
parentName = menuDef.getName();
}
level++;
for (ShortCut shortCut : menuDef.getShortcutList()) {
if (shortCut instanceof UpdateAction) {
shortCutsList.add(new UpdateActionModel(ParentName, (UpdateAction) shortCut));
shortCutsList.add(new UpdateActionModel(parentName, (UpdateAction) shortCut));
} 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(new AboutAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AlphafineAction());
shortCuts.add(new AlphaFineAction());
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;
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.
@ -10,14 +12,35 @@ import com.fr.design.actions.UpdateAction;
* action对象
*/
public class UpdateActionModel {
private static final String SEPARATOR = "/";
private String parentName;
private String actionName;
private String className;
private String searchKey;
private UpdateAction action;
public UpdateActionModel(String parentName, UpdateAction action) {
this.parentName = parentName;
this.action = action;
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) {
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.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -114,10 +115,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
}
private void bindGlobalListener() {
Set<GlobalListenerProvider> providers = ExtraDesignClassManager.getInstance().getArray(GlobalListenerProvider.XML_TAG);
for (GlobalListenerProvider provider : providers) {
Toolkit.getDefaultToolkit().addAWTEventListener(provider.listener(), AWTEvent.KEY_EVENT_MASK);
}
GlobalListenerProviderManager.getInstance().init();
}
private void showErrorPluginsMessage() {

25
designer_chart/build.9.0.gradle

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

43
designer_chart/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
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版本
sourceCompatibility=1.7
//jar包版本
@ -15,15 +36,21 @@ jar{
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"src",includes:"com/**")
}
}
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src"]
// }
// }
//}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
@ -25,7 +26,8 @@ public class ChartPreStyleAction extends UpdateAction {
this.setMenuKeySet(CHART_DEFAULT_STYLE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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){
options.encoding = 'UTF-8'
}
@ -36,16 +36,23 @@ jar{
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src",
"${srcDir}/../designer/src"]
}
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"../designer/src",includes:"com/**")
fileset(dir:"src",includes:"com/**")
}
}
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src",
// "${srcDir}/../designer/src"]
// }
// }
//}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -71,8 +78,8 @@ def dataContent ={def dir ->
task copyFile(type:Copy,dependsOn:compileJava){
copy{
with dataContent.call("${srcDir}/src")
with dataContent.call("${srcDir}/../designer/src")
with dataContent.call("${srcDir}/src/main/java")
// with dataContent.call("${srcDir}/../designer/src")
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'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
fileset (dir:"${srcDir}/../designer/src"){
fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}

52
designer_form/build.9.0.gradle.bak

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
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版本
sourceCompatibility=1.7
//jar包版本
@ -15,16 +36,23 @@ jar{
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src",
"${srcDir}/../designer/src"]
}
ant{
delete(dir:"src/main")
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"../designer/src",includes:"com/**")
fileset(dir:"src",includes:"com/**")
}
}
//
//sourceSets{
// main{
// java{
// srcDirs=["${srcDir}/src",
// "${srcDir}/../designer/src"]
// }
// }
//}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
@ -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'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
fileset (dir:"${srcDir}/../designer/src"){
fileset (dir:"${srcDir}/src/main/java"){
include (name:'**/*.js')
include (name:'**/*.css')
}

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

@ -26,6 +26,7 @@ import com.fr.general.ComparatorUtils;
public class WidgetPropertyTable extends AbstractPropertyTable {
private FormDesigner designer;
private static final int LEFT_COLUMN_WIDTH = 97; // "属性名"列的宽度
public WidgetPropertyTable(FormDesigner designer) {
super();
@ -86,9 +87,18 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
setModel(model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(30);
tc.setMinWidth(LEFT_COLUMN_WIDTH);
tc.setMaxWidth(LEFT_COLUMN_WIDTH);
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) {
this.designer = designer;
@ -110,7 +120,14 @@ public class WidgetPropertyTable extends AbstractPropertyTable {
}
return null;
}
@Override
public void columnMarginChanged(javax.swing.event.ChangeEvent e) {
setRightColumnWidth(false);
super.columnMarginChanged(e);
setRightColumnWidth(true);
}
/**
* 待说明
*/

Loading…
Cancel
Save