diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
index de66ad3d56..ff61edda09 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
@@ -143,7 +143,15 @@ public class AlphaFineDialog extends UIDialog {
private static String beforeSearchStr = "";
private static boolean alreadySearch = false;
private static boolean alreadyInitHot = false;
- public static String[][] data;
+ private String[][] hotData;
+
+ public String[][] getHotData() {
+ return hotData;
+ }
+
+ public void setHotData(String[][] hotData) {
+ this.hotData = hotData;
+ }
public AlphaFineDialog(Frame parent, boolean forceOpen) {
super(parent);
@@ -242,14 +250,14 @@ public class AlphaFineDialog extends UIDialog {
try {
HttpGet getHelp = new HttpGet(AlphaFineConstants.ALPHA_HOT_SEARCH);
HttpToolbox.getHttpClient(AlphaFineConstants.ALPHA_HOT_SEARCH).execute(getHelp).getStatusLine();
- if (data == null) {
- data = HotIssuesManager.getInstance().getHotIssues();
+ if (hotData == null) {
+ hotData = HotIssuesManager.getInstance().getHotIssues();
}
- for (int i = 0; i < data.length; i++) {
- panel.add(new HotIssueJpanel(data[i], i + 1));
+ for (int i = 0; i < hotData.length; i++) {
+ panel.add(new HotIssueJpanel(hotData[i], i + 1));
}
} catch (Exception e) {
- data = null;
+ hotData = null;
for (int i = 0; i < AlphaFineConstants.HOT_ITEMS; i++) {
panel.add(new HotIssueJpanel(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed")}, i + 1));
}
@@ -544,7 +552,7 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildDocumentList(final String[] searchText) {
- addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText));
+ addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildFileList(String searchStr, final String[] searchText) {
@@ -552,24 +560,24 @@ public class AlphaFineDialog extends UIDialog {
}
private void buildActionList(final String[] searchText) {
- addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText));
+ addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildPluginList(final String[] searchText) {
- addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText));
+ addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildRecommendList(final String[] searchText) {
- addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText));
+ addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildRecentList(final String[] searchText) {
- addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText));
+ addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(getHotData(), searchText));
}
private void buildSimilarList(final String[] searchText) {
- addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(searchText));
+ addSearchResult(SimilarSearchManeger.getInstance().getLessSearchResult(getHotData(), searchText));
}
private synchronized void addSearchResult(SearchResult searchResult) {
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
index 336e64dce2..120d15f2b0 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
@@ -28,6 +28,8 @@ import java.net.URL;
*/
public class RobotPreviewPane extends JPanel {
+ private static final int TITLE_AREA_HEIGHT = 30;
+
public RobotPreviewPane(String title, String content) {
this.setLayout(new BorderLayout());
this.setBackground(Color.WHITE);
@@ -41,17 +43,17 @@ public class RobotPreviewPane extends JPanel {
final JEditorPane editorPane = new JEditorPane();
editorPane.setEditorKit(new HTMLEditorKit());
- editorPane.setText(content+"
");
+ editorPane.setText(content + "
");
editorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
- if(e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)){
- String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX,StringUtils.EMPTY)
- .replaceAll("\\('",StringUtils.EMPTY)
- .replaceAll("'\\)",StringUtils.EMPTY);
+ if (e.getDescription().startsWith(AlphaFineConstants.JAVASCRIPT_PREFIX)) {
+ String s = e.getDescription().replaceAll(AlphaFineConstants.JAVASCRIPT_PREFIX, StringUtils.EMPTY)
+ .replaceAll("\\('", StringUtils.EMPTY)
+ .replaceAll("'\\)", StringUtils.EMPTY);
try {
Desktop.getDesktop().browse(new URI(AlphaFineConstants.ALPHA_PREVIEW + s));
} catch (IOException e1) {
@@ -60,7 +62,8 @@ public class RobotPreviewPane extends JPanel {
FineLoggerFactory.getLogger().error(e1.getMessage());
}
}
- URL linkUrl = e.getURL();if (linkUrl != null) {
+ URL linkUrl = e.getURL();
+ if (linkUrl != null) {
try {
Desktop.getDesktop().browse(e.getURL().toURI());
} catch (IOException | URISyntaxException e1) {
@@ -73,6 +76,7 @@ public class RobotPreviewPane extends JPanel {
UIScrollPane jScrollPane = new UIScrollPane(editorPane);
jScrollPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
jScrollPane.setBorder(BorderFactory.createMatteBorder(5, 10, 0, 10, Color.white));
+ this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT - TITLE_AREA_HEIGHT));
add(jScrollPane, BorderLayout.CENTER);
}
}
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
index b75aa894c4..154e7c858e 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
@@ -12,7 +12,7 @@ public interface AlphaFineSearchProvider {
* @param searchText
* @return
*/
- SearchResult getLessSearchResult(String[] searchText);
+ SearchResult getLessSearchResult(String[][] data, String[] searchText);
/**
* 获取剩余条数
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
index 1ba95926a1..97bfde18d0 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
@@ -12,10 +12,9 @@ import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvi
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel;
import com.fr.general.ComparatorUtils;
-
import com.fr.json.JSONObject;
-import com.fr.stable.StringUtils;
import com.fr.stable.ArrayUtils;
+import com.fr.stable.StringUtils;
import java.util.List;
@@ -58,15 +57,15 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
filterModelList = new SearchResult();
lessModelList = new SearchResult();
moreModelList = new SearchResult();
- if (ArrayUtils.isEmpty(searchText)) {
- lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")));
- return lessModelList;
- }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
+ if (ArrayUtils.isEmpty(searchText)) {
+ lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")));
+ return lessModelList;
+ }
List updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
for (int j = 0; j < searchText.length; j++) {
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
index cb1f91cda7..1003c0e21b 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
@@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.DocumentModel;
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.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@@ -52,19 +51,16 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
- if (ArrayUtils.isEmpty(searchText)) {
- return new SearchResult();
- } else if (AlphaFineDialog.data == null) {
- return AlphaFineHelper.getNoConnectList(instance);
- }
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
- if (ArrayUtils.isEmpty(searchText)) {
- lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
- return lessModelList;
- }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
+ if (ArrayUtils.isEmpty(searchText)) {
+ lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
+ return lessModelList;
+ } else if (hotData == null) {
+ return AlphaFineHelper.getNoConnectList(instance);
+ }
SearchResult searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j] + AlphaFineConstants.FIRST_PAGE;
@@ -78,7 +74,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
DocumentModel cellModel = getModelFromCloud(jsonArray.optJSONObject(i));
- if (!AlphaFineHelper.getFilterResult().contains(cellModel)) {
+ if (!AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) {
searchResult.add(cellModel);
}
}
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
index 17c58998df..c7972753ca 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
@@ -96,7 +96,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
return null;
}
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
index 5aafe29faf..0feff55215 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
@@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
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.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.ComparatorUtils;
@@ -17,8 +16,8 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
-import com.fr.stable.EncodeConstants;
import com.fr.stable.ArrayUtils;
+import com.fr.stable.EncodeConstants;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -97,20 +96,17 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
- if (ArrayUtils.isEmpty(searchText)) {
- return new SearchResult();
- } else if (AlphaFineDialog.data == null) {
- return AlphaFineHelper.getNoConnectList(instance);
- }
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
- if (ArrayUtils.isEmpty(searchText)) {
- lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
- return lessModelList;
- }
SearchResult searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
+ if (ArrayUtils.isEmpty(searchText)) {
+ lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon")));
+ return lessModelList;
+ } else if (hotData == null) {
+ return AlphaFineHelper.getNoConnectList(instance);
+ }
for (int j = 0; j < searchText.length; j++) {
try {
String encodedKey = URLEncoder.encode(searchText[j], EncodeConstants.ENCODING_UTF_8);
@@ -123,7 +119,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false);
- if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel)) {
+ if (cellModel != null && !AlphaFineHelper.getFilterResult().contains(cellModel) && !searchResult.contains(cellModel)) {
searchResult.add(cellModel);
}
}
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
index 866c2c7349..38f413423a 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
@@ -72,7 +72,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.modelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
recentModelList = getRecentModelList(searchText[j]);
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
index 7a234838aa..de527d5513 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
@@ -8,7 +8,6 @@ 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.AlphaCellModel;
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.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@@ -16,9 +15,9 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
+import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
-import com.fr.stable.ArrayUtils;
import java.io.IOException;
import java.util.Iterator;
@@ -47,15 +46,15 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
- if (ArrayUtils.isEmpty(searchText)) {
- return new SearchResult();
- } else if(AlphaFineDialog.data == null){
- return AlphaFineHelper.getNoConnectList(instance);
- }
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
this.modelList = new SearchResult();
this.recommendModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
+ if (ArrayUtils.isEmpty(searchText)) {
+ return new SearchResult();
+ } else if(hotData == null){
+ return AlphaFineHelper.getNoConnectList(instance);
+ }
for (int j = 0; j < searchText.length; j++) {
searchText[j] = searchText[j].replaceAll(StringUtils.BLANK, StringUtils.EMPTY);
try {
@@ -69,7 +68,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider {
for (int i = 0; i < jsonArray.length(); i++) {
AlphaFineHelper.checkCancel();
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i));
- if (alphaCellModel != null && !alreadyContain(alphaCellModel)) {
+ if (alphaCellModel != null && !alreadyContain(alphaCellModel) && !this.recommendModelList.contains(alphaCellModel)) {
this.recommendModelList.add(alphaCellModel);
}
}
diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
index 661eba0ff0..90d0489321 100644
--- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
+++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java
@@ -6,7 +6,6 @@ import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
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.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
@@ -38,14 +37,14 @@ public class SimilarSearchManeger implements AlphaFineSearchProvider {
}
@Override
- public SearchResult getLessSearchResult(String[] searchText) {
- if (ArrayUtils.isEmpty(searchText)) {
- return new SearchResult();
- } else if (AlphaFineDialog.data == null) {
- return AlphaFineHelper.getNoConnectList(instance);
- }
+ public SearchResult getLessSearchResult(String[][] hotData, String[] searchText) {
lessModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedIntelligentCustomerService()) {
+ if (ArrayUtils.isEmpty(searchText)) {
+ return new SearchResult();
+ } else if (hotData == null) {
+ return AlphaFineHelper.getNoConnectList(instance);
+ }
SearchResult allModelList = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String token = DigestUtils.md5Hex(AlphaFineConstants.ALPHA_ROBOT_SEARCH_TOKEN + searchText[j]);