Browse Source

bug fix

master
XiaXiang 8 years ago
parent
commit
9eba157623
  1. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  2. 8
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  3. 24
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  4. 8
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  5. 32
      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;

8
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,10 +36,11 @@ 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) {
UpdateAction updateAction = updateActionModel.getAction();
if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) { 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) { if (filterModelList != null && filterModelList.size() >0) {

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;
} }
} }

32
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;
}
}
Loading…
Cancel
Save