Browse Source

REPORT-75093 运营产品化二期

修改pr
security/10.0
Link.Zhao 2 years ago
parent
commit
3ce2932eb9
  1. 3
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  3. 10
      designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java
  4. 40
      designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java
  5. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java
  6. 15
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  7. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsList.java
  8. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchPane.java
  9. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourceImagePanel.java
  10. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePageGridPane.java
  11. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/TemplateResourcePanel.java
  12. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketConstants.java
  13. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java
  14. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResource.java
  15. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java
  16. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateResourceDetailPane.java
  17. 29
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/TemplateShopPane.java
  18. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/TemplateResourceSearchWorkerManager.java
  19. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java
  20. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/TemplateResourceSearchManager.java
  21. 3
      designer-realize/src/main/java/com/fr/market/key/FineMarketDefaultKeyProperties.java
  22. 3
      designer-realize/src/main/java/com/fr/market/key/FineMarketPublicKeyConstants.java

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

@ -461,6 +461,9 @@ public class AlphaFineConfigManager implements XMLable {
return productDynamics && FRContext.isChineseEnv();
}
/**
* 有无模板商城
* */
public boolean hasTemplateShop() {
return showTemplateShop && FRContext.isChineseEnv();
}

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

@ -74,7 +74,9 @@ public class AlphaFineConfigPane extends BasicPane {
return components;
}
// 搜索范围
/**
* 搜索范围
* */
private void createSearchConfigPane(JPanel contentPane) {
double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT};
double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH};
@ -120,7 +122,9 @@ public class AlphaFineConfigPane extends BasicPane {
|| containPluginCheckbox.isSelected() || containActionCheckbox.isSelected() || containMyTemplateCheckbox.isSelected();
}
// 搜索范围-我的模板
/**
* 搜索范围-我的模板
*/
private void initMyTemplateSearchPane() {
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5));
containMyTemplateCheckbox.setBorder(BorderFactory.createEmptyBorder());

10
designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java

@ -19,7 +19,12 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* toast弹窗
*
* alphafine - 下载模板时的toast弹窗
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class SimpleToast extends UIDialog {
private static final int MIN_HEIGHT = 36;
@ -94,6 +99,9 @@ public class SimpleToast extends UIDialog {
}
/**
* 显示toast
* */
public void display(JPanel outerPanel) {
show = true;
outerPanel.setLocation(0, -hideHeight);

40
designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java

@ -8,25 +8,39 @@ import java.awt.Color;
import java.awt.Font;
/**
*
* 链接字符串工具类
*
* @author Harrison
* @version 10.0
* created by Harrison on 2022/05/24
**/
public class LinkStrUtils {
public static final UILabel LABEL = new UILabel();
/**
* 创建链接label
* */
public static UILabel generateLabel(String html, JComponent templateLabel) {
String style = generateStyle(templateLabel.getBackground(), templateLabel.getFont(), templateLabel.getForeground());
String fullHtml = generateHtmlTag(style, html);
return new UILabel(fullHtml);
}
/**
* 创建链接字符串html格式
* */
public static String generateHtmlTag(String html) {
String defaultStyle = generateDefaultStyle();
return generateHtmlTag(defaultStyle, html);
}
/**
* 创建链接字符串html格式
* */
public static String generateHtmlTag(String style, String html) {
if (StringUtils.isEmpty(style)) {
@ -37,16 +51,25 @@ public class LinkStrUtils {
}
return "<html><body style=\"" + style + "\">" + html + "</body></html>";
}
/**
* 创建链接字符串html格式
* */
public static String generateLinkTag(String link, String text) {
return "<a href=\"" + link + "\">" + text + "</a>";
}
/**
* 创建链接字符串无下划线html格式
* */
public static String generateLinkTagWithoutUnderLine(String link, String text) {
return "<a style=\"text-decoration:none;\" href=\"" + link + "\">" + text + "</a>";
}
/**
* 创建链接字符串的html style
* */
public static String generateStyle(Color backgroundColor, Font font, Color fontColor) {
// 构建相同风格样式
@ -60,6 +83,9 @@ public class LinkStrUtils {
return style.toString();
}
/**
* 创建链接字符串的html style
* */
public static String generateStyle(Font font, Color fontColor) {
// 构建相同风格样式
@ -72,7 +98,9 @@ public class LinkStrUtils {
}
/**
* 创建默认style
* */
public static String generateDefaultStyle() {
return generateStyle(LABEL.getBackground(), LABEL.getFont(), LABEL.getForeground());

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

@ -18,10 +18,13 @@ import java.io.IOException;
/**
* alphaFine - 模板资源 - 二级界面 - 开始使用按钮的绑定事件
*
* 点击后跳转至帆软市场下载对应模板资源
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/22
*
* TODO:可以参考mini组件商城的下载@ComponentsPackageInstallation#install
* */
public class StartUseAction implements ActionListener {

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

@ -196,14 +196,23 @@ public class AlphaFineFrame extends JFrame {
initSearchManager();
}
/**
* 显示指定结果面板
* */
public void showResult(String flag) {
cardLayout.show(resultPane, flag);
}
/**
* add结果面板
* */
public void addResult(JPanel panel, String flag) {
resultPane.add(panel, flag);
}
/**
* 移除指定结果面板
* */
public void removeSearchResultPane(JPanel panel) {
resultPane.remove(panel);
}
@ -560,7 +569,9 @@ public class AlphaFineFrame extends JFrame {
}
// 方便记埋点
/**
* 方便记埋点
* */
private void switchTab(CellType cellType, UILabel readLabel) {
switch (cellType) {
case PRODUCT_NEWS:
@ -587,6 +598,8 @@ public class AlphaFineFrame extends JFrame {
TemplateShopPane.getInstance().showResult();
switchType(CellType.TEMPLATE_SHOP);
break;
default:
break;
}
}

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

@ -66,7 +66,9 @@ public class ProductNewsList extends JList<ProductNews> {
AlphaFineHelper.getAlphaFineDialog().repaint();
}
// 方便埋点
/**
* 方便埋点
* */
private void openNewsInBrowser(String url) {
BrowseUtils.browser(url);
}

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

@ -14,6 +14,14 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
/**
*
* alphafine - 推荐搜索面板
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class RecommendSearchPane extends TemplateResourcePanel {
private static final Color BORDER_WHITE = new Color(0xe8e8e9);

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

@ -17,6 +17,14 @@ import java.awt.Image;
import java.awt.RenderingHints;
/**
*
* alphafine - 模板资源图片面板
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourceImagePanel extends JPanel {
private static final int BACKGROUND_HEIGHT = 20;

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

@ -26,7 +26,12 @@ import java.util.Arrays;
import java.util.List;
/**
* 卡片布局每个卡片里塞了scrollpanel
*
* alphafine - 模板资源最外层面板, 卡片布局每个卡片里塞了scrollpanel
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourcePageGridPane extends JPanel {

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

@ -17,7 +17,14 @@ import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
*
* alphafine - 模板资源面板
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourcePanel extends JPanel {
private JPanel northPane;
@ -53,6 +60,9 @@ public class TemplateResourcePanel extends JPanel {
});
}
/**
* 通过数据构造面板
* */
public static TemplateResourcePanel create(TemplateResource templateResource) {
if (TemplateResource.Type.RECOMMEND_SEARCH.equals(templateResource.getType())) {
return new RecommendSearchPane(templateResource);

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

@ -1,5 +1,14 @@
package com.fr.design.mainframe.alphafine.download;
/**
*
* alphafine - 帆软市场常量
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class FineMarketConstants {
public static final String REPORTLETS = "/reportlets";

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

@ -26,6 +26,10 @@ import java.util.HashMap;
* 在这里统一管理帆软市场的下载
* 下载的流程控制尽量都在这个类内部完成
* 通过Process类来实现下载流程控制
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class FineMarketDownloadManager {
@ -119,11 +123,17 @@ public class FineMarketDownloadManager {
});
}
/**
* 下载失败
* */
public void downloadFailed() {
downloadingToast.setVisible(false);
showFailedToast();
}
/**
* 下载成功
* */
public void downloadSuccess() {
downloadingToast.setVisible(false);
}

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

@ -15,16 +15,24 @@ import java.util.List;
/**
* 模板资源数据
*/
*
* alphafine - 模板资源数据
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
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;
@ -65,6 +73,9 @@ public class TemplateResource {
private List<String> recommendSearchKey;
private boolean embed;
/**
* json转obj
* */
public static List<TemplateResource> createByJson(JSONArray jsonArray) {
List<TemplateResource> list = new ArrayList<>();
if (jsonArray != null) {
@ -75,7 +86,9 @@ public class TemplateResource {
return list;
}
/**
* json转obj
* */
public static TemplateResource createByJson(JSONObject jsonObject) {
TemplateResource templateResource = new TemplateResource().setId(jsonObject.getString(ID)).setUuid(jsonObject.getString(UUID)).setName(jsonObject.getString(NAME))
@ -184,6 +197,9 @@ public class TemplateResource {
return demoUrl;
}
/**
* 有无在线演示
* */
public boolean hasDemoUrl() {
return !StringUtil.isEmpty(demoUrl);
}

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

@ -14,9 +14,15 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 模板资源详细数据
*/
*
* alphafine - 模板资源详细数据
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourceDetail {
// 与对应的模板资源关联
@ -149,10 +155,16 @@ public class TemplateResourceDetail {
this.parentPkgUrl = parentPkgUrl;
}
/**
* 通过模板资源数据构建详细数据
* */
public static TemplateResourceDetail createByTemplateResource(TemplateResource root) {
return Builder.buildByResource(root);
}
/**
* 通过内置模板资源数据构建详细数据
* */
public static TemplateResourceDetail createFromEmbedResource(TemplateResource root) {
return Builder.buildFromEmbedResource(root);
}
@ -225,10 +237,10 @@ public class TemplateResourceDetail {
* <p>为保障模板预览效果建议安装<a href="https://help.fanruan.com/finereport10.0/doc-view-3665.html" target="_self">新自适应插件</a>FR11.0版本插件已内置无需手动安装有使用需求或疑问请联系帆软技术支持咨询<br/></p>
* ]
* */
static final Pattern htmlPattern = Pattern.compile("<p>(.+?)</p>");
static final Pattern HTML_PATTERN = Pattern.compile("<p>(.+?)</p>");
static List<String> parseDetailInfo(String htmlDetailInfo) {
List<String> infos = new ArrayList<>();
Matcher matcher = htmlPattern.matcher(htmlDetailInfo);
Matcher matcher = HTML_PATTERN.matcher(htmlDetailInfo);
while (matcher.find()) {
infos.add(matcher.group());
}

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

@ -28,6 +28,14 @@ import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
*
* alphafine - 模板资源详情页
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourceDetailPane extends JPanel {

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

@ -19,6 +19,15 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
/**
*
* alphafine - 模板商城面板
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateShopPane extends JPanel {
private static final TemplateShopPane INSTANCE = new TemplateShopPane();
@ -61,18 +70,27 @@ public class TemplateShopPane extends JPanel {
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)) {
if (StringUtils.equals(currentCard,PAGE_PANEL)) {
switchCard(DEFAULT_PAGE_PANEL);
}
}
/**
* 显示结果
* */
public void showResult() {
if (Strings.isEmpty(AlphaFineHelper.getAlphaFineDialog().getSearchText())) {
switchCard(DEFAULT_PAGE_PANEL);
@ -81,7 +99,10 @@ public class TemplateShopPane extends JPanel {
}
}
// 打开二级页面,显示详细信息
/**
* 打开二级页面显示详细信息
* */
public void searchAndShowDetailPane(TemplateResource resource) {
changeLabel(resource.getName());
@ -154,7 +175,9 @@ public class TemplateShopPane extends JPanel {
});
}
// 方便埋点,勿删
/**
* 方便埋点勿删
* */
public String getCurrentCard() {
return currentCard;
}

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

@ -12,6 +12,14 @@ import javax.swing.SwingWorker;
import java.util.List;
import java.util.function.Function;
/**
*
* alphafine - 模板资源搜索管理
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourceSearchWorkerManager implements SearchManager {
private final CellType cellType;

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

@ -39,6 +39,14 @@ import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* alphafine - 帆软市场助手
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class FineMarketClientHelper {
private static final FineMarketClientHelper INSTANCE = new FineMarketClientHelper();
public static FineMarketClientHelper getInstance() {
@ -89,6 +97,9 @@ public class FineMarketClientHelper {
}
/**
* 下载
* */
public String download(TemplateResource resource, File destDir, com.fr.design.extra.Process<Double> process) throws Exception {
String resourceId = resource.getId();

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

@ -12,6 +12,15 @@ import com.fr.json.JSONArray;
import java.util.ArrayList;
import java.util.List;
/**
*
* alphafine - 模板资源搜索助手
*
* @author Link
* @version 10.0
* Created by Link on 2022/9/22
* */
public class TemplateResourceSearchManager {
private static final TemplateResourceSearchManager INSTANCE = new TemplateResourceSearchManager();

3
designer-realize/src/main/java/com/fr/market/key/FineMarketDefaultKeyProperties.java

@ -12,6 +12,9 @@ import java.util.Map;
import java.util.Properties;
/**
*
* 帆软市场公钥Properties
*
* @author Link
* @version 11.0
* Created by Yvan on 2022/8/25

3
designer-realize/src/main/java/com/fr/market/key/FineMarketPublicKeyConstants.java

@ -2,6 +2,9 @@ package com.fr.market.key;
/**
*
* 帆软市场公钥常量
*
* @author Link
* @version 11.0
* Created by Link on 2022/8/25

Loading…
Cancel
Save