Browse Source

REPORT-11328 & REPORT-10946 & REPORT-10928 & REPORT-11196

1.修复右侧预览内容过宽,没有横向滚动条的问题
2.处理断网时,显示链接失败的一处错误逻辑
3.list中重复元素去重
4.原先写法不规范,应申明为private,set,get取存值
research/10.0
alex.sung 6 years ago
parent
commit
8185971723
  1. 32
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/RobotPreviewPane.java
  3. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  4. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  5. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  6. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  7. 22
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  8. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  9. 17
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java
  10. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java

32
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) {

16
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+"<br><br><br>");
editorPane.setText(content + "<br><br><br>");
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);
}
}

2
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);
/**
* 获取剩余条数

13
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<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateActionModel updateActionModel : updateActions) {
for (int j = 0; j < searchText.length; j++) {

20
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);
}
}

2
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;
}

22
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);
}
}

2
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]);

17
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);
}
}

13
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]);

Loading…
Cancel
Save