Browse Source

REPORT-10946 离线状态下(断网)alphafine都打不开了

1、正常断网后,需要联网的各模块提示“链接失败”
2、断网后联网,alphafine可以正常打开
3、和视觉沟通,热门界面的图标外围的圆,不使用swing画了,由视觉重新提供切图。
research/10.0
alex.sung 6 years ago
parent
commit
7f7c48a667
  1. 30
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  2. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  3. 97
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  4. 36
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ContainsCirclePane.java
  5. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  6. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java
  7. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  8. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  9. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
  10. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1.png
  11. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png
  12. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2.png
  13. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png
  14. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3.png
  15. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png
  16. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4.png
  17. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png
  18. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5.png
  19. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png
  20. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6.png
  21. BIN
      designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png

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

@ -4,13 +4,17 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
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.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.NoResultModel; import com.fr.design.mainframe.alphafine.cell.model.NoResultModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog; import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.HotIssuesManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManeger;
import com.fr.general.ProcessCanceledException; import com.fr.general.ProcessCanceledException;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
@ -104,7 +108,7 @@ public class AlphaFineHelper {
public static SearchResult getModelListFromJSONArray(String result, String keyword) throws ClassCastException, JSONException { public static SearchResult getModelListFromJSONArray(String result, String keyword) throws ClassCastException, JSONException {
SearchResult allModelList = new SearchResult(); SearchResult allModelList = new SearchResult();
JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result); JSONArray jsonArray = (JSONArray) JSONUtils.jsonDecode(result);
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
JSONObject jsonObject = jsonArray.optJSONObject(i); JSONObject jsonObject = jsonArray.optJSONObject(i);
@ -120,5 +124,25 @@ public class AlphaFineHelper {
return allModelList; return allModelList;
} }
/**
* 网络异常时的处理
* @param object
* @return
*/
public static SearchResult getNoConnectList(Object object) {
SearchResult result = new SearchResult();
if (object instanceof RecommendSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend")));
} else if (object instanceof DocumentSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
} else if (object instanceof PluginSearchManager) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
} else if (object instanceof SimilarSearchManeger) {
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Relation_Item")));
} else if (object instanceof HotIssuesManager) {
return new SearchResult();
}
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
} }

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

@ -9,15 +9,14 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
@ -50,7 +49,6 @@ public class ContentCellRender implements ListCellRenderer<Object> {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(null); panel.setBackground(null);
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
if (model.hasAction()) { if (model.hasAction()) {
if (isSelected) { if (isSelected) {
titleLabel.setText(StringUtils.BLANK + model.getName()); titleLabel.setText(StringUtils.BLANK + model.getName());
@ -63,7 +61,6 @@ public class ContentCellRender implements ListCellRenderer<Object> {
titleLabel.setIcon(IconLoader.getIcon(iconUrl)); titleLabel.setIcon(IconLoader.getIcon(iconUrl));
} }
} else { } else {
titleLabel.setText(highLightModelName(model.getName(), segmentationResult)); titleLabel.setText(highLightModelName(model.getName(), segmentationResult));
String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX; String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX;
if (value instanceof RobotModel && ((RobotModel) value).isHotItemModel()) { if (value instanceof RobotModel && ((RobotModel) value).isHotItemModel()) {
@ -74,6 +71,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
} }
} else { } else {
titleLabel.setText(model.getName());
titleLabel.setIcon(null); titleLabel.setIcon(null);
titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY); titleLabel.setForeground(AlphaFineConstants.MEDIUM_GRAY);
} }
@ -115,7 +113,11 @@ public class ContentCellRender implements ListCellRenderer<Object> {
modelName = modelName.replaceAll(strings[i], primaryStr); modelName = modelName.replaceAll(strings[i], primaryStr);
} }
} }
modelName = "<HTML>" + modelName.replaceAll("\\|", "") + "</HTML>"; modelName = "<html><head><style> .style{" +
"overflow: hidden;" +
"text-overflow: ellipsis;" +
"white-space: nowrap;}" +
"</style></head><body class=\"style\">" + modelName.replaceAll("\\|", StringUtils.EMPTY) + "</body></HTML>";
return modelName; return modelName;
} }

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

@ -19,7 +19,6 @@ import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ContainsCirclePane;
import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane; import com.fr.design.mainframe.alphafine.preview.DocumentPreviewPane;
import com.fr.design.mainframe.alphafine.preview.FilePreviewPane; import com.fr.design.mainframe.alphafine.preview.FilePreviewPane;
import com.fr.design.mainframe.alphafine.preview.NoResultPane; import com.fr.design.mainframe.alphafine.preview.NoResultPane;
@ -40,6 +39,7 @@ import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.io.TemplateWorkBookIO; import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONException; import com.fr.json.JSONException;
@ -49,6 +49,7 @@ import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -142,6 +143,7 @@ public class AlphaFineDialog extends UIDialog {
private static String beforeSearchStr = ""; private static String beforeSearchStr = "";
private static boolean alreadySearch = false; private static boolean alreadySearch = false;
private static boolean alreadyInitHot = false; private static boolean alreadyInitHot = false;
public static String[][] data;
public AlphaFineDialog(Frame parent, boolean forceOpen) { public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent); super(parent);
@ -224,6 +226,7 @@ public class AlphaFineDialog extends UIDialog {
* 初始化热门界面 * 初始化热门界面
*/ */
private void initHotPane() { private void initHotPane() {
removeHotPane();
hotPane = new JPanel(); hotPane = new JPanel();
hotPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); hotPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
hotPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE); hotPane.setPreferredSize(AlphaFineConstants.CONTENT_SIZE);
@ -232,25 +235,28 @@ public class AlphaFineDialog extends UIDialog {
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot")); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot"));
uiLabel.setFont(AlphaFineConstants.SMALL_FONT); uiLabel.setFont(AlphaFineConstants.SMALL_FONT);
uiLabel.setForeground(AlphaFineConstants.DARK_GRAY); uiLabel.setForeground(AlphaFineConstants.DARK_GRAY);
JPanel panel = new JPanel();
hotPane.add(uiLabel, BorderLayout.NORTH);
hotPane.add(panel, BorderLayout.CENTER);
GridLayout gridLayout = new GridLayout(2, 3, 3, 3); GridLayout gridLayout = new GridLayout(2, 3, 3, 3);
JPanel panel = new JPanel();
panel.setLayout(gridLayout); panel.setLayout(gridLayout);
try {
String[][] ss = HotIssuesManager.getInstance().getHotIssues(); HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH);
HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine();
if(ss != null){ if (data == null) {
for (int i = 0; i < ss.length; i++) { data = HotIssuesManager.getInstance().getHotIssues();
panel.add(new HotIssueJpanel(ss[i], i + 1));
} }
}else { for (int i = 0; i < data.length; i++) {
panel.add(new HotIssueJpanel(data[i], i + 1));
}
} catch (Exception e) {
data = null;
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) { for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{" "}, i + 1)); panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
} }
} }
hotPane.add(uiLabel, BorderLayout.NORTH);
hotPane.add(panel, BorderLayout.CENTER);
add(hotPane, BorderLayout.SOUTH); add(hotPane, BorderLayout.SOUTH);
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
} }
@ -313,10 +319,8 @@ public class AlphaFineDialog extends UIDialog {
return; return;
} }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (hotPane == null) { initHotPane();
initHotPane(); } else {
}
}else{
removeHotPane(); removeHotPane();
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
refreshContainer(); refreshContainer();
@ -706,19 +710,19 @@ public class AlphaFineDialog extends UIDialog {
this.showWorker = new SwingWorker<String, Void>() { this.showWorker = new SwingWorker<String, Void>() {
@Override @Override
protected String doInBackground() { protected String doInBackground() {
if(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item").equals((selectedValue).getName())){ if (com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item").equals((selectedValue).getName())) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
String content = RobotModel.getContent((selectedValue).getName()); String content = RobotModel.getContent((selectedValue).getName());
if(StringUtils.isNotEmpty(content)){ if (StringUtils.isNotEmpty(content)) {
//1.去掉小帆底部的信息。2.修改链接标签,使点击能够正常跳转。 //1.去掉小帆底部的信息。2.修改链接标签,使点击能够正常跳转。
content = content.replaceAll(AlphaFineConstants.BOTTOM_REGEX_FIRST, StringUtils.EMPTY) content = content.replaceAll(AlphaFineConstants.BOTTOM_REGEX_FIRST, StringUtils.EMPTY)
.replaceAll(AlphaFineConstants.BOTTOM_REGEX_SECOND, StringUtils.EMPTY) .replaceAll(AlphaFineConstants.BOTTOM_REGEX_SECOND, StringUtils.EMPTY)
.replaceAll(AlphaFineConstants.LINK_REGEX,StringUtils.EMPTY) .replaceAll(AlphaFineConstants.LINK_REGEX, StringUtils.EMPTY)
.replaceAll("'\\)",StringUtils.EMPTY) .replaceAll("'\\)", StringUtils.EMPTY)
.replaceAll(AlphaFineConstants.LINK_REGEX_ANOTHER,StringUtils.EMPTY); .replaceAll(AlphaFineConstants.LINK_REGEX_ANOTHER, StringUtils.EMPTY);
return content; return content;
}else{ } else {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item");
} }
} }
@ -816,11 +820,9 @@ public class AlphaFineDialog extends UIDialog {
removeSearchResult(); removeSearchResult();
refreshContainer(); refreshContainer();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (hotPane == null) { initHotPane();
initHotPane(); setSize(AlphaFineConstants.FULL_SIZE);
setSize(AlphaFineConstants.FULL_SIZE); } else {
}
}else{
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
} }
refreshContainer(); refreshContainer();
@ -834,17 +836,17 @@ public class AlphaFineDialog extends UIDialog {
refreshContainer(); refreshContainer();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) {
//是高级搜索 //是高级搜索
if(searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)){ if (searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)) {
segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(searchTextField.getText().toLowerCase())); segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(searchTextField.getText().toLowerCase()));
} }
//是普通搜索 //是普通搜索
else{ else {
segmentationResult = SegmentationManager.getInstance().startSegmentation(searchTextField.getText().toLowerCase()); segmentationResult = SegmentationManager.getInstance().startSegmentation(searchTextField.getText().toLowerCase());
} }
} else { } else {
if(StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))){ if (StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))) {
segmentationResult = null; segmentationResult = null;
}else{ } else {
segmentationResult = new String[]{getRealSearchText(searchTextField.getText())}; segmentationResult = new String[]{getRealSearchText(searchTextField.getText())};
} }
} }
@ -867,7 +869,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 去除特殊字符空格等 * 去除特殊字符空格等
*/ */
private String getRealSearchText(String searchText){ private String getRealSearchText(String searchText) {
searchText = searchText.toLowerCase(); searchText = searchText.toLowerCase();
Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX); Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX);
Matcher m = p.matcher(searchText); Matcher m = p.matcher(searchText);
@ -936,7 +938,7 @@ public class AlphaFineDialog extends UIDialog {
* @param cellModel * @param cellModel
*/ */
private void saveLocalHistory(final AlphaCellModel cellModel) { private void saveLocalHistory(final AlphaCellModel cellModel) {
if(cellModel instanceof BottomModel){ if (cellModel instanceof BottomModel) {
return; return;
} }
Thread sendThread = new Thread(new Runnable() { Thread sendThread = new Thread(new Runnable() {
@ -1170,7 +1172,7 @@ public class AlphaFineDialog extends UIDialog {
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue);
}else if(selectedValue instanceof BottomModel){ } else if (selectedValue instanceof BottomModel) {
dealWithSearchResult(selectedValue); dealWithSearchResult(selectedValue);
} }
} }
@ -1198,6 +1200,7 @@ public class AlphaFineDialog extends UIDialog {
setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
} }
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
} }
@ -1330,12 +1333,12 @@ public class AlphaFineDialog extends UIDialog {
protected Object doInBackground() throws Exception { protected Object doInBackground() throws Exception {
resetContainer(); resetContainer();
if(modeList.size() == ONLY_ONE_AVAILABLE_MODEL && "".equals(modeList.get(1).getName())){ if (modeList.size() == ONLY_ONE_AVAILABLE_MODEL && "".equals(modeList.get(1).getName())) {
RobotModel model = new RobotModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item"), null); RobotModel model = new RobotModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha_Hot_No_Item"), null);
searchListModel.addElement(model); searchListModel.addElement(model);
}else { } else {
for (AlphaCellModel object : modeList) { for (AlphaCellModel object : modeList) {
if(!searchListModel.contains(object)){ if (!searchListModel.contains(object)) {
searchListModel.addElement(object); searchListModel.addElement(object);
} }
} }
@ -1363,6 +1366,7 @@ public class AlphaFineDialog extends UIDialog {
hotPane = null; hotPane = null;
} }
} }
/** /**
* 增加返回面板 * 增加返回面板
*/ */
@ -1382,11 +1386,9 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane = null; searchResultPane = null;
} }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
if (hotPane == null) { initHotPane();
initHotPane();
}
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
}else{ } else {
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
} }
refreshContainer(); refreshContainer();
@ -1407,14 +1409,19 @@ public class AlphaFineDialog extends UIDialog {
this.setSize(AlphaFineConstants.HOT_ISSUES_JAPNEL_SIZE); this.setSize(AlphaFineConstants.HOT_ISSUES_JAPNEL_SIZE);
JPanel pane1 = new JPanel(new BorderLayout()); JPanel pane1 = new JPanel(new BorderLayout());
ContainsCirclePane circle = new ContainsCirclePane(pngIndex); UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.ALPHA_HOT_IMAGE_NAME + pngIndex + ".png"));
circle.setBorder(BorderFactory.createEmptyBorder(20,0,10,0)); iconLabel.setOpaque(true);
pane1.add(circle, BorderLayout.NORTH); iconLabel.setBackground(Color.WHITE);
iconLabel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
pane1.add(iconLabel, BorderLayout.NORTH);
add(pane1, BorderLayout.NORTH); add(pane1, BorderLayout.NORTH);
JPanel centerPanel = new JPanel(new BorderLayout()); JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.setBackground(Color.white); centerPanel.setBackground(Color.white);
UILabel title = new UILabel(); UILabel title = new UILabel();
if (StringUtils.isEmpty(str[0])) {
title.setText(StringUtils.EMPTY);
}
title.setText(str[0]); title.setText(str[0]);
title.setFont(AlphaFineConstants.MEDIUM_FONT_ANOTHER); title.setFont(AlphaFineConstants.MEDIUM_FONT_ANOTHER);
title.setForeground(AlphaFineConstants.DARK_GRAY); title.setForeground(AlphaFineConstants.DARK_GRAY);

36
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/ContainsCirclePane.java

@ -1,36 +0,0 @@
package com.fr.design.mainframe.alphafine.preview;
import com.bulenkov.iconloader.IconLoader;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Graphics;
/**
* @Author alex.sung
* created by 2018.08.15
*/
public class ContainsCirclePane extends JPanel {
public ContainsCirclePane(int pngIndex) {
UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + AlphaFineConstants.ALPHA_HOT_IMAGE_NAME + pngIndex + ".png"));
iconLabel.setPreferredSize(AlphaFineConstants.HOT_ICON_LABEL_SIZE);
iconLabel.setOpaque(true);
iconLabel.setBackground(Color.WHITE);
add(iconLabel);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
int height = AlphaFineConstants.HOT_ICON_LABEL_HEIGHT;
setBackground(Color.white);
int x0 = getSize().width / 2;
int y0 = height / 2 + 23;
int r = height / 2 + 9;
g.setColor(AlphaFineConstants.LIGHT_GRAY);
g.drawOval(x0 - r, y0 - r, r * 2, r * 2);
}
}

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

@ -6,6 +6,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel; import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
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;
@ -52,6 +53,11 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
@Override @Override
public SearchResult getLessSearchResult(String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (AlphaFineDialog.data == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
@ -99,18 +105,6 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
return lessModelList; return lessModelList;
} }
/**
* 无连接
*
* @return
*/
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@Override @Override
public SearchResult getMoreSearchResult(String searchText) { public SearchResult getMoreSearchResult(String searchText) {
return moreModelList; return moreModelList;

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

@ -12,7 +12,7 @@ import com.fr.json.JSONObject;
import com.fr.json.JSONUtils; import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -73,7 +73,6 @@ public class HotIssuesManager {
try { try {
String result = HttpToolbox.get(AlphaFineConstants.ALPHA_HOT_SEARCH); String result = HttpToolbox.get(AlphaFineConstants.ALPHA_HOT_SEARCH);
AlphaFineHelper.checkCancel();
JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result); JSONArray jsonArray = (JSONArray)JSONUtils.jsonDecode(result);
if(jsonArray != null){ if(jsonArray != null){
for (int i = 0; i < HOT_ITEM_NUM; i++) { for (int i = 0; i < HOT_ITEM_NUM; i++) {
@ -82,10 +81,9 @@ public class HotIssuesManager {
data[i] = getTitleStrings(jsonObject); data[i] = getTitleStrings(jsonObject);
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage()); FineLoggerFactory.getLogger().error("hotissues search error: " + e.getMessage());
} catch (IOException e) { return null;
FineLoggerFactory.getLogger().error("hotissues search get result error: " + e.getMessage());
} }
return data; return data;
} }

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

@ -6,6 +6,7 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
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.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -99,6 +100,8 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult(); return new SearchResult();
} else if (AlphaFineDialog.data == null) {
return AlphaFineHelper.getNoConnectList(instance);
} }
this.lessModelList = new SearchResult(); this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
@ -147,13 +150,6 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
return this.lessModelList; return this.lessModelList;
} }
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@Override @Override
public SearchResult getMoreSearchResult(String searchText) { public SearchResult getMoreSearchResult(String searchText) {
return this.moreModelList; return this.moreModelList;

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

@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
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.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
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;
@ -49,6 +50,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) { if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult(); return new SearchResult();
} else if(AlphaFineDialog.data == null){
return AlphaFineHelper.getNoConnectList(instance);
} }
this.modelList = new SearchResult(); this.modelList = new SearchResult();
this.recommendModelList = new SearchResult(); this.recommendModelList = new SearchResult();
@ -56,7 +59,8 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY); searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
try { try {
String result = HttpToolbox.get(AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j])); String url = AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j]);
String result = HttpToolbox.get(url);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
if ("success".equals(jsonObject.optString("status"))) { if ("success".equals(jsonObject.optString("status"))) {
@ -179,14 +183,6 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
return RecentSearchManager.getInstance().getRecentModelList().contains(cellModel) || this.recommendModelList.contains(cellModel); return RecentSearchManager.getInstance().getRecentModelList().contains(cellModel) || this.recommendModelList.contains(cellModel);
} }
private SearchResult getNoConnectList() {
SearchResult result = new SearchResult();
result.add(0, new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Recommend")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result;
}
@Override @Override
public SearchResult getMoreSearchResult(String searchText) { public SearchResult getMoreSearchResult(String searchText) {
return moreModelList; return moreModelList;

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

@ -6,19 +6,18 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.RobotModel; import com.fr.design.mainframe.alphafine.cell.model.RobotModel;
import com.fr.design.mainframe.alphafine.component.AlphaFineDialog;
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.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.json.JSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.io.IOException; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
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.
*/ */
@ -40,6 +39,11 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
@Override @Override
public SearchResult getLessSearchResult(String[] searchText) { public SearchResult getLessSearchResult(String[] searchText) {
if (ArrayUtils.isEmpty(searchText)) {
return new SearchResult();
} else if (AlphaFineDialog.data == null) {
return AlphaFineHelper.getNoConnectList(instance);
}
lessModelList = new SearchResult(); lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
SearchResult allModelList = new SearchResult(); SearchResult allModelList = new SearchResult();

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot1@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot2@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot3@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot4@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot5@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/alphafine_hot6@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Loading…
Cancel
Save