|
|
@ -146,6 +146,8 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
private UILabel clearLabel; |
|
|
|
private UILabel clearLabel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel tabPane; |
|
|
|
|
|
|
|
|
|
|
|
private CellType selectedType; |
|
|
|
private CellType selectedType; |
|
|
|
|
|
|
|
|
|
|
|
private String beforeSearchStr = StringUtils.EMPTY; |
|
|
|
private String beforeSearchStr = StringUtils.EMPTY; |
|
|
@ -365,7 +367,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
labelPane.add(labelContentPane); |
|
|
|
labelPane.add(labelContentPane); |
|
|
|
labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, 30)); |
|
|
|
labelPane.setPreferredSize(new Dimension(AlphaFineConstants.FULL_SIZE.width, 30)); |
|
|
|
|
|
|
|
|
|
|
|
JPanel tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); |
|
|
|
tabPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 10)); |
|
|
|
tabPane.setBackground(Color.WHITE); |
|
|
|
tabPane.setBackground(Color.WHITE); |
|
|
|
List<SelectedLabel> selectedLabelList = createSelectedLabelList(); |
|
|
|
List<SelectedLabel> selectedLabelList = createSelectedLabelList(); |
|
|
|
selectedType = selectedLabelList.get(0).getCellType(); |
|
|
|
selectedType = selectedLabelList.get(0).getCellType(); |
|
|
@ -624,6 +626,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
clearLabel.setVisible(true); |
|
|
|
clearLabel.setVisible(true); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
SearchTooltipPopup.getInstance().show(searchTextFieldWrapperPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tabPane.repaint(); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
timer.start(); |
|
|
|
timer.start(); |
|
|
@ -644,26 +647,56 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
beforeSearchStr = StringUtils.EMPTY; |
|
|
|
beforeSearchStr = StringUtils.EMPTY; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String lowerCaseSearchText = preProcessSearchText(searchTextField.getText().toLowerCase()); |
|
|
|
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) { |
|
|
|
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isNeedSegmentationCheckbox()) { |
|
|
|
|
|
|
|
dealSegmentationSearch(lowerCaseSearchText); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
dealNormalSearch(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getHistorySearch().push(searchTextField.getText()); |
|
|
|
|
|
|
|
doSearch(lowerCaseSearchText); |
|
|
|
|
|
|
|
beforeSearchStr = searchTextField.getText(); |
|
|
|
|
|
|
|
SearchTooltipPopup.getInstance().hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 普通搜索 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void dealNormalSearch() { |
|
|
|
|
|
|
|
String searchText = preProcessSearchText(searchTextField.getText()); |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(getRealSearchText(searchText))) { |
|
|
|
|
|
|
|
segmentationResult = null; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
segmentationResult = new String[]{getRealSearchText(searchText)}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 分词搜索 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void dealSegmentationSearch(String lowerCaseSearchText) { |
|
|
|
//是高级搜索
|
|
|
|
//是高级搜索
|
|
|
|
if (searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)) { |
|
|
|
if (searchTextField.getText().toLowerCase().startsWith(ADVANCED_SEARCH_MARK)) { |
|
|
|
segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(searchTextField.getText().toLowerCase())); |
|
|
|
segmentationResult = SegmentationManager.getInstance().startSegmentation(getStoreText(lowerCaseSearchText)); |
|
|
|
} |
|
|
|
} |
|
|
|
//是普通搜索
|
|
|
|
//是普通搜索
|
|
|
|
else { |
|
|
|
else { |
|
|
|
segmentationResult = SegmentationManager.getInstance().startSegmentation(searchTextField.getText().toLowerCase()); |
|
|
|
segmentationResult = SegmentationManager.getInstance().startSegmentation(lowerCaseSearchText); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(getRealSearchText(searchTextField.getText()))) { |
|
|
|
|
|
|
|
segmentationResult = null; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
segmentationResult = new String[]{getRealSearchText(searchTextField.getText())}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 文本预处理 限制长度 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param text |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private String preProcessSearchText(String text) { |
|
|
|
|
|
|
|
if (text.length() > AlphaFineConstants.LEN_LIMIT) { |
|
|
|
|
|
|
|
return text.substring(0, AlphaFineConstants.LEN_LIMIT); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return text; |
|
|
|
} |
|
|
|
} |
|
|
|
DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getHistorySearch().push(searchTextField.getText()); |
|
|
|
|
|
|
|
doSearch(searchTextField.getText().toLowerCase()); |
|
|
|
|
|
|
|
beforeSearchStr = searchTextField.getText(); |
|
|
|
|
|
|
|
SearchTooltipPopup.getInstance().hide(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void dealWithSearchResult() { |
|
|
|
private void dealWithSearchResult() { |
|
|
@ -717,7 +750,7 @@ public class AlphaFineFrame extends JFrame { |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void reSearch() { |
|
|
|
private void reSearch() { |
|
|
|
String text = this.searchTextField.getText().toLowerCase(); |
|
|
|
String text = preProcessSearchText(this.searchTextField.getText().toLowerCase()); |
|
|
|
if (StringUtils.isEmpty(text)) { |
|
|
|
if (StringUtils.isEmpty(text)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|