Browse Source

Pull request #8834: REPORT-70446 svg绘制去掉抗锯齿 && REPORT-70681 搜索结果高亮和搜索结果准确性

Merge in DESIGN/design from ~HADES/design:release/11.0 to release/11.0

* commit '8799446feb3717909341ff9705eeb6989cf91b13':
  REPORT-70681 fix 去掉调试日志
  REPORT-70681 fix 去掉调试日志
  REPORT-70681 搜索结果高亮和搜索结果准确性
  REPORT-70446 svg绘制去掉抗锯齿
newui
Hades 3 years ago
parent
commit
d92ecb60be
  1. 24
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java
  2. 14
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java
  3. 1
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java
  4. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java
  5. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/SearchWorkerManager.java
  6. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java
  7. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java
  8. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  9. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  10. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

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

@ -171,38 +171,26 @@ public class AlphaFineFrame extends JFrame {
this.settingSearchWorkerManager = new SearchWorkerManager(
CellType.ACTION,
searchTextBean -> {
ActionSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return ActionSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> ActionSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new SimpleRightSearchResultPane(new NoResultPane(NO_RESULT, AlphaFineConstants.NO_RESULT_ICON))
);
fileSearchWorkerManager = new SearchWorkerManager(
CellType.FILE,
searchTextBean -> {
FileSearchManager.getInstance().getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation());
return FileSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> FileSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new LoadingRightSearchResultPane()
);
documentWorkerManager = new SearchWorkerManager(
CellType.DOCUMENT,
searchTextBean -> {
DocumentSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return DocumentSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> DocumentSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new SimpleRightSearchResultPane(new JPanel())
);
pluginSearchWorkerManager = new SearchWorkerManager(
CellType.PLUGIN,
searchTextBean -> {
PluginSearchManager.getInstance().getLessSearchResult(searchTextBean.getSegmentation());
return PluginSearchManager.getInstance().getMoreSearchResult(searchTextBean.getSearchText());
},
searchTextBean -> PluginSearchManager.getInstance().getSearchResult(searchTextBean),
this,
new LoadingRightSearchResultPane()
);
@ -663,6 +651,10 @@ public class AlphaFineFrame extends JFrame {
resultPane.add(panel, flag);
}
public void removeSearchResultPane(JPanel panel) {
resultPane.remove(panel);
}
private void doSearch(String text) {

14
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java

@ -9,7 +9,6 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import javax.swing.JPanel;
/**
@ -25,11 +24,6 @@ public class QuestionPane extends JPanel {
private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg");
private static final int WIDTH = 40;
private static final int HEIGHT = 40;
public QuestionPane() {
this.setBackground(new Color(0, 0, 0, 0));
}
@ -38,22 +32,20 @@ public class QuestionPane extends JPanel {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
SvgPaintUtils.beforePaint(g2);
// 宽高保持
int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth();
int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight();
if (AlphaFineUtil.unread()) {
g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this);
g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, this);
} else {
g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this);
g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, this);
}
int imageWidth = QUESTION_IMAGE.getWidth(this);
int imageHeight = QUESTION_IMAGE.getHeight(this);
g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this);
g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2 - 2, (height - imageHeight) / 2 - 2,this);
SvgPaintUtils.afterPaint(g2);
}

1
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java

@ -57,7 +57,6 @@ public class QuestionWindow extends JWindow {
public void windowDeactivated(WindowEvent e) {
QuestionWindow.getInstance().setVisible(false);
}
});
questionPane.setToolTipText(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About"));
this.setContentPane(questionPane);

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/ProductNewsSearchWorkerManager.java

@ -48,10 +48,11 @@ public class ProductNewsSearchWorkerManager implements SearchManager {
checkSearchWork();
searchOver = false;
networkError = false;
if (searchResultPane == null) {
if (searchResultPane != null) {
alphaFineFrame.removeSearchResultPane(searchResultPane);
}
searchResultPane = new ProductNewsSearchResultPane(searchTextBean.getSegmentation());
alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result());
}
this.searchWorker = new SwingWorker<DefaultListModel<ProductNews>, Void>() {
@Override

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

@ -48,10 +48,11 @@ public class SearchWorkerManager implements SearchManager {
}
private void initSearchResult(SearchTextBean searchTextBean) {
if (searchResultPane == null) {
if (searchResultPane != null) {
alphaFineFrame.removeSearchResultPane(searchResultPane);
}
searchResultPane = new SearchResultPane(searchTextBean.getSegmentation(), resultShowPane);
alphaFineFrame.addResult(searchResultPane, cellType.getFlagStr4Result());
}
}

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/fun/AlphaFineSearchProvider.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager.fun;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
/**
* Created by XiaXiang on 2017/3/27.
@ -20,4 +21,15 @@ public interface AlphaFineSearchProvider {
* @return
*/
SearchResult getMoreSearchResult(String searchText);
/**
* 获取所有搜索结果 取决于具体实现
*
* @param searchTextBean
* @return
*/
default SearchResult getSearchResult(SearchTextBean searchTextBean) {
return new SearchResult();
}
}

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

@ -8,6 +8,7 @@ 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.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel;
@ -101,4 +102,10 @@ public class ActionSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return filterModelList;
}
}

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

@ -7,15 +7,14 @@ 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.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.http.HttpToolbox;
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 java.io.IOException;
/**
* Created by XiaXiang on 2017/3/27.
@ -24,6 +23,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
private static volatile DocumentSearchManager instance;
private SearchResult lessModelList;
private SearchResult moreModelList;
private SearchResult searchResult;
public static DocumentSearchManager getInstance() {
if (instance == null) {
@ -54,6 +54,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
searchResult = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
if (ArrayUtils.isEmpty(searchText)) {
lessModelList.add(new MoreModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help")));
@ -63,7 +64,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
if(noConnectList != null){
return noConnectList;
}
SearchResult searchResult = new SearchResult();
searchResult = new SearchResult();
for (int j = 0; j < searchText.length; j++) {
String url = AlphaFineConstants.DOCUMENT_SEARCH_URL + searchText[j];
try {
@ -106,4 +107,9 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return searchResult;
}
}

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

@ -9,6 +9,7 @@ import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.model.FileModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
@ -114,6 +115,12 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSearchText(), searchTextBean.getSegmentation());
return filterModelList;
}
private void doSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainTemplate()) {
for (FileNode node : fileNodes) {

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

@ -7,6 +7,7 @@ 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.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.SearchTextBean;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
@ -28,6 +29,7 @@ import java.net.URLEncoder;
public class PluginSearchManager implements AlphaFineSearchProvider {
private SearchResult lessModelList;
private SearchResult moreModelList;
private SearchResult searchResult;
private PluginSearchManager() {
@ -97,7 +99,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
public SearchResult getLessSearchResult(String[] searchText) {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
SearchResult searchResult = new SearchResult();
this.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")));
@ -146,4 +148,11 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
public SearchResult getMoreSearchResult(String searchText) {
return this.moreModelList;
}
@Override
public SearchResult getSearchResult(SearchTextBean searchTextBean) {
getLessSearchResult(searchTextBean.getSegmentation());
return searchResult;
}
}

Loading…
Cancel
Save