Browse Source

Merge pull request #510 in DESIGN/design from ~ALEX.SUNG/design:release/10.0 to release/10.0

REPORT-11523 @Sung:mac下alphafine打开网页超链有问题

* commit '88db8fbe547d1a58b8eb6058a81d32b5c9f1f2b0':
  使用模板打debug日志
  代码质量
  1.REPORT-11523 @Sung:mac下alphafine打开网页超链有问题 ---修复该问题 2.增强程序健壮性;返回按钮增加小手,增强交互性 3.修改一些次要程度的log的级别
final/10.0
Alex.Sung 6 years ago
parent
commit
fcabee5df1
  1. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  3. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java
  4. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  5. 15
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java

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

@ -947,12 +947,14 @@ public class AlphaFineDialog extends UIDialog {
Thread sendThread = new Thread(new Runnable() { Thread sendThread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
if(StringUtils.isNotEmpty(storeText)){
RecentSearchManager searchManager = RecentSearchManager.getInstance(); RecentSearchManager searchManager = RecentSearchManager.getInstance();
searchManager.addModel(storeText, cellModel); searchManager.addModel(storeText, cellModel);
sendDataToServer(storeText, cellModel); sendDataToServer(storeText, cellModel);
TemplateInfoCollector.getInstance().sendTemplateInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo(); ErrorInfoUploader.getInstance().sendErrorInfo();
} }
}
}); });
sendThread.start(); sendThread.start();
} }
@ -1376,10 +1378,11 @@ public class AlphaFineDialog extends UIDialog {
private void initBackPane() { private void initBackPane() {
backPane = new JPanel(new BorderLayout()); backPane = new JPanel(new BorderLayout());
JLabel jLabel = new JLabel(" < " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back")); JLabel jLabel = new JLabel(" < " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Back"));
jLabel.setPreferredSize(new Dimension(680, 20)); jLabel.setPreferredSize(new Dimension(80, 20));
jLabel.setFont(AlphaFineConstants.SMALL_FONT); jLabel.setFont(AlphaFineConstants.SMALL_FONT);
jLabel.setForeground(AlphaFineConstants.DARK_GRAY); jLabel.setForeground(AlphaFineConstants.DARK_GRAY);
backPane.add(jLabel, BorderLayout.CENTER); jLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
backPane.add(jLabel, BorderLayout.WEST);
jLabel.addMouseListener(new MouseAdapter() { jLabel.addMouseListener(new MouseAdapter() {
@Override @Override

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

@ -7,6 +7,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -23,6 +24,7 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder;
/** /**
@ -58,7 +60,7 @@ public class RobotPreviewPane extends JPanel {
.replaceAll("\\('", StringUtils.EMPTY) .replaceAll("\\('", StringUtils.EMPTY)
.replaceAll("'\\)", StringUtils.EMPTY); .replaceAll("'\\)", StringUtils.EMPTY);
try { try {
Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + s)); Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + URLEncoder.encode(s, EncodeConstants.ENCODING_UTF_8)));
} catch (IOException e1) { } catch (IOException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage()); FineLoggerFactory.getLogger().error(e1.getMessage());
} catch (URISyntaxException e1) { } catch (URISyntaxException e1) {

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

@ -3,16 +3,9 @@ package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.io.IOException;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils; import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
@ -37,6 +30,7 @@ public class ComplementAdviceManager {
/** /**
* 从接口中获取补全建议结果 * 从接口中获取补全建议结果
*
* @param searchText * @param searchText
* @return * @return
*/ */
@ -50,11 +44,9 @@ public class ComplementAdviceManager {
try { try {
String result = HttpToolbox.get(url); String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
allModelList = AlphaFineHelper.getModelListFromJSONArray(result,"keywords"); allModelList = AlphaFineHelper.getModelListFromJSONArray(result, "keywords");
} catch(ClassCastException | JSONException e){ } catch (Exception e) {
FineLoggerFactory.getLogger().error("complement advice search error: " + e.getMessage()); FineLoggerFactory.getLogger().debug("complement advice search error. search str {}", searchText[j]);
} catch (IOException e1) {
FineLoggerFactory.getLogger().error("complement advice get result error: " + e1.getMessage());
} }
} }
if (searchResult.isEmpty()) { if (searchResult.isEmpty()) {

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

@ -12,14 +12,12 @@ import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -54,7 +52,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
return new SearchResult(); return new SearchResult();
} }
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){ if (noConnectList != null) {
return noConnectList; return noConnectList;
} }
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
@ -76,10 +74,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
} }
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("recommend search error! :" + e.getMessage()); FineLoggerFactory.getLogger().debug("recommend search get result error! search str {}", searchText[j]);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("recommend search get result error! :" + e.getMessage());
} }
} }
@ -113,7 +109,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将推荐接口获取的数据分别放入显示部分显示更多的list * 将推荐接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getRecommendSearchResult(){ private void getRecommendSearchResult() {
if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) { if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) {
if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
@ -131,7 +127,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将补全接口获取的数据分别放入显示部分显示更多的list * 将补全接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getComplementAdviceSearchResult(){ private void getComplementAdviceSearchResult() {
if (complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
modelList.addAll(complementAdviceModelList.subList(0, AlphaFineConstants.SHOW_SIZE)); modelList.addAll(complementAdviceModelList.subList(0, AlphaFineConstants.SHOW_SIZE));
@ -145,7 +141,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
/** /**
* 将推荐接口和补全接口获取的数据分别放入显示部分显示更多的list * 将推荐接口和补全接口获取的数据分别放入显示部分显示更多的list
*/ */
private void getRecommendAndAdviceSearchResult(){ private void getRecommendAndAdviceSearchResult() {
if (recommendModelList.size() + complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) { if (recommendModelList.size() + complementAdviceModelList.size() > AlphaFineConstants.SHOW_SIZE) {
modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND)); modelList.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_ShowAll"), true, CellType.RECOMMEND));
if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) { if (recommendModelList.size() > AlphaFineConstants.RECOMMEND_MAX_ITEM_NUM) {

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

@ -9,14 +9,11 @@ import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils; import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
import java.io.IOException;
/** /**
* Created by alex.sung on 2018/8/3. * Created by alex.sung on 2018/8/3.
*/ */
@ -27,7 +24,7 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
public static SimilarSearchManeger getInstance() { public static SimilarSearchManeger getInstance() {
if (instance == null) { if (instance == null) {
synchronized (SimilarSearchManeger.class){ synchronized (SimilarSearchManeger.class) {
if (instance == null) { if (instance == null) {
instance = new SimilarSearchManeger(); instance = new SimilarSearchManeger();
} }
@ -44,7 +41,7 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
return new SearchResult(); return new SearchResult();
} }
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(instance);
if(noConnectList != null){ if (noConnectList != null) {
return noConnectList; return noConnectList;
} }
SearchResult allModelList = new SearchResult(); SearchResult allModelList = new SearchResult();
@ -54,11 +51,9 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
try { try {
String result = HttpToolbox.get(url); String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
allModelList = AlphaFineHelper.getModelListFromJSONArray(result,"title"); allModelList = AlphaFineHelper.getModelListFromJSONArray(result, "title");
} catch (ClassCastException | JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("similar search error: " + e.getMessage()); FineLoggerFactory.getLogger().debug("similar search error.search str {}", searchText[j]);
} catch (IOException e) {
FineLoggerFactory.getLogger().error("similar search get result error: " + e.getMessage());
} }
} }
moreModelList.clear(); moreModelList.clear();

Loading…
Cancel
Save