|
|
@ -4,7 +4,9 @@ import com.fr.base.svg.IconUtils; |
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
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.actions.help.alphafine.AlphaFineShortCutUtil; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
|
|
|
import com.fr.design.gui.borders.UITextFieldBorder; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.mainframe.alphafine.AlphaFineConstants; |
|
|
|
import com.fr.design.mainframe.alphafine.AlphaFineConstants; |
|
|
@ -15,8 +17,10 @@ import com.fr.design.mainframe.alphafine.model.ProductNews; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.DefaultProductNewsPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.HelpDocumentNoResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.LoadingRightSearchResultPane; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.alphafine.preview.NetWorkFailedPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.NoResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.NoResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.NoResultWithLinkPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.NoResultWithLinkPane; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.alphafine.preview.SearchLoadingPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.SimpleRightSearchResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.preview.SimpleRightSearchResultPane; |
|
|
|
import com.fr.design.mainframe.alphafine.question.QuestionWindow; |
|
|
|
import com.fr.design.mainframe.alphafine.question.QuestionWindow; |
|
|
|
import com.fr.design.mainframe.alphafine.search.ProductNewsSearchWorkerManager; |
|
|
|
import com.fr.design.mainframe.alphafine.search.ProductNewsSearchWorkerManager; |
|
|
@ -30,10 +34,6 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchMa |
|
|
|
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; |
|
|
|
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; |
|
|
|
import com.fr.design.utils.DesignUtils; |
|
|
|
import com.fr.design.utils.DesignUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.json.JSON; |
|
|
|
|
|
|
|
import com.fr.json.JSONArray; |
|
|
|
|
|
|
|
import com.fr.json.JSONFactory; |
|
|
|
|
|
|
|
import com.fr.json.JSONObject; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.CardLayout; |
|
|
|
import java.awt.CardLayout; |
|
|
@ -44,6 +44,7 @@ import java.awt.Font; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Image; |
|
|
|
|
|
|
|
import java.awt.Insets; |
|
|
|
import java.awt.RenderingHints; |
|
|
|
import java.awt.RenderingHints; |
|
|
|
import java.awt.Toolkit; |
|
|
|
import java.awt.Toolkit; |
|
|
|
import java.awt.Window; |
|
|
|
import java.awt.Window; |
|
|
@ -56,9 +57,7 @@ import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
@ -97,7 +96,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private static final String TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates"); |
|
|
|
private static final String TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Templates"); |
|
|
|
|
|
|
|
|
|
|
|
private static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"); |
|
|
|
public static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"); |
|
|
|
|
|
|
|
|
|
|
|
private static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"); |
|
|
|
private static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help"); |
|
|
|
|
|
|
|
|
|
|
@ -107,8 +106,12 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"); |
|
|
|
private static final String NO_SEARCH_RESULT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_NO_Result"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String PRODUCT_DYNAMICS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_Dynamics"); |
|
|
|
|
|
|
|
|
|
|
|
private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); |
|
|
|
private static final Image SEARCH_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/search.svg"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Color BORDER_COLOR = new Color(232, 232, 233); |
|
|
|
|
|
|
|
|
|
|
|
private final CardLayout cardLayout = new CardLayout(); |
|
|
|
private final CardLayout cardLayout = new CardLayout(); |
|
|
|
|
|
|
|
|
|
|
|
private final JPanel resultPane = new JPanel(cardLayout); |
|
|
|
private final JPanel resultPane = new JPanel(cardLayout); |
|
|
@ -125,6 +128,12 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private AlphaFineList searchResultList; |
|
|
|
private AlphaFineList searchResultList; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SearchLoadingPane searchLoadingPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel searchTextFieldWrapperPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UILabel clearLabel; |
|
|
|
|
|
|
|
|
|
|
|
private CellType selectedType; |
|
|
|
private CellType selectedType; |
|
|
|
|
|
|
|
|
|
|
|
private String beforeSearchStr = StringUtils.EMPTY; |
|
|
|
private String beforeSearchStr = StringUtils.EMPTY; |
|
|
@ -229,7 +238,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
topRightPane.setBackground(Color.WHITE); |
|
|
|
topRightPane.setBackground(Color.WHITE); |
|
|
|
JPanel tipPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel tipPane = new JPanel(new BorderLayout()); |
|
|
|
tipPane.setBackground(Color.WHITE); |
|
|
|
tipPane.setBackground(Color.WHITE); |
|
|
|
String toolTip = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts()); |
|
|
|
String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts())); |
|
|
|
tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); |
|
|
|
tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); |
|
|
|
tipIconLabel.addMouseListener(tipMouseListener); |
|
|
|
tipIconLabel.addMouseListener(tipMouseListener); |
|
|
|
tipIconLabel.setToolTipText(toolTip); |
|
|
|
tipIconLabel.setToolTipText(toolTip); |
|
|
@ -268,7 +277,27 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
private JPanel createSearchPane() { |
|
|
|
private JPanel createSearchPane() { |
|
|
|
JPanel searchPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel searchPane = new JPanel(new BorderLayout()); |
|
|
|
searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); |
|
|
|
searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); |
|
|
|
searchPane.add(searchTextField, BorderLayout.CENTER); |
|
|
|
searchTextFieldWrapperPane = new JPanel(new BorderLayout()) { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void paintBorder(Graphics g) { |
|
|
|
|
|
|
|
g.setColor(BORDER_COLOR); |
|
|
|
|
|
|
|
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
searchTextFieldWrapperPane.setBorder(new UITextFieldBorder(new Insets(2, 3, 2, 3))); |
|
|
|
|
|
|
|
searchTextFieldWrapperPane.setBackground(Color.WHITE); |
|
|
|
|
|
|
|
searchTextFieldWrapperPane.add(searchTextField, BorderLayout.CENTER); |
|
|
|
|
|
|
|
clearLabel = new UILabel(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/clear.svg")); |
|
|
|
|
|
|
|
clearLabel.setVisible(false); |
|
|
|
|
|
|
|
clearLabel.addMouseListener(new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
|
|
|
searchTextField.setText(StringUtils.EMPTY); |
|
|
|
|
|
|
|
clearLabel.setVisible(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
searchTextFieldWrapperPane.add(clearLabel, BorderLayout.EAST); |
|
|
|
|
|
|
|
searchPane.add(searchTextFieldWrapperPane, BorderLayout.CENTER); |
|
|
|
JButton searchButton = new JButton(SEARCH) { |
|
|
|
JButton searchButton = new JButton(SEARCH) { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
public void paintComponent(Graphics g) { |
|
|
@ -297,17 +326,18 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
private JPanel createShowPane() { |
|
|
|
private JPanel createShowPane() { |
|
|
|
JPanel showPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel showPane = new JPanel(new BorderLayout()); |
|
|
|
resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); |
|
|
|
resultPane.add(new DefaultProductNewsPane(), CellType.PRODUCT_NEWS.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(NO_SEARCH_RESULT, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.NO_RESULT.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.ACTION.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultWithLinkPane(GO_FORUM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.FILE.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None()); |
|
|
|
resultPane.add(new NoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.PLUGIN.getFlagStr4None()); |
|
|
|
resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON, generateMap()), CellType.DOCUMENT.getFlagStr4None()); |
|
|
|
resultPane.add(new HelpDocumentNoResultPane(SEARCH_TERM, AlphaFineConstants.NO_RESULT_ICON), CellType.DOCUMENT.getFlagStr4None()); |
|
|
|
|
|
|
|
resultPane.add(new NetWorkFailedPane(this::reSearch), AlphaFineConstants.NETWORK_ERROR); |
|
|
|
|
|
|
|
|
|
|
|
JPanel labelPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel labelPane = new JPanel(new BorderLayout()); |
|
|
|
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); |
|
|
|
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); |
|
|
|
labelPane.setBackground(Color.WHITE); |
|
|
|
labelPane.setBackground(Color.WHITE); |
|
|
|
JPanel labelContentPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel labelContentPane = new JPanel(new BorderLayout()); |
|
|
|
UILabel tabLabel = new UILabel(PRODUCT_NEWS); |
|
|
|
UILabel tabLabel = new UILabel(PRODUCT_DYNAMICS); |
|
|
|
tabLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); |
|
|
|
tabLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); |
|
|
|
tabLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
|
|
tabLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
|
|
tabLabel.setPreferredSize(new Dimension(100, 30)); |
|
|
|
tabLabel.setPreferredSize(new Dimension(100, 30)); |
|
|
@ -363,7 +393,12 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); |
|
|
|
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedLabel.setSelected(true); |
|
|
|
selectedLabel.setSelected(true); |
|
|
|
tabLabel.setText(selectedLabel.getText()); |
|
|
|
// 处理产品动态 tab与下方文字展示不一致
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) { |
|
|
|
|
|
|
|
tabLabel.setText(PRODUCT_DYNAMICS); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
tabLabel.setText(selectedLabel.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
readLabel.setVisible(false); |
|
|
|
readLabel.setVisible(false); |
|
|
|
tabPane.repaint(); |
|
|
|
tabPane.repaint(); |
|
|
|
switch (selectedLabel.getCellType()) { |
|
|
|
switch (selectedLabel.getCellType()) { |
|
|
@ -372,20 +407,20 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
switchType(CellType.PRODUCT_NEWS); |
|
|
|
switchType(CellType.PRODUCT_NEWS); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ACTION: |
|
|
|
case ACTION: |
|
|
|
switchType(CellType.ACTION); |
|
|
|
|
|
|
|
currentSearchWorkerManager = settingSearchWorkerManager; |
|
|
|
currentSearchWorkerManager = settingSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.ACTION); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case FILE: |
|
|
|
case FILE: |
|
|
|
switchType(CellType.FILE); |
|
|
|
|
|
|
|
currentSearchWorkerManager = fileSearchWorkerManager; |
|
|
|
currentSearchWorkerManager = fileSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.FILE); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case DOCUMENT: |
|
|
|
case DOCUMENT: |
|
|
|
switchType(CellType.DOCUMENT); |
|
|
|
|
|
|
|
currentSearchWorkerManager = documentWorkerManager; |
|
|
|
currentSearchWorkerManager = documentWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.DOCUMENT); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case PLUGIN: |
|
|
|
case PLUGIN: |
|
|
|
switchType(CellType.PLUGIN); |
|
|
|
|
|
|
|
currentSearchWorkerManager = pluginSearchWorkerManager; |
|
|
|
currentSearchWorkerManager = pluginSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.PLUGIN); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentSearchWorkerManager != null) { |
|
|
|
if (currentSearchWorkerManager != null) { |
|
|
@ -425,27 +460,61 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, String> generateMap() { |
|
|
|
|
|
|
|
JSONArray jsonArray = JSONFactory.createJSON(JSON.ARRAY, AlphaFineConstants.ALPHA_HELP_RECOMMEND); |
|
|
|
|
|
|
|
Map<String, String> linkMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
for (int i = 0, len = jsonArray.size(); i < len; i++) { |
|
|
|
|
|
|
|
JSONObject json = jsonArray.getJSONObject(i); |
|
|
|
|
|
|
|
linkMap.put(json.getString("name"), json.getString("link")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return linkMap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void switchType(CellType cellType) { |
|
|
|
private void switchType(CellType cellType) { |
|
|
|
this.selectedType = cellType; |
|
|
|
this.selectedType = cellType; |
|
|
|
if (StringUtils.isEmpty(searchTextField.getText())) { |
|
|
|
if (StringUtils.isEmpty(searchTextField.getText())) { |
|
|
|
cardLayout.show(resultPane, cellType.getFlagStr4None()); |
|
|
|
cardLayout.show(resultPane, cellType.getFlagStr4None()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
// 当前搜索未结束 不切换loading
|
|
|
|
|
|
|
|
if (!checkSearchLoading()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 所有都搜索都结束 移除loading
|
|
|
|
|
|
|
|
if (isAllSearchOver()) { |
|
|
|
|
|
|
|
resultPane.remove(searchLoadingPane); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 网络异常
|
|
|
|
|
|
|
|
if (checkNetworkError()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cardLayout.show(resultPane, cellType.getFlagStr4Result()); |
|
|
|
cardLayout.show(resultPane, cellType.getFlagStr4Result()); |
|
|
|
checkSearchResult(); |
|
|
|
checkSearchResult(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkNetworkError() { |
|
|
|
|
|
|
|
boolean networkError; |
|
|
|
|
|
|
|
if (selectedType == CellType.PRODUCT_NEWS) { |
|
|
|
|
|
|
|
networkError = productNewsSearchWorkerManager.isNetWorkError(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
networkError = currentSearchWorkerManager.isNetWorkError(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cardLayout.show(resultPane, AlphaFineConstants.NETWORK_ERROR); |
|
|
|
|
|
|
|
return networkError; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkSearchLoading() { |
|
|
|
|
|
|
|
boolean searchOver; |
|
|
|
|
|
|
|
if (selectedType == CellType.PRODUCT_NEWS) { |
|
|
|
|
|
|
|
searchOver = productNewsSearchWorkerManager.isSearchOver(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
searchOver = currentSearchWorkerManager.isSearchOver(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cardLayout.show(resultPane, AlphaFineConstants.LOADING); |
|
|
|
|
|
|
|
return searchOver; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isAllSearchOver() { |
|
|
|
|
|
|
|
return productNewsSearchWorkerManager.isSearchOver() |
|
|
|
|
|
|
|
&& pluginSearchWorkerManager.isSearchOver() |
|
|
|
|
|
|
|
&& fileSearchWorkerManager.isSearchOver() |
|
|
|
|
|
|
|
&& settingSearchWorkerManager.isSearchOver() |
|
|
|
|
|
|
|
&& documentWorkerManager.isSearchOver(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkSearchResult() { |
|
|
|
private void checkSearchResult() { |
|
|
|
if (currentSearchWorkerManager == null) { |
|
|
|
if (currentSearchWorkerManager == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -473,6 +542,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
searchTextField.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); |
|
|
|
searchTextField.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); |
|
|
|
searchTextField.setBackground(Color.WHITE); |
|
|
|
searchTextField.setBackground(Color.WHITE); |
|
|
|
searchTextField.setPreferredSize(new Dimension(300, 60)); |
|
|
|
searchTextField.setPreferredSize(new Dimension(300, 60)); |
|
|
|
|
|
|
|
searchTextField.setBorder(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -482,7 +552,8 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
// 搜索提示框
|
|
|
|
// 搜索提示框
|
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextField); |
|
|
|
clearLabel.setVisible(true); |
|
|
|
|
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
} |
|
|
|
} |
|
|
|
AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); |
|
|
|
AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
@ -507,7 +578,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextField); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -531,7 +602,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
switchType(selectedType); |
|
|
|
switchType(selectedType); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (searchTextField.hasFocus()) { |
|
|
|
else if (searchTextField.hasFocus()) { |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextField); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -593,6 +664,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void doSearch(String text) { |
|
|
|
private void doSearch(String text) { |
|
|
|
|
|
|
|
initSearchLoadingPane(); |
|
|
|
SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); |
|
|
|
SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); |
|
|
|
this.productNewsSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.productNewsSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.settingSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.settingSearchWorkerManager.doSearch(searchTextBean); |
|
|
@ -601,6 +673,34 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
this.pluginSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.pluginSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 仅搜索依赖网络的搜索项 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void reSearch() { |
|
|
|
|
|
|
|
String text = this.searchTextField.getText().toLowerCase(); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(text)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
searchLoadingPane = new SearchLoadingPane(); |
|
|
|
|
|
|
|
SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); |
|
|
|
|
|
|
|
this.productNewsSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
|
|
|
|
this.documentWorkerManager.doSearch(searchTextBean); |
|
|
|
|
|
|
|
this.pluginSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initSearchLoadingPane() { |
|
|
|
|
|
|
|
if (searchLoadingPane == null) { |
|
|
|
|
|
|
|
searchLoadingPane = new SearchLoadingPane(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
resultPane.add(searchLoadingPane, AlphaFineConstants.LOADING); |
|
|
|
|
|
|
|
cardLayout.show(resultPane, AlphaFineConstants.LOADING); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getSearchText() { |
|
|
|
|
|
|
|
return searchTextField.getText(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CellType getSelectedType() { |
|
|
|
public CellType getSelectedType() { |
|
|
|
return selectedType; |
|
|
|
return selectedType; |
|
|
|