Browse Source

Pull request #10192: REPORT-81231【运营产品化二期】alphafine不选择任何TAB,点击alphafine,日志中出现报错;REPORT-81241【运营产品化二期】插件中心断网后的重新加载无反应; REPORT-80752【运营产品化二期】动态无法显示出来,若插件中心在首个也无法显示; REPORT-81211【运营产品化二期】插件模块查询的推荐与视觉图UI不一致

Merge in DESIGN/design from ~LINK.ZHAO/design:feature/x to feature/x

* commit '1c781a2c9be59d2b5a8829d9cb8afd2bf2d3a30e':
  REPORT-81231【运营产品化二期】alphafine不选择任何TAB,点击alphafine,日志中出现报错 REPORT-81241【运营产品化二期】插件中心断网后的重新加载无反应 REPORT-80752【运营产品化二期】动态无法显示出来,若插件中心在首个也无法显示 REPORT-81211【运营产品化二期】插件模块查询的推荐与视觉图UI不一致 1、修改pr
  REPORT-81231【运营产品化二期】alphafine不选择任何TAB,点击alphafine,日志中出现报错 REPORT-81241【运营产品化二期】插件中心断网后的重新加载无反应 REPORT-80752【运营产品化二期】动态无法显示出来,若插件中心在首个也无法显示 REPORT-81211【运营产品化二期】插件模块查询的推荐与视觉图UI不一致 1、屏蔽报错 2、没有设置reload方法 3、改下ui
feature/x
Link.Zhao-赵展 2 years ago
parent
commit
8c80c6c78c
  1. 8
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 10
      designer-base/src/main/java/com/fr/design/remote/button/IconButton.java
  3. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  4. 1
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  5. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/RecommendSearchLabel.java
  6. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/SearchHintPane.java
  7. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/download/FineMarketDownloadManager.java
  8. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultContentPane.java
  9. 58
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/DefaultPluginContentPane.java
  10. 3
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java

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

@ -484,6 +484,14 @@ public class AlphaFineConfigManager implements XMLable {
this.showTemplateShop = showTemplateShop;
}
/**
* 是否展示alphafine窗口设置-搜索范围 0勾选则不显示
*/
public boolean needShowAlphaFineDialog() {
return hasTemplateShop() || isContainDocument() || isContainPlugin() ||
isContainAction() || isProductDynamics() || isContainMyTemplate();
}
/**
* 返回tab显示顺序
*/

10
designer-base/src/main/java/com/fr/design/remote/button/IconButton.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -15,14 +16,19 @@ import java.awt.Graphics2D;
import java.awt.Point;
public final class IconButton extends JButton {
public IconButton() {
public IconButton(Icon icon) {
super(StringUtils.EMPTY);
setContentAreaFilled(false);
setFocusPainted(false);
setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_tab_close_normal.png"));
setIcon(icon);
setBorder(null);
}
public IconButton() {
this(BaseUtils.readIcon("com/fr/design/remote/images/icon_tab_close_normal.png"));
}
@Override
protected void paintBorder(Graphics g) {
}

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

@ -58,7 +58,7 @@ public class AlphaFineHelper {
* 弹出alphafine搜索面板
*/
public static void showAlphaFineDialog(boolean forceOpen) {
if (!AlphaFineConfigManager.isALPHALicAvailable()) {
if (!AlphaFineConfigManager.isALPHALicAvailable() || !AlphaFineConfigManager.getInstance().needShowAlphaFineDialog()) {
return;
}
if (alphaFineDialog == null) {

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

@ -920,6 +920,7 @@ public class AlphaFineFrame extends JFrame {
this.productNewsSearchWorkerManager.doSearch(searchTextBean);
this.documentWorkerManager.doSearch(searchTextBean);
this.pluginSearchWorkerManager.doSearch(searchTextBean);
this.templateResourceSearchWorkerManager.doSearch(searchTextBean);
}
/**

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

@ -23,7 +23,7 @@ public class RecommendSearchLabel extends JPanel {
private static final Color RECOMMEND_SEARCH_KEY_BLUE = new Color(0x419bf9);
public RecommendSearchLabel(String title, @NotNull List<String> tips) {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setLayout(new FlowLayout(FlowLayout.CENTER));
this.setBackground(Color.WHITE);
JLabel recommend = new JLabel(title);
this.add(recommend);

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

@ -31,8 +31,9 @@ public class SearchHintPane extends JPanel {
private static final String TITLE = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Search_Title");
private static final String RECOMMEND = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend_Search");
private static final Icon ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/search_hint.svg");
private static final int HEIGHT = 305;
private static final int HEIGHT = 200;
private static final int WIDTH = 300;
private static final int TITLE_LABEL_HEIGHT = 30;
private static final int TITLE_FONT_SIZE = 14;
public SearchHintPane() {
@ -45,6 +46,7 @@ public class SearchHintPane extends JPanel {
public SearchHintPane(List<String> hints, Icon icon, String title) {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(40,0,0,0));
setBackground(Color.white);
setPreferredSize(new Dimension(WIDTH, HEIGHT));
setAlignmentY(SwingConstants.CENTER);
@ -64,6 +66,7 @@ public class SearchHintPane extends JPanel {
description.setFont(DesignUtils.getDefaultGUIFont().applySize(TITLE_FONT_SIZE));
description.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
description.setHorizontalAlignment(SwingConstants.CENTER);
description.setPreferredSize(new Dimension(WIDTH, TITLE_LABEL_HEIGHT));
return description;
}

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

@ -2,7 +2,6 @@ package com.fr.design.mainframe.alphafine.download;
import com.fr.base.svg.IconUtils;
import com.fr.common.util.Strings;
import com.fr.decision.webservice.v10.log.download.utils.LogZipUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.Process;
import com.fr.design.i18n.Toolkit;
@ -12,9 +11,9 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.model.TemplateResource;
import com.fr.design.mainframe.alphafine.search.helper.FineMarketClientHelper;
import com.fr.design.mainframe.toast.SimpleToast;
import com.fr.file.FileCommonUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.pinyin.ChineseHelper;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileSystemView;
@ -82,11 +81,8 @@ public class FineMarketDownloadManager {
if (fileName.endsWith(FineMarketConstants.ZIP)) {
File file = new File(fileName);
File parentDir = file.getParentFile();
if (ChineseHelper.containChinese(fileName)) {
IOUtils.unzip(file, parentDir.getAbsolutePath(), LogZipUtils.GBK);
} else {
IOUtils.unzip(file, parentDir.getAbsolutePath());
}
// TODO:之前用的gbk解码太容易乱码了。这里应该自动识别编码,然后解压,但是要添加1个三方包,可能会赶不上发布。所以先暂时用utf8顶着。
IOUtils.unzip(file, FileCommonUtils.getAbsolutePath(parentDir), "UTF-8");
}
}

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

@ -35,6 +35,14 @@ public class DefaultContentPane extends JPanel {
this.searchWorkerManager.showDefault(this);
}
/**
* 显示搜索结果
*/
public void showResult(JPanel result) {
add(result);
repaint();
}
public DefaultContentPane() {
}

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

@ -10,8 +10,9 @@ import com.fr.design.mainframe.alphafine.search.manager.SearchProviderRegistry;
import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.List;
@ -25,18 +26,46 @@ import java.util.List;
public class DefaultPluginContentPane extends DefaultContentPane {
private static final String[] HINTS = CloudCenter.getInstance().acquireConf("alphafine.plugin.recommend", "JS,API,JSON").split(",");
// 左边展示内容,右边展示搜索提示
private static final String LOADING_PANE = "loading";
private static final String NETWORK_ERROR = "networkError";
private static final String RESULT_PANE = "result";
private SearchWorkerManager searchWorkerManager;
private CellType cellType;
private AlphaFineFrame parentWindow;
private CardLayout cardLayout;
private SearchLoadingPane searchLoadingPane;
private NetWorkFailedPane netWorkFailedPane;
private SwingWorker<Boolean, Void> worker;
public DefaultPluginContentPane(CellType cellType, AlphaFineFrame parentWindow) {
super();
this.setLayout(new BorderLayout());
this.cellType = cellType;
this.parentWindow = parentWindow;
this.cardLayout = new CardLayout();
this.setLayout(cardLayout);
this.setPreferredSize(AlphaFineConstants.PREVIEW_SIZE);
new SwingWorker<Boolean, Void>() {
initPanel();
add(searchLoadingPane, LOADING_PANE);
add(netWorkFailedPane, NETWORK_ERROR);
worker = createWorker();
worker.execute();
}
private void initPanel() {
this.searchLoadingPane = new SearchLoadingPane();
this.netWorkFailedPane = new NetWorkFailedPane(()-> reload());
}
private void switchPane(String tag) {
cardLayout.show(this, tag);
}
private SwingWorker<Boolean, Void> createWorker() {
return new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
add(new SearchLoadingPane());
switchPane(LOADING_PANE);
return AlphaFineHelper.isNetworkOk();
}
@ -45,9 +74,8 @@ public class DefaultPluginContentPane extends DefaultContentPane {
super.done();
try {
boolean networkOk = get();
removeAll();
if (!networkOk) {
add(new NetWorkFailedPane());
switchPane(NETWORK_ERROR);
} else {
List<String> searchKeys = new ArrayList<>();
for (String s : HINTS) {
@ -64,10 +92,22 @@ public class DefaultPluginContentPane extends DefaultContentPane {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
}
}.execute();
};
}
@Override
public void showResult(JPanel result) {
add(result, RESULT_PANE);
switchPane(RESULT_PANE);
}
/**
* 网络异常时重新加载
*/
public void reload() {
worker = createWorker();
worker.execute();
}
public CellType getCellType() {

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

@ -135,8 +135,7 @@ public class SearchWorkerManager implements SearchManager {
searchResultPane.getSearchResultList().setModel(searchListModel);
searchResultPane.getSearchResultList().setSelectedIndex(0);
searchResultPane.getSearchResultList().requestFocus();
defaultContentPane.add(searchResultPane);
SwingUtilities.invokeLater(()->defaultContentPane.repaint());
SwingUtilities.invokeLater(()->defaultContentPane.showResult(searchResultPane));
}
@Override

Loading…
Cancel
Save