Browse Source

REPORT-79093 运营产品化二期(遗留)

1、添加插件,我的模板,功能的默认展示界面
2、添加tab页自定义排序
3、修复fvs打不开问题
4、一些小细节
feature/x
Link.Zhao 2 years ago
parent
commit
bec418373a
  1. 44
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 97
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  3. 19
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java
  4. 174
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java
  5. 95
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java
  6. 33
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java
  7. 1
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  8. 1
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java
  9. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java
  10. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java
  11. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java
  12. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  13. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java
  14. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java
  15. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  16. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  17. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  18. 58
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  19. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java
  20. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java
  21. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java
  22. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java
  23. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java
  24. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java
  25. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java
  26. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java
  27. 53
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java
  28. 37
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java
  29. 76
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java
  30. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java
  31. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java
  32. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java
  33. 28
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java
  34. 1
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketConstants.java
  35. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java
  36. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java
  37. 48
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java
  38. 80
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java
  39. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java
  40. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java
  41. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java
  42. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java
  43. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java
  44. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java
  45. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java
  46. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java
  47. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java
  48. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  49. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java
  50. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java
  51. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java
  52. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java
  53. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java
  54. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java
  55. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java
  56. 25
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java
  57. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java
  58. 34
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java
  59. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  60. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  61. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java
  62. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  63. 19
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  64. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java
  65. 73
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  66. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java
  67. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  68. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  69. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java
  70. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java
  71. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java
  72. 37
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search_hint.svg
  73. 2
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java

44
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -102,6 +102,14 @@ public class AlphaFineConfigManager implements XMLable {
* */ * */
private boolean showTemplateShop = true; private boolean showTemplateShop = true;
/**
* tab页排序
* 默认排序动态模板商城帮助文档插件中心功能我的模板
* */
private String[] tabOrder;
public static final String COMMA = ",";
private Map<String, String> actionSearchTextCache = new HashMap<>(8); private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO; private String cacheBuildNO;
@ -158,6 +166,7 @@ public class AlphaFineConfigManager implements XMLable {
this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts())); this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts()));
this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true)); this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true));
this.setOperateCount(reader.getAttrAsInt("operateCount", 0)); this.setOperateCount(reader.getAttrAsInt("operateCount", 0));
this.setTabOrder(reader.getAttrAsString("tabOrder", getDefaultTabOrder()).split(","));
} else if (reader.isChildNode()) { } else if (reader.isChildNode()) {
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) { if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) {
readActionSearchTextCacheXML(reader); readActionSearchTextCacheXML(reader);
@ -254,7 +263,8 @@ public class AlphaFineConfigManager implements XMLable {
.attr("operateCount", this.getOperateCount()) .attr("operateCount", this.getOperateCount())
.attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox()) .attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox())
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService())
.attr("productDynamics", this.isProductDynamics()); .attr("productDynamics", this.isProductDynamics())
.attr("tabOrder", this.getTabOrderString());
writeActionSearchTextCacheXML(writer); writeActionSearchTextCacheXML(writer);
writeSearchHistory(writer); writeSearchHistory(writer);
writeReadSet(writer); writeReadSet(writer);
@ -317,6 +327,13 @@ public class AlphaFineConfigManager implements XMLable {
return OperatingSystem.isMacOS() ? "meta + D" : "ctrl + D"; return OperatingSystem.isMacOS() ? "meta + D" : "ctrl + D";
} }
/**
* 返回默认排序
* */
private String getDefaultTabOrder() {
return AlphaFineConstants.PRODUCT_NEWS + COMMA + AlphaFineConstants.TEMPLATE_SHOP + COMMA + AlphaFineConstants.HELP + COMMA + AlphaFineConstants.PLUGIN + COMMA + AlphaFineConstants.FUNCTION + COMMA + AlphaFineConstants.MY_TEMPLATES;
}
public boolean isContainAction() { public boolean isContainAction() {
return containAction; return containAction;
} }
@ -472,4 +489,29 @@ public class AlphaFineConfigManager implements XMLable {
public void setProductDynamics(boolean productDynamics) { public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics; this.productDynamics = productDynamics;
} }
/**
* 返回tab显示顺序
* */
public String[] getTabOrder() {
if (tabOrder == null) {
tabOrder = getDefaultTabOrder().split(COMMA);
}
return tabOrder;
}
/**
* getTabOrder的tostring
* */
public String getTabOrderString() {
StringBuilder sb = new StringBuilder();
for (String s : getTabOrder()) {
sb.append(s + COMMA);
}
return sb.toString();
}
public void setTabOrder(String[] tabOrder) {
this.tabOrder = tabOrder;
}
} }

97
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -3,8 +3,11 @@ package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.component.CustomSortPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -17,6 +20,7 @@ import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -30,6 +34,8 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by XiaXiang on 2017/4/6. * Created by XiaXiang on 2017/4/6.
@ -39,14 +45,24 @@ public class AlphaFineConfigPane extends BasicPane {
private static final String DISPLAY_TYPE = "+"; private static final String DISPLAY_TYPE = "+";
private static final Color LABEL_TEXT = new Color(0x919193); private static final Color LABEL_TEXT = new Color(0x919193);
private static final int SEARCH_CONFIG_PANE_HEIGHT = 70;
private static final int SEARCH_CONFIG_PANE_WIDTH = 87;
private static final double COLUMN_WIDTH = 150; private static final double COLUMN_WIDTH = 150;
private static final double ROW_HEIGHT = 25; private static final double ROW_HEIGHT = 25;
private KeyStroke shortCutKeyStore = null; private KeyStroke shortCutKeyStore = null;
private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox; private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox;
private UICheckBox productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, private UICheckBox productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox,
containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox; containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox;
// 自定义排序按钮
private ActionLabel customSortLabel;
private UITextField shortcutsField; private UITextField shortcutsField;
// 当前tab排序。点击确定后会保存到配置文件中
private String[] currentOrder;
// 搜索范围-我的模板,相关组件 // 搜索范围-我的模板,相关组件
private JPanel containMyTemplatePane; private JPanel containMyTemplatePane;
private JButton myTemplateSearchConfigButton; private JButton myTemplateSearchConfigButton;
@ -79,7 +95,8 @@ public class AlphaFineConfigPane extends BasicPane {
double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT}; double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT};
double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH}; double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH};
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range")); JPanel searchConfigWrapperPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range"));
// 搜索选项
productDynamicsCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News")); productDynamicsCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"));
containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function")); containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function"));
containPluginCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")); containPluginCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"));
@ -89,10 +106,37 @@ public class AlphaFineConfigPane extends BasicPane {
containTemplateShopCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop")); containTemplateShopCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop"));
containMyTemplateCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_My_Templates")); containMyTemplateCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_My_Templates"));
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize); JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize);
northPane.add(searchConfigPane);
contentPane.add(northPane); // 自定义排序
JPanel customSortWrapperPane = new JPanel();
customSortWrapperPane.setPreferredSize(new Dimension(SEARCH_CONFIG_PANE_HEIGHT, SEARCH_CONFIG_PANE_WIDTH));
customSortWrapperPane.setAlignmentY(JPanel.TOP_ALIGNMENT);
customSortLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Config_Custom_Sort"), false);
customSortLabel.setForeground(UIConstants.NORMAL_BLUE);
customSortLabel.addActionListener((event)->{
openCustomSortMenu();
});
customSortWrapperPane.add(customSortLabel);
if (!hasSelectedSearchRangeCheckBox()) {
customSortLabel.setEnabled(false);
}
searchConfigWrapperPane.add(searchConfigPane);
searchConfigWrapperPane.add(customSortWrapperPane);
contentPane.add(searchConfigWrapperPane);
} }
/**
* 打开自定义排序面板
* */
private void openCustomSortMenu() {
CustomSortPane customSortPane = new CustomSortPane(getSelectedSearchRangeCheckBox(), this);
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(customSortPane);
GUICoreUtils.showPopupMenu(popupMenu, customSortLabel, 0, customSortLabel.getHeight());
}
private Component[][] initSearchRangeComponents() { private Component[][] initSearchRangeComponents() {
// 我的模板checkbox设置,点击后 // 我的模板checkbox设置,点击后
initMyTemplateSearchPane(); initMyTemplateSearchPane();
@ -102,12 +146,16 @@ public class AlphaFineConfigPane extends BasicPane {
new Component[]{containPluginCheckbox, containActionCheckbox, containMyTemplatePane}, new Component[]{containPluginCheckbox, containActionCheckbox, containMyTemplatePane},
}; };
for (int i = 0; i < components.length; i++) { // 添加选项点事件,无选中选项时自定排序按钮置灰
for (int j = 0; j < components[i].length; j++) { UICheckBox[] checkBoxes = new UICheckBox[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox};
if (components[i][j] instanceof UICheckBox) { for (UICheckBox box : checkBoxes) {
UICheckBox box = (UICheckBox) components[i][j]; box.addActionListener((e)->{
} if (!hasSelectedSearchRangeCheckBox()) {
customSortLabel.setEnabled(false);
} else {
customSortLabel.setEnabled(true);
} }
});
} }
return components; return components;
} }
@ -120,6 +168,20 @@ public class AlphaFineConfigPane extends BasicPane {
|| containPluginCheckbox.isSelected() || containActionCheckbox.isSelected() || containMyTemplateCheckbox.isSelected(); || containPluginCheckbox.isSelected() || containActionCheckbox.isSelected() || containMyTemplateCheckbox.isSelected();
} }
/**
* 获取当前选中的搜索范围选项
* */
private List<UICheckBox> getSelectedSearchRangeCheckBox() {
List<UICheckBox> res = new ArrayList<>();
UICheckBox[] checkBoxes = new UICheckBox[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox};
for (UICheckBox c : checkBoxes) {
if (c.isSelected()) {
res.add(c);
}
}
return res;
}
// 搜索范围-我的模板 // 搜索范围-我的模板
private void initMyTemplateSearchPane() { private void initMyTemplateSearchPane() {
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5)); containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5));
@ -280,6 +342,14 @@ public class AlphaFineConfigPane extends BasicPane {
this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox()); this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox());
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts()); shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
this.currentOrder = alphaFineConfigManager.getTabOrder().clone();
if (!hasSelectedSearchRangeCheckBox()) {
customSortLabel.setEnabled(false);
} else {
customSortLabel.setEnabled(true);
}
} }
public void update() { public void update() {
@ -296,6 +366,9 @@ public class AlphaFineConfigPane extends BasicPane {
alphaFineConfigManager.setContainFileContent(this.containFileContentSearchCheckbox.isSelected()); alphaFineConfigManager.setContainFileContent(this.containFileContentSearchCheckbox.isSelected());
alphaFineConfigManager.setNeedSegmentationCheckbox(this.needSegmentationCheckbox.isSelected()); alphaFineConfigManager.setNeedSegmentationCheckbox(this.needSegmentationCheckbox.isSelected());
alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText()); alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
alphaFineConfigManager.setTabOrder(currentOrder);
designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager); designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager);
try { try {
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
@ -327,4 +400,12 @@ public class AlphaFineConfigPane extends BasicPane {
public void setIsContainFileContentCheckbox(UICheckBox isContainFileContentCheckbox) { public void setIsContainFileContentCheckbox(UICheckBox isContainFileContentCheckbox) {
this.containFileContentSearchCheckbox = isContainFileContentCheckbox; this.containFileContentSearchCheckbox = isContainFileContentCheckbox;
} }
public String[] getCurrentOrder() {
return currentOrder;
}
public void setCurrentOrder(String[] currentOrder) {
this.currentOrder = currentOrder;
}
} }

19
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java → designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java

@ -1,4 +1,4 @@
package com.fr.design.mainframe.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
@ -22,6 +22,19 @@ import java.util.Set;
*/ */
public class AlphaFineConstants { public class AlphaFineConstants {
public static final String FUNCTION = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function");
public static final String MY_TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_My_Templates");
public static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News");
public static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help");
public static final String PLUGIN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon");
public static final String TEMPLATE_SHOP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop");
public static final int SHOW_SIZE = 5; public static final int SHOW_SIZE = 5;
public static final int MAX_FILE_SIZE = 1000; public static final int MAX_FILE_SIZE = 1000;
@ -40,7 +53,7 @@ public class AlphaFineConstants {
public static final int CONTENT_HEIGHT = 405; public static final int CONTENT_HEIGHT = 405;
public static final int CELL_HEIGHT = 32; public static final int CELL_HEIGHT = 29;
public static final int CELL_TITLE_HEIGHT = 24; public static final int CELL_TITLE_HEIGHT = 24;
@ -115,6 +128,8 @@ public class AlphaFineConstants {
public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
public static final String SEARCH_ALL_PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.all.searchAPI");
public static final String PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo"); public static final String PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo");
public static final String REUSE_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo"); public static final String REUSE_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo");

174
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java

@ -0,0 +1,174 @@
package com.fr.design.actions.help.alphafine.component;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.help.alphafine.AlphaFineConfigPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.plaf.PanelUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* @version 11.0
* @author: Link
* @date: 2022/9/9
* @Description: alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板
*/
public class CustomSortPane extends JPanel {
private static final int WIDTH = 147;
private static final int ITEM_HEIGHT = 23;
private static final int GAP = 1;
private static final Color BACKGROUND_COLOR = new Color(0xdadadd);
private UIButton top;
private UIButton bottom;
private UIButton up;
private UIButton down;
private JPanel toolbarPane;
private MenuLabelPane sortItemPane;
private List<UICheckBox> sortItems;
private MenuLabel selectedLabel;
private AlphaFineConfigPane parentPane;
public CustomSortPane(List<UICheckBox> items, AlphaFineConfigPane parentPane) {
this.sortItems = items;
this.parentPane = parentPane;
setLayout(new BorderLayout(GAP, GAP));
int height = (sortItems.size() + 1) * (ITEM_HEIGHT + GAP) + GAP;
setPreferredSize(new Dimension(WIDTH, height));
initComponent();
add(toolbarPane, BorderLayout.NORTH);
add(sortItemPane, BorderLayout.CENTER);
revalidate();
this.setVisible(true);
}
@Override
public void setUI(PanelUI ui) {
super.setUI(ui);
setBackground(BACKGROUND_COLOR);
}
private void initComponent() {
createToolbarPane();
createSortItemPane();
}
private void createToolbarPane() {
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"));
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"));
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"));
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"));
top.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
sortItemPane.setComponentZOrder(selectedLabel, 0);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
bottom.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
up.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
down.addActionListener(e -> {
SwingUtilities.invokeLater(()->{
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1);
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
toolbarPane = new JPanel(new FlowLayout(FlowLayout.TRAILING, GAP, GAP));
toolbarPane.setBorder(BorderFactory.createEmptyBorder());
toolbarPane.add(top);
toolbarPane.add(bottom);
toolbarPane.add(up);
toolbarPane.add(down);
}
private void createSortItemPane() {
String[] currentTabOrder = parentPane.getCurrentOrder();
Map<String, Integer> sortMap = new HashMap<>();
for (int i = 0; i < currentTabOrder.length; i++) {
sortMap.put(currentTabOrder[i], i);
}
List<MenuLabel> sortLabels = new ArrayList<>();
for (UICheckBox item : sortItems) {
MenuLabel label = new MenuLabel(item.getText(), (Function<MenuLabel, Object>) o -> {
selectedLabel = o;
return null;
});
sortLabels.add(label);
}
sortLabels.sort(Comparator.comparingInt(tab -> sortMap.get(tab.getText())));
sortItemPane = new MenuLabelPane(sortLabels);
}
private void refreshCurrentOrder() {
String[] currentTabOrder = parentPane.getCurrentOrder();
HashSet<String> selectedTab = new HashSet<>();
for (UICheckBox item : sortItems) {
selectedTab.add(item.getText());
}
// 未选中的tab,保持原排序不变
Map<String, Integer> exTab = new HashMap<>();
for (int i = 0; i < currentTabOrder.length; i++) {
if (!selectedTab.contains(currentTabOrder[i])) {
exTab.put(currentTabOrder[i], i);
}
}
// 计算当前排序
String[] newOrder = new String[currentTabOrder.length];
Component[] components =sortItemPane.getComponents();
for (String s : exTab.keySet()) {
newOrder[exTab.get(s)] = s;
}
int t = 0;
for (int i = 0; i < newOrder.length; i++) {
if (StringUtils.isEmpty(newOrder[i])) {
newOrder[i] = ((MenuLabel)components[t++]).getText();
}
}
parentPane.setCurrentOrder(newOrder);
}
}

95
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java

@ -0,0 +1,95 @@
package com.fr.design.actions.help.alphafine.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import javax.swing.BorderFactory;
import javax.swing.plaf.LabelUI;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.function.Function;
/**
* @version 11.0
* @author: Link
* @date: 2022/9/12
* @Description: 菜单label
*/
public class MenuLabel extends UILabel {
private static final Color BACKGROUND_COLOR = Color.white;
private static final Color SELECTED_COLOR = new Color(0x419BF9);
private static final Color HOVERED_COLOR = new Color(0xd9ebfe);
private static final int HEIGHT = 23;
private static final int WIDTH = 147;
private MenuLabelPane parentMenu;
private Function function;
private boolean isSelected;
public MenuLabel(String text, Function function) {
super(text);
this.function = function;
setOpaque(true);
addMouseListener(createMouseListener());
}
public void setParentMenu(MenuLabelPane menu) {
this.parentMenu = menu;
}
@Override
public void setUI(LabelUI ui) {
super.setUI(ui);
this.setBackground(BACKGROUND_COLOR);
this.setBorder(BorderFactory.createEmptyBorder(2,10,1,10));
this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
this.setFont(DesignUtils.getDefaultGUIFont().applySize(12));
}
public void setSelected(boolean selected) {
if (selected) {
parentMenu.setNoneSelected();
setBackground(SELECTED_COLOR);
function.apply(this);
isSelected = true;
} else {
setBackground(BACKGROUND_COLOR);
isSelected = false;
}
}
public boolean isSelected() {
return isSelected;
}
MouseListener createMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
setSelected(true);
}
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
if (!isSelected) {
setBackground(HOVERED_COLOR);
}
}
@Override
public void mouseExited(MouseEvent e) {
super.mouseExited(e);
if (!isSelected) {
setBackground(BACKGROUND_COLOR);
}
}
};
}
}

33
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java

@ -0,0 +1,33 @@
package com.fr.design.actions.help.alphafine.component;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.util.List;
/**
* @version 11.0
* @author: Link
* @date: 2022/9/12
* @Description: 简单菜单面板
*/
public class MenuLabelPane extends JPanel {
private static final int GAP = 1;
private List<MenuLabel> labels;
public MenuLabelPane(List<MenuLabel> labels) {
this.labels = labels;
setLayout(new FlowLayout(FlowLayout.CENTER, GAP, GAP));
for (MenuLabel label : labels) {
label.setParentMenu(this);
add(label);
}
}
public void setNoneSelected() {
for (MenuLabel label : labels) {
label.setSelected(false);
}
}
}

1
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -161,6 +161,7 @@ public class StartupPageWindow extends JFrame {
revalidate(); revalidate();
setFullScreen(); setFullScreen();
} }
private void setFullScreen() { private void setFullScreen() {

1
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine; package com.fr.design.mainframe.alphafine;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java

@ -72,7 +72,7 @@ public class StartUseAction implements ActionListener {
File fileNeedOpen = new File(fileName); File fileNeedOpen = new File(fileName);
if (fileName.endsWith(FineMarketConstants.ZIP)) { if (fileName.endsWith(FineMarketConstants.ZIP)) {
File[] files = fileNeedOpen.getParentFile().listFiles(); File[] files = fileNeedOpen.getParentFile().listFiles();
fileNeedOpen = getFirstCptOrFrm(files); fileNeedOpen = getFirstTemplate(files);
} else if (fileName.endsWith(FineMarketConstants.RAR)) { } else if (fileName.endsWith(FineMarketConstants.RAR)) {
// rar资源没有解压,所以不用打开模板 // rar资源没有解压,所以不用打开模板
return; return;
@ -88,9 +88,11 @@ public class StartUseAction implements ActionListener {
} }
private File getFirstCptOrFrm(File[] files) { private File getFirstTemplate(File[] files) {
for (File f : files) { for (File f : files) {
if (f.getName().endsWith(FineMarketConstants.CPT) || f.getName().endsWith(FineMarketConstants.FRM)) { if (f.getName().endsWith(FineMarketConstants.CPT) ||
f.getName().endsWith(FineMarketConstants.FRM) ||
f.getName().endsWith(FineMarketConstants.FVS)) {
return f; return f;
} }
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/BottomModel.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONException; import com.fr.json.JSONException;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/BottomCellRender.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.cell.render; package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.BottomModel; import com.fr.design.mainframe.alphafine.cell.model.BottomModel;
import javax.swing.*; import javax.swing.*;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.alphafine.cell.render;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
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.BottomModel; import com.fr.design.mainframe.alphafine.cell.model.BottomModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.cell.render; package com.fr.design.mainframe.alphafine.cell.render;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import javax.swing.*; import javax.swing.*;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -7,7 +7,7 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
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;

58
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

@ -4,16 +4,18 @@ import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader; import com.fr.base.svg.SVGLoader;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil; import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.borders.UITextFieldBorder; import com.fr.design.gui.borders.UITextFieldBorder;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; 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.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.mainframe.alphafine.preview.DefaultContentPane;
import com.fr.design.mainframe.alphafine.preview.DefaultPluginContentPane;
import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane; import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane;
import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane; import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane;
import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane; import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane;
@ -72,7 +74,10 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -102,8 +107,6 @@ public class AlphaFineFrame extends JFrame {
private static final String PLACE_HOLDER = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine"); private static final String PLACE_HOLDER = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine");
private static final String FUNCTION = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function");
private static final String NO_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No_Result"); private static final String NO_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_No_Result");
private static final String SKILLS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Skills"); private static final String SKILLS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Skills");
@ -114,20 +117,10 @@ public class AlphaFineFrame extends JFrame {
private static final String GO_FORUM = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Go_Forum"); private static final String GO_FORUM = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Go_Forum");
private static final String MY_TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_My_Templates");
public static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News");
private static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help");
private static final String PLUGIN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon");
private static final String ONE_CLICK_READ = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_One_Click_Read"); private static final String ONE_CLICK_READ = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_One_Click_Read");
private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"); private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result");
private static final String TEMPLATE_SHOP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop");
private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg");
private static final Color BORDER_COLOR = new Color(232, 232, 233); private static final Color BORDER_COLOR = new Color(232, 232, 233);
@ -425,9 +418,9 @@ public class AlphaFineFrame extends JFrame {
// 内容区,card layout // 内容区,card layout
resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None());
resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None());
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None()); resultPane.add(new DefaultContentPane(CellType.ACTION, this), CellType.ACTION.getFlagStr4None());
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); resultPane.add(new DefaultContentPane(CellType.FILE, this), CellType.FILE.getFlagStr4None());
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None()); resultPane.add(new DefaultPluginContentPane(CellType.PLUGIN, this), CellType.PLUGIN.getFlagStr4None());
resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None()); resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None());
resultPane.add(TemplateShopPane.getInstance(), CellType.TEMPLATE_SHOP.getFlagStr4None()); resultPane.add(TemplateShopPane.getInstance(), CellType.TEMPLATE_SHOP.getFlagStr4None());
resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR); resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR);
@ -438,7 +431,7 @@ public class AlphaFineFrame extends JFrame {
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
labelPane.setBackground(Color.WHITE); labelPane.setBackground(Color.WHITE);
labelContentPane = new JPanel(new BorderLayout()); labelContentPane = new JPanel(new BorderLayout());
tabLabel = createTabLabel(PRODUCT_NEWS); tabLabel = createTabLabel(AlphaFineConstants.PRODUCT_NEWS);
labelWestPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); labelWestPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
labelWestPane.add(tabLabel); labelWestPane.add(tabLabel);
labelContentPane.add(labelWestPane, BorderLayout.WEST); labelContentPane.add(labelWestPane, BorderLayout.WEST);
@ -518,8 +511,8 @@ public class AlphaFineFrame extends JFrame {
AlphaFineFrame.this.selectedTab = selectedLabel; AlphaFineFrame.this.selectedTab = selectedLabel;
// 处理产品动态 tab与下方文字展示不一致 // 处理产品动态 tab与下方文字展示不一致
if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) { if (ComparatorUtils.equals(selectedLabel.getText().trim(), AlphaFineConstants.PRODUCT_NEWS)) {
tabLabel.setText(PRODUCT_NEWS); tabLabel.setText(AlphaFineConstants.PRODUCT_NEWS);
} else { } else {
tabLabel.setText(selectedLabel.getText()); tabLabel.setText(selectedLabel.getText());
} }
@ -600,25 +593,27 @@ public class AlphaFineFrame extends JFrame {
List<SelectedLabel> selectedLabelList = new ArrayList<>(); List<SelectedLabel> selectedLabelList = new ArrayList<>();
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (alphaFineConfigManager.isProductDynamics()) { if (alphaFineConfigManager.isProductDynamics()) {
selectedLabelList.add(new SelectedLabel(PRODUCT_NEWS, CellType.PRODUCT_NEWS)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.PRODUCT_NEWS, CellType.PRODUCT_NEWS));
} }
if (alphaFineConfigManager.hasTemplateShop()) { if (alphaFineConfigManager.hasTemplateShop()) {
selectedLabelList.add(new SelectedLabel(TEMPLATE_SHOP, CellType.TEMPLATE_SHOP)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.TEMPLATE_SHOP, CellType.TEMPLATE_SHOP));
} }
if (alphaFineConfigManager.isContainDocument()) { if (alphaFineConfigManager.isContainDocument()) {
selectedLabelList.add(new SelectedLabel(HELP, CellType.DOCUMENT)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.HELP, CellType.DOCUMENT));
} }
if (alphaFineConfigManager.isContainPlugin()) { if (alphaFineConfigManager.isContainPlugin()) {
selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.PLUGIN, CellType.PLUGIN));
} }
if (alphaFineConfigManager.isContainAction()) { if (alphaFineConfigManager.isContainAction()) {
selectedLabelList.add(new SelectedLabel(FUNCTION, CellType.ACTION)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.FUNCTION, CellType.ACTION));
} }
if (alphaFineConfigManager.isContainMyTemplate()) { if (alphaFineConfigManager.isContainMyTemplate()) {
selectedLabelList.add(new SelectedLabel(MY_TEMPLATES, CellType.FILE)); selectedLabelList.add(new SelectedLabel(AlphaFineConstants.MY_TEMPLATES, CellType.FILE));
} }
// 根据设置排序
sortList(selectedLabelList);
// 默认选中第一个tab // 默认选中第一个tab
if (!selectedLabelList.isEmpty()) { if (!selectedLabelList.isEmpty()) {
selectedLabelList.get(0).setSelected(true); selectedLabelList.get(0).setSelected(true);
@ -627,6 +622,19 @@ public class AlphaFineFrame extends JFrame {
return selectedLabelList; return selectedLabelList;
} }
/**
* 根据用户自定义的顺序排序
* */
private void sortList(List<SelectedLabel> list) {
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
String[] tabOrder = alphaFineConfigManager.getTabOrder();
Map<String, Integer> orderMap = new HashMap<>();
for (int i = 0; i < tabOrder.length; i++) {
orderMap.put(tabOrder[i], i);
}
list.sort(Comparator.comparingInt(tab -> orderMap.get(tab.getText())));
}
private void fireOneClickRead() { private void fireOneClickRead() {
List<ProductNews> productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList(); List<ProductNews> productNewsList = ProductNewsSearchManager.getInstance().getCachedProductNewsList();
Set<Long> readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); Set<Long> readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet();

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineList.java

@ -1,15 +1,16 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
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.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
import javax.swing.JList;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.JList;
/** /**
* @author hades * @author hades

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipContentCellRender.java

@ -1,20 +1,21 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
/** /**
* @author hades * @author hades

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineToolTipList.java

@ -1,13 +1,14 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.JList;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.JList;
/** /**
* @author hades * @author hades

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaSearchTooltipPane.java

@ -1,14 +1,14 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.stable.StringUtils; import javax.swing.DefaultListModel;
import javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.Stack; import java.util.Stack;
import javax.swing.DefaultListModel;
import javax.swing.JPanel;
/** /**
* @author hades * @author hades

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsContentCellRender.java

@ -1,21 +1,22 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
/** /**
* @author hades * @author hades

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsSearchResultPane.java

@ -1,13 +1,12 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
/** /**
* @author hades * @author hades

53
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java

@ -0,0 +1,53 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
/**
* @author Link
* @version 11.0
* Created by Link on 2022/9/19
* alphaFine - 推荐搜索词标签
*/
public class RecommendSearchLabel extends JPanel {
private static final Color RECOMMEND_SEARCH_KEY_BLUE = new Color(0x419bf9);
public RecommendSearchLabel(String title, @NotNull List<String> tips) {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBackground(Color.WHITE);
JLabel recommend = new JLabel(title);
this.add(recommend);
for (String key : tips) {
JLabel keyLabel = new SearchKeyLabel(key);
this.add(keyLabel);
}
}
public class SearchKeyLabel extends JLabel {
String searchKey;
SearchKeyLabel(String searchKey) {
this.searchKey = searchKey;
setText(searchKey);
setBackground(Color.WHITE);
setForeground(RECOMMEND_SEARCH_KEY_BLUE);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
AlphaFineHelper.getAlphaFineDialog().fireSearch(searchKey);
}
});
}
}
}

37
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java

@ -1,23 +1,16 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource; import com.fr.design.mainframe.alphafine.model.TemplateResource;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List; import java.util.List;
public class RecommendSearchPane extends TemplateResourcePanel { public class RecommendSearchPane extends TemplateResourcePanel {
private static final Color BORDER_WHITE = new Color(0xe8e8e9); private static final Color BORDER_WHITE = new Color(0xe8e8e9);
private static final Color RECOMMEND_SEARCH_KEY_BLUE = new Color(0x419bf9);
public RecommendSearchPane(TemplateResource templateResource) { public RecommendSearchPane(TemplateResource templateResource) {
super(); super();
@ -37,37 +30,11 @@ public class RecommendSearchPane extends TemplateResourcePanel {
private void createCenterPane() { private void createCenterPane() {
setCenterPane(new JPanel(new FlowLayout(FlowLayout.LEFT)));
JPanel centerPane = getCenterPane();
centerPane.setBackground(Color.WHITE);
JLabel recommend = new JLabel(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Recommend_For_You"));
centerPane.add(recommend);
String recommend = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Recommend_For_You");
List<String> searchKeys = getTemplateResource().getRecommendSearchKey(); List<String> searchKeys = getTemplateResource().getRecommendSearchKey();
for (String key : searchKeys) { setCenterPane(new RecommendSearchLabel(recommend, searchKeys));
JLabel keyLabel = new SearchKeyLabel(key);
centerPane.add(keyLabel);
}
}
class SearchKeyLabel extends JLabel {
String searchKey;
SearchKeyLabel(String searchKey) {
this.searchKey = searchKey;
setText(searchKey);
setBackground(Color.WHITE);
setForeground(RECOMMEND_SEARCH_KEY_BLUE);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
AlphaFineHelper.getAlphaFineDialog().fireSearch(searchKey);
}
});
}
} }

76
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java

@ -0,0 +1,76 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.base.svg.IconUtils;
import com.fr.common.util.Collections;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
/**
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine - 搜索提示面板
*/
public class SearchHintPane extends JPanel {
private static final String TITLE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Search_Title");
private static final String RECOMMEND = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend_Search");
private static final Icon icon = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/search_hint.svg");
private static final int HEIGHT = 305;
private static final int WIDTH = 300;
private static final int TITLE_FONT_SIZE = 14;
public SearchHintPane() {
this(new ArrayList<>());
}
public SearchHintPane(List<String> hints) {
this(hints, icon, TITLE);
}
public SearchHintPane(List<String> hints, Icon icon, String title) {
setLayout(new BorderLayout());
setBackground(Color.white);
setPreferredSize(new Dimension(WIDTH, HEIGHT));
setAlignmentY(SwingConstants.CENTER);
UILabel image = new UILabel();
image.setPreferredSize(new Dimension(150, 111));
image.setHorizontalAlignment(SwingConstants.CENTER);
image.setIcon(icon);
image.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
add(image, BorderLayout.NORTH);
add(generateDescription(title), BorderLayout.CENTER);
add(generateHintsLabel(hints), BorderLayout.SOUTH);
}
protected Component generateDescription(String title) {
JLabel description = new JLabel(title);
description.setForeground(AlphaFineConstants.MEDIUM_GRAY);
description.setFont(DesignUtils.getDefaultGUIFont().applySize(TITLE_FONT_SIZE));
description.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
return description;
}
private Component generateHintsLabel(List<String> hints) {
if (Collections.isEmpty(hints)) {
return new JLabel();
}
return new RecommendSearchLabel(RECOMMEND, hints);
}
}

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultContentCellRender.java

@ -1,19 +1,20 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
/** /**
* @author hades * @author hades

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchResultPane.java

@ -1,13 +1,14 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JPanel;
/** /**
* @author hades * @author hades

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SelectedLabel.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.alphafine.component;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineUtil; import com.fr.design.mainframe.alphafine.AlphaFineUtil;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;

28
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.common.util.Strings;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.model.TemplateResource; import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.preview.TemplateShopPane; import com.fr.design.mainframe.alphafine.preview.TemplateShopPane;
@ -93,11 +94,8 @@ public class TemplateResourcePanel extends JPanel {
} }
private void createCenterPane() { private void createCenterPane() {
JLabel nameLabel = new JLabel(templateResource.getName()); JLabel nameLabel = createHtmlNameLabel();
nameLabel.setFont(RESOURCE_NAME_FONT);
nameLabel.setForeground(RESOURCE_NAME_COLOR);
nameLabel.setBackground(Color.WHITE);
nameLabel.setBorder(BorderFactory.createEmptyBorder());
JLabel demoLabel = new JLabel(); JLabel demoLabel = new JLabel();
if (templateResource.hasDemoUrl()) { if (templateResource.hasDemoUrl()) {
@ -121,6 +119,26 @@ public class TemplateResourcePanel extends JPanel {
centerPane.add(demoLabel, BorderLayout.EAST); centerPane.add(demoLabel, BorderLayout.EAST);
} }
private static final String SEARCH_WORD_FORMAT = "<span style=\"color:#419BF9\">%s</span>";
private static final String HTML_JLABEL_FORMAT = "<html>%s</html>";
private JLabel createHtmlNameLabel() {
JLabel label = new JLabel();
String htmlText = templateResource.getName();
String searchWord = templateResource.getSearchWord();
if (!Strings.isEmpty(searchWord) && htmlText.contains(searchWord)) {
htmlText = htmlText.replace(searchWord, String.format(SEARCH_WORD_FORMAT, searchWord));
}
htmlText = String.format(HTML_JLABEL_FORMAT, htmlText);
label.setText(htmlText);
label.setFont(RESOURCE_NAME_FONT);
label.setForeground(RESOURCE_NAME_COLOR);
label.setBackground(Color.WHITE);
label.setBorder(BorderFactory.createEmptyBorder());
return label;
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(180, 90); return new Dimension(180, 90);

1
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketConstants.java

@ -7,4 +7,5 @@ public class FineMarketConstants {
public static final String RAR = ".rar"; public static final String RAR = ".rar";
public static final String CPT = ".cpt"; public static final String CPT = ".cpt";
public static final String FRM = ".frm"; public static final String FRM = ".frm";
public static final String FVS = ".fvs";
} }

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.download;
import com.fr.base.svg.IconUtils; import com.fr.base.svg.IconUtils;
import com.fr.common.util.Strings; import com.fr.common.util.Strings;
import com.fr.decision.webservice.v10.log.download.utils.LogZipUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -11,8 +12,9 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource; import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper; import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper;
import com.fr.design.mainframe.toast.SimpleToast; import com.fr.design.mainframe.toast.SimpleToast;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.third.jodd.io.ZipUtil; import com.fr.stable.pinyin.ChineseHelper;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileSystemView; import javax.swing.filechooser.FileSystemView;
@ -80,7 +82,11 @@ public class FineMarketDownloadManager {
if (fileName.endsWith(FineMarketConstants.ZIP)) { if (fileName.endsWith(FineMarketConstants.ZIP)) {
File file = new File(fileName); File file = new File(fileName);
File parentDir = file.getParentFile(); File parentDir = file.getParentFile();
ZipUtil.unzip(file, parentDir); if (ChineseHelper.containChinese(fileName)) {
IOUtils.unzip(file, parentDir.getAbsolutePath(), LogZipUtils.GBK);
} else {
IOUtils.unzip(file, parentDir.getAbsolutePath());
}
} }
} }

14
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java

@ -65,6 +65,12 @@ public class TemplateResource {
private List<String> recommendSearchKey; private List<String> recommendSearchKey;
private boolean embed; private boolean embed;
/// 其他属性
// 当前搜索词
private String searchWord;
public static List<TemplateResource> createByJson(JSONArray jsonArray) { public static List<TemplateResource> createByJson(JSONArray jsonArray) {
List<TemplateResource> list = new ArrayList<>(); List<TemplateResource> list = new ArrayList<>();
if (jsonArray != null) { if (jsonArray != null) {
@ -219,4 +225,12 @@ public class TemplateResource {
this.uuid = uuid; this.uuid = uuid;
return this; return this;
} }
public String getSearchWord() {
return searchWord;
}
public void setSearchWord(String searchWord) {
this.searchWord = searchWord;
}
} }

48
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java

@ -0,0 +1,48 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.component.AlphaFineFrame;
import com.fr.design.mainframe.alphafine.component.SearchHintPane;
import com.fr.design.mainframe.alphafine.search.SearchWorkerManager;
import com.fr.design.mainframe.alphafine.search.manager.SearchProviderRegistry;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* @version 11.0
* @author: Link
* @date: 2022/9/16
* @Description: alphaFine - 默认展示页面
*/
public class DefaultContentPane extends JPanel {
// 左边展示内容,右边展示搜索提示
private SearchWorkerManager searchWorkerManager;
private CellType cellType;
public DefaultContentPane(CellType cellType, AlphaFineFrame parentWindow) {
this.setLayout(new BorderLayout());
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
this.searchWorkerManager = new SearchWorkerManager(
cellType,
searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(),
parentWindow,
new SimpleRightSearchResultPane(new SearchHintPane())
);
this.searchWorkerManager.showDefault(this);
}
public DefaultContentPane() {
}
public CellType getCellType() {
return cellType;
}
public void setCellType(CellType cellType) {
this.cellType = cellType;
}
}

80
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java

@ -0,0 +1,80 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.component.AlphaFineFrame;
import com.fr.design.mainframe.alphafine.component.SearchHintPane;
import com.fr.design.mainframe.alphafine.search.SearchWorkerManager;
import com.fr.design.mainframe.alphafine.search.manager.SearchProviderRegistry;
import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
/**
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine插件默认页
*/
public class DefaultPluginContentPane extends DefaultContentPane {
// 左边展示内容,右边展示搜索提示
private SearchWorkerManager searchWorkerManager;
private CellType cellType;
private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(",");
public DefaultPluginContentPane(CellType cellType, AlphaFineFrame parentWindow) {
super();
this.setLayout(new BorderLayout());
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
new SwingWorker<Boolean, Void>(){
@Override
protected Boolean doInBackground() throws Exception {
add(new SearchLoadingPane());
return AlphaFineHelper.isNetworkOk();
}
@Override
protected void done() {
super.done();
try {
boolean networkOk = get();
removeAll();
if (!networkOk) {
add(new NetWorkFailedPane());
} else {
List<String> searchKeys = new ArrayList<>();
for (String s : HINTS) {
searchKeys.add(s);
}
searchWorkerManager = new SearchWorkerManager(
cellType,
searchTextBean -> SearchProviderRegistry.getSearchProvider(cellType).getDefaultResult(),
parentWindow,
new SimpleRightSearchResultPane(new SearchHintPane(searchKeys))
);
searchWorkerManager.showDefault(DefaultPluginContentPane.this);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
}
}.execute();
}
public CellType getCellType() {
return cellType;
}
public void setCellType(CellType cellType) {
this.cellType = cellType;
}
}

9
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultProductNewsPane.java

@ -1,9 +1,9 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.component.ProductNewsContentCellRender; import com.fr.design.mainframe.alphafine.component.ProductNewsContentCellRender;
import com.fr.design.mainframe.alphafine.component.ProductNewsList; import com.fr.design.mainframe.alphafine.component.ProductNewsList;
@ -12,14 +12,15 @@ import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.List;
/** /**
* @author hades * @author hades

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

14
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/HelpDocumentNoResultPane.java

@ -1,9 +1,9 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
@ -13,6 +13,12 @@ import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
@ -22,12 +28,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
/** /**
* @author hades * @author hades

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/LoadingRightSearchResultPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.FileModel; import com.fr.design.mainframe.alphafine.cell.model.FileModel;
@ -11,6 +11,11 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.LocalExportOperator; import com.fr.workspace.server.exporter.LocalExportOperator;
import com.fr.workspace.server.exporter.TemplateExportOperator; import com.fr.workspace.server.exporter.TemplateExportOperator;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.SwingWorker;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@ -18,10 +23,6 @@ import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.SwingWorker;
/** /**
* @author hades * @author hades

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NetWorkFailedPane.java

@ -3,7 +3,7 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java

@ -1,17 +1,16 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.bulenkov.iconloader.IconLoader; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import java.awt.Component;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
/** /**

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultWithLinkPane.java

@ -1,15 +1,16 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import java.awt.Color;
import java.awt.Component;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
import java.awt.Color;
import java.awt.Component;
/** /**
* 带跳转链接的无结果面板 * 带跳转链接的无结果面板

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/PluginPreviewPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java

@ -3,7 +3,7 @@ package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
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.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SearchLoadingPane.java

@ -1,13 +1,12 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
/** /**
* @author hades * @author hades

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/SimpleRightSearchResultPane.java

@ -1,11 +1,12 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; 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 javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JPanel;
/** /**
* @author hades * @author hades

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java

@ -1,10 +1,10 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.action.StartUseAction; import com.fr.design.mainframe.alphafine.action.StartUseAction;
import com.fr.design.mainframe.alphafine.component.TemplateResourceImagePanel; import com.fr.design.mainframe.alphafine.component.TemplateResourceImagePanel;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail; import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
@ -70,8 +70,8 @@ public class TemplateResourceDetailPane extends JPanel {
private static final Font HTML_FONT = DesignUtils.getDefaultGUIFont().applySize(12); private static final Font HTML_FONT = DesignUtils.getDefaultGUIFont().applySize(12);
private static final Color HTML_COLOR = new Color(0x5c5c5d); private static final Color HTML_COLOR = new Color(0x5c5c5d);
private static final String HTML_FORMAT = "<html><style>a {color: #419BF9;text-decoration:none;}</style><body style=\"line-height: 20px;"+ LinkStrUtils.generateStyle(HTML_FONT, HTML_COLOR) +"\">%s</body></html>"; private static final String HTML_FORMAT = "<html><style>a {color: #419BF9 !important;text-decoration:none !important;}</style><body style=\"line-height: 20px;"+ LinkStrUtils.generateStyle(HTML_FONT, HTML_COLOR) + "\">%s</body></html>";
private static final String DETAIL_INFO_HTML_FORMAT = "<html><style>a {color: #419BF9;text-decoration:none;}</style><body style=\"line-height: 20px;" + LinkStrUtils.generateStyle(HTML_FONT, HTML_COLOR) + "\"><p>" + DETAIL_INFO + "</p>%s</body></html>"; private static final String DETAIL_INFO_HTML_FORMAT = "<html><style>a {color: #419BF9 !important;text-decoration:none !important;}</style><body style=\"line-height: 20px;" + LinkStrUtils.generateStyle(HTML_FONT, HTML_COLOR) + "\"><p>" + DETAIL_INFO + "</p>%s</body></html>";
private static final String HTML_P_TAG_FORMAT = "<p style=\"margin-top:5pt;\">%s</p>"; private static final String HTML_P_TAG_FORMAT = "<p style=\"margin-top:5pt;\">%s</p>";

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.preview; package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.component.TemplateResourcePageGridPane; import com.fr.design.mainframe.alphafine.component.TemplateResourcePageGridPane;
import com.fr.design.mainframe.alphafine.model.TemplateResource; import com.fr.design.mainframe.alphafine.model.TemplateResource;

13
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java

@ -1,16 +1,18 @@
package com.fr.design.mainframe.alphafine.search; package com.fr.design.mainframe.alphafine.search;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; import com.fr.design.mainframe.alphafine.component.AlphaFineFrame;
import com.fr.design.mainframe.alphafine.component.ProductNewsSearchResultPane; import com.fr.design.mainframe.alphafine.component.ProductNewsSearchResultPane;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.design.mainframe.alphafine.preview.DefaultContentPane;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.List;
import java.util.function.Function;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.util.List;
import java.util.function.Function;
/** /**
* @author hades * @author hades
@ -99,6 +101,11 @@ public class ProductNewsSearchWorkerManager implements SearchManager {
this.searchWorker.execute(); this.searchWorker.execute();
} }
@Override
public void showDefault(DefaultContentPane defaultContentPane) {
}
public ProductNewsSearchResultPane getSearchResultPane() { public ProductNewsSearchResultPane getSearchResultPane() {
return searchResultPane; return searchResultPane;
} }

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchManager.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.alphafine.search; package com.fr.design.mainframe.alphafine.search;
import com.fr.design.mainframe.alphafine.preview.DefaultContentPane;
/** /**
* @author hades * @author hades
* @version 11.0 * @version 11.0
@ -9,6 +11,11 @@ public interface SearchManager {
void doSearch(SearchTextBean searchTextBean); void doSearch(SearchTextBean searchTextBean);
/**
* 展示默认内容
* */
void showDefault(DefaultContentPane defaultContentPane);
boolean hasSearchResult(); boolean hasSearchResult();
boolean isSearchOver(); boolean isSearchOver();

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchTextBean.java

@ -7,6 +7,8 @@ package com.fr.design.mainframe.alphafine.search;
*/ */
public class SearchTextBean { public class SearchTextBean {
public static SearchTextBean EMPTY = new SearchTextBean("", new String[0]);
private String searchText; private String searchText;
/** /**

25
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.search; package com.fr.design.mainframe.alphafine.search;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; 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;
@ -9,12 +9,15 @@ import com.fr.design.mainframe.alphafine.component.AlphaFineList;
import com.fr.design.mainframe.alphafine.component.SearchListModel; import com.fr.design.mainframe.alphafine.component.SearchListModel;
import com.fr.design.mainframe.alphafine.component.SearchResultPane; import com.fr.design.mainframe.alphafine.component.SearchResultPane;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.DefaultContentPane;
import com.fr.design.mainframe.alphafine.preview.ResultShowPane; import com.fr.design.mainframe.alphafine.preview.ResultShowPane;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.function.Function;
import javax.swing.SwingWorker;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import java.util.function.Function;
/** /**
* @author hades * @author hades
* @version 11.0 * @version 11.0
@ -120,6 +123,22 @@ public class SearchWorkerManager implements SearchManager {
this.searchWorker.execute(); this.searchWorker.execute();
} }
@Override
public void showDefault(DefaultContentPane defaultContentPane) {
searchResultPane = new SearchResultPane(SearchTextBean.EMPTY.getSegmentation(), resultShowPane);
SearchListModel searchListModel = new SearchListModel(new SearchResult(), searchResultPane.getSearchResultList(), searchResultPane.getLeftSearchResultPane());
SearchResult searchResult = searchResultFunction.apply(SearchTextBean.EMPTY);
for (AlphaCellModel object : searchResult) {
AlphaFineHelper.checkCancel();
searchListModel.addElement(object);
}
searchResultPane.getSearchResultList().setModel(searchListModel);
searchResultPane.getSearchResultList().setSelectedIndex(0);
searchResultPane.getSearchResultList().requestFocus();
defaultContentPane.add(searchResultPane);
SwingUtilities.invokeLater(()->defaultContentPane.repaint());
}
@Override @Override
public boolean hasSearchResult() { public boolean hasSearchResult() {
return hasSearchResult; return hasSearchResult;

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java

@ -1,10 +1,11 @@
package com.fr.design.mainframe.alphafine.search; package com.fr.design.mainframe.alphafine.search;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.component.AlphaFineFrame; import com.fr.design.mainframe.alphafine.component.AlphaFineFrame;
import com.fr.design.mainframe.alphafine.model.TemplateResource; import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.preview.DefaultContentPane;
import com.fr.design.mainframe.alphafine.preview.TemplateShopPane; import com.fr.design.mainframe.alphafine.preview.TemplateShopPane;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -68,6 +69,11 @@ public class TemplateResourceSearchWorkerManager implements SearchManager {
this.searchWorker.execute(); this.searchWorker.execute();
} }
@Override
public void showDefault(DefaultContentPane defaultContentPane) {
}
void showResult(List<TemplateResource> list) { void showResult(List<TemplateResource> list) {
if (networkError && !searchResult) { if (networkError && !searchResult) {
alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR); alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR);

34
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/SearchProviderRegistry.java

@ -0,0 +1,34 @@
package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
* alphafine搜索提供者注册到这里
*/
public class SearchProviderRegistry {
private static Map<CellType, AlphaFineSearchProvider> map;
static {
map = new HashMap<>();
map.put(CellType.PLUGIN, PluginSearchManager.getInstance());
map.put(CellType.ACTION, ActionSearchManager.getInstance());
map.put(CellType.FILE, FileSearchManager.getInstance());
}
/**
* 根据celltype获得对应searchProvider
* */
public static AlphaFineSearchProvider getSearchProvider(CellType cellType) {
return map.get(cellType);
}
}

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java

@ -22,6 +22,12 @@ public interface AlphaFineSearchProvider {
*/ */
SearchResult getMoreSearchResult(String searchText); SearchResult getMoreSearchResult(String searchText);
/**
* 不搜索的情况下获取显示结果
* */
default SearchResult getDefaultResult() {
return new SearchResult();
}
/** /**
* 获取所有搜索结果 取决于具体实现 * 获取所有搜索结果 取决于具体实现

22
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
@ -29,6 +29,7 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
private SearchResult defaultModelList;
public static ActionSearchManager getInstance() { public static ActionSearchManager getInstance() {
if (instance == null) { if (instance == null) {
@ -41,6 +42,17 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
return instance; return instance;
} }
/**
* 初始化的时候初始化默认功能列表
* */
private ActionSearchManager() {
defaultModelList = new SearchResult();
List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
defaultModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
}
}
/** /**
* 根据类名获取对象 * 根据类名获取对象
* *
@ -115,4 +127,12 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
getLessSearchResult(searchTextBean.getSegmentation()); getLessSearchResult(searchTextBean.getSegmentation());
return filterModelList; return filterModelList;
} }
@Override
public SearchResult getDefaultResult() {
return defaultModelList;
}
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;

19
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -3,7 +3,7 @@ package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.FileModel; import com.fr.design.mainframe.alphafine.cell.model.FileModel;
@ -21,6 +21,8 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.List;
/** /**
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
@ -33,9 +35,11 @@ public class FileSearchManager implements AlphaFineSearchProvider {
private static volatile FileSearchManager instance; private static volatile FileSearchManager instance;
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult defaultModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
private String searchText; private String searchText;
private FileNode[] fileNodes = null; private FileNode[] fileNodes = null;
private static final int defaultListSize = 10;
//停止搜索 //停止搜索
//隐藏的搜索功能,可根据特殊的字符标记判断搜索分类 //隐藏的搜索功能,可根据特殊的字符标记判断搜索分类
@ -137,6 +141,19 @@ public class FileSearchManager implements AlphaFineSearchProvider {
} }
} }
@Override
public SearchResult getDefaultResult() {
List<String> list = DesignerEnvManager.getEnvManager().getRecentOpenedFilePathList();
defaultModelList = new SearchResult();
for (int i = 0; i < Math.min(defaultListSize, list.size()); i++) {
String name = list.get(i).toLowerCase();
name = name.replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
FileModel model = new FileModel(name, name);
defaultModelList.add(model);
}
return defaultModelList;
}
/** /**
* 搜索模板内容 * 搜索模板内容
* *

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
@ -11,16 +11,15 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONFactory; import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.Nullable;
/** /**

73
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -1,7 +1,8 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.common.util.Collections;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
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.MoreModel;
@ -15,13 +16,19 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalType;
import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.ToLongFunction;
/** /**
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
@ -30,6 +37,12 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
private SearchResult searchResult; private SearchResult searchResult;
private SearchResult defaultModelList;
private static final int defaultListSize = 10;
private static final String timeFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
private static final String UPLOAD_TIME = "uploadTime";
private PluginSearchManager() { private PluginSearchManager() {
@ -155,4 +168,60 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
getLessSearchResult(searchTextBean.getSegmentation()); getLessSearchResult(searchTextBean.getSegmentation());
return searchResult; return searchResult;
} }
@Override
public SearchResult getDefaultResult() {
this.defaultModelList = new SearchResult();
try {
String url = AlphaFineConstants.SEARCH_ALL_PLUGIN_URL;
String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("result");
List<Map> plugins = jsonArray.getList();
List<PluginModel> pluginModels = new ArrayList<>();
pluginModels.addAll(parseDefaultPluginModel(plugins));
pluginModels.forEach(m->this.defaultModelList.add(m));
} catch (Exception e) {
FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage());
}
return this.defaultModelList;
}
/**
* 将jsonobject转化为PluginModel
* 并按照更新时间排序取最新的10个
* */
List<PluginModel> parseDefaultPluginModel(List<Map> jsonObjects) {
List<PluginModel> pluginModels = new ArrayList<>();
if (!Collections.isEmpty(jsonObjects)) {
SimpleDateFormat format = new SimpleDateFormat(timeFormat);
try {
jsonObjects.sort(Comparator.comparingLong(new ToLongFunction<Map>() {
@Override
public long applyAsLong(Map value) {
Long time = 0l;
try {
time = format.parse((String) value.get(UPLOAD_TIME)).getTime();
} catch (ParseException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return time;
}
}));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
for (int i = 0; i < defaultListSize; i++) {
pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false));
}
}
return pluginModels;
}
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ProductNewsSearchManager.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.ProductNews; import com.fr.design.mainframe.alphafine.model.ProductNews;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SegmentationManager.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.ibm.icu.text.BreakIterator; import com.fr.third.ibm.icu.text.BreakIterator;

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManager.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
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.MoreModel;

22
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java

@ -29,7 +29,19 @@ public class TemplateResourceSearchManager {
public List<TemplateResource> getSearchResult(String searchText) { public List<TemplateResource> getSearchResult(String searchText) {
List<TemplateResource> resourceList = new ArrayList<>(); List<TemplateResource> resourceList = new ArrayList<>();
// 联网搜索 resourceList.addAll(searchOnline(searchText));
resourceList.addAll(searchLocal(searchText));
resourceList.stream().forEach(resource -> {resource.setSearchWord(searchText);});
return resourceList;
}
/**
* 联网搜索
* */
private List<TemplateResource> searchOnline(String searchText) {
List<TemplateResource> resourceList = new ArrayList<>();
try { try {
JSONArray jsonArray = helper.getTemplateInfoByName(searchText); JSONArray jsonArray = helper.getTemplateInfoByName(searchText);
if (jsonArray != null && !jsonArray.isEmpty()) { if (jsonArray != null && !jsonArray.isEmpty()) {
@ -38,8 +50,14 @@ public class TemplateResourceSearchManager {
} catch (Exception e) { } catch (Exception e) {
} }
return resourceList;
}
// 本地搜索 /**
* 本地搜索
* */
private List<TemplateResource> searchLocal(String searchText) {
List<TemplateResource> resourceList = new ArrayList<>();
if (resourceList.isEmpty()) { if (resourceList.isEmpty()) {
List<TemplateResource> localResource = getEmbedResourceList(); List<TemplateResource> localResource = getEmbedResourceList();
localResource.stream().forEach(resource->{ localResource.stream().forEach(resource->{

37
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/search_hint.svg

@ -0,0 +1,37 @@
<svg width="112" height="100" viewBox="0 0 112 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="55.5" cy="57.5" r="42.5" fill="#EFEFF1"/>
<circle cx="19.3947" cy="12.2012" r="2.72659" fill="#E7E7EA"/>
<circle cx="11.2149" cy="35.9614" r="1.55805" fill="#DADAE0"/>
<circle cx="101.971" cy="39.4671" r="1.94756" fill="#E7E7EA"/>
<path opacity="0.593564" fill-rule="evenodd" clip-rule="evenodd" d="M107.866 26.5612L105.477 25.8341L107.866 25.107L108.593 22.718L109.32 25.107L111.709 25.8341L109.32 26.5612L108.593 28.9502L107.866 26.5612Z" fill="#D8D8D8"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M87.91 13.0191L85.2224 12.2011L87.91 11.3831L88.728 8.69548L89.546 11.3831L92.2336 12.2011L89.546 13.0191L88.728 15.7067L87.91 13.0191Z" fill="#D8D8D8"/>
<g filter="url(#filter0_d_2271_72853)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 37C30.3431 37 29 38.3431 29 40V74C29 75.6569 30.3431 77 32 77H81C82.6569 77 84 75.6569 84 74V49L72 37H32Z" fill="white"/>
</g>
<path d="M72 37L84 49H75C73.3431 49 72 47.6569 72 46V37Z" fill="#F0F0F0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35 47C35 46.4477 35.4477 46 36 46H68C68.5523 46 69 46.4477 69 47V48C69 48.5523 68.5523 49 68 49H36C35.4477 49 35 48.5523 35 48V47Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35 55C35 54.4477 35.4477 54 36 54H54C54.5523 54 55 54.4477 55 55V56C55 56.5523 54.5523 57 54 57H36C35.4477 57 35 56.5523 35 56V55Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35 63C35 62.4477 35.4477 62 36 62H51C51.5523 62 52 62.4477 52 63V64C52 64.5523 51.5523 65 51 65H36C35.4477 65 35 64.5523 35 64V63Z" fill="#ECECEC"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M69.8212 68.6844V68.9847H67.9316V68.6844C67.9316 68.031 68.0375 67.4659 68.2848 67.0067C68.5143 66.5122 69.1854 65.7882 70.2803 64.8169L70.5806 64.4813C70.8984 64.0752 71.075 63.6513 71.075 63.1922C71.075 62.5741 70.8984 62.0972 70.5629 61.744C70.2097 61.3908 69.6976 61.2142 69.0618 61.2142C68.2671 61.2142 67.6843 61.4615 67.3311 61.9736C67.0132 62.3975 66.8543 62.9979 66.8543 63.7749H65C65 62.4858 65.3709 61.4791 66.1126 60.7374C66.8543 59.978 67.8786 59.6072 69.1854 59.6072C70.3157 59.6072 71.234 59.9074 71.9404 60.5432C72.6468 61.1613 73 62.0089 73 63.0685C73 63.9339 72.7704 64.6579 72.3289 65.2231C72.17 65.4173 71.6755 65.8765 70.8455 66.6005C70.5099 66.8831 70.2627 67.201 70.1037 67.5189C69.9095 67.8721 69.8212 68.2606 69.8212 68.6844ZM69.7859 72.1106C69.5386 72.3401 69.2207 72.4638 68.8675 72.4638C68.5143 72.4638 68.1965 72.3401 67.9492 72.0929C67.702 71.8457 67.5784 71.5454 67.5784 71.1922C67.5784 70.8214 67.702 70.5212 67.9492 70.2916C68.1965 70.0443 68.5143 69.9384 68.8675 69.9384C69.2384 69.9384 69.5563 70.0443 69.8035 70.2916C70.0508 70.5212 70.1744 70.8214 70.1744 71.1922C70.1744 71.5631 70.0331 71.8633 69.7859 72.1106Z" fill="#DCDCDF"/>
<circle cx="69" cy="65" r="11.935" transform="rotate(-45 69 65)" stroke="#DADADD" stroke-width="3"/>
<circle cx="69" cy="65" r="10.6067" transform="rotate(-45 69 65)" fill="#D9DADD" fill-opacity="0.22"/>
<rect x="76.1232" y="74.7715" width="3.74565" height="5.45555" transform="rotate(-45 76.1232 74.7715)" fill="#DADADD"/>
<rect x="78.4767" y="78.7192" width="6" height="1" transform="rotate(-45 78.4767 78.7192)" fill="#C8C9CD"/>
<mask id="mask0_2271_72853" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="13" y="15" width="85" height="85">
<circle cx="55.5" cy="57.5" r="42.5" fill="#EBEBED"/>
</mask>
<g mask="url(#mask0_2271_72853)">
<path d="M79.1838 79.4263L83.4265 75.1836L89.7904 81.5476C90.962 82.7192 90.962 84.6187 89.7904 85.7902C88.6189 86.9618 86.7194 86.9618 85.5478 85.7902L79.1838 79.4263Z" fill="#D3D3D8"/>
</g>
<defs>
<filter id="filter0_d_2271_72853" x="25" y="33" width="63" height="48" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="2"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.867956 0 0 0 0 0.867956 0 0 0 0 0.886124 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2271_72853"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2271_72853" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

2
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;

Loading…
Cancel
Save