|
|
@ -77,6 +77,18 @@ import javax.swing.Timer; |
|
|
|
public class AlphaFineFrame extends JFrame { |
|
|
|
public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private static final String ADVANCED_SEARCH_MARK = "k:"; |
|
|
|
private static final String ADVANCED_SEARCH_MARK = "k:"; |
|
|
|
|
|
|
|
private static final String ACTION_MARK_SHORT = "k:1 "; |
|
|
|
|
|
|
|
private static final String ACTION_MARK = "k:setting "; |
|
|
|
|
|
|
|
private static final String DOCUMENT_MARK_SHORT = "k:2 "; |
|
|
|
|
|
|
|
private static final String DOCUMENT_MARK = "k:help "; |
|
|
|
|
|
|
|
private static final String FILE_MARK_SHORT = "k:3 "; |
|
|
|
|
|
|
|
private static final String FILE_MARK = "k:reportlets "; |
|
|
|
|
|
|
|
private static final String CPT_MARK = "k:cpt "; |
|
|
|
|
|
|
|
private static final String FRM_MARK = "k:frm "; |
|
|
|
|
|
|
|
private static final String DS_MARK = "k:ds "; |
|
|
|
|
|
|
|
private static final String DS_NAME = "dsname=\""; |
|
|
|
|
|
|
|
private static final String PLUGIN_MARK_SHORT = "k:4 "; |
|
|
|
|
|
|
|
private static final String PLUGIN_MARK = "k:shop "; |
|
|
|
|
|
|
|
|
|
|
|
private static final int TIMER_DELAY = 300; |
|
|
|
private static final int TIMER_DELAY = 300; |
|
|
|
|
|
|
|
|
|
|
@ -282,6 +294,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
searchTextField.setText(StringUtils.EMPTY); |
|
|
|
searchTextField.setText(StringUtils.EMPTY); |
|
|
|
|
|
|
|
beforeSearchStr = StringUtils.EMPTY; |
|
|
|
clearLabel.setVisible(false); |
|
|
|
clearLabel.setVisible(false); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -354,6 +367,87 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
JPanel tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); |
|
|
|
JPanel tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); |
|
|
|
tabPane.setBackground(Color.WHITE); |
|
|
|
tabPane.setBackground(Color.WHITE); |
|
|
|
|
|
|
|
List<SelectedLabel> selectedLabelList = createSelectedLabelList(); |
|
|
|
|
|
|
|
selectedType = selectedLabelList.get(0).getCellType(); |
|
|
|
|
|
|
|
// 第一个tab 非产品动态
|
|
|
|
|
|
|
|
if (selectedType != CellType.PRODUCT_NEWS) { |
|
|
|
|
|
|
|
tabLabel.setText(selectedLabelList.get(0).getText()); |
|
|
|
|
|
|
|
readLabel.setVisible(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (SelectedLabel selectedLabel : selectedLabelList) { |
|
|
|
|
|
|
|
selectedLabel.addMouseListener(createMouseListener(selectedLabelList, selectedLabel, tabPane, tabLabel, readLabel)); |
|
|
|
|
|
|
|
tabPane.add(selectedLabel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
showPane.add(tabPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
showPane.add(labelPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
showPane.add(resultPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
return showPane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MouseAdapter createMouseListener(List<SelectedLabel> selectedLabelList, SelectedLabel selectedLabel, |
|
|
|
|
|
|
|
JPanel tabPane, UILabel tabLabel, UILabel readLabel) { |
|
|
|
|
|
|
|
return new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
|
|
|
for (SelectedLabel label : selectedLabelList) { |
|
|
|
|
|
|
|
label.setSelected(false); |
|
|
|
|
|
|
|
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
selectedLabel.setSelected(true); |
|
|
|
|
|
|
|
// 处理产品动态 tab与下方文字展示不一致
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) { |
|
|
|
|
|
|
|
tabLabel.setText(PRODUCT_DYNAMICS); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
tabLabel.setText(selectedLabel.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
readLabel.setVisible(false); |
|
|
|
|
|
|
|
tabPane.repaint(); |
|
|
|
|
|
|
|
switch (selectedLabel.getCellType()) { |
|
|
|
|
|
|
|
case PRODUCT_NEWS: |
|
|
|
|
|
|
|
readLabel.setVisible(true); |
|
|
|
|
|
|
|
switchType(CellType.PRODUCT_NEWS); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ACTION: |
|
|
|
|
|
|
|
currentSearchWorkerManager = settingSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.ACTION); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FILE: |
|
|
|
|
|
|
|
currentSearchWorkerManager = fileSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.FILE); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case DOCUMENT: |
|
|
|
|
|
|
|
currentSearchWorkerManager = documentWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.DOCUMENT); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case PLUGIN: |
|
|
|
|
|
|
|
currentSearchWorkerManager = pluginSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.PLUGIN); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (currentSearchWorkerManager != null) { |
|
|
|
|
|
|
|
AlphaFineList alphaFineList = currentSearchWorkerManager.getSearchResultList(); |
|
|
|
|
|
|
|
if (alphaFineList != null) { |
|
|
|
|
|
|
|
alphaFineList.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Color defaultColor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
defaultColor = selectedLabel.getForeground(); |
|
|
|
|
|
|
|
selectedLabel.setForeground(AlphaFineConstants.SUSPENDED_COLOR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
selectedLabel.setForeground(defaultColor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<SelectedLabel> createSelectedLabelList() { |
|
|
|
List<SelectedLabel> selectedLabelList = new ArrayList<>(); |
|
|
|
List<SelectedLabel> selectedLabelList = new ArrayList<>(); |
|
|
|
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); |
|
|
|
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); |
|
|
|
if (alphaFineConfigManager.isProductDynamics()) { |
|
|
|
if (alphaFineConfigManager.isProductDynamics()) { |
|
|
@ -371,74 +465,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
if (alphaFineConfigManager.isContainPlugin()) { |
|
|
|
if (alphaFineConfigManager.isContainPlugin()) { |
|
|
|
selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN)); |
|
|
|
selectedLabelList.add(new SelectedLabel(PLUGIN, CellType.PLUGIN)); |
|
|
|
} |
|
|
|
} |
|
|
|
selectedType = selectedLabelList.get(0).getCellType(); |
|
|
|
return selectedLabelList; |
|
|
|
for (SelectedLabel selectedLabel : selectedLabelList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectedLabel.addMouseListener(new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
|
|
|
for (SelectedLabel label : selectedLabelList) { |
|
|
|
|
|
|
|
label.setSelected(false); |
|
|
|
|
|
|
|
label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
selectedLabel.setSelected(true); |
|
|
|
|
|
|
|
// 处理产品动态 tab与下方文字展示不一致
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(selectedLabel.getText().trim(), PRODUCT_NEWS)) { |
|
|
|
|
|
|
|
tabLabel.setText(PRODUCT_DYNAMICS); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
tabLabel.setText(selectedLabel.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
readLabel.setVisible(false); |
|
|
|
|
|
|
|
tabPane.repaint(); |
|
|
|
|
|
|
|
switch (selectedLabel.getCellType()) { |
|
|
|
|
|
|
|
case PRODUCT_NEWS: |
|
|
|
|
|
|
|
readLabel.setVisible(true); |
|
|
|
|
|
|
|
switchType(CellType.PRODUCT_NEWS); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case ACTION: |
|
|
|
|
|
|
|
currentSearchWorkerManager = settingSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.ACTION); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FILE: |
|
|
|
|
|
|
|
currentSearchWorkerManager = fileSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.FILE); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case DOCUMENT: |
|
|
|
|
|
|
|
currentSearchWorkerManager = documentWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.DOCUMENT); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case PLUGIN: |
|
|
|
|
|
|
|
currentSearchWorkerManager = pluginSearchWorkerManager; |
|
|
|
|
|
|
|
switchType(CellType.PLUGIN); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (currentSearchWorkerManager != null) { |
|
|
|
|
|
|
|
AlphaFineList alphaFineList = currentSearchWorkerManager.getSearchResultList(); |
|
|
|
|
|
|
|
if (alphaFineList != null) { |
|
|
|
|
|
|
|
alphaFineList.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Color defaultColor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
defaultColor = selectedLabel.getForeground(); |
|
|
|
|
|
|
|
selectedLabel.setForeground(AlphaFineConstants.SUSPENDED_COLOR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
selectedLabel.setForeground(defaultColor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
tabPane.add(selectedLabel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
showPane.add(tabPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
showPane.add(labelPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
showPane.add(resultPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
return showPane; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fireOneClickRead() { |
|
|
|
private void fireOneClickRead() { |
|
|
@ -543,6 +570,8 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
if (StringUtils.isNotEmpty(searchTextField.getText())) { |
|
|
|
clearLabel.setVisible(true); |
|
|
|
clearLabel.setVisible(true); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
beforeSearchStr = StringUtils.EMPTY; |
|
|
|
} |
|
|
|
} |
|
|
|
AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); |
|
|
|
AlphaFineToolTipList alphaFineToolTipList = SearchTooltipPopup.getInstance().getAlphaFineToolTipList(); |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
@ -590,6 +619,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
SearchTooltipPopup.getInstance().hide(); |
|
|
|
SearchTooltipPopup.getInstance().hide(); |
|
|
|
clearLabel.setVisible(false); |
|
|
|
clearLabel.setVisible(false); |
|
|
|
switchType(selectedType); |
|
|
|
switchType(selectedType); |
|
|
|
|
|
|
|
beforeSearchStr = StringUtils.EMPTY; |
|
|
|
} else if (searchTextField.hasFocus()) { |
|
|
|
} else if (searchTextField.hasFocus()) { |
|
|
|
clearLabel.setVisible(true); |
|
|
|
clearLabel.setVisible(true); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
@ -659,7 +689,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private void doSearch(String text) { |
|
|
|
private void doSearch(String text) { |
|
|
|
initSearchLoadingPane(); |
|
|
|
initSearchLoadingPane(); |
|
|
|
SearchTextBean searchTextBean = new SearchTextBean(text, segmentationResult); |
|
|
|
SearchTextBean searchTextBean = generateSearchTextBean(text); |
|
|
|
this.productNewsSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.productNewsSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.settingSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.settingSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.fileSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.fileSearchWorkerManager.doSearch(searchTextBean); |
|
|
@ -667,6 +697,21 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
this.pluginSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
this.pluginSearchWorkerManager.doSearch(searchTextBean); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SearchTextBean generateSearchTextBean(String searchText) { |
|
|
|
|
|
|
|
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK) |
|
|
|
|
|
|
|
|| searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { |
|
|
|
|
|
|
|
return new SearchTextBean(StringUtils.EMPTY, new String[]{getStoreText(searchText)}); |
|
|
|
|
|
|
|
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK) |
|
|
|
|
|
|
|
|| searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK) |
|
|
|
|
|
|
|
|| searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { |
|
|
|
|
|
|
|
return new SearchTextBean(getStoreText(searchText), new String[]{getStoreText(searchText)}); |
|
|
|
|
|
|
|
} else if (searchText.startsWith(DS_MARK)) { |
|
|
|
|
|
|
|
return new SearchTextBean(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return new SearchTextBean(searchText, segmentationResult == null ? new String[]{} : segmentationResult); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 仅搜索依赖网络的搜索项 |
|
|
|
* 仅搜索依赖网络的搜索项 |
|
|
|
* |
|
|
|
* |
|
|
@ -772,6 +817,9 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
public void setVisible(boolean b) { |
|
|
|
public void setVisible(boolean b) { |
|
|
|
super.setVisible(b); |
|
|
|
super.setVisible(b); |
|
|
|
QuestionWindow.getInstance().setVisible(!b); |
|
|
|
QuestionWindow.getInstance().setVisible(!b); |
|
|
|
|
|
|
|
if (!b) { |
|
|
|
|
|
|
|
AlphaFineHelper.resetAlphaFineDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|