Browse Source

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

* commit '64578ebf2cd9c9b0baee2d9332bcc5b6fb41a1b9':
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
  bug fix
master
superman 8 years ago
parent
commit
1eff6d8d79
  1. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  2. 12
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png
  4. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine1.png
  5. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine2.png
  6. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine3.png
  7. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine4.png
  8. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png
  9. 13
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  10. 52
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  11. 14
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java
  12. 18
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java
  13. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  14. 24
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  15. 8
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  16. 58
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java

8
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. * Created by XiaXiang on 2017/4/20.
*/ */
public class ActionModel extends AlphaCellModel implements Serializable { public class ActionModel extends AlphaCellModel {
private Action action; private Action action;
private String actionName; private String actionName;
@ -38,6 +38,12 @@ public class ActionModel extends AlphaCellModel implements Serializable {
return action != null ? action.hashCode() : 0; return action != null ? action.hashCode() : 0;
} }
public ActionModel(String name, String description, Action action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
}
public ActionModel(String name, Action action) { public ActionModel(String name, Action action) {
super(name, null, CellType.ACTION); super(name, null, CellType.ACTION);
this.action = action; this.action = action;

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

@ -248,11 +248,9 @@ public class AlphaFineDialog extends UIDialog {
int selectedIndex = searchResultList.getSelectedIndex(); int selectedIndex = searchResultList.getSelectedIndex();
Object selectedValue = searchResultList.getSelectedValue(); Object selectedValue = searchResultList.getSelectedValue();
if (e.getClickCount() == 2) { if (e.getClickCount() == 2) {
final int i = searchResultList.locationToIndex(e.getPoint());
searchResultList.setSelectedIndex(i);
doNavigate(selectedIndex); doNavigate(selectedIndex);
if (selectedValue instanceof AlphaCellModel) { if (selectedValue instanceof AlphaCellModel) {
saveHistory(searchText, (AlphaCellModel) selectedValue); saveHistory((AlphaCellModel) selectedValue);
} }
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
@ -277,7 +275,11 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
Object selectedValue = searchResultList.getSelectedValue();
doNavigate(searchResultList.getSelectedIndex()); doNavigate(searchResultList.getSelectedIndex());
if (searchResultList.getSelectedValue() instanceof AlphaCellModel) {
saveHistory((AlphaCellModel) selectedValue);
}
} }
} }
}); });
@ -556,10 +558,10 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 保存本地本地常用 * 保存本地本地常用
* @param searchText
* @param cellModel * @param cellModel
*/ */
private void saveHistory(String searchText, AlphaCellModel cellModel) { private void saveHistory(AlphaCellModel cellModel) {
String searchText = searchTextField.getText();
RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger();
recentSearchManager.addRecentModel(searchText, cellModel); recentSearchManager.addRecentModel(searchText, cellModel);
recentSearchManager.saveXMLFile(); recentSearchManager.saveXMLFile();

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 418 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 372 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 248 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 369 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

13
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.cell.model.ActionModel;
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.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -35,13 +36,15 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) {
List<UpdateAction> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateAction updateAction : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) { if (updateActionModel.getActionName() != null) {
filterModelList.add(new ActionModel(updateAction.getName() ,updateAction)); if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
}
} }
} }
if (filterModelList != null && filterModelList.size() >0) { if (filterModelList != null && filterModelList.size() > 0) {
final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size()); final int length = Math.min(AlphaFineConstants.SHOW_SIZE, filterModelList.size());
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
lessModelList.add(filterModelList.get(i)); lessModelList.add(filterModelList.get(i));

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

@ -1,5 +1,6 @@
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.mainframe.alphafine.cell.CellModelHelper; 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.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
@ -29,35 +30,38 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
} }
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
String result; if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) {
this.modelList = new SearchResult(); String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); this.modelList = new SearchResult();
httpClient.asGet(); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.setTimeout(5000); httpClient.asGet();
if (!httpClient.isServerAlive()) { httpClient.setTimeout(5000);
return modelList; if (!httpClient.isServerAlive()) {
} return modelList;
result = httpClient.getResponseText(); }
try { result = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(result); try {
if (jsonObject.optString("status").equals("success")) { JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("result"); if (jsonObject.optString("status").equals("success")) {
if (jsonArray != null && jsonArray.length() > 0) { JSONArray jsonArray = jsonObject.optJSONArray("result");
for (int i = 0; i < jsonArray.length(); i++) { if (jsonArray != null && jsonArray.length() > 0) {
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); for (int i = 0; i < jsonArray.length(); i++) {
if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) { AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
this.modelList.add(alphaCellModel); if (!RecentSearchManager.getRecentSearchManger().getRecentModelList().contains(alphaCellModel)) {
this.modelList.add(alphaCellModel);
}
} }
} }
} }
}
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error("data transform error! :" + e.getMessage());
} }
if (modelList.size() > 0) { if (modelList.size() > 0) {
modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false));
}
} }
return modelList; return modelList;
} }

14
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.setEnabled(reader.getAttrAsBoolean("isEnabled", 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.setContainConclude(reader.getAttrAsBoolean("isContainConclude", true)); this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));
this.setContainAction(reader.getAttrAsBoolean("isContainAction", true)); this.setContainAction(reader.getAttrAsBoolean("isContainAction", true));
this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true)); this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true));
this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false)); this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false));
@ -104,7 +104,7 @@ public class AlphafineConfigManager implements XMLable {
writer.attr("isEnabled", this.isEnabled()) writer.attr("isEnabled", this.isEnabled())
.attr("isSearchOnline", this.isSearchOnLine()) .attr("isSearchOnline", this.isSearchOnLine())
.attr("shortcuts", this.getShortcuts()) .attr("shortcuts", this.getShortcuts())
.attr("isContainConclude", this.isContainConclude()) .attr("isContainRecommend", this.isContainRecommend())
.attr("isContainAction", this.isContainAction()) .attr("isContainAction", this.isContainAction())
.attr("isContainDocument", this.isContainDocument()) .attr("isContainDocument", this.isContainDocument())
.attr("isContainTemplate", this.isContainTemplate()) .attr("isContainTemplate", this.isContainTemplate())
@ -176,12 +176,12 @@ public class AlphafineConfigManager implements XMLable {
this.isContainPlugin = containPlugin; this.isContainPlugin = containPlugin;
} }
public boolean isContainConclude() { public boolean isContainRecommend() {
return isContainConclude; return isContainRecommend;
} }
public void setContainConclude(boolean containConclude) { public void setContainRecommend(boolean containConclude) {
isContainConclude = containConclude; isContainRecommend = containConclude;
} }
public boolean isEnabled() { public boolean isEnabled() {

18
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 COLUMN_GAP = 180;
private static final double ROW_GAP = 25; private static final double ROW_GAP = 25;
private KeyStroke shortCutKeyStore = null; 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; private UITextField shortcutsField;
public AlphafineConfigPane() { public AlphafineConfigPane() {
@ -73,7 +73,7 @@ public class AlphafineConfigPane extends BasicPane {
private Component[][] initsearchRangeComponents() { private Component[][] initsearchRangeComponents() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isContainConcludeCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox},
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox}
}; };
return components; return components;
@ -85,7 +85,7 @@ public class AlphafineConfigPane extends BasicPane {
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange")); JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange"));
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")); isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set"));
isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon")); isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon"));
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
@ -125,14 +125,14 @@ public class AlphafineConfigPane extends BasicPane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (!isSearchOnlineCheckbox.isSelected()) { if (!isSearchOnlineCheckbox.isSelected()) {
isContainConcludeCheckbox.setEnabled(false); isContainRecommendCheckbox.setEnabled(false);
isContainPluginCheckbox.setEnabled(false); isContainPluginCheckbox.setEnabled(false);
isContainDocumentCheckbox.setEnabled(false); isContainDocumentCheckbox.setEnabled(false);
isContainConcludeCheckbox.setSelected(false); isContainRecommendCheckbox.setSelected(false);
isContainPluginCheckbox.setSelected(false); isContainPluginCheckbox.setSelected(false);
isContainDocumentCheckbox.setSelected(false); isContainDocumentCheckbox.setSelected(false);
} else { } else {
isContainConcludeCheckbox.setEnabled(true); isContainRecommendCheckbox.setEnabled(true);
isContainPluginCheckbox.setEnabled(true); isContainPluginCheckbox.setEnabled(true);
isContainDocumentCheckbox.setEnabled(true); isContainDocumentCheckbox.setEnabled(true);
} }
@ -163,8 +163,8 @@ public class AlphafineConfigPane extends BasicPane {
this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine()); this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts())); this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts());
} }
@ -175,7 +175,7 @@ public class AlphafineConfigPane extends BasicPane {
alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected());
alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected());
alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected());
alphafineConfigManager.setContainConclude(this.isContainConcludeCheckbox.isSelected()); alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected());
alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected());
alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected());
alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected());

2
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_Templates_Content=\u6A21\u677F\u5185\u5BB9
FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8 FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8
FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_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_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22

24
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; public static final int PANLE_HEIGNT = 26;
private MenuDef[] menus; private MenuDef[] menus;
private ToolBarDef toolBarDef; private ToolBarDef toolBarDef;
private ArrayList<UpdateAction> shortCuts; private List<UpdateActionModel> shortCutsList;
/** /**
* 更新菜单 * 更新菜单
*/ */
@ -145,27 +144,36 @@ public abstract class ToolBarMenuDock {
addCommunityMenuDef(menuList); addCommunityMenuDef(menuList);
// 添加全部UpdateAction到actionmanager中 // 添加全部UpdateAction到actionmanager中
getAllUpdateActions(menuList); addAllUpdateActionsToList(menuList);
UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCuts); UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCutsList);
return menuList.toArray(new MenuDef[menuList.size()]); return menuList.toArray(new MenuDef[menuList.size()]);
} }
private List<UpdateAction> getAllUpdateActions(List<MenuDef> menuList) { /**
shortCuts = new ArrayList<>(); * 获取所有actionmodel
* @param menuList
*/
private void addAllUpdateActionsToList(List<MenuDef> menuList) {
shortCutsList = new ArrayList<>();
for (MenuDef menuDef : menuList) { for (MenuDef menuDef : menuList) {
addUpdateActionToList(menuDef); addUpdateActionToList(menuDef);
} }
return shortCuts;
} }
/**
* 递归获取所有UpdateAction
* @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;
} }
for (ShortCut shortCut : menuDef.getShortcutList()) { for (ShortCut shortCut : menuDef.getShortcutList()) {
if (shortCut instanceof UpdateAction) { if (shortCut instanceof UpdateAction) {
shortCuts.add((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);
} }

8
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
import java.util.List; import java.util.List;
/** /**
@ -9,7 +7,7 @@ import java.util.List;
*/ */
public class UpdateActionManager { public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null; private static UpdateActionManager updateActionManager = null;
private List<UpdateAction> updateActions; private List<UpdateActionModel> updateActions;
public synchronized static UpdateActionManager getUpdateActionManager() { public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) { if (updateActionManager == null) {
@ -18,11 +16,11 @@ public class UpdateActionManager {
return updateActionManager; return updateActionManager;
} }
public List<UpdateAction> getUpdateActions() { public List<UpdateActionModel> getUpdateActions() {
return updateActions; return updateActions;
} }
public void setUpdateActions(List<UpdateAction> updateActions) { public void setUpdateActions(List<UpdateActionModel> updateActions) {
this.updateActions = updateActions; this.updateActions = updateActions;
} }
} }

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

@ -0,0 +1,58 @@
package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
/**
* Created by XiaXiang on 2017/5/24.
*/
/**
* action对象
*/
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();
}
/**
* 获取上一层级菜单name
* @return
*/
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
/**
* 获取action
* @return
*/
public UpdateAction getAction() {
return action;
}
public void setAction(UpdateAction action) {
this.action = action;
}
/**
* 获取actionName
* @return
*/
public String getActionName() {
return actionName;
}
public void setActionName(String actionName) {
this.actionName = actionName;
}
}
Loading…
Cancel
Save