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.
*/
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;

12
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();

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.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,13 +36,15 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) {
List<UpdateAction> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateAction updateAction : updateActions) {
if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) {
filterModelList.add(new ActionModel(updateAction.getName() ,updateAction));
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
if (updateActionModel.getActionName() != null) {
if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) {
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());
for (int i = 0; i < length; 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;
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;
@ -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("data transform error! :" + e.getMessage());
}
if (modelList.size() > 0) {
modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false));
}
}
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.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() {

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 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());

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_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

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;
private MenuDef[] menus;
private ToolBarDef toolBarDef;
private ArrayList<UpdateAction> shortCuts;
private List<UpdateActionModel> 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<UpdateAction> getAllUpdateActions(List<MenuDef> menuList) {
shortCuts = new ArrayList<>();
/**
* 获取所有actionmodel
* @param menuList
*/
private void addAllUpdateActionsToList(List<MenuDef> 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);
}

8
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<UpdateAction> updateActions;
private List<UpdateActionModel> updateActions;
public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) {
@ -18,11 +16,11 @@ public class UpdateActionManager {
return updateActionManager;
}
public List<UpdateAction> getUpdateActions() {
public List<UpdateActionModel> getUpdateActions() {
return updateActions;
}
public void setUpdateActions(List<UpdateAction> updateActions) {
public void setUpdateActions(List<UpdateActionModel> 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