Browse Source

Merge pull request #917 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit 'd705d50fa21418af0872eed06a6e3dde7cc3b11c':
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix 设置的搜索
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  alphafine bug fix 设置搜索
  alphafine 设置的面板内容搜索
master
superman 8 years ago
parent
commit
f311ec8c0f
  1. 8
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  2. 10
      designer/src/com/fr/design/actions/report/ReportEngineAttrAction.java
  3. 5
      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. 5
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  12. 16
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  13. 79
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  14. 33
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  15. 100
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  16. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  17. 8
      designer/src/com/fr/design/webattr/EditReportServerParameterPane.java
  18. 11
      designer/src/com/fr/design/webattr/ReportWebAttrPane.java
  19. 2
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  20. 119
      designer_base/src/com/fr/design/actions/UpdateAction.java
  21. 56
      designer_base/src/com/fr/design/actions/file/PreferenceAction.java
  22. 3
      designer_base/src/com/fr/design/actions/help/AboutAction.java
  23. 4
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java
  24. 1
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java
  25. 6
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  26. 4
      designer_base/src/com/fr/design/actions/server/FunctionManagerAction.java
  27. 26
      designer_base/src/com/fr/design/gui/frpane/LoadingBasicPane.java
  28. 5
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  29. 39
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  30. 4
      designer_chart/src/com/fr/design/module/ChartPreStyleAction.java

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

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

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

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

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

@ -9,7 +9,9 @@ import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.ReportExportAttrPane; import com.fr.design.report.ReportExportAttrPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.plugin.chart.designer.other.HyperlinkMapFactory;
public class ReportExportAttrAction extends JWorkBookAction { public class ReportExportAttrAction extends JWorkBookAction {
@ -18,7 +20,8 @@ public class ReportExportAttrAction extends JWorkBookAction {
this.setMenuKeySet(KeySetUtils.REPORT_EXPORT_ATTR); this.setMenuKeySet(KeySetUtils.REPORT_EXPORT_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exportAttr.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/exportAttr.png"));
this.setSearchText(new ReportExportAttrPane());
} }
/** /**

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,15 +8,12 @@ import com.fr.stable.StringUtils;
* Created by XiaXiang on 2017/5/8. * Created by XiaXiang on 2017/5/8.
*/ */
public class AlphaFineHelper { public class AlphaFineHelper {
private static AlphaFineDialog dialog;
/** /**
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
*/ */
public static void showAlphaFineDialog(boolean forceOpen) { public static void showAlphaFineDialog(boolean forceOpen) {
if (dialog == null) { AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
}
dialog.setVisible(true); dialog.setVisible(true);
} }

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

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

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

@ -68,15 +68,19 @@ public class AlphaFineDialog extends UIDialog {
private SearchListModel searchListModel; private SearchListModel searchListModel;
private SwingWorker searchWorker; private SwingWorker searchWorker;
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下 //是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean foreOpen; private boolean forceOpen;
public AlphaFineDialog(Frame parent, boolean foreOpen) { public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent); super(parent);
this.forceOpen = forceOpen;
initProperties(); initProperties();
initListener(); initListener();
initComponents(); initComponents();
} }
/**
* 初始化全部组件
*/
private void initComponents() { private void initComponents() {
searchTextField = new AlphaFineTextField("AlphaFine"); searchTextField = new AlphaFineTextField("AlphaFine");
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
@ -122,6 +126,9 @@ public class AlphaFineDialog extends UIDialog {
}); });
} }
/**
*
*/
private void initProperties() { private void initProperties() {
setUndecorated(true); setUndecorated(true);
addComponentListener(new ComponentHandler()); addComponentListener(new ComponentHandler());
@ -129,6 +136,10 @@ public class AlphaFineDialog extends UIDialog {
centerWindow(this); centerWindow(this);
} }
/**
* 设置面板位置
* @param win
*/
private void centerWindow(Window win) { private void centerWindow(Window win) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
@ -144,6 +155,10 @@ public class AlphaFineDialog extends UIDialog {
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);
} }
/**
* 执行搜索暂时字符要求超过两个才开始搜索
* @param text
*/
private void doSearch(String text) { private void doSearch(String text) {
if (text.length() < 2 || text.contains("'")) { if (text.length() < 2 || text.contains("'")) {
return; return;
@ -156,6 +171,9 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 移除搜索结果
*/
private void removeSearchResult() { private void removeSearchResult() {
if (searchResultPane != null) { if (searchResultPane != null) {
remove(searchResultPane); remove(searchResultPane);
@ -178,7 +196,10 @@ public class AlphaFineDialog extends UIDialog {
// } // }
/**
* 展示搜索结果
* @param searchText
*/
private void showSearchResult(String searchText) { private void showSearchResult(String searchText) {
if (searchResultPane == null) { if (searchResultPane == null) {
initSearchResultComponents(); initSearchResultComponents();
@ -187,6 +208,9 @@ public class AlphaFineDialog extends UIDialog {
initSearchWorker(searchText); initSearchWorker(searchText);
} }
/**
* 初始化搜索面板
*/
private void initSearchResultComponents() { private void initSearchResultComponents() {
searchResultList = new JList(); searchResultList = new JList();
searchResultPane = new JPanel(); searchResultPane = new JPanel();
@ -208,6 +232,10 @@ public class AlphaFineDialog extends UIDialog {
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
} }
/**
* 异步加载搜索结构
* @param searchText
*/
private void initSearchWorker(final String searchText) { private void initSearchWorker(final String searchText) {
searchResultList.setModel(new SearchListModel(AlphaSearchManager.getSearchManager().showDefaultSearchResult())); searchResultList.setModel(new SearchListModel(AlphaSearchManager.getSearchManager().showDefaultSearchResult()));
if (this.searchWorker != null && !this.searchWorker.isDone()) { if (this.searchWorker != null && !this.searchWorker.isDone()) {
@ -230,6 +258,13 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.repaint(); searchResultList.repaint();
validate(); validate();
repaint(); repaint();
/**
* 默认选中第1项第0项为title
*/
if (searchResultList.getModel().getSize() > 0) {
searchResultList.setSelectedIndex(1);
}
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
@ -243,7 +278,14 @@ public class AlphaFineDialog extends UIDialog {
this.searchWorker.execute(); this.searchWorker.execute();
} }
/**
* 初始化监听器
* @param searchText
*/
private void initListListener(final String searchText) { private void initListListener(final String searchText) {
/**
* 鼠标监听器
*/
searchResultList.addMouseListener(new MouseAdapter() { searchResultList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -262,7 +304,9 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
// TODO: 2017/5/8 xiaxiang: e.getClickCount() == 1 时,偶发性的不能触发,所以先放到valueChanged /**
*单击时触发右侧面板展示搜索结果
*/
searchResultList.addListSelectionListener(new ListSelectionListener() { searchResultList.addListSelectionListener(new ListSelectionListener() {
@Override @Override
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
@ -273,6 +317,9 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
/**
* 键盘监听器
*/
searchResultList.addKeyListener(new KeyAdapter() { searchResultList.addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
@ -435,6 +482,9 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 窗口拖拽
*/
private void initMouseListener() { private void initMouseListener() {
addMouseMotionListener(new MouseMotionAdapter() { addMouseMotionListener(new MouseMotionAdapter() {
@Override @Override
@ -487,9 +537,9 @@ public class AlphaFineDialog extends UIDialog {
Point p = k.getLocationOnScreen(); Point p = k.getLocationOnScreen();
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); Rectangle dialogRectangle = AlphaFineDialog.this.getBounds();
Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize()); Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !foreOpen) { if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
foreOpen = false; forceOpen = false;
} }
} }
} }
@ -604,15 +654,20 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 点击显示更多时添加对应的model到list点击收起是移除model
* @param index
* @param selectedValue
*/
private void rebuildShowMoreList(int index, MoreModel selectedValue) { private void rebuildShowMoreList(int index, MoreModel selectedValue) {
SearchResult moreResult = getMoreResult(selectedValue); SearchResult moreResult = getMoreResult(selectedValue);
if((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) { if((selectedValue).getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowLess"))) {
for (int i = 0; i < moreResult.size(); i++) { for (int i = 0; i < moreResult.size(); i++) {
this.searchListModel.insertElementAt(moreResult.get(i), index + AlphaFineConstants.SHOW_SIZE -1 + i); this.searchListModel.insertElementAt(moreResult.get(i), index + AlphaFineConstants.SHOW_SIZE + 1 + i);
} }
} else { } else {
for (int i = 0; i < moreResult.size(); i++) { for (int i = 0; i < moreResult.size(); i++) {
this.searchListModel.removeElementAt(index + AlphaFineConstants.SHOW_SIZE - 1); this.searchListModel.removeElementAt(index + AlphaFineConstants.SHOW_SIZE + 1);
} }
} }
@ -669,11 +724,11 @@ public class AlphaFineDialog extends UIDialog {
} }
public boolean isForeOpen() { public boolean isForceOpen() {
return foreOpen; return forceOpen;
} }
public void setForeOpen(boolean foreOpen) { public void setForceOpen(boolean forceOpen) {
this.foreOpen = foreOpen; this.forceOpen = forceOpen;
} }
} }

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

@ -1,16 +1,16 @@
package com.fr.design.mainframe.alphafine.search.manager; package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel; import com.fr.design.mainframe.toolbar.UpdateActionModel;
import com.fr.general.FRLogger; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import java.util.List; import java.util.List;
@ -38,8 +38,8 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) {
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (updateActionModel.getActionName() != null) { if (StringUtils.isNotBlank(updateActionModel.getSearchKey())) {
if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) { if (updateActionModel.getSearchKey().toLowerCase().contains(searchText.toLowerCase()) ) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
} }
} }
@ -53,7 +53,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
moreModelList.add(filterModelList.get(i)); moreModelList.add(filterModelList.get(i));
} }
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE) { 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)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.ACTION));
} else { } else {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set"), CellType.ACTION));
} }
@ -70,24 +70,17 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
} }
/** /**
* 根据类名反射获取对象 * 根据类名获取对象
* @param actionName * @param actionName
* @return * @return
*/ */
public static ActionModel getModelFromCloud(String actionName ) { public static ActionModel getModelFromCloud(String actionName ) {
UpdateAction action = null; List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
String name = null; for (UpdateActionModel updateActionModel : updateActions) {
try { if (ComparatorUtils.equals(actionName, updateActionModel.getClassName())) {
Class<?> className = Class.forName(actionName); return new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction());
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); return null;
} }
} }

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

@ -3,7 +3,7 @@ package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
@ -38,11 +38,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
private static final int MAX_SIZE = 3; private static final int MAX_SIZE = 3;
private static RecentSearchManager recentSearchManager = null; private static RecentSearchManager recentSearchManager = null;
private static File recentFile = null; private static File recentFile = null;
private List<String> fileList;
private List<String> actionList;
private List<String> documentList;
private SearchResult modelList; private SearchResult modelList;
private List<String> pluginList; private List<AlphaCellModel> fileList = new ArrayList<>();
private List<AlphaCellModel> actionList = new ArrayList<>();
private List<AlphaCellModel> documentList = new ArrayList<>();
private List<AlphaCellModel> pluginList = new ArrayList<>();
private List<AlphaCellModel> recentModelList = new ArrayList<>(); private List<AlphaCellModel> recentModelList = new ArrayList<>();
private Map<String, List<AlphaCellModel>> recentKVModelMap = new HashMap<>(); private Map<String, List<AlphaCellModel>> recentKVModelMap = new HashMap<>();
@ -95,17 +95,73 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
} }
} }
private void addModelToList(List<AlphaCellModel> list, String name) { private void addModelToList(List<AlphaCellModel> list, String name) {
try { try {
AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name)); AlphaCellModel model = getModelFromJson(new JSONObject(name));
if (model != null) { if (model != null) {
list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); list.add(model);
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }
} }
/**
* 转成cellModel
* @param object
* @return
*/
private AlphaCellModel getModelFromJson(JSONObject object) {
int typeValue = object.optInt("cellType");
AlphaCellModel cellModel = null;
switch (CellType.parse(typeValue)) {
case ACTION:
cellModel = ActionSearchManager.getModelFromCloud(object.optString("result"));
if (cellModel != null) {
actionList.add(cellModel);
}
break;
case DOCUMENT:
cellModel = DocumentSearchManager.getModelFromCloud(object.optJSONObject("result"));
if (cellModel != null) {
documentList.add(cellModel);
}
break;
case FILE:
cellModel = FileSearchManager.getModelFromCloud(object.optString("result"));
if (cellModel != null) {
fileList.add(cellModel);
}
break;
case PLUGIN:
case REUSE:
cellModel = PluginSearchManager.getModelFromCloud(object.optJSONObject("result"));
if (cellModel != null) {
pluginList.add(cellModel);
}
break;
}
return cellModel;
}
public List<AlphaCellModel> getFileList() {
return fileList;
}
public List<AlphaCellModel> getActionList() {
return actionList;
}
public List<AlphaCellModel> getDocumentList() {
return documentList;
}
public List<AlphaCellModel> getPluginList() {
return pluginList;
}
@Override @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG); writer.startTAG(XML_TAG);
@ -135,37 +191,7 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
return "alphafine_recent.xml"; return "alphafine_recent.xml";
} }
public List<String> getFileList() {
return fileList;
}
public void setFileList(List<String> fileList) {
this.fileList = fileList;
}
public List<String> getActionList() {
return actionList;
}
public void setActionList(List<String> actionList) {
this.actionList = actionList;
}
public List<String> getDocumentList() {
return documentList;
}
public void setDocumentList(List<String> documentList) {
this.documentList = documentList;
}
public List<String> getPluginList() {
return pluginList;
}
public void setPluginList(List<String> pluginList) {
this.pluginList = pluginList;
}
/** /**
* 获取xml * 获取xml

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

@ -47,7 +47,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
if (jsonArray != null && jsonArray.length() > 0) { if (jsonArray != null && jsonArray.length() > 0) {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { if (alphaCellModel != null && !RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) {
this.modelList.add(alphaCellModel); this.modelList.add(alphaCellModel);
} }
} }

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

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

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

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

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

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

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

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

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

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

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

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

4
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java

@ -9,6 +9,7 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -21,7 +22,8 @@ public class AlphafineAction extends UpdateAction {
this.setMenuKeySet(ALPHAFINE); this.setMenuKeySet(ALPHAFINE);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
this.setSearchText(new AlphafineConfigPane());
} }
public static final MenuKeySet ALPHAFINE = new MenuKeySet() { public static final MenuKeySet ALPHAFINE = new MenuKeySet() {

1
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java

@ -95,6 +95,7 @@ public class AlphafineConfigManager implements XMLable {
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (reader.isAttr()) { if (reader.isAttr()) {
this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); this.setEnabled(reader.getAttrAsBoolean("isEnabled", true));
this.setSearchOnLine(reader.getAttrAsBoolean("isSearchOnline", true));
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true)); this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));

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

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

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

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

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

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

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

@ -166,14 +166,13 @@ public abstract class ToolBarMenuDock {
* @param menuDef * @param menuDef
*/ */
private void addUpdateActionToList(MenuDef menuDef) { private void addUpdateActionToList(MenuDef menuDef) {
String ParentName = menuDef.getName();
if (menuDef instanceof OpenRecentReportMenuDef) { if (menuDef instanceof OpenRecentReportMenuDef) {
return; return;
} }
String parentName = menuDef.getName();
for (ShortCut shortCut : menuDef.getShortcutList()) { for (ShortCut shortCut : menuDef.getShortcutList()) {
if (shortCut instanceof UpdateAction) { if (shortCut instanceof UpdateAction) {
shortCutsList.add(new UpdateActionModel(ParentName, (UpdateAction) shortCut)); shortCutsList.add(new UpdateActionModel(parentName, (UpdateAction) shortCut));
} else if (shortCut instanceof MenuDef) { } else if (shortCut instanceof MenuDef) {
addUpdateActionToList((MenuDef) shortCut); addUpdateActionToList((MenuDef) shortCut);
} }

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

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

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

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

Loading…
Cancel
Save