|
|
@ -71,6 +71,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
private static final String PLUGIN_MARK_SHORT = "k:4 "; |
|
|
|
private static final String PLUGIN_MARK_SHORT = "k:4 "; |
|
|
|
private static final String PLUGIN_MARK = "k:shop "; |
|
|
|
private static final String PLUGIN_MARK = "k:shop "; |
|
|
|
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine"); |
|
|
|
private static final String PLACE_HOLDER = Inter.getLocText("FR-Designer_AlphaFine"); |
|
|
|
|
|
|
|
private static final int MAX_SHOW_SIZE = 12; |
|
|
|
|
|
|
|
|
|
|
|
private AlphaFineTextField searchTextField; |
|
|
|
private AlphaFineTextField searchTextField; |
|
|
|
private UIButton closeButton; |
|
|
|
private UIButton closeButton; |
|
|
@ -89,7 +90,6 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
|
|
|
|
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
|
|
|
|
private boolean forceOpen; |
|
|
|
private boolean forceOpen; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlphaFineDialog(Frame parent, boolean forceOpen) { |
|
|
|
public AlphaFineDialog(Frame parent, boolean forceOpen) { |
|
|
|
super(parent); |
|
|
|
super(parent); |
|
|
|
this.forceOpen = forceOpen; |
|
|
|
this.forceOpen = forceOpen; |
|
|
@ -161,12 +161,6 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
}); |
|
|
|
}); |
|
|
|
topPane.add(closeButton, BorderLayout.EAST); |
|
|
|
topPane.add(closeButton, BorderLayout.EAST); |
|
|
|
add(topPane, BorderLayout.CENTER); |
|
|
|
add(topPane, BorderLayout.CENTER); |
|
|
|
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void textChanged(DocumentEvent e) { |
|
|
|
|
|
|
|
doSearch(searchTextField.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -174,7 +168,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initSearchTextField() { |
|
|
|
private void initSearchTextField() { |
|
|
|
searchTextField = new AlphaFineTextField(PLACE_HOLDER); |
|
|
|
searchTextField = new AlphaFineTextField(PLACE_HOLDER); |
|
|
|
initTextFieldKeyListener(); |
|
|
|
initTextFieldListener(); |
|
|
|
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); |
|
|
|
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); |
|
|
|
searchTextField.setBackground(Color.WHITE); |
|
|
|
searchTextField.setBackground(Color.WHITE); |
|
|
|
searchTextField.setBorderPainted(false); |
|
|
|
searchTextField.setBorderPainted(false); |
|
|
@ -228,16 +222,11 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* @param text |
|
|
|
* @param text |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void doSearch(String text) { |
|
|
|
private void doSearch(String text) { |
|
|
|
|
|
|
|
showSearchResult(text); |
|
|
|
if (StringUtils.isBlank(text) || isNeedSearch(text)) { |
|
|
|
|
|
|
|
removeSearchResult(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
showSearchResult(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean isNeedSearch(String text) { |
|
|
|
boolean isNoNeedSearch(String text) { |
|
|
|
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'"); |
|
|
|
return ComparatorUtils.equals(PLACE_HOLDER, text) || text.contains("'") || StringUtils.isBlank(text); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -272,17 +261,17 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
searchResultPane = null; |
|
|
|
searchResultPane = null; |
|
|
|
} |
|
|
|
} |
|
|
|
setSize(AlphaFineConstants.FIELD_SIZE); |
|
|
|
setSize(AlphaFineConstants.FIELD_SIZE); |
|
|
|
repaint(); |
|
|
|
refreshContainer(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 展示搜索结果 |
|
|
|
* 展示搜索结果 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void showSearchResult() { |
|
|
|
private void showSearchResult(String text) { |
|
|
|
if (searchResultPane == null) { |
|
|
|
if (searchResultPane == null) { |
|
|
|
initSearchResultComponents(); |
|
|
|
initSearchResultComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
initSearchWorker(); |
|
|
|
initSearchWorker(text); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -299,8 +288,8 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
searchResultList.setCellRenderer(new ContentCellRender()); |
|
|
|
searchResultList.setCellRenderer(new ContentCellRender()); |
|
|
|
|
|
|
|
|
|
|
|
leftSearchResultPane = new UIScrollPane(searchResultList); |
|
|
|
leftSearchResultPane = new UIScrollPane(searchResultList); |
|
|
|
|
|
|
|
leftSearchResultPane.setBorder(null); |
|
|
|
leftSearchResultPane.setBackground(Color.WHITE); |
|
|
|
leftSearchResultPane.setBackground(Color.WHITE); |
|
|
|
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
|
|
|
|
|
|
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); |
|
|
|
leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); |
|
|
|
rightSearchResultPane = new JPanel(); |
|
|
|
rightSearchResultPane = new JPanel(); |
|
|
|
rightSearchResultPane.setBackground(Color.WHITE); |
|
|
|
rightSearchResultPane.setBackground(Color.WHITE); |
|
|
@ -317,7 +306,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 异步加载搜索结果 |
|
|
|
* 异步加载搜索结果 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initSearchWorker() { |
|
|
|
private void initSearchWorker(final String text) { |
|
|
|
if (this.searchWorker != null && !this.searchWorker.isDone()) { |
|
|
|
if (this.searchWorker != null && !this.searchWorker.isDone()) { |
|
|
|
this.searchWorker.cancel(true); |
|
|
|
this.searchWorker.cancel(true); |
|
|
|
this.searchWorker = null; |
|
|
|
this.searchWorker = null; |
|
|
@ -325,9 +314,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
this.searchWorker = new SwingWorker() { |
|
|
|
this.searchWorker = new SwingWorker() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Object doInBackground() throws Exception { |
|
|
|
protected Object doInBackground() throws Exception { |
|
|
|
resumeLeftPane(); |
|
|
|
rebuildList(text); |
|
|
|
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif"))); |
|
|
|
|
|
|
|
rebuildList(searchTextField.getText().toLowerCase()); |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -347,11 +334,9 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void resumeLeftPane() { |
|
|
|
private void resumeLeftPane() { |
|
|
|
if (searchResultPane != null && defaultPane != null) { |
|
|
|
if (searchResultPane != null && defaultPane != null) { |
|
|
|
rightSearchResultPane.removeAll(); |
|
|
|
|
|
|
|
searchResultPane.remove(defaultPane); |
|
|
|
searchResultPane.remove(defaultPane); |
|
|
|
defaultPane = null; |
|
|
|
defaultPane = null; |
|
|
|
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); |
|
|
|
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); |
|
|
|
refreshContainer(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -394,25 +379,26 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void rebuildList(String searchText) { |
|
|
|
private void rebuildList(String searchText) { |
|
|
|
resetContainer(); |
|
|
|
resetContainer(); |
|
|
|
|
|
|
|
|
|
|
|
if (searchText.startsWith(ADVANCED_SEARCH_MARK)) { |
|
|
|
if (searchText.startsWith(ADVANCED_SEARCH_MARK)) { |
|
|
|
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { |
|
|
|
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getActionList(storeText); |
|
|
|
buildActionList(storeText); |
|
|
|
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { |
|
|
|
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getDocumentList(storeText); |
|
|
|
buildDocumentList(storeText); |
|
|
|
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { |
|
|
|
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getFileList(storeText); |
|
|
|
buildFileList(storeText); |
|
|
|
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { |
|
|
|
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getFileList(searchText); |
|
|
|
buildFileList(searchText); |
|
|
|
} else if (searchText.startsWith(DS_MARK)) { |
|
|
|
} else if (searchText.startsWith(DS_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getFileList(DS_NAME + storeText); |
|
|
|
buildFileList(DS_NAME + storeText); |
|
|
|
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { |
|
|
|
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
storeText = searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length()); |
|
|
|
getPluginList(storeText); |
|
|
|
buildPluginList(storeText); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
storeText = searchText.trim(); |
|
|
|
storeText = searchText.trim(); |
|
|
@ -425,9 +411,11 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* 重置面板 |
|
|
|
* 重置面板 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void resetContainer() { |
|
|
|
private void resetContainer() { |
|
|
|
|
|
|
|
rightSearchResultPane.removeAll(); |
|
|
|
|
|
|
|
splitLabel.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigloading.gif"))); |
|
|
|
|
|
|
|
resumeLeftPane(); |
|
|
|
searchListModel.removeAllElements(); |
|
|
|
searchListModel.removeAllElements(); |
|
|
|
searchListModel.resetSelectedState(); |
|
|
|
searchListModel.resetSelectedState(); |
|
|
|
rightSearchResultPane.removeAll(); |
|
|
|
|
|
|
|
refreshContainer(); |
|
|
|
refreshContainer(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -437,23 +425,22 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* @param searchText |
|
|
|
* @param searchText |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void doNormalSearch(String searchText) { |
|
|
|
private void doNormalSearch(String searchText) { |
|
|
|
getRecentList(searchText); |
|
|
|
buildRecentList(searchText); |
|
|
|
getRecommendList(searchText); |
|
|
|
buildRecommendList(searchText); |
|
|
|
getActionList(searchText); |
|
|
|
buildActionList(searchText); |
|
|
|
getFileList(searchText); |
|
|
|
buildFileList(searchText); |
|
|
|
getDocumentList(searchText); |
|
|
|
buildDocumentList(searchText); |
|
|
|
getPluginList(searchText); |
|
|
|
buildPluginList(searchText); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getDocumentList(final String searchText) { |
|
|
|
private void buildDocumentList(final String searchText) { |
|
|
|
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); |
|
|
|
SearchResult documentModelList = DocumentSearchManager.getDocumentSearchManager().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : documentModelList) { |
|
|
|
for (AlphaCellModel object : documentModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
|
|
|
|
searchListModel.addElement(object); |
|
|
|
searchListModel.addElement(object); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getFileList(final String searchText) { |
|
|
|
private void buildFileList(final String searchText) { |
|
|
|
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); |
|
|
|
SearchResult fileModelList = FileSearchManager.getFileSearchManager().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : fileModelList) { |
|
|
|
for (AlphaCellModel object : fileModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
@ -461,34 +448,30 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getActionList(final String searchText) { |
|
|
|
private void buildActionList(final String searchText) { |
|
|
|
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); |
|
|
|
SearchResult actionModelList = ActionSearchManager.getActionSearchManager().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : actionModelList) { |
|
|
|
for (AlphaCellModel object : actionModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
|
|
|
|
searchListModel.addElement(object); |
|
|
|
searchListModel.addElement(object); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getPluginList(final String searchText) { |
|
|
|
private void buildPluginList(final String searchText) { |
|
|
|
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); |
|
|
|
SearchResult pluginModelList = PluginSearchManager.getPluginSearchManager().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : pluginModelList) { |
|
|
|
for (AlphaCellModel object : pluginModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
|
|
|
|
searchListModel.addElement(object); |
|
|
|
searchListModel.addElement(object); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getRecommendList(final String searchText) { |
|
|
|
private void buildRecommendList(final String searchText) { |
|
|
|
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); |
|
|
|
SearchResult recommendModelList = RecommendSearchManager.getRecommendSearchManager().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : recommendModelList) { |
|
|
|
for (AlphaCellModel object : recommendModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
|
|
|
|
searchListModel.addElement(object); |
|
|
|
searchListModel.addElement(object); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getRecentList(final String searchText) { |
|
|
|
private void buildRecentList(final String searchText) { |
|
|
|
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); |
|
|
|
SearchResult recentModelList = RecentSearchManager.getRecentSearchManger().getLessSearchResult(searchText); |
|
|
|
for (AlphaCellModel object : recentModelList) { |
|
|
|
for (AlphaCellModel object : recentModelList) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
|
|
|
|
searchListModel.addElement(object); |
|
|
|
searchListModel.addElement(object); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -639,11 +622,10 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void HandleMoreOrLessResult(int index, MoreModel selectedValue) { |
|
|
|
private void dealWithMoreOrLessResult(int index, MoreModel selectedValue) { |
|
|
|
if (selectedValue.getContent().equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"))) { |
|
|
|
if (ComparatorUtils.equals(Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), selectedValue.getContent())) { |
|
|
|
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess")); |
|
|
|
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowLess")); |
|
|
|
rebuildShowMoreList(index, selectedValue); |
|
|
|
rebuildShowMoreList(index, selectedValue); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll")); |
|
|
|
selectedValue.setContent(Inter.getLocText("FR-Designer_AlphaFine_ShowAll")); |
|
|
|
rebuildShowMoreList(index, selectedValue); |
|
|
|
rebuildShowMoreList(index, selectedValue); |
|
|
@ -655,8 +637,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); |
|
|
|
UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); |
|
|
|
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0)); |
|
|
|
label.setBorder(BorderFactory.createEmptyBorder(120, 0, 0, 0)); |
|
|
|
rightSearchResultPane.add(label, BorderLayout.CENTER); |
|
|
|
rightSearchResultPane.add(label, BorderLayout.CENTER); |
|
|
|
validate(); |
|
|
|
refreshContainer(); |
|
|
|
repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -667,18 +648,15 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 为textfield添加键盘监听器 |
|
|
|
* 为textfield添加监听器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initTextFieldKeyListener() { |
|
|
|
private void initTextFieldListener() { |
|
|
|
searchTextField.addKeyListener(new KeyAdapter() { |
|
|
|
searchTextField.addKeyListener(new KeyAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_DOWN) { |
|
|
|
if (e.getKeyCode() == KeyEvent.VK_DOWN) { |
|
|
|
searchResultList.requestFocus(); |
|
|
|
searchResultList.requestFocus(); |
|
|
|
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); |
|
|
|
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); |
|
|
|
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
|
|
|
|
doNavigate(); |
|
|
|
|
|
|
|
saveHistory(searchResultList.getSelectedValue()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -690,7 +668,25 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
AlphaFineDialog.this.setVisible(false); |
|
|
|
AlphaFineDialog.this.setVisible(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchTextField.setText(null); |
|
|
|
searchTextField.setText(null); |
|
|
|
|
|
|
|
removeSearchResult(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void textChanged(DocumentEvent e) { |
|
|
|
|
|
|
|
if (isNoNeedSearch(searchTextField.getText())) { |
|
|
|
|
|
|
|
removeSearchResult(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Thread.sleep(10); |
|
|
|
|
|
|
|
doSearch(searchTextField.getText()); |
|
|
|
|
|
|
|
} catch (InterruptedException e1) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e1.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -726,7 +722,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void checkValid() throws Exception { |
|
|
|
public void checkValid() throws Exception { |
|
|
|
|
|
|
|
//不处理
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void doNavigate() { |
|
|
|
private void doNavigate() { |
|
|
@ -778,7 +774,6 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
if (!httpClient.isServerAlive()) { |
|
|
|
if (!httpClient.isServerAlive()) { |
|
|
|
FRLogger.getLogger().error("Failed to sent data to server!"); |
|
|
|
FRLogger.getLogger().error("Failed to sent data to server!"); |
|
|
|
} |
|
|
|
} |
|
|
|
httpClient.setTimeout(5000); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -935,7 +930,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
saveHistory(selectedValue); |
|
|
|
saveHistory(selectedValue); |
|
|
|
} else if (e.getClickCount() == 1) { |
|
|
|
} else if (e.getClickCount() == 1) { |
|
|
|
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { |
|
|
|
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { |
|
|
|
HandleMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); |
|
|
|
dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -971,10 +966,23 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void addElement(AlphaCellModel element) { |
|
|
|
public void addElement(AlphaCellModel element) { |
|
|
|
|
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
int index = myDelegate.size(); |
|
|
|
int index = myDelegate.size(); |
|
|
|
myDelegate.add(element); |
|
|
|
myDelegate.add(element); |
|
|
|
fireContentsChanged(this, index, index); |
|
|
|
fireContentsChanged(this, index, index); |
|
|
|
fireSelectedStateChanged(element, index); |
|
|
|
fireSelectedStateChanged(element, index); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void fireContentsChanged(Object source, int index0, int index1) { |
|
|
|
|
|
|
|
if (myDelegate.size() > MAX_SHOW_SIZE) { |
|
|
|
|
|
|
|
leftSearchResultPane.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
|
|
|
|
|
|
|
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 2)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
leftSearchResultPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
super.fireContentsChanged(source, index0, index1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|