Browse Source

REPORT-75093 运营产品化二期

1、alphafine设置页修改
2、alphafine新增模板资源页面
3、原来的tab页修改了名字
feature/x
Link.Zhao 2 years ago
parent
commit
4b5cee8995
  1. 41
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 164
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  3. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java
  4. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java
  5. 201
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  6. 69
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java
  7. 74
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourceImagePanel.java
  8. 225
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java
  9. 97
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java
  10. 191
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java
  11. 192
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java
  12. 185
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java
  13. 120
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java
  14. 105
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java
  15. 130
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java
  16. 100
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java
  17. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bottom.svg
  18. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bottom_disable.svg
  19. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/config.svg
  20. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/down.svg
  21. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/down_disable.svg
  22. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template1.png
  23. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template2.png
  24. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template3.png
  25. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template4.png
  26. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/more.png
  27. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/next.svg
  28. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/prev.svg
  29. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/top.svg
  30. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/top_disable.svg
  31. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/up.svg
  32. 3
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/up_disable.svg
  33. 106
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/template_resource/local_templates.json

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

@ -10,18 +10,16 @@ import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.Stack;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
/**
* AlphaFine配置类
@ -54,13 +52,17 @@ public class AlphaFineConfigManager implements XMLable {
*/
private boolean containRecommend = true;
/**
* 设置
* 功能
*/
private boolean containAction = true;
/**
* 帮助文档
*/
private boolean containDocument = true;
/**
* 我的模板
* */
private boolean containMyTemplate = true;
/**
* 模板
*/
@ -70,7 +72,7 @@ public class AlphaFineConfigManager implements XMLable {
*/
private boolean containFileContent;
/**
* 应用中心
* 插件中心
*/
private boolean containPlugin = true;
/**
@ -95,6 +97,11 @@ public class AlphaFineConfigManager implements XMLable {
*/
private boolean productDynamics = true;
/**
* 模板商城是否展示
* */
private boolean showTemplateShop = true;
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
@ -326,6 +333,14 @@ public class AlphaFineConfigManager implements XMLable {
this.containDocument = containDocument;
}
public void setContainMyTemplate(boolean containMyTemplate) {
this.containMyTemplate = containMyTemplate;
}
public boolean isContainMyTemplate() {
return containMyTemplate;
}
public boolean isContainTemplate() {
return containTemplate;
}
@ -446,6 +461,14 @@ public class AlphaFineConfigManager implements XMLable {
return productDynamics && FRContext.isChineseEnv();
}
public boolean hasTemplateShop() {
return showTemplateShop && FRContext.isChineseEnv();
}
public void setShowTemplateShop(boolean showTemplateShop) {
this.showTemplateShop = showTemplateShop;
}
public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics;
}

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

@ -1,17 +1,29 @@
package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -27,12 +39,20 @@ public class AlphaFineConfigPane extends BasicPane {
private static final String DISPLAY_TYPE = "+";
private static final double COLUMN_GAP = 180;
private static final double ROW_GAP = 25;
private static final double COLUMN_WIDTH = 150;
private static final double ROW_HEIGHT = 25;
private KeyStroke shortCutKeyStore = null;
private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox, needIntelligentCustomerService, productDynamicsCheckbox, containActionCheckbox, containDocumentCheckbox, containTemplateCheckbox, containPluginCheckbox, containFileContentCheckbox;
private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox;
private UICheckBox productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox,
containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox;
private UITextField shortcutsField;
// 搜索范围-我的模板,相关组件
private JPanel containMyTemplatePane;
private JButton myTemplateSearchConfigButton;
private UIPopupMenu myTemplateSearchMenu;
private UICheckBox containTemplateNameSearchCheckbox, containFileContentSearchCheckbox;
public AlphaFineConfigPane() {
this.initComponents();
}
@ -45,15 +65,6 @@ public class AlphaFineConfigPane extends BasicPane {
createSearchConfigPane(contentPane);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(contentPane, BorderLayout.NORTH);
}
private Component[][] initSearchRangeComponents() {
Component[][] components = new Component[][]{
new Component[]{productDynamicsCheckbox, containActionCheckbox, containDocumentCheckbox},
new Component[]{containTemplateCheckbox, containPluginCheckbox, containFileContentCheckbox},
};
return components;
}
private Component[][] initOnlineComponents() {
@ -63,24 +74,99 @@ public class AlphaFineConfigPane extends BasicPane {
return components;
}
// 搜索范围
private void createSearchConfigPane(JPanel contentPane) {
double[] rowSize = {ROW_GAP, ROW_GAP, ROW_GAP};
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT};
double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH};
JPanel northPane = 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_Dynamics"));
containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"));
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"));
containPluginCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"));
containDocumentCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"));
containTemplateCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates"));
containFileContentCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
needIntelligentCustomerService = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Intelligent_Customer_Service"));
containMyTemplateCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_My_Templates"));
containFileContentSearchCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
containTemplateShopCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop"));
containMyTemplateCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_My_Templates"));
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize);
northPane.add(searchConfigPane);
contentPane.add(northPane);
}
private Component[][] initSearchRangeComponents() {
// 我的模板checkbox设置,点击后
initMyTemplateSearchPane();
Component[][] components = new Component[][]{
new Component[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox},
new Component[]{containPluginCheckbox, containActionCheckbox, containMyTemplatePane},
};
for (int i = 0; i < components.length; i++) {
for (int j = 0; j < components[i].length; j++) {
if (components[i][j] instanceof UICheckBox) {
UICheckBox box = (UICheckBox) components[i][j];
}
}
}
return components;
}
/**
* 搜索范围中的复选框有无选中的
* */
private boolean hasSelectedSearchRangeCheckBox() {
return productDynamicsCheckbox.isSelected() || containTemplateShopCheckbox.isSelected() || containDocumentCheckbox.isSelected()
|| containPluginCheckbox.isSelected() || containActionCheckbox.isSelected() || containMyTemplateCheckbox.isSelected();
}
// 搜索范围-我的模板
private void initMyTemplateSearchPane() {
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5));
containMyTemplateCheckbox.setBorder(BorderFactory.createEmptyBorder());
containMyTemplateCheckbox.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (containMyTemplateCheckbox.isSelected()) {
myTemplateSearchConfigButton.setVisible(true);
} else {
myTemplateSearchConfigButton.setVisible(false);
}
}
}
);
myTemplateSearchConfigButton = new JButton();
myTemplateSearchConfigButton.setBorder(BorderFactory.createEmptyBorder());
myTemplateSearchConfigButton.setMargin(new Insets(0,0,0,0));
myTemplateSearchConfigButton.setIcon(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/config.svg"));
myTemplateSearchMenu = new UIPopupMenu();
containTemplateNameSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Name_Search"));
containFileContentSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Content_Search"));
containTemplateNameSearchCheckbox.setSelected(true);
containTemplateNameSearchCheckbox.setEnabled(false);
containTemplateNameSearchCheckbox.setBackground(null);
containFileContentSearchCheckbox.setBackground(null);
myTemplateSearchMenu.add(containTemplateNameSearchCheckbox);
myTemplateSearchMenu.add(containFileContentSearchCheckbox);
myTemplateSearchConfigButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
GUICoreUtils.showPopupMenu(myTemplateSearchMenu, containMyTemplatePane, containMyTemplateCheckbox.getWidth(), containMyTemplatePane.getY());
}
@Override
public void mouseMoved(MouseEvent e) {
super.mouseMoved(e);
myTemplateSearchMenu.setVisible(false);
}
});
containMyTemplatePane.add("containMyTemplateCheckbox", containMyTemplateCheckbox);
containMyTemplatePane.add("myTemplateSearchConfigButton", myTemplateSearchConfigButton);
}
private void createShortcutsPane(JPanel contentPane) {
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Shortcut_Config"));
shortcutsField = new UITextField();
@ -91,7 +177,7 @@ public class AlphaFineConfigPane extends BasicPane {
northPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open") + ":"));
northPane.add(shortcutsField);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_SetShortcuts"));
label.setForeground(Color.RED);
label.setForeground(new Color(0x919193));
northPane.add(label);
contentPane.add(northPane);
}
@ -130,21 +216,21 @@ public class AlphaFineConfigPane extends BasicPane {
productDynamicsCheckbox.setEnabled(false);
containPluginCheckbox.setEnabled(false);
containDocumentCheckbox.setEnabled(false);
needIntelligentCustomerService.setEnabled(false);
containTemplateShopCheckbox.setEnabled(false);
productDynamicsCheckbox.setSelected(false);
containPluginCheckbox.setSelected(false);
containDocumentCheckbox.setSelected(false);
needIntelligentCustomerService.setSelected(false);
containTemplateShopCheckbox.setSelected(false);
} else {
productDynamicsCheckbox.setEnabled(true);
containPluginCheckbox.setEnabled(true);
containDocumentCheckbox.setEnabled(true);
needIntelligentCustomerService.setEnabled(true);
containTemplateShopCheckbox.setEnabled(true);
}
}
});
double[] rowSize = {ROW_GAP};
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
double[] rowSize = {ROW_HEIGHT};
double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH};
JPanel onlinePane = TableLayoutHelper.createTableLayoutPane(initOnlineComponents(), rowSize, columnSize);
northPane.add(onlinePane);
contentPane.add(northPane);
@ -172,8 +258,10 @@ public class AlphaFineConfigPane extends BasicPane {
this.searchOnlineCheckbox.setSelected(enabled4Locale);
this.containActionCheckbox.setSelected(alphaFineConfigManager.isContainAction());
this.containTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate());
this.containFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.containMyTemplateCheckbox.setSelected(alphaFineConfigManager.isContainMyTemplate());
this.myTemplateSearchConfigButton.setVisible(alphaFineConfigManager.isContainMyTemplate());
this.containFileContentSearchCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.containDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && enabled4Locale);
this.containDocumentCheckbox.setEnabled(enabled4Locale);
@ -184,13 +272,13 @@ public class AlphaFineConfigPane extends BasicPane {
this.productDynamicsCheckbox.setSelected(alphaFineConfigManager.isProductDynamics() && enabled4Locale);
this.productDynamicsCheckbox.setEnabled(enabled4Locale);
this.containTemplateShopCheckbox.setSelected(alphaFineConfigManager.hasTemplateShop() && enabled4Locale);
this.containTemplateShopCheckbox.setEnabled(enabled4Locale);
this.shortcutsField.setText(AlphaFineShortCutUtil.getDisplayShortCut(alphaFineConfigManager.getShortcuts()));
this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox());
this.needIntelligentCustomerService.setSelected(alphaFineConfigManager.isNeedIntelligentCustomerService() && enabled4Locale);
this.needIntelligentCustomerService.setEnabled(enabled4Locale);
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
}
@ -201,12 +289,12 @@ public class AlphaFineConfigPane extends BasicPane {
alphaFineConfigManager.setContainAction(this.containActionCheckbox.isSelected());
alphaFineConfigManager.setContainDocument(this.containDocumentCheckbox.isSelected());
alphaFineConfigManager.setProductDynamics(this.productDynamicsCheckbox.isSelected());
alphaFineConfigManager.setShowTemplateShop(this.containTemplateShopCheckbox.isSelected());
alphaFineConfigManager.setEnabled(this.enabledCheckbox.isSelected());
alphaFineConfigManager.setSearchOnLine(this.searchOnlineCheckbox.isSelected());
alphaFineConfigManager.setContainTemplate(this.containTemplateCheckbox.isSelected());
alphaFineConfigManager.setContainFileContent(this.containFileContentCheckbox.isSelected());
alphaFineConfigManager.setContainMyTemplate(this.containMyTemplateCheckbox.isSelected());
alphaFineConfigManager.setContainFileContent(this.containFileContentSearchCheckbox.isSelected());
alphaFineConfigManager.setNeedSegmentationCheckbox(this.needSegmentationCheckbox.isSelected());
alphaFineConfigManager.setNeedIntelligentCustomerService(this.needIntelligentCustomerService.isSelected());
alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager);
try {
@ -233,10 +321,10 @@ public class AlphaFineConfigPane extends BasicPane {
}
public UICheckBox getIsContainFileContentCheckbox() {
return containFileContentCheckbox;
return containFileContentSearchCheckbox;
}
public void setIsContainFileContentCheckbox(UICheckBox isContainFileContentCheckbox) {
this.containFileContentCheckbox = isContainFileContentCheckbox;
this.containFileContentSearchCheckbox = isContainFileContentCheckbox;
}
}

18
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/CellType.java

@ -17,7 +17,8 @@ public enum CellType {
RECOMMEND_ROBOT(8),
BOTTOM(9),
ROBOT(10),
PRODUCT_NEWS(11, "productNews", "productNewsResult", true);
PRODUCT_NEWS(11, "productNews", "productNewsResult", true, false),
TEMPLATE_SHOP(12, "templateShop", "templateShop", false, true);
private int typeValue;
@ -35,11 +36,19 @@ public enum CellType {
private boolean needNetWork = true;
CellType(int type, String flagStr4None, String flagStr4Result, boolean needNetWork) {
private boolean canLocalSearch = false;
CellType(int type, String flagStr4None, String flagStr4Result, boolean needNetWork, boolean canLocalSearch) {
this.typeValue = type;
this.flagStr4None = flagStr4None;
this.flagStr4Result = flagStr4Result;
this.needNetWork = needNetWork;
this.canLocalSearch = canLocalSearch;
}
CellType(int type, String flagStr4None, String flagStr4Result, boolean needNetWork) {
this(type, flagStr4None, flagStr4Result, needNetWork, false);
}
CellType(int type) {
@ -75,5 +84,8 @@ public enum CellType {
public boolean isNeedNetWork() {
return needNetWork;
}
}
public boolean isCanLocalSearch() {
return canLocalSearch;
}
}

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

@ -0,0 +1,22 @@
package com.fr.design.mainframe.alphafine.action;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper;
import com.fr.design.utils.BrowseUtils;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class StartUseAction implements ActionListener {
TemplateResourceDetail resourceDetail;
public StartUseAction(TemplateResourceDetail detail) {
this.resourceDetail = detail;
}
@Override
public void actionPerformed(ActionEvent e) {
String url = FineMarketClientHelper.getInstance().getTemplateDownLoadUrl(resourceDetail.getRoot());
BrowseUtils.browser(url);
}
}

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

@ -22,20 +22,34 @@ import com.fr.design.mainframe.alphafine.preview.NoResultPane;
import com.fr.design.mainframe.alphafine.preview.NoResultWithLinkPane;
import com.fr.design.mainframe.alphafine.preview.SearchLoadingPane;
import com.fr.design.mainframe.alphafine.preview.SimpleRightSearchResultPane;
import com.fr.design.mainframe.alphafine.preview.TemplateShopPane;
import com.fr.design.mainframe.alphafine.question.QuestionWindow;
import com.fr.design.mainframe.alphafine.search.ProductNewsSearchWorkerManager;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.SearchWorkerManager;
import com.fr.design.mainframe.alphafine.search.TemplateResourceSearchWorkerManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
@ -62,16 +76,6 @@ import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
/**
* @author hades
@ -98,7 +102,7 @@ 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 SETTING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set");
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");
@ -110,7 +114,7 @@ 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 TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates");
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");
@ -122,7 +126,7 @@ public class AlphaFineFrame extends JFrame {
private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result");
private static final String PRODUCT_DYNAMICS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_Dynamics");
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");
@ -152,7 +156,7 @@ public class AlphaFineFrame extends JFrame {
private JPanel tabPane;
private CellType selectedType;
private SelectedLabel selectedTab;
private String beforeSearchStr = StringUtils.EMPTY;
@ -168,15 +172,38 @@ public class AlphaFineFrame extends JFrame {
private ProductNewsSearchWorkerManager productNewsSearchWorkerManager;
private TemplateResourceSearchWorkerManager templateResourceSearchWorkerManager;
public AlphaFineFrame() {
this.setTitle(AlphaFineConstants.TITLE);
//去掉边框
setUndecorated(true);
setSize(AlphaFineConstants.FIELD_SIZE);
setSize(AlphaFineConstants.FULL_SIZE);
initComponents();
centerWindow(this);
initSearchManager();
}
public void showResult(String flag) {
cardLayout.show(resultPane, flag);
}
public void addResult(JPanel panel, String flag) {
resultPane.add(panel, flag);
}
public void removeSearchResultPane(JPanel panel) {
resultPane.remove(panel);
}
public String getSearchText() {
return searchTextField.getText();
}
public CellType getSelectedType() {
return selectedTab.getCellType();
}
private void initSearchManager() {
this.productNewsSearchWorkerManager = new ProductNewsSearchWorkerManager(
@ -213,20 +240,26 @@ public class AlphaFineFrame extends JFrame {
new LoadingRightSearchResultPane()
);
this.templateResourceSearchWorkerManager = new TemplateResourceSearchWorkerManager(
CellType.TEMPLATE_SHOP,
searchTextBean -> {
return TemplateResourceSearchManager.getInstance().getSearchResult(searchTextBean.getSearchText());
},
this
);
}
/**
* 初始化全部组件
*/
private void initComponents() {
add(createTopPane(), BorderLayout.NORTH);
initSearchTextField();
add(createSearchPane(), BorderLayout.CENTER);
add(createShowPane(), BorderLayout.SOUTH);
this.getContentPane().setBackground(Color.WHITE);
this.setIconImage(SEARCH_IMAGE);
this.setSize(AlphaFineConstants.FULL_SIZE);
this.setIconImage(SEARCH_IMAGE); // 应用图标
}
private JPanel createTopPane() {
@ -289,7 +322,6 @@ public class AlphaFineFrame extends JFrame {
}
};
private JPopupMenu createTipPop() {
JPanel panel = new JPanel(new BorderLayout());
String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts()));
@ -372,21 +404,29 @@ public class AlphaFineFrame extends JFrame {
return searchPane;
}
/**
* showPane,内容展示区分为三个小区tab区label区内容区
* */
private JPanel createShowPane() {
JPanel showPane = new JPanel(new BorderLayout());
// 内容区,card layout
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 NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None());
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None());
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None());
resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None());
resultPane.add(TemplateShopPane.getInstance(), CellType.TEMPLATE_SHOP.getFlagStr4None());
resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR);
// label区,border layout
JPanel labelPane = new JPanel(new BorderLayout());
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
labelPane.setBackground(Color.WHITE);
JPanel labelContentPane = new JPanel(new BorderLayout());
UILabel tabLabel = new UILabel(PRODUCT_DYNAMICS);
UILabel tabLabel = new UILabel(PRODUCT_NEWS);
tabLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6);
tabLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
tabLabel.setPreferredSize(new Dimension(100, 30));
@ -394,6 +434,7 @@ public class AlphaFineFrame extends JFrame {
westPane.add(tabLabel);
labelContentPane.add(westPane, BorderLayout.WEST);
JPanel eastPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
// 一键已读
UILabel readLabel = new UILabel(ONE_CLICK_READ);
readLabel.setHorizontalAlignment(SwingConstants.RIGHT);
readLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));;
@ -412,18 +453,24 @@ public class AlphaFineFrame extends JFrame {
labelPane.add(labelContentPane);
labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, 30));
// tab区 flow layout
tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10));
tabPane.setBackground(Color.WHITE);
List<SelectedLabel> selectedLabelList = createSelectedLabelList();
selectedType = selectedLabelList.get(0).getCellType();
// 第一个tab 非产品动态
if (selectedType != CellType.PRODUCT_NEWS) {
tabLabel.setText(selectedLabelList.get(0).getText());
selectedTab = null;
for (SelectedLabel label : selectedLabelList) {
if (label.isSelected()) {
selectedTab = label;
break;
}
}
if (this.selectedTab.getCellType() != CellType.PRODUCT_NEWS) {
tabLabel.setText(this.selectedTab.getText());
readLabel.setVisible(false);
}
for (SelectedLabel selectedLabel : selectedLabelList) {
selectedLabel.addMouseListener(createMouseListener(selectedLabelList, selectedLabel, tabPane, tabLabel, readLabel));
tabPane.add(selectedLabel);
for (SelectedLabel label : selectedLabelList) {
label.addMouseListener(createMouseListener(selectedLabelList, label, tabPane, tabLabel, readLabel));
tabPane.add(label);
}
showPane.add(tabPane, BorderLayout.NORTH);
showPane.add(labelPane, BorderLayout.CENTER);
@ -436,19 +483,29 @@ public class AlphaFineFrame extends JFrame {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
// tab栏里的label全设置为没选中,并设置颜色为灰色
for (SelectedLabel label : selectedLabelList) {
label.setSelected(false);
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8);
}
// 选中
selectedLabel.setSelected(true);
AlphaFineFrame.this.selectedTab = selectedLabel;
// 处理产品动态 tab与下方文字展示不一致
if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) {
tabLabel.setText(PRODUCT_DYNAMICS);
tabLabel.setText(PRODUCT_NEWS);
} else {
tabLabel.setText(selectedLabel.getText());
}
// 将已读设置不可见
readLabel.setVisible(false);
// tab栏重新绘制
tabPane.repaint();
// 选中事件
switch (selectedLabel.getCellType()) {
case PRODUCT_NEWS:
readLabel.setVisible(true);
@ -470,6 +527,10 @@ public class AlphaFineFrame extends JFrame {
currentSearchWorkerManager = pluginSearchWorkerManager;
switchType(CellType.PLUGIN);
break;
case TEMPLATE_SHOP:
TemplateShopPane.getInstance().showPagePane();
switchType(CellType.TEMPLATE_SHOP);
break;
}
if (currentSearchWorkerManager != null) {
AlphaFineList alphaFineList = currentSearchWorkerManager.getSearchResultList();
@ -498,13 +559,11 @@ public class AlphaFineFrame extends JFrame {
List<SelectedLabel> selectedLabelList = new ArrayList<>();
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (alphaFineConfigManager.isProductDynamics()) {
selectedLabelList.add(new SelectedLabel(PRODUCT_NEWS, CellType.PRODUCT_NEWS, true));
selectedLabelList.add(new SelectedLabel(PRODUCT_NEWS, CellType.PRODUCT_NEWS));
}
if (alphaFineConfigManager.isContainAction()) {
selectedLabelList.add(new SelectedLabel(SETTING, CellType.ACTION));
}
if (alphaFineConfigManager.isContainFileContent() || alphaFineConfigManager.isContainTemplate()) {
selectedLabelList.add(new SelectedLabel(TEMPLATES, CellType.FILE));
// 默认选中模板商城
if (alphaFineConfigManager.hasTemplateShop()) {
selectedLabelList.add(new SelectedLabel(TEMPLATE_SHOP, CellType.TEMPLATE_SHOP, true));
}
if (alphaFineConfigManager.isContainDocument()) {
selectedLabelList.add(new SelectedLabel(HELP, CellType.DOCUMENT));
@ -512,6 +571,19 @@ public class AlphaFineFrame extends JFrame {
if (alphaFineConfigManager.isContainPlugin()) {
selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN));
}
if (alphaFineConfigManager.isContainAction()) {
selectedLabelList.add(new SelectedLabel(FUNCTION, CellType.ACTION));
}
if (alphaFineConfigManager.isContainMyTemplate()) {
selectedLabelList.add(new SelectedLabel(MY_TEMPLATES, CellType.FILE));
}
// 如果不展示模板商城,则list中第一个被选中
if (!alphaFineConfigManager.hasTemplateShop() && !selectedLabelList.isEmpty()) {
selectedLabelList.get(0).setSelected(true);
}
return selectedLabelList;
}
@ -524,7 +596,6 @@ public class AlphaFineFrame extends JFrame {
}
private void switchType(CellType cellType) {
this.selectedType = cellType;
if (StringUtils.isEmpty(searchTextField.getText())) {
cardLayout.show(resultPane, cellType.getFlagStr4None());
} else {
@ -541,8 +612,7 @@ public class AlphaFineFrame extends JFrame {
if (checkNetworkError()) {
return;
}
cardLayout.show(resultPane, cellType.getFlagStr4Result());
showResult(cellType.getFlagStr4Result());
checkSearchResult();
}
@ -550,23 +620,23 @@ public class AlphaFineFrame extends JFrame {
private boolean checkNetworkError() {
boolean networkError;
if (selectedType == CellType.PRODUCT_NEWS) {
if (selectedTab.getCellType() == CellType.PRODUCT_NEWS) {
networkError = productNewsSearchWorkerManager.isNetWorkError();
} else {
networkError = currentSearchWorkerManager.isNetWorkError();
}
cardLayout.show(resultPane, AlphaFineConstants.NETWORK_ERROR);
showResult(AlphaFineConstants.NETWORK_ERROR);
return networkError;
}
private boolean checkSearchLoading() {
boolean searchOver;
if (selectedType == CellType.PRODUCT_NEWS) {
if (selectedTab.getCellType() == CellType.PRODUCT_NEWS) {
searchOver = productNewsSearchWorkerManager.isSearchOver();
} else {
searchOver = currentSearchWorkerManager.isSearchOver();
}
cardLayout.show(resultPane, AlphaFineConstants.LOADING);
showResult(AlphaFineConstants.LOADING);
return searchOver;
}
@ -587,14 +657,14 @@ public class AlphaFineFrame extends JFrame {
searchResultList.requestFocus();
}
boolean hasSearchResult = true;
if (selectedType == CellType.PRODUCT_NEWS) {
if (selectedTab.getCellType() == CellType.PRODUCT_NEWS) {
hasSearchResult = productNewsSearchWorkerManager.hasSearchResult();
} else {
hasSearchResult = currentSearchWorkerManager.hasSearchResult();
}
if (!hasSearchResult) {
cardLayout.show(resultPane, CellType.NO_RESULT.getFlagStr4None());
showResult(CellType.NO_RESULT.getFlagStr4None());
}
}
@ -608,7 +678,6 @@ public class AlphaFineFrame extends JFrame {
searchTextField.setBorder(null);
}
private void initTextFieldListener() {
searchTextField.addKeyListener(new KeyAdapter() {
@Override
@ -659,20 +728,24 @@ public class AlphaFineFrame extends JFrame {
}
/**
* 控制搜索tip框弹出收起
* 不断地刷新tab页并防止tab页显示错误
* */
private void startSearchTextFieldTimer() {
Timer timer = new Timer(TIMER_DELAY, e -> {
// 坑 isShowing返回false 即使textField有内容 getText返回的也是空
if (searchTextField.isShowing() && StringUtils.isEmpty(searchTextField.getText())) {
SearchTooltipPopup.getInstance().hide();
clearLabel.setVisible(false);
switchType(selectedType);
switchType(selectedTab.getCellType());
TemplateShopPane.getInstance().quitSearchResultPane();
beforeSearchStr = StringUtils.EMPTY;
} else if (searchTextField.hasFocus()) {
clearLabel.setVisible(true);
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane);
}
tabPane.repaint();
});
timer.start();
}
@ -751,20 +824,6 @@ public class AlphaFineFrame extends JFrame {
}
}
public void showResult(String flag) {
cardLayout.show(resultPane, flag);
}
public void addResult(JPanel panel, String flag) {
resultPane.add(panel, flag);
}
public void removeSearchResultPane(JPanel panel) {
resultPane.remove(panel);
}
private void doSearch(String text) {
initSearchLoadingPane();
SearchTextBean searchTextBean = generateSearchTextBean(text);
@ -773,6 +832,7 @@ public class AlphaFineFrame extends JFrame {
this.fileSearchWorkerManager.doSearch(searchTextBean);
this.documentWorkerManager.doSearch(searchTextBean);
this.pluginSearchWorkerManager.doSearch(searchTextBean);
this.templateResourceSearchWorkerManager.doSearch(searchTextBean);
}
private SearchTextBean generateSearchTextBean(String searchText) {
@ -806,25 +866,15 @@ public class AlphaFineFrame extends JFrame {
this.pluginSearchWorkerManager.doSearch(searchTextBean);
}
/**
* 所有tab页搜索通用的加载panel
* */
private void initSearchLoadingPane() {
if (searchLoadingPane == null) {
searchLoadingPane = new SearchLoadingPane();
}
resultPane.add(searchLoadingPane, AlphaFineConstants.LOADING);
cardLayout.show(resultPane, AlphaFineConstants.LOADING);
}
public String getSearchText() {
return searchTextField.getText();
}
public CellType getSelectedType() {
return selectedType;
}
public void setStoreText(String storeText) {
this.storeText = storeText;
showResult(AlphaFineConstants.LOADING);
}
/**
@ -839,6 +889,9 @@ public class AlphaFineFrame extends JFrame {
return storeText;
}
public void setStoreText(String storeText) {
this.storeText = storeText;
}
/**
* 去除特殊字符空格等

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

@ -0,0 +1,69 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
public class RecommendSearchPane extends TemplateResourcePanel {
public RecommendSearchPane(TemplateResource templateResource) {
super();
this.templateResource = templateResource;
initComponent();
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createLineBorder(new Color(0xe8e8e9), 1));
this.add(northPane, BorderLayout.NORTH);
this.add(southPane, BorderLayout.SOUTH);
}
private void initComponent() {
createNorthPane();
createSouthPane();
}
private void createSouthPane() {
southPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
southPane.setBackground(Color.WHITE);
JLabel recommend = new JLabel(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Recommend_For_You"));
southPane.add(recommend);
List<String> searchKeys = templateResource.getRecommendSearchKey();
for (String key : searchKeys) {
JLabel keyLabel = new SearchKeyLabel(key);
southPane.add(keyLabel);
}
}
class SearchKeyLabel extends JLabel {
String searchKey;
SearchKeyLabel(String searchKey) {
this.searchKey = searchKey;
setText(searchKey);
setBackground(Color.WHITE);
setForeground(new Color(0x419bf9));
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
AlphaFineHelper.getAlphaFineDialog().fireSearch(searchKey);
}
});
}
}
}

74
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourceImagePanel.java

@ -0,0 +1,74 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.base.GraphHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.third.jodd.util.StringUtil;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
public class TemplateResourceImagePanel extends JPanel {
private static final int BACKGROUND_HEIGHT = 20;
private static final Color BACKGROUND_COLOR = new Color(116, 181, 249);
private static final Color COVER_COLOR = new Color(116, 181, 249, 26);
private TemplateResource templateResource;
private int width = 200;
private int height = 100;
public TemplateResourceImagePanel(TemplateResource templateResource) {
this.templateResource = templateResource;
}
public TemplateResourceImagePanel(TemplateResource templateResource, int width, int height) {
this(templateResource);
this.width = width;
this.height = height;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
Color defaultColor = g2.getColor();
Image image = templateResource.getImage();
if (image != null) {
g2.drawImage(templateResource.getImage(), 0, 0, getWidth(), getHeight(), this);
} else {
g2.setColor(COVER_COLOR);
g2.fillRect(0, 0, getWidth(), getHeight());
}
String tagName = templateResource.getType().getName();
if (!StringUtil.isEmpty(tagName)) {
g2.setColor(BACKGROUND_COLOR);
g2.fillRect(0, getHeight() - BACKGROUND_HEIGHT, getWidth(), BACKGROUND_HEIGHT);
g2.setColor(Color.WHITE);
int x = (getWidth() - GraphHelper.getWidth(tagName, g2.getFont())) / 2;
g2.drawString(tagName, x, getHeight() - 5);
}
g2.setColor(defaultColor);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(width, height);
}
}

225
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java

@ -0,0 +1,225 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 卡片布局每个卡片里塞了scrollpanel
* */
public class TemplateResourcePageGridPane extends JPanel {
private List<TemplateResource> data;
private CardLayout cardLayout;
private List<Page> pages;
private int totalPage;
List<UIScrollPane> scrollPanes = new ArrayList<>();
private static final int PAGE_MAX_SIZE = 12;
private static final int TABLE_MAX_ROW_COUNT = 4;
private static final int TABLE_COL_COUNT = 3;
private static final int TABLE_VGAP = 15;
private static final int TABLE_HGAP = 15;
private static final int RESOURCE_WIDTH = 197;
private static final int RESOURCE_HEIGHT = 128;
public TemplateResourcePageGridPane(List<TemplateResource> templateResourceList) {
this.data = templateResourceList;
totalPage = (int) Math.ceil((double)data.size() / PAGE_MAX_SIZE);
createPages();
initComponents();
this.setBackground(Color.WHITE);
this.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20));
switchPage(1);
}
private void initComponents() {
cardLayout = new CardLayout();
this.setLayout(cardLayout);
this.setBackground(Color.WHITE);
for (int i = 0; i < pages.size(); i++) {
UIScrollPane scrollPane = new UIScrollPane(pages.get(i));
scrollPanes.add(scrollPane);
this.add(scrollPane, String.valueOf(i + 1));
}
}
/**
* 构建分页将资源切分到每一页并在每一页尾部添加分页按钮
* */
private void createPages() {
int dataCnt = data.size();
List<TemplateResource>[] slice = new ArrayList[totalPage];
for (int i = 0; i < dataCnt; i++) {
int index = i / PAGE_MAX_SIZE;
if (slice[index] == null) {
slice[index] = new ArrayList<>();
}
slice[index].add(data.get(i));
}
pages = new ArrayList<>();
for (int i = 0; i < totalPage; i++) {
pages.add(new Page(slice[i], i + 1));
}
}
private void switchPage(int pageNumber) {
if (pageNumber < 1 || pageNumber > this.totalPage) {
return;
}
cardLayout.show(TemplateResourcePageGridPane.this, String.valueOf(pageNumber));
scrollPanes.get(pageNumber - 1).getVerticalScrollBar().setValue(0);
// 坑,切换页面会刷新失败,需要手动滚动一下才能刷新
scrollPanes.get(pageNumber - 1).getVerticalScrollBar().setValue(1);
scrollPanes.get(pageNumber - 1).getVerticalScrollBar().setValue(0);
}
/**
* 分页panelborderlayout布局north为信息页south为分页按钮区
* */
private class Page extends JPanel {
List<TemplateResource> pageData;
Component[][] comps;
JPanel contentPane;
JPanel pageButtonPane;
JButton prev, next;
JTextField pageNumberField;
JLabel pageCnt;
int pageNumber;
Page(List<TemplateResource> pageData, int pageNumber) {
super();
this.pageData = pageData;
this.pageNumber = pageNumber;
initComponents();
this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.NORTH);
if (totalPage > 1) {
this.add(pageButtonPane, BorderLayout.SOUTH);
}
this.setBackground(Color.WHITE);
}
private void initComponents() {
createContentPane();
createPageButtonPane();
}
void createContentPane() {
int dataCnt = pageData.size();
int rowCnt = (int) Math.ceil((double)dataCnt / 3);
double[] rowHeight = new double[rowCnt];
double[] colWidth = new double[TABLE_COL_COUNT];
Arrays.fill(rowHeight, RESOURCE_HEIGHT);
Arrays.fill(colWidth, RESOURCE_WIDTH);
comps = new Component[rowCnt][TABLE_COL_COUNT];
for (int i = 0; i < rowCnt; i++) {
for (int j = 0; j < TABLE_COL_COUNT; j++) {
int which = i * 3 + j;
if (which >= dataCnt) {
Label empty = new Label();
empty.setPreferredSize(new Dimension(RESOURCE_WIDTH, RESOURCE_HEIGHT));
empty.setVisible(false);
comps[i][j] = empty;
} else {
TemplateResourcePanel resource = TemplateResourcePanel.create(pageData.get(which));
resource.setPreferredSize(new Dimension(RESOURCE_WIDTH, RESOURCE_HEIGHT));
comps[i][j] = resource;
}
}
}
contentPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowHeight, colWidth, TABLE_HGAP, TABLE_VGAP);
contentPane.setBackground(Color.WHITE);
}
void createPageButtonPane() {
prev = new JButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/prev.svg"));
next = new JButton(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/next.svg"));
pageNumberField = new JTextField((int) Math.log10(totalPage) + 1);
pageNumberField.setText(String.valueOf(this.pageNumber));
pageCnt = new JLabel("/ " + totalPage);
pageButtonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pageButtonPane.add(prev);
pageButtonPane.add(pageNumberField);
pageButtonPane.add(pageCnt);
pageButtonPane.add(next);
addPageAction();
}
// 添加翻页按钮事件
void addPageAction() {
addPrevPageAction();
addNextPageAction();
addGotoPageAction();
}
void addPrevPageAction() {
prev.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (pageNumber > 1) {
switchPage(pageNumber - 1);
}
}
});
};
void addNextPageAction() {
next.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
if (pageNumber < totalPage) {
switchPage(pageNumber + 1);
}
}
});
}
void addGotoPageAction() {
pageNumberField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
String numb = pageNumberField.getText();
if (numb != null && !numb.equals(pageNumber)) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
switchPage(Integer.parseInt(numb));
}
}
}
});
}
}
}

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

@ -0,0 +1,97 @@
package com.fr.design.mainframe.alphafine.component;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.preview.TemplateShopPane;
import com.fr.design.utils.BrowseUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class TemplateResourcePanel extends JPanel {
protected JPanel northPane;
protected JPanel southPane;
protected TemplateResource templateResource;
protected TemplateResourcePanel() {
}
protected TemplateResourcePanel(TemplateResource templateResource) {
this.templateResource = templateResource;
initComponent();
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createLineBorder(new Color(0xe8e8e9), 1));
this.add(northPane, BorderLayout.NORTH);
this.add(southPane, BorderLayout.SOUTH);
addAction();
}
private void addAction() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
TemplateShopPane.getInstance().searchAndShowDetailPane(templateResource);
}
});
}
public static TemplateResourcePanel create(TemplateResource templateResource) {
if (TemplateResource.Type.RECOMMEND_SEARCH.equals(templateResource.getType())) {
return new RecommendSearchPane(templateResource);
} else {
return new TemplateResourcePanel(templateResource);
}
}
private void initComponent() {
createNorthPane();
createSouthPane();
}
protected void createNorthPane() {
northPane = new TemplateResourceImagePanel(templateResource);
}
private void createSouthPane() {
JLabel nameLabel = new JLabel(templateResource.getName());
nameLabel.setBackground(Color.WHITE);
nameLabel.setBorder(BorderFactory.createEmptyBorder());
JLabel demoLabel = new JLabel();
if (templateResource.hasDemoUrl()) {
demoLabel.setText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Demo"));
demoLabel.setForeground(new Color(0x419bf9));
demoLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
BrowseUtils.browser(templateResource.getDemoUrl());
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}
}
});
}
southPane = new JPanel(new BorderLayout());
southPane.setBackground(Color.WHITE);
southPane.add(nameLabel, BorderLayout.WEST);
southPane.add(demoLabel, BorderLayout.EAST);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(180, 90);
}
}

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

@ -0,0 +1,191 @@
package com.fr.design.mainframe.alphafine.model;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager;
import com.fr.general.IOUtils;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.third.jodd.util.StringUtil;
import java.awt.Image;
import java.util.ArrayList;
import java.util.List;
/**
* 模板资源数据
*/
public class TemplateResource {
/***
* 模板资源类型模板解决方案推荐搜索
*/
public enum Type {
SINGLE_TEMPLATE(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Single_Template")),
SCENARIO_SOLUTION(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Resource_Scenario_Solution")),
RECOMMEND_SEARCH;
private String name;
Type() {
}
Type(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
// 模板资源搜索接口返回值字段名
public static final String ID = "id";
public static final String UUID = "uuid";
public static final String NAME = "name";
public static final String IMAGE_URL = "pic";
public static final String DEMO_URL = "demoUrl";
public static final String PKG_SIZE = "pkgsize";
private static final String RECOMMEND_SEARCH_IMG_URL = "com/fr/design/mainframe/alphafine/images/more.png";
// 模板资源属性
private String id;
private String uuid;
private Type type;
private String imageUrl;
private Image image;
private String name;
private String demoUrl;
private int pkgSize;
private List<String> recommendSearchKey;
public static List<TemplateResource> createByJson(JSONArray jsonArray) {
List<TemplateResource> list = new ArrayList<>();
if (jsonArray != null) {
for (int i = jsonArray.length() - 1; i >= 0; i--) {
list.add(createByJson(jsonArray.getJSONObject(i)));
}
}
return list;
}
public static TemplateResource createByJson(JSONObject jsonObject) {
TemplateResource templateResource = new TemplateResource().setId(jsonObject.getString(ID)).setUuid(jsonObject.getString(UUID)).setName(jsonObject.getString(NAME))
.setDemoUrl(jsonObject.getString(DEMO_URL)).setPkgSize(jsonObject.getInt(PKG_SIZE));
int pkgSize = templateResource.getPkgSize();
if (pkgSize == 0) {
templateResource.type = Type.SINGLE_TEMPLATE;
} else {
templateResource.type = Type.SCENARIO_SOLUTION;
}
templateResource.setImageUrl(parseUrl(jsonObject));
templateResource.setImage(IOUtils.readImage(templateResource.imageUrl));
return templateResource;
}
/**
* 商城接口传过来的图片url是特殊格式需要特殊处理下
* */
static String parseUrl(JSONObject jsonObject) {
String imgUrl = jsonObject.getString(IMAGE_URL);
int index = imgUrl.indexOf(",");
if (index != -1) {
imgUrl = imgUrl.substring(0, imgUrl.indexOf(","));
}
return imgUrl;
}
public static TemplateResource getRecommendSearch() {
TemplateResource recommend = new TemplateResource();
recommend.setType(Type.RECOMMEND_SEARCH);
recommend.setImageUrl(RECOMMEND_SEARCH_IMG_URL);
recommend.setImage(IOUtils.readImage(RECOMMEND_SEARCH_IMG_URL));
recommend.setRecommendSearchKey(TemplateResourceSearchManager.getInstance().getRecommendSearchKeys());
return recommend;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public List<String> getRecommendSearchKey() {
return recommendSearchKey;
}
public void setRecommendSearchKey(List<String> recommendSearchKey) {
this.recommendSearchKey = recommendSearchKey;
}
public TemplateResource setImage(Image image) {
this.image = image;
return this;
}
public Image getImage() {
return image;
}
public TemplateResource setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
public String getName() {
return name;
}
public TemplateResource setName(String name) {
this.name = name;
return this;
}
public String getDemoUrl() {
return demoUrl;
}
public boolean hasDemoUrl() {
return !StringUtil.isEmpty(demoUrl);
}
public TemplateResource setDemoUrl(String demoUrl) {
this.demoUrl = demoUrl;
return this;
}
public int getPkgSize() {
return pkgSize;
}
public TemplateResource setPkgSize(int pkgSize) {
this.pkgSize = pkgSize;
return this;
}
public String getId() {
return id;
}
public TemplateResource setId(String id) {
this.id = id;
return this;
}
public String getUuid() {
return uuid;
}
public TemplateResource setUuid(String uuid) {
this.uuid = uuid;
return this;
}
}

192
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java

@ -0,0 +1,192 @@
package com.fr.design.mainframe.alphafine.model;
import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 模板资源详细数据
*/
public class TemplateResourceDetail {
// 与对应的模板资源关联
private final TemplateResource root;
private String info;
private String vendor;
private List<String> detailInfo;
private String[] tagsId;
private List<String> tagsName;
private double price;
private String parentPkgName;
private String resourceUrl;
public static final String ID = "id";
public static final String INFO = "description";
public static final String VENDOR = "vendor";
public static final String DETAIL_INFO = "text";
public static final String TAGS_ID = "cid";
public static final String PRICE = "price";
public static final String NAME = "name";
public static final String PARENT_NAME = "parentName";
public static final String TAGS_NAME = "tagsName";
public static final String URL = "url";
public TemplateResourceDetail(TemplateResource resource) {
this.root = resource;
}
public String getVendor() {
return vendor;
}
public void setVendor(String vendor) {
this.vendor = vendor;
}
public TemplateResource getRoot() {
return root;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public List<String> getDetailInfo() {
return detailInfo;
}
public void setDetailInfo(List<String> detailInfo) {
this.detailInfo = detailInfo;
}
public String[] getTagsId() {
return tagsId;
}
public void setTagsId(String[] tagsId) {
this.tagsId = tagsId;
}
public List<String> getTagsName() {
return tagsName;
}
public void setTagsName(List<String> tagsName) {
this.tagsName = tagsName;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getParentPkgName() {
return parentPkgName;
}
public void setParentPkgName(String parentPkgName) {
this.parentPkgName = parentPkgName;
}
public String getResourceUrl() {
return resourceUrl;
}
public void setResourceUrl(String resourceUrl) {
this.resourceUrl = resourceUrl;
}
public static TemplateResourceDetail createByTemplateResource(TemplateResource root) {
return Builder.buildByResource(root);
}
public static TemplateResourceDetail createFromEmbedResource(TemplateResource root) {
return Builder.buildFromEmbedResource(root);
}
static class Builder {
static FineMarketClientHelper helper = FineMarketClientHelper.getInstance();
static TemplateResourceDetail buildFromEmbedResource(TemplateResource templateResource) {
TemplateResourceDetail detail = new TemplateResourceDetail(templateResource);
String resourceId = templateResource.getId();
JSONArray embedResources = TemplateResourceSearchManager.getInstance().getEmbedResourceJSONArray();
for (int i = 0; i < embedResources.length(); i++) {
JSONObject resource = embedResources.getJSONObject(i);
if (resourceId.equals(resource.getString(ID))) {
detail.setInfo(resource.getString(INFO));
detail.setDetailInfo(parseDetailInfo(resource.getString(DETAIL_INFO)));
detail.setVendor(resource.getString(VENDOR));
detail.setPrice(resource.getDouble(PRICE));
detail.setResourceUrl(resource.getString(URL));
detail.setParentPkgName(resource.getString(PARENT_NAME));
detail.setTagsName(Arrays.asList(resource.getString(TAGS_NAME).split(",")));
break;
}
}
return detail;
}
static TemplateResourceDetail buildByResource(TemplateResource templateResource) {
TemplateResourceDetail detail = new TemplateResourceDetail(templateResource);
String resourceId = templateResource.getId();
// 获取模板详情页的信息一共需要三次请求
try {
// 1请求详细信息
JSONObject info = helper.getTemplateInfoById(resourceId);
detail.setInfo(info.getString(INFO));
detail.setDetailInfo(parseDetailInfo(info.getString(DETAIL_INFO)));
detail.setVendor(info.getString(VENDOR));
detail.setTagsId(info.getString(TAGS_ID).split(","));
detail.setPrice(info.getDouble(PRICE));
detail.setResourceUrl(helper.getTemplateUrlById(templateResource.getId()));
// 2请求所属模板包信息
JSONObject parentPkginfo = helper.getTemplateParentPackageByTemplateId(resourceId);
if (parentPkginfo != null) {
detail.setParentPkgName(parentPkginfo.getString(NAME));
}
// 3请求标签信息
detail.setTagsName(helper.getTemplateTagsByTemplateCids(detail.getTagsId()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return detail;
}
static final Pattern htmlPattern = Pattern.compile("<p>(.+?)</p>");
static List<String> parseDetailInfo(String htmlDetailInfo) {
List<String> infos = new ArrayList<>();
Matcher matcher = htmlPattern.matcher(htmlDetailInfo);
while (matcher.find()) {
infos.add(matcher.group());
}
return infos;
}
}
}

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

@ -0,0 +1,185 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.alphafine.action.StartUseAction;
import com.fr.design.mainframe.alphafine.component.TemplateResourceImagePanel;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
import com.fr.design.utils.BrowseUtils;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
public class TemplateResourceDetailPane extends JPanel {
private TemplateResourceDetail data;
private TemplateResourceImagePanel imagePane;
private JPanel contentPane;
private UIScrollPane infoScrollPane;
private JPanel operatePane;
private UIScrollPane detailInfoPane;
private static final int IMAGE_HEIGHT = 170;
private static final int IMAGE_WIDTH= 310;
private static final int SCROLL_PANE_WIDTH = 320;
private static final int SCROLL_PANE_HEIGHT = 150;
private static final int CONTENT_PANE_WIDTH = 320;
private static final int CONTENT_PANE_HEIGHT = 180;
private static final int DETAIL_PANE_HEIGHT = 110;
private static final int TEXT_SCROLL_PANE_HEIGHT = 500;
private static final int PANE_WIDTH = 640;
private static final String GOTO_DETAIL = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_GOTO_DETAIL");
private static final String START_USE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_START_USE");
private static final String VENDOR = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Vendor");
private static final String TAGS = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Tags");
private static final String PARENT_PACKAGE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Parent_Package");
private static final String DETAIL_INFO = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Detail_Info");
private static final String SPACE = " ";
private static final String LF = "<br>";
public TemplateResourceDetailPane(TemplateResourceDetail detail) {
this.data = detail;
initComponent();
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBorder(BorderFactory.createEmptyBorder(10,20,0,20));
this.add(imagePane);
this.add(contentPane);
this.add(detailInfoPane);
this.setBackground(Color.WHITE);
}
public void refresh() {
}
private void initComponent() {
createImagePane();
createContentPane();
createDetailInfoPane();
}
private void createContentPane() {
createInfoScrollPane();
createOperatePane();
contentPane = new JPanel();
contentPane.setLayout(new FlowLayout(FlowLayout.LEFT));
contentPane.setPreferredSize(new Dimension(CONTENT_PANE_WIDTH, CONTENT_PANE_HEIGHT));
contentPane.add(infoScrollPane);
contentPane.add(operatePane);
contentPane.setBackground(Color.WHITE);
}
private void createOperatePane() {
operatePane = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel emptyLabel = new JLabel();
emptyLabel.setPreferredSize(new Dimension(115, 25));
JLabel priceLabel = new JLabel();
if (data.getPrice() == 0) {
priceLabel.setText("免费");
} else {
priceLabel.setText("$ " + data.getPrice());
}
operatePane.add(createLinkLabel());
operatePane.add(emptyLabel);
operatePane.add(priceLabel);
operatePane.add(createStartUseButton());
operatePane.setBackground(Color.WHITE);
}
JLabel createLinkLabel() {
JLabel linkLabel = new JLabel(GOTO_DETAIL);
linkLabel.setBackground(Color.WHITE);
linkLabel.setForeground(Color.BLUE);
linkLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
String url = data.getResourceUrl();
BrowseUtils.browser(url);
}
});
return linkLabel;
}
JButton createStartUseButton() {
JButton starUseButton = new JButton(START_USE);
starUseButton.addActionListener(new StartUseAction(data));
return starUseButton;
}
private void createInfoScrollPane() {
JLabel content = new JLabel();
content.setHorizontalAlignment(SwingConstants.LEFT);
content.setVerticalAlignment(SwingConstants.TOP);
StringBuilder sb = new StringBuilder();
sb.append("<html><body><p>");
sb.append(VENDOR + data.getVendor() + LF);
List<String> tags = data.getTagsName();
sb.append(TAGS);
for (String tag : tags) {
sb.append(tag + SPACE);
}
sb.append(LF);
sb.append(PARENT_PACKAGE + data.getParentPkgName() + LF);
sb.append(data.getInfo());
sb.append("</p></body></html>");
content.setText(sb.toString());
content.setBackground(new Color(0xf9f9f9));
content.setForeground(new Color(0x5b5b5c));
content.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH - 10, TEXT_SCROLL_PANE_HEIGHT));
infoScrollPane = new UIScrollPane(content);
infoScrollPane.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH, SCROLL_PANE_HEIGHT - 25));
infoScrollPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
}
private void createImagePane() {
imagePane = new TemplateResourceImagePanel(data.getRoot(), IMAGE_WIDTH, IMAGE_HEIGHT);
}
private void createDetailInfoPane() {
JLabel content = new JLabel();
content.setHorizontalAlignment(SwingConstants.LEFT);
content.setVerticalAlignment(SwingConstants.TOP);
StringBuilder sb = new StringBuilder();
sb.append("<html><body><p>");
sb.append(DETAIL_INFO + LF);
List<String> detailInfos = data.getDetailInfo();
for (String info : detailInfos) {
sb.append(info);
}
sb.append("</p></body></html>");
content.setText(sb.toString());
content.setPreferredSize(new Dimension(PANE_WIDTH - 20, TEXT_SCROLL_PANE_HEIGHT));
content.setBackground(Color.WHITE);
detailInfoPane = new UIScrollPane(content);
detailInfoPane.setPreferredSize(new Dimension(PANE_WIDTH, DETAIL_PANE_HEIGHT));
detailInfoPane.setBackground(Color.WHITE);
detailInfoPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
}
}

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

@ -0,0 +1,120 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.component.TemplateResourcePageGridPane;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager;
import com.fr.third.apache.logging.log4j.util.Strings;
import javax.swing.*;
import java.awt.CardLayout;
import java.util.List;
import java.util.concurrent.ExecutionException;
public class TemplateShopPane extends JPanel {
private static final TemplateShopPane INSTANCE = new TemplateShopPane();
public static TemplateShopPane getInstance() {
return INSTANCE;
}
private static final String DEFAULT_PAGE_PANEL = "defaultPagePane";
private static final String PAGE_PANEL = "pagePane";
private static final String DETAIL_PANEL = "detailPane";
private static final String LOADING_PANEL = "loadingPane";
private String currentCard = Strings.EMPTY;
private CardLayout cardLayout = new CardLayout();
private JPanel defaultPagePane;
private JPanel pagePane;
private JPanel detailPane;
private JPanel loadingPane;
private TemplateShopPane() {
setLayout(cardLayout);
initComponents();
this.add(defaultPagePane, DEFAULT_PAGE_PANEL);
this.add(loadingPane, LOADING_PANEL);
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
switchCard(DEFAULT_PAGE_PANEL);
}
private void switchCard(String flag) {
cardLayout.show(this, flag);
currentCard = flag;
}
private void initComponents() {
defaultPagePane = createDefaultResourcePane();
loadingPane = createLoadingPane();
}
public void refreshPagePane(List<TemplateResource> resourceList) {
pagePane = createContentPane(resourceList);
this.add(pagePane, PAGE_PANEL);
switchCard(PAGE_PANEL);
}
public void quitSearchResultPane() {
if (currentCard.equals(PAGE_PANEL)) {
switchCard(DEFAULT_PAGE_PANEL);
}
}
public void showPagePane() {
switchCard(PAGE_PANEL);
}
// 打开二级页面,显示详细信息
public void searchAndShowDetailPane(TemplateResource resource) {
switchCard(LOADING_PANEL);
new SwingWorker<TemplateResourceDetail, Void>() {
@Override
protected TemplateResourceDetail doInBackground(){
// 搜搜
TemplateResourceDetail detail = TemplateResourceSearchManager.getInstance().getDetailSearchResult(resource);
return detail;
}
@Override
protected void done() {
TemplateResourceDetail detail = null;
try {
detail = get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
// detailpane初始化
detailPane = new TemplateResourceDetailPane(detail);
// 切换
INSTANCE.add(detailPane, DETAIL_PANEL);
switchCard(DETAIL_PANEL);
}
}.execute();
}
private JPanel createContentPane(List<TemplateResource> templateResources) {
return new TemplateResourcePageGridPane(templateResources);
}
private JPanel createDefaultResourcePane() {
return createContentPane(TemplateResourceSearchManager.getInstance().getDefaultResourceList());
}
private JPanel createLoadingPane() {
return new SearchLoadingPane();
}
}

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

@ -0,0 +1,105 @@
package com.fr.design.mainframe.alphafine.search;
import com.fr.design.mainframe.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.model.TemplateResource;
import com.fr.design.mainframe.alphafine.preview.TemplateShopPane;
import com.fr.log.FineLoggerFactory;
import javax.swing.SwingWorker;
import java.util.List;
import java.util.function.Function;
public class TemplateResourceSearchWorkerManager implements SearchManager {
private final CellType cellType;
private SwingWorker<List<TemplateResource>, Void> searchWorker;
private Function<SearchTextBean, List<TemplateResource>> searchFunction;
private AlphaFineFrame alphaFineFrame;
private volatile boolean hasSearchResult = true;
private volatile boolean searchOver = false;
private volatile boolean networkError = false;
public TemplateResourceSearchWorkerManager(CellType cellType, Function<SearchTextBean, List<TemplateResource>> searchFunction, AlphaFineFrame alphaFineFrame) {
this.cellType = cellType;
this.searchFunction = searchFunction;
this.alphaFineFrame = alphaFineFrame;
}
@Override
public void doSearch(SearchTextBean searchTextBean) {
checkSearchWork();
searchOver = false;
networkError = false;
this.searchWorker = new SwingWorker<List<TemplateResource>, Void>() {
@Override
protected List<TemplateResource> doInBackground() {
List<TemplateResource> list;
if (!AlphaFineHelper.isNetworkOk() && cellType.isNeedNetWork()) {
networkError = true;
FineLoggerFactory.getLogger().warn("alphaFine network error");
}
list = searchFunction.apply(searchTextBean);
return list;
}
@Override
protected void done() {
searchOver = true;
if (!isCancelled()) {
try {
List<TemplateResource> list = get();
hasSearchResult = !list.isEmpty();
if (networkError && !hasSearchResult) {
alphaFineFrame.showResult(AlphaFineConstants.NETWORK_ERROR);
return;
}
if (alphaFineFrame.getSelectedType() == cellType) {
if (!hasSearchResult) {
alphaFineFrame.showResult(CellType.NO_RESULT.getFlagStr4None());
return;
}
TemplateShopPane.getInstance().refreshPagePane(list);
AlphaFineHelper.getAlphaFineDialog().showResult(cellType.getFlagStr4None());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
this.searchWorker.execute();
}
@Override
public boolean hasSearchResult() {
return hasSearchResult;
}
@Override
public boolean isSearchOver() {
return searchOver;
}
private void checkSearchWork() {
if (this.searchWorker != null && !this.searchWorker.isDone()) {
this.searchWorker.cancel(true);
this.searchWorker = null;
}
}
@Override
public boolean isNetWorkError() {
return networkError;
}
}

130
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java

@ -0,0 +1,130 @@
package com.fr.design.mainframe.alphafine.search.helper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FineMarketClientHelper {
private static final FineMarketClientHelper INSTANCE = new FineMarketClientHelper();
public static FineMarketClientHelper getInstance() {
return INSTANCE;
}
public static final String FINE_MARKET_TEMPLATE_INFO = CloudCenter.getInstance().acquireUrlByKind("market.template.info", "https://market.fanruan.com/templates/");
public static final String FINE_MARKET_TEMPLATE_URL = CloudCenter.getInstance().acquireUrlByKind("market.template.url", "https://market.fanruan.com/template/");
public static final String FILE_DOWNLOAD = "file/";
public static final String TEMPLATES_PARENT_PACKAGE = "parent/";
public static final String TEMPLATES_TAGS = "filter";
public static final String NAME_SEARCH = "?searchKeyword=";
public static final String RESPONSE_STATE = "state";
public static final String RESPONSE_SUCCESS = "ok";
public static final String RESPONSE_RESULT = "result";
public static final String TAGS_KEY = "key";
public static final String TAGS_ITEMS = "items";
public static final String TAG_NAME = "name";
public static final String TAG_ID = "id";
// 缓存下所有tag标签
private Map<String, String> tags;
public String getTemplateDownLoadUrl(TemplateResource templateResource) {
String url = FINE_MARKET_TEMPLATE_INFO + FILE_DOWNLOAD;
if (templateResource != null) {
url += templateResource.getId();
}
return url;
}
public JSONObject getTemplateInfoById(String id) throws IOException {
String url = FINE_MARKET_TEMPLATE_INFO + id;
String jsonString = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(jsonString);
String responseState = (String) jsonObject.get(RESPONSE_STATE);
if (RESPONSE_SUCCESS.equals(responseState)) {
return jsonObject.getJSONObject(RESPONSE_RESULT);
} else {
return null;
}
}
public JSONArray getTemplateInfoByName(String name) throws IOException {
String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + name;
String jsonString = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(jsonString);
String responseState = (String) jsonObject.get(RESPONSE_STATE);
if (RESPONSE_SUCCESS.equals(responseState)) {
return jsonObject.getJSONArray(RESPONSE_RESULT);
}
return null;
}
public String getTemplateUrlById(String id) {
return FINE_MARKET_TEMPLATE_URL + id;
}
public JSONObject getTemplateParentPackageByTemplateId(String id) throws IOException {
String url = FINE_MARKET_TEMPLATE_INFO + TEMPLATES_PARENT_PACKAGE + id;
String jsonString = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(jsonString);
String responseState = (String) jsonObject.get(RESPONSE_STATE);
if (RESPONSE_SUCCESS.equals(responseState)) {
JSONArray jsonArray = jsonObject.getJSONArray(RESPONSE_RESULT);
if (!jsonArray.isEmpty()) {
return jsonObject.getJSONArray(RESPONSE_RESULT).getJSONObject(0);
}
}
return null;
}
public List<String> getTemplateTagsByTemplateCids(String[] cids) throws IOException {
List<String> list = new ArrayList<>();
initTags();
if (cids != null) {
for (String cid : cids) {
String tagName = tags.get(cid);
if (tagName != null) {
list.add(tagName);
}
}
}
return list;
}
private void initTags() throws IOException {
tags = new HashMap<>();
String url = FINE_MARKET_TEMPLATE_INFO + TEMPLATES_TAGS;
String jsonString = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(jsonString);
String responseState = (String) jsonObject.get(RESPONSE_STATE);
if (RESPONSE_SUCCESS.equals(responseState)) {
JSONArray resultArray = jsonObject.getJSONArray(RESPONSE_RESULT);
for (int i = 1; i < resultArray.size(); i++) {
JSONObject result = resultArray.getJSONObject(i);
String key = result.getString(TAGS_KEY);
key = key.substring(key.indexOf('@') + 1);
JSONArray items = result.getJSONArray(TAGS_ITEMS);
for (int j = 0; j < items.length(); j++) {
JSONObject item = items.getJSONObject(j);
String id = item.getString(TAG_ID);
String name = item.getString(TAG_NAME);
tags.put(key + '-' + id, name);
}
}
}
}
}

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

@ -0,0 +1,100 @@
package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.model.TemplateResourceDetail;
import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import com.fr.json.JSONArray;
import java.util.ArrayList;
import java.util.List;
public class TemplateResourceSearchManager {
private static final TemplateResourceSearchManager INSTANCE = new TemplateResourceSearchManager();
public static TemplateResourceSearchManager getInstance() {
return INSTANCE;
}
public static final String LOCAL_RESOURCE_URL = "/com/fr/design/mainframe/alphafine/template_resource/local_templates.json";
private static final FineMarketClientHelper helper = FineMarketClientHelper.getInstance();
/**
* 帆软市场暂时没有分页搜索接口先全量搜分页展示
* */
public List<TemplateResource> getSearchResult(String searchText) {
List<TemplateResource> resourceList = new ArrayList<>();
// 联网搜索
try {
JSONArray jsonArray = helper.getTemplateInfoByName(searchText);
if (jsonArray != null && !jsonArray.isEmpty()) {
resourceList.addAll(TemplateResource.createByJson(jsonArray));
}
} catch (Exception e) {
}
// 本地搜索
if (resourceList.isEmpty()) {
List<TemplateResource> localResource = getEmbedResourceList();
localResource.stream().forEach(resource->{
if (resource.getName().contains(searchText)) {
resourceList.add(resource);
}
});
}
return resourceList;
}
/**
* 返回默认资源
* */
public List<TemplateResource> getDefaultResourceList() {
List<TemplateResource> resourceList = getEmbedResourceList();
// 添加推荐搜索卡片
resourceList.add(TemplateResource.getRecommendSearch());
return resourceList;
}
/**
* 返回内置资源
* */
public List<TemplateResource> getEmbedResourceList() {
List<TemplateResource> resourceList = new ArrayList<>();
JSONArray jsonArray = getEmbedResourceJSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
resourceList.add(TemplateResource.createByJson(jsonArray.getJSONObject(i)));
}
return resourceList;
}
public JSONArray getEmbedResourceJSONArray() {
String jsonString = IOUtils.readResourceAsString(LOCAL_RESOURCE_URL);
return new JSONArray(jsonString);
}
public List<String> getRecommendSearchKeys() {
List<String> searchKey = new ArrayList<>();
String[] keys = CloudCenter.getInstance().acquireConf("alphafine.tempalte.recommend", "库存,指标,可视化").split(",");
for (String k : keys) {
searchKey.add(k);
}
return searchKey;
}
public TemplateResourceDetail getDetailSearchResult(TemplateResource resource) {
if (AlphaFineHelper.isNetworkOk()) {
return TemplateResourceDetail.createByTemplateResource(resource);
} else {
return TemplateResourceDetail.createFromEmbedResource(resource);
}
}
}

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bottom.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42701 7C3.31655 7 3.22701 7.08954 3.22701 7.2C3.22701 7.24679 3.24341 7.29209 3.27336 7.32804L7.84636 12.8156C7.91707 12.9005 8.04318 12.9119 8.12804 12.8412C8.13733 12.8335 8.1459 12.8249 8.15364 12.8156L12.7266 7.32804C12.7973 7.24318 12.7859 7.11707 12.701 7.04636C12.6651 7.0164 12.6198 7 12.573 7H9V2C9 1.44772 8.55228 1 8 1C7.44772 1 7 1.44772 7 2V7H3.42701ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14H3.5C3.22386 14 3 14.2239 3 14.5C3 14.7761 3.22386 15 3.5 15H12.5Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 672 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/bottom_disable.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" opacity=".7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42701 7C3.31655 7 3.22701 7.08954 3.22701 7.2C3.22701 7.24679 3.24341 7.29209 3.27336 7.32804L7.84636 12.8156C7.91707 12.9005 8.04318 12.9119 8.12804 12.8412C8.13733 12.8335 8.1459 12.8249 8.15364 12.8156L12.7266 7.32804C12.7973 7.24318 12.7859 7.11707 12.701 7.04636C12.6651 7.0164 12.6198 7 12.573 7H9V2C9 1.44772 8.55228 1 8 1C7.44772 1 7 1.44772 7 2V7H3.42701ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14H3.5C3.22386 14 3 14.2239 3 14.5C3 14.7761 3.22386 15 3.5 15H12.5Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 685 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/config.svg

@ -0,0 +1,3 @@
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C7.17157 1 6.5 1.67157 6.5 2.5V3.2289C6.21745 3.31765 5.9457 3.4308 5.68724 3.56589L5.1716 3.05025C4.58582 2.46447 3.63607 2.46447 3.05028 3.05025C2.4645 3.63604 2.4645 4.58579 3.05028 5.17157L3.56591 5.6872C3.43081 5.94567 3.31765 6.21743 3.2289 6.5H2.5C1.67157 6.5 1 7.17157 1 8C1 8.82843 1.67157 9.5 2.5 9.5H3.2289C3.31765 9.78256 3.43081 10.0543 3.5659 10.3128L3.05026 10.8284C2.46448 11.4142 2.46448 12.364 3.05026 12.9497C3.63605 13.5355 4.5858 13.5355 5.17159 12.9497L5.68722 12.4341C5.94569 12.5692 6.21744 12.6824 6.5 12.7711V13.5C6.5 14.3284 7.17157 15 8 15C8.82843 15 9.5 14.3284 9.5 13.5V12.7711C9.78257 12.6824 10.0543 12.5692 10.3128 12.4341L10.8285 12.9497C11.4142 13.5355 12.364 13.5355 12.9498 12.9497C13.5356 12.364 13.5356 11.4142 12.9498 10.8284L12.4341 10.3128C12.5692 10.0543 12.6824 9.78255 12.7711 9.5H13.5C14.3284 9.5 15 8.82843 15 8C15 7.17157 14.3284 6.5 13.5 6.5H12.7711C12.6824 6.21744 12.5692 5.94569 12.4341 5.68722L12.9498 5.17157C13.5355 4.58579 13.5355 3.63604 12.9498 3.05025C12.364 2.46447 11.4142 2.46447 10.8284 3.05025L10.3128 3.5659C10.0543 3.43081 9.78256 3.31765 9.5 3.2289V2.5C9.5 1.67157 8.82843 1 8 1ZM8 10C9.10457 10 10 9.10457 10 8C10 6.89543 9.10457 6 8 6C6.89543 6 6 6.89543 6 8C6 9.10457 6.89543 10 8 10Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/down.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42705 9.1124C3.31659 9.1124 3.22705 9.20195 3.22705 9.31241C3.22705 9.35919 3.24345 9.4045 3.27341 9.44044L7.8464 14.928C7.91711 15.0129 8.04322 15.0244 8.12808 14.9536C8.13737 14.9459 8.14594 14.9373 8.15369 14.928L12.7267 9.44044C12.7974 9.35559 12.7859 9.22947 12.7011 9.15876C12.6651 9.12881 12.6198 9.1124 12.573 9.1124H9.00004V2.1124C9.00004 1.56012 8.55233 1.1124 8.00004 1.1124C7.44776 1.1124 7.00004 1.56012 7.00004 2.1124V9.1124H3.42705Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 620 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/down_disable.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" opacity=".7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42705 9.1124C3.31659 9.1124 3.22705 9.20195 3.22705 9.31241C3.22705 9.35919 3.24345 9.4045 3.27341 9.44044L7.8464 14.928C7.91711 15.0129 8.04322 15.0244 8.12808 14.9536C8.13737 14.9459 8.14594 14.9373 8.15369 14.928L12.7267 9.44044C12.7974 9.35559 12.7859 9.22947 12.7011 9.15876C12.6651 9.12881 12.6198 9.1124 12.573 9.1124H9.00004V2.1124C9.00004 1.56012 8.55233 1.1124 8.00004 1.1124C7.44776 1.1124 7.00004 1.56012 7.00004 2.1124V9.1124H3.42705Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 637 B

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 MiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/local_template4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/more.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/next.svg

@ -0,0 +1,3 @@
<svg width="6" height="10" viewBox="0 0 6 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.29289 5L0.646447 8.64645C0.451184 8.84171 0.451184 9.15829 0.646447 9.35355C0.841709 9.54882 1.15829 9.54882 1.35355 9.35355L5.35355 5.35355C5.54882 5.15829 5.54882 4.84171 5.35355 4.64645L1.35355 0.646447C1.15829 0.451184 0.841709 0.451184 0.646447 0.646447C0.451184 0.841709 0.451184 1.15829 0.646447 1.35355L4.29289 5Z" fill="#C2C2C2"/>
</svg>

After

Width:  |  Height:  |  Size: 453 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/prev.svg

@ -0,0 +1,3 @@
<svg width="6" height="10" viewBox="0 0 6 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.70711 5L5.35355 8.64645C5.54882 8.84171 5.54882 9.15829 5.35355 9.35355C5.15829 9.54882 4.84171 9.54882 4.64645 9.35355L0.646447 5.35355C0.451185 5.15829 0.451185 4.84171 0.646447 4.64645L4.64645 0.646447C4.84171 0.451184 5.15829 0.451184 5.35355 0.646447C5.54882 0.841709 5.54882 1.15829 5.35355 1.35355L1.70711 5Z" fill="#C2C2C2"/>
</svg>

After

Width:  |  Height:  |  Size: 447 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/top.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42701 9C3.31655 9 3.22701 8.91046 3.22701 8.8C3.22701 8.75321 3.24341 8.70791 3.27336 8.67196L7.84636 3.18437C7.91707 3.09952 8.04318 3.08805 8.12804 3.15877C8.13733 3.16651 8.1459 3.17508 8.15364 3.18437L12.7266 8.67196C12.7973 8.75682 12.7859 8.88293 12.701 8.95364C12.6651 8.9836 12.6198 9 12.573 9H9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9H3.42701ZM12.5 1C12.7761 1 13 1.22386 13 1.5C13 1.77614 12.7761 2 12.5 2H3.5C3.22386 2 3 1.77614 3 1.5C3 1.22386 3.22386 1 3.5 1H12.5Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 668 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/top_disable.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" opacity=".7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42701 9C3.31655 9 3.22701 8.91046 3.22701 8.8C3.22701 8.75321 3.24341 8.70791 3.27336 8.67196L7.84636 3.18437C7.91707 3.09952 8.04318 3.08805 8.12804 3.15877C8.13733 3.16651 8.1459 3.17508 8.15364 3.18437L12.7266 8.67196C12.7973 8.75682 12.7859 8.88293 12.701 8.95364C12.6651 8.9836 12.6198 9 12.573 9H9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9H3.42701ZM12.5 1C12.7761 1 13 1.22386 13 1.5C13 1.77614 12.7761 2 12.5 2H3.5C3.22386 2 3 1.77614 3 1.5C3 1.22386 3.22386 1 3.5 1H12.5Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 684 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/up.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42705 7C3.31659 7 3.22705 6.91046 3.22705 6.8C3.22705 6.75321 3.24345 6.7079 3.27341 6.67196L7.8464 1.18437C7.91711 1.09952 8.04322 1.08805 8.12808 1.15876C8.13737 1.16651 8.14594 1.17508 8.15369 1.18437L12.7267 6.67196C12.7974 6.75682 12.7859 6.88293 12.7011 6.95364C12.6651 6.9836 12.6198 7 12.573 7H9.00004V14C9.00004 14.5523 8.55233 15 8.00004 15C7.44776 15 7.00004 14.5523 7.00004 14V7H3.42705Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 573 B

3
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/up_disable.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" opacity=".7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.42705 7C3.31659 7 3.22705 6.91046 3.22705 6.8C3.22705 6.75321 3.24345 6.7079 3.27341 6.67196L7.8464 1.18437C7.91711 1.09952 8.04322 1.08805 8.12808 1.15876C8.13737 1.16651 8.14594 1.17508 8.15369 1.18437L12.7267 6.67196C12.7974 6.75682 12.7859 6.88293 12.7011 6.95364C12.6651 6.9836 12.6198 7 12.573 7H9.00004V14C9.00004 14.5523 8.55233 15 8.00004 15C7.44776 15 7.00004 14.5523 7.00004 14V7H3.42705Z" fill="#333334"/>
</svg>

After

Width:  |  Height:  |  Size: 589 B

106
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/template_resource/local_templates.json

@ -0,0 +1,106 @@
[
{
"id": 20000736,
"name": "库存变动分析看板",
"uuid": "eee73cbe-441f-48a3-8b08-f27445a922df",
"cid": "terminal-1,industry-3,purpose-3",
"description": "通过存货变动看板,财务分析人员或者管理会计可以根据指标的趋势、数据对比等进行分析。",
"vendor": "Victoria.",
"pic": "com\\fr\\design\\mainframe\\alphafine\\images\\local_template1.png",
"fileLoca": "库存变动分析看板.frm",
"uploadTime": "2022-05-07T09:11:54.000Z",
"tag": null,
"sellerId": 202,
"style": "2",
"price": 0,
"downloadTimes": 3931,
"updateTime": "2022-05-07T09:11:54.000Z",
"designVersion": "10.0",
"involvePlugins": "none",
"pkgsize": 0,
"link": "template",
"score": 16.519018,
"url": "https://market.fanruan.com/template/20000736",
"text": "<ol style=\\\"list-style-type: decimal;\\\" class=\\\" list-paddingleft-2\\\"><li><p>该模板需用10.0及以上版本设计器预览<br/></p></li><li><p>该模板为库存场景解决方案的部分内容,全部内容可下载<a href=\\\"https://market.fanruan.com/template/20000733\\\" target=\\\"_self\\\">库存场景解决方案</a>查看</p></li><li><p>为保障模板预览效果,建议安装<a href=\\\"https://help.fanruan.com/finereport10.0/doc-view-3665.html\\\" target=\\\"_self\\\">新自适应插件</a>(FR11.0版本插件已内置,无需手动安装),有使用需求或疑问,请联系帆软技术支持咨询<br/></p></li></ol>",
"parentName": "库存场景解决方案",
"tagsName": "制造加工,采购"
},
{
"id": 20000578,
"name": "采购综合分析",
"uuid": "6dff455a-3a78-461e-8534-0a092fdf60ef",
"cid": "terminal-1,industry-3,purpose-3",
"description": "综合分析看板中,主要从采购全流程销量监控、重点模块独立分析的角度进行数据分析。决策者可以直接根据看板中的数据进行采购全流程的全面把控、定位责任模块,释放管理压力。",
"vendor": "Victoria.",
"pic": "com\\fr\\design\\mainframe\\alphafine\\images\\local_template2.png",
"fileLoca": "采购综合分析.frm",
"uploadTime": "2022-05-07T09:15:07.000Z",
"tag": null,
"sellerId": 202,
"style": "1",
"price": 0,
"downloadTimes": 2715,
"updateTime": "2022-05-07T09:15:07.000Z",
"designVersion": "10.0",
"involvePlugins": "none",
"pkgsize": 0,
"link": "template",
"score": 16.519018,
"url": "https://market.fanruan.com/template/20000578",
"text": "<ol style=\\\"list-style-type: decimal;\\\" class=\\\" list-paddingleft-2\\\"><li><p>看板包括采购流程中的主要节点、预算分析、降本分析、物料消耗情况等。</p></li><li><p>为保障模板预览效果,建议安装<a href=\\\"https://help.fanruan.com/finereport10.0/doc-view-3665.html\\\" target=\\\"_self\\\">新自适应插件</a>(FR11.0版本插件已内置,无需手动安装),有使用需求或疑问,请联系帆软技术支持咨询<br/></p></li></ol>",
"parentName": "采购场景解决方案",
"tagsName": "制造加工,采购"
},
{
"id": 20000780,
"name": "仓储物流综合管理平台",
"uuid": "d94fcc7e61b44af4bde68a7aa769df3e",
"cid": "template_type-2,terminal-1,industry-4,purpose-5,purpose-6,purpose-4",
"description": "仓储物流综合管理平台包含园区内的车流、人流、物流监控,仓库内景工作状态监控,码头集装箱监控三大场景。实现仓储物流全方位动态管理。",
"vendor": "finereport",
"pic": "com\\fr\\design\\mainframe\\alphafine\\images\\local_template3.png",
"fileLoca": "仓储物流综合管理.zip",
"uploadTime": "2022-06-29T06:07:16.000Z",
"tag": null,
"sellerId": 1,
"style": "简约清新",
"price": 0,
"downloadTimes": 149,
"updateTime": "2022-06-29T06:07:16.000Z",
"designVersion": "10.0",
"involvePlugins": "1162",
"pkgsize": 0,
"link": "template",
"score": 18.520216,
"url": "https://market.fanruan.com/template/20000780",
"text": "<p>1.本大屏场景要求使用FR11.0正式发布版本,且必须将“fvs大屏编辑模式”插件更新到1.4版本,设置方法请查看帮助文档:<a href=\\\"https://help.fanruan.com/finereport/doc-view-4188.html?source=0&from=demoshop\\\"target=\\\"_blank\\\">FVS插件安装及配置要求</a></p>\\n<p>2.压缩包内包含仓储物流综合管理模板以及三个钻取页面的文件。需要把两个弹窗内容文件和主文件一起放在报表目录文件夹下,设置对应的预览链接。弹窗和网页链接的设置方法参考:<a href=\\\"https://help.fanruan.com/finereport/doc-view-4400.html?source=0&from=demoshop\\\"target=\\\"_blank\\\">FVS点击跳出弹出框</a> 、<a href=\\\"https://help.fanruan.com/finereport/doc-view-4399.html?source=0&from=demoshop\\\"target=\\\"_blank\\\">FVS点击跳转网页链接</a></p>\\n<p>3.仓储物流综合管理模板使用了自定义模型组件,并设置了模型动画。详情请查看文档:<a href=\\\"https://help.fanruan.com/finereport/doc-view-4496.html?source=0&from=demoshop\\\"target=\\\"_blank\\\">FVS自定义模型组件</a></p>",
"parentName": "",
"tagsName": "交通运输,库存,物流生产"
},
{
"id": 20000779,
"name": "考勤异常提醒",
"uuid": "b0c0bc3ba3f744a6b2299c69d4d55f31",
"cid": "template_type-3,terminal-2,industry-7,purpose-8",
"description": "考勤异常提醒场景通过 FineReport 移动端微信集成和移动端推送,实现每月考勤周期末将考勤异常数据推送给企业员工。\n员工可以在手机上打开异常报表预览,及时处理异常数据,降低企业HR部门的沟通成本。\n其中异常报表包括员工当月出勤汇总情况和异常记录情况。\n详细说明见文档:考勤异常提醒-https://help.fanruan.com/dvg/doc-view-212.html?source=0&from=shopdemo\n",
"vendor": "finereport",
"pic": "com\\fr\\design\\mainframe\\alphafine\\images\\local_template4.png",
"fileLoca": "考勤异常提醒.rar",
"uploadTime": "2022-06-27T02:55:34.000Z",
"tag": null,
"sellerId": 1,
"style": "简约清新",
"price": 0,
"downloadTimes": 46,
"updateTime": "2022-06-27T02:55:34.000Z",
"designVersion": "10.0",
"involvePlugins": null,
"pkgsize": 0,
"link": "template",
"score": 18.520168,
"url": "https://market.fanruan.com/template/20000779",
"text": "<p>一、附件内容说明</p>\\n<p>1)04考勤异常提醒.frm:模板,数据为「数据库查询」数据集,可使用 2) 的语句将数据导入自己的数据库后,连接数据查看。</p>\\n<p>2)Hr_考勤早晚卡记录.sql:Hr_考勤早晚卡记录表的 DDL 语句,可以直接在自己的数据库中还原Hr_考勤早晚卡记录表。</p>\\n<p>3)内置数据集模板:内置数据的模板,不替换数据的情况可查看样式,涉及数据变化,如参数查询等功能不支持</p>\\n<p>4)素材:模板中用到的素材</p>\\n<p>二、使用说明</p>\\n<p>1)下载后先在个人数据库表中准备数据,打开模板后替换数据连接即可查看,不想替换可使用内置数据集的模板。</p>\\n<p>2)注意附件只提供模板,推送效果需要将自己的工程与微信集成,在工程上设置定时调度后使用,相关内容可查看文档。</p>\",\"description\":\"<p>考勤异常提醒场景通过 FineReport 移动端微信集成和移动端推送,实现每月考勤周期末将考勤异常数据推送给企业员工。\\n员工可以在手机上打开异常报表预览,及时处理异常数据,降低企业HR部门的沟通成本。</p>\\n<p>其中异常报表包括员工当月出勤汇总情况和异常记录情况。</p>\\n<p>详细说明见文档:考勤异常提醒-https://help.fanruan.com/dvg/doc-view-212.html?source=0&from=shopdemo</p>",
"parentName": "",
"tagsName": "批发零售,人力资源"
}
]
Loading…
Cancel
Save