From d1494dc20b29311e840f4cacfdcf9795b125224d Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 15:08:24 +0800 Subject: [PATCH 1/8] bug fix --- .../mainframe/alphafine/images/alphafine0.png | Bin 369 -> 0 bytes .../mainframe/alphafine/images/alphafine1.png | Bin 372 -> 418 bytes .../mainframe/alphafine/images/alphafine2.png | Bin 248 -> 372 bytes .../mainframe/alphafine/images/alphafine3.png | Bin 418 -> 248 bytes .../mainframe/alphafine/images/alphafine4.png | Bin 237 -> 369 bytes .../mainframe/alphafine/images/alphafine5.png | Bin 0 -> 237 bytes .../manager/RecommendSearchManager.java | 54 ++++++++++-------- .../AlphaFine/AlphafineConfigManager.java | 14 ++--- .../help/AlphaFine/AlphafineConfigPane.java | 18 +++--- .../design/locale/designer_zh_CN.properties | 2 +- 10 files changed, 46 insertions(+), 42 deletions(-) delete mode 100644 designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png create mode 100644 designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png b/designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png deleted file mode 100644 index e23a33ab542ea640bb96bbd86d609624a7fd87e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 369 zcmV-%0gnEOP)_OaZPf)Q->&My_7?6NkeSLuTq(Z= P00000NkvXXu0mjfh`61) diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/alphafine1.png b/designer/src/com/fr/design/mainframe/alphafine/images/alphafine1.png index aae79cb065f47bb3a700dd4941308fc908ed2ba2..8d5464a6d2575cb7d45471e4fda5e9ef09f324d6 100644 GIT binary patch delta 370 zcmV-&0ge9j0-^(uIe%11L_t(I%cYaCQN%D1MW1iTbyUDz2QWCtR{`$eM6BdGz#VV_ zj#L5!BoIe0agVj;ENH)LxPf(wEI`P|F5!f9Qn^WNe_7)R=^&(2HpWHR|Q-F z&w%yL93v)+736hT0v|w75(}IuE+|O_7~s@9GfXQumo275y}%ln}LwhFxQ&NO))3ZPTJk%PiJ z)8}=tz=Q7Fg}^Pa_RchNGy(^mjVeSjYhkvF2uP(#*xxA-NgKI2>JefBtDfU}mE9-p zJx=Du#ssZ`-fPrfd^t=ws06kma|^WDIF3<;PWrCAGs8rMMt4gfs_~^lGKmH71Z=!B zhq<|*ifjx67fDUZuo-vMKZ9@Yb@|ED;8TBYFRC4a+?g+HMl&Ed+;sEdpcyR`JlK1=_Qc8?TDh16TPZtpi zFy?)fhHQ|Stjv5uk#o2 WJ$Fkeu_s^v0000Wyv5QRS&A}68)(}6v6Du51b=bkZ+mAHf} zf#8(iRd99%hFrnX0oQ?40ZtZ=jCIDhGYkUl&)c_ev(3)$ffxR715i7oJV3VD`N!|F$P+ZqP!!mDh>4@}s#ydxGc* zrawuLl7N!0E(or$JF~N6CkX%-@(Xy-7880245m_N@BGOMC$fhjhw2;Oe;m0000!|F$P+ZqP!!mDh>4@}s#ydxGc* zrawuLl7N!0E(or$JF~N6CkX%-@(Xy-7880245m_N@BGOMC$fhjhw2;Oe;m00007JAiwH=iN!Z^h5J?-kIqDH&0;`_mdX?QL z?LAKB#l{4!f^6Q@Uwk=CIH&}+B6AD0**K0-g--geyfec@g+_NvAgb}DLNbX3@C0nU zGl#jkpNp9rq#>D&GGYGPm#)A5!fu9xUw>hdNHa*^9=Mgg05;m+$*v<9;1i6+o{c+@ RquT%g002ovPDHLkV1kW1r_KNX diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/alphafine4.png b/designer/src/com/fr/design/mainframe/alphafine/images/alphafine4.png index 064f0d8e8afba4e54ecfdbabf3e0cb0a278026da..e23a33ab542ea640bb96bbd86d609624a7fd87e4 100644 GIT binary patch delta 322 zcmV-I0loh10r3KmIDY{nNklZ%LHQhk$BVjkMY64(O` zpnwSUz`+|e=GY4YZDTEsuPny^wBD%WnLyh({q2e0#}{z8N3e%?`3d!qc*Z90H0#7J2$Lc<89RiC*Q8>!uA&K8<3gG ULtH7p1poj507*qoM6N<$g4ynuE&u=k delta 189 zcmV;u07C!q0__2iIDY`2Nkl2bgD$m-`GP!0}QBmfP8_06yknkClUGvoaiHOPi58O@M3708%^E z+>@L5Qa=gEKIYTb01GTY@-bgG_=72>{Pz#+0FpXRBV6>ZIW`8VXR2Wuwk}AYsKT}% rkY@Eh4b~fM)zgBcrx2R;2)6J5Z2(4Uity>Z00000NkvXXu0mjf$Z}Pg diff --git a/designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png b/designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png new file mode 100644 index 0000000000000000000000000000000000000000..064f0d8e8afba4e54ecfdbabf3e0cb0a278026da GIT binary patch literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GGLLkg|>2BR0px}H@ z7sn8b(`P3gFJnLPVPkUi%KyJwfL zF>vcRd@_tT|Iw_u^v`$xHw=@k{FGz9tg~cWnZ7DfYMY+N{1u0`$xlf8YR7v`I_K); jrX|Y-W_{(@_JJXn!7Z!n!^^!ur!siD`njxgN@xNAlSy2u literal 0 HcmV?d00001 diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index 9e2355855..44ce23ed3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.search.manager; +import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; @@ -19,7 +20,7 @@ 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 final String SEARCHAPI = "http://192.168.2.45:8080/monitor/alphafine/search/recommend?searchKey="; public synchronized static RecommendSearchManager getRecommendSearchManager() { if (recommendSearchManager == null) { @@ -29,35 +30,38 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { } @Override public synchronized SearchResult getLessSearchResult(String searchText) { - String result; - this.modelList = new SearchResult(); - HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); - httpClient.asGet(); - httpClient.setTimeout(5000); - if (!httpClient.isServerAlive()) { - return modelList; - } - result = httpClient.getResponseText(); - 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++) { - AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); - if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { - this.modelList.add(alphaCellModel); + if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) { + String result; + this.modelList = new SearchResult(); + HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); + httpClient.asGet(); + httpClient.setTimeout(5000); + if (!httpClient.isServerAlive()) { + return modelList; + } + result = httpClient.getResponseText(); + 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++) { + AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); + if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { + this.modelList.add(alphaCellModel); + } } } } - } - } catch (JSONException e) { - FRLogger.getLogger().error(e.getMessage()); - } - if (modelList.size() > 0) { - modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); + } catch (JSONException e) { + FRLogger.getLogger().error("cloud server error! :" + e.getMessage()); + } + if (modelList.size() > 0) { + modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); + } } + return modelList; } diff --git a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java index be1ff3386..aa73d7afe 100644 --- a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java +++ b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java @@ -35,7 +35,7 @@ public class AlphafineConfigManager implements XMLable { /** * 猜您需要 */ - private boolean isContainConclude; + private boolean isContainRecommend; /** * 设置 @@ -88,7 +88,7 @@ public class AlphafineConfigManager implements XMLable { this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true)); - this.setContainConclude(reader.getAttrAsBoolean("isContainConclude", true)); + this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true)); this.setContainAction(reader.getAttrAsBoolean("isContainAction", true)); this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true)); this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false)); @@ -104,7 +104,7 @@ public class AlphafineConfigManager implements XMLable { writer.attr("isEnabled", this.isEnabled()) .attr("isSearchOnline", this.isSearchOnLine()) .attr("shortcuts", this.getShortcuts()) - .attr("isContainConclude", this.isContainConclude()) + .attr("isContainRecommend", this.isContainRecommend()) .attr("isContainAction", this.isContainAction()) .attr("isContainDocument", this.isContainDocument()) .attr("isContainTemplate", this.isContainTemplate()) @@ -176,12 +176,12 @@ public class AlphafineConfigManager implements XMLable { this.isContainPlugin = containPlugin; } - public boolean isContainConclude() { - return isContainConclude; + public boolean isContainRecommend() { + return isContainRecommend; } - public void setContainConclude(boolean containConclude) { - isContainConclude = containConclude; + public void setContainRecommend(boolean containConclude) { + isContainRecommend = containConclude; } public boolean isEnabled() { diff --git a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java index 470d04196..5d4d75275 100644 --- a/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java +++ b/designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java @@ -53,7 +53,7 @@ public class AlphafineConfigPane extends BasicPane { private static final double COLUMN_GAP = 180; private static final double ROW_GAP = 25; private KeyStroke shortCutKeyStore = null; - private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainConcludeCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; + private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; private UITextField shortcutsField; public AlphafineConfigPane() { @@ -73,7 +73,7 @@ public class AlphafineConfigPane extends BasicPane { private Component[][] initsearchRangeComponents() { Component[][] components = new Component[][]{ - new Component[]{isContainConcludeCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, + new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} }; return components; @@ -85,7 +85,7 @@ public class AlphafineConfigPane extends BasicPane { double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange")); - isContainConcludeCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude")); + isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude")); 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")); @@ -125,14 +125,14 @@ public class AlphafineConfigPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { if (!isSearchOnlineCheckbox.isSelected()) { - isContainConcludeCheckbox.setEnabled(false); + isContainRecommendCheckbox.setEnabled(false); isContainPluginCheckbox.setEnabled(false); isContainDocumentCheckbox.setEnabled(false); - isContainConcludeCheckbox.setSelected(false); + isContainRecommendCheckbox.setSelected(false); isContainPluginCheckbox.setSelected(false); isContainDocumentCheckbox.setSelected(false); } else { - isContainConcludeCheckbox.setEnabled(true); + isContainRecommendCheckbox.setEnabled(true); isContainPluginCheckbox.setEnabled(true); isContainDocumentCheckbox.setEnabled(true); } @@ -163,8 +163,8 @@ public class AlphafineConfigPane extends BasicPane { this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); - this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine()); - this.isContainConcludeCheckbox.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()); } @@ -175,7 +175,7 @@ public class AlphafineConfigPane extends BasicPane { alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); - alphafineConfigManager.setContainConclude(this.isContainConcludeCheckbox.isSelected()); + alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected()); alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 0da090b68..62caf9aeb 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -1999,6 +1999,6 @@ 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_Latest=\u6700\u8FD1\u5E38\u7528 +FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 \ No newline at end of file From 71f0274776959232abac787f21a8bbb9e94cb42a Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 16:58:36 +0800 Subject: [PATCH 2/8] bug fix --- .../alphafine/component/AlphaFineDialog.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 00e1744fc..2c7519ac8 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -248,11 +248,9 @@ public class AlphaFineDialog extends UIDialog { int selectedIndex = searchResultList.getSelectedIndex(); Object selectedValue = searchResultList.getSelectedValue(); if (e.getClickCount() == 2) { - final int i = searchResultList.locationToIndex(e.getPoint()); - searchResultList.setSelectedIndex(i); doNavigate(selectedIndex); if (selectedValue instanceof AlphaCellModel) { - saveHistory(searchText, (AlphaCellModel) selectedValue); + saveHistory((AlphaCellModel) selectedValue); } } else if (e.getClickCount() == 1) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { @@ -277,7 +275,11 @@ public class AlphaFineDialog extends UIDialog { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { + Object selectedValue = searchResultList.getSelectedValue(); doNavigate(searchResultList.getSelectedIndex()); + if (searchResultList.getSelectedValue() instanceof AlphaCellModel) { + saveHistory((AlphaCellModel) selectedValue); + } } } }); @@ -556,10 +558,10 @@ public class AlphaFineDialog extends UIDialog { /** * 保存本地(本地常用) - * @param searchText * @param cellModel */ - private void saveHistory(String searchText, AlphaCellModel cellModel) { + private void saveHistory(AlphaCellModel cellModel) { + String searchText = searchTextField.getText(); RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); recentSearchManager.addRecentModel(searchText, cellModel); recentSearchManager.saveXMLFile(); From 0ed921bfd04c6969f13145faa8f79df661cb6f4b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 17:12:23 +0800 Subject: [PATCH 3/8] bug fix --- .../alphafine/search/manager/RecommendSearchManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java index 44ce23ed3..b2707e502 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java @@ -20,7 +20,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { private static RecommendSearchManager recommendSearchManager = null; private SearchResult modelList; //todo:for test - private static final String SEARCHAPI = "http://192.168.2.45:8080/monitor/alphafine/search/recommend?searchKey="; + private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey="; public synchronized static RecommendSearchManager getRecommendSearchManager() { if (recommendSearchManager == null) { @@ -55,7 +55,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor { } } catch (JSONException e) { - FRLogger.getLogger().error("cloud server error! :" + e.getMessage()); + FRLogger.getLogger().error("data transform error! :" + e.getMessage()); } if (modelList.size() > 0) { modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); From 9eba157623f2af396420280cbe7491fd2aed14db Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 18:47:11 +0800 Subject: [PATCH 4/8] bug fix --- .../alphafine/cell/model/ActionModel.java | 8 ++++- .../search/manager/ActionSearchManager.java | 8 +++-- .../mainframe/toolbar/ToolBarMenuDock.java | 24 +++++++++----- .../toolbar/UpdateActionManager.java | 8 ++--- .../mainframe/toolbar/UpdateActionModel.java | 32 +++++++++++++++++++ 5 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java index f0f0e32f6..493c5ad10 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java @@ -11,7 +11,7 @@ import java.io.Serializable; /** * Created by XiaXiang on 2017/4/20. */ -public class ActionModel extends AlphaCellModel implements Serializable { +public class ActionModel extends AlphaCellModel { private Action action; private String actionName; @@ -38,6 +38,12 @@ public class ActionModel extends AlphaCellModel implements Serializable { 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; diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 0200cdb24..12417f4d6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel; 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.Inter; @@ -35,10 +36,11 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { lessModelList = new SearchResult(); moreModelList = new SearchResult(); if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { - List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); - for (UpdateAction updateAction : updateActions) { + List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); + for (UpdateActionModel updateActionModel : updateActions) { + UpdateAction updateAction = updateActionModel.getAction(); if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) { - filterModelList.add(new ActionModel(updateAction.getName() ,updateAction)); + filterModelList.add(new ActionModel(updateAction.getName() ,updateActionModel.getParentName(), updateAction)); } } if (filterModelList != null && filterModelList.size() >0) { diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 536f984eb..ff49aa7b0 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -55,8 +55,7 @@ public abstract class ToolBarMenuDock { public static final int PANLE_HEIGNT = 26; private MenuDef[] menus; private ToolBarDef toolBarDef; - private ArrayList shortCuts; - + private List shortCutsList; /** * 更新菜单 */ @@ -145,27 +144,36 @@ public abstract class ToolBarMenuDock { addCommunityMenuDef(menuList); // 添加全部UpdateAction到actionmanager中 - getAllUpdateActions(menuList); - UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCuts); + addAllUpdateActionsToList(menuList); + UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCutsList); return menuList.toArray(new MenuDef[menuList.size()]); } - private List getAllUpdateActions(List menuList) { - shortCuts = new ArrayList<>(); + /** + * 获取所有actionmodel + * @param menuList + */ + private void addAllUpdateActionsToList(List menuList) { + shortCutsList = new ArrayList<>(); for (MenuDef menuDef : menuList) { addUpdateActionToList(menuDef); } - return shortCuts; } + /** + * 递归获取所有UpdateAction + * @param menuDef + */ private void addUpdateActionToList(MenuDef menuDef) { + + String ParentName = menuDef.getName(); if (menuDef instanceof OpenRecentReportMenuDef) { return; } for (ShortCut shortCut : menuDef.getShortcutList()) { if (shortCut instanceof UpdateAction) { - shortCuts.add((UpdateAction) shortCut); + shortCutsList.add(new UpdateActionModel(ParentName, (UpdateAction) shortCut)); } else if (shortCut instanceof MenuDef) { addUpdateActionToList((MenuDef) shortCut); } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index 05cad8d98..47ae6101f 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe.toolbar; -import com.fr.design.actions.UpdateAction; - import java.util.List; /** @@ -9,7 +7,7 @@ import java.util.List; */ public class UpdateActionManager { private static UpdateActionManager updateActionManager = null; - private List updateActions; + private List updateActions; public synchronized static UpdateActionManager getUpdateActionManager() { if (updateActionManager == null) { @@ -18,11 +16,11 @@ public class UpdateActionManager { return updateActionManager; } - public List getUpdateActions() { + public List getUpdateActions() { return updateActions; } - public void setUpdateActions(List updateActions) { + public void setUpdateActions(List updateActions) { this.updateActions = updateActions; } } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java new file mode 100644 index 000000000..b14277618 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java @@ -0,0 +1,32 @@ +package com.fr.design.mainframe.toolbar; + +import com.fr.design.actions.UpdateAction; + +/** + * Created by XiaXiang on 2017/5/24. + */ +public class UpdateActionModel { + private String parentName; + private UpdateAction action; + + public UpdateActionModel(String parentName, UpdateAction action) { + this.parentName = parentName; + this.action = action; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public UpdateAction getAction() { + return action; + } + + public void setAction(UpdateAction action) { + this.action = action; + } +} From 3ed13a85afe5584fb31704a085ca4062a641fa62 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 19:24:55 +0800 Subject: [PATCH 5/8] bug fix --- .../alphafine/search/manager/ActionSearchManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 12417f4d6..6c35624f2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -39,8 +39,10 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateActionModel updateActionModel : updateActions) { UpdateAction updateAction = updateActionModel.getAction(); - if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) { - filterModelList.add(new ActionModel(updateAction.getName() ,updateActionModel.getParentName(), updateAction)); + if (updateAction.getName() != null) { + if (updateAction.getName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) { + filterModelList.add(new ActionModel(updateAction.getName(), updateActionModel.getParentName(), updateAction)); + } } } if (filterModelList != null && filterModelList.size() >0) { From d91c0002e2c7b44f8556737e754495be1b3a8927 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 19:31:38 +0800 Subject: [PATCH 6/8] bug fix --- .../mainframe/alphafine/search/manager/ActionSearchManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 6c35624f2..902ab430f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -45,7 +45,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { } } } - if (filterModelList != null && filterModelList.size() >0) { + 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)); From fae529f30b079fae11ffd90d5481baa674dc2325 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 19:40:27 +0800 Subject: [PATCH 7/8] bug fix --- .../alphafine/search/manager/ActionSearchManager.java | 7 +++---- .../fr/design/mainframe/toolbar/UpdateActionModel.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java index 902ab430f..32b71eeb3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java @@ -38,10 +38,9 @@ public class ActionSearchManager implements AlphaFineSearchProcessor { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); for (UpdateActionModel updateActionModel : updateActions) { - UpdateAction updateAction = updateActionModel.getAction(); - if (updateAction.getName() != null) { - if (updateAction.getName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) { - filterModelList.add(new ActionModel(updateAction.getName(), updateActionModel.getParentName(), updateAction)); + if (updateActionModel.getActionName() != null) { + if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) { + filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction())); } } } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java index b14277618..8bfda2310 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java @@ -7,11 +7,13 @@ import com.fr.design.actions.UpdateAction; */ public class UpdateActionModel { private String parentName; + private String actionName; private UpdateAction action; public UpdateActionModel(String parentName, UpdateAction action) { this.parentName = parentName; this.action = action; + this.actionName = action.getName(); } public String getParentName() { @@ -29,4 +31,12 @@ public class UpdateActionModel { public void setAction(UpdateAction action) { this.action = action; } + + public String getActionName() { + return actionName; + } + + public void setActionName(String actionName) { + this.actionName = actionName; + } } From 64578ebf2cd9c9b0baee2d9332bcc5b6fb41a1b9 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 24 May 2017 19:42:56 +0800 Subject: [PATCH 8/8] bug fix --- .../mainframe/toolbar/UpdateActionModel.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java index 8bfda2310..ad3db0348 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java @@ -5,6 +5,10 @@ import com.fr.design.actions.UpdateAction; /** * Created by XiaXiang on 2017/5/24. */ + +/** + * action对象 + */ public class UpdateActionModel { private String parentName; private String actionName; @@ -16,6 +20,10 @@ public class UpdateActionModel { this.actionName = action.getName(); } + /** + * 获取上一层级菜单name + * @return + */ public String getParentName() { return parentName; } @@ -24,6 +32,10 @@ public class UpdateActionModel { this.parentName = parentName; } + /** + * 获取action + * @return + */ public UpdateAction getAction() { return action; } @@ -32,6 +44,10 @@ public class UpdateActionModel { this.action = action; } + /** + * 获取actionName + * @return + */ public String getActionName() { return actionName; }