Browse Source

快捷键响应

master
XiaXiang 7 years ago
parent
commit
c1e327af06
  1. 28
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

28
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -670,6 +670,8 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setText(null); searchTextField.setText(null);
removeSearchResult(); removeSearchResult();
} }
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
dealWithSearchResult(searchResultList.getSelectedValue());
} }
} }
}); });
@ -694,6 +696,15 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 处理搜索结果
* @param selectedValue
*/
private void dealWithSearchResult(AlphaCellModel selectedValue) {
doNavigate();
saveLocalHistory(selectedValue);
}
/** /**
* 当鼠标在搜索界面边界外点击时触发 * 当鼠标在搜索界面边界外点击时触发
*/ */
@ -725,6 +736,9 @@ public class AlphaFineDialog extends UIDialog {
//不处理 //不处理
} }
/**
* 导航到结果页面
*/
private void doNavigate() { private void doNavigate() {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
final AlphaCellModel model = searchResultList.getSelectedValue(); final AlphaCellModel model = searchResultList.getSelectedValue();
@ -732,15 +746,15 @@ public class AlphaFineDialog extends UIDialog {
} }
/** /**
* 保存本地本地常用 * 保存结果到本地本地常用
* *
* @param cellModel * @param cellModel
*/ */
private void saveHistory(AlphaCellModel cellModel) { private void saveLocalHistory(AlphaCellModel cellModel) {
RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger();
recentSearchManager.addRecentModel(storeText, cellModel); recentSearchManager.addRecentModel(storeText, cellModel);
recentSearchManager.saveXMLFile(); recentSearchManager.saveXMLFile();
sendToServer(storeText, cellModel); sendDataToServer(storeText, cellModel);
} }
@ -750,7 +764,7 @@ public class AlphaFineDialog extends UIDialog {
* @param searchKey * @param searchKey
* @param cellModel * @param cellModel
*/ */
private void sendToServer(String searchKey, AlphaCellModel cellModel) { private void sendDataToServer(String searchKey, AlphaCellModel cellModel) {
if (cellModel.isNeedToSendToServer()) { if (cellModel.isNeedToSendToServer()) {
String username = ConfigManager.getProviderInstance().getBbsUsername(); String username = ConfigManager.getProviderInstance().getBbsUsername();
String uuid = DesignerEnvManager.getEnvManager().getUUID(); String uuid = DesignerEnvManager.getEnvManager().getUUID();
@ -908,8 +922,7 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
doNavigate(); dealWithSearchResult(getSelectedValue());
saveHistory(getSelectedValue());
} else if (e.getKeyCode() == KeyEvent.VK_UP) { } else if (e.getKeyCode() == KeyEvent.VK_UP) {
if (getSelectedIndex() == 1) { if (getSelectedIndex() == 1) {
searchTextField.requestFocus(); searchTextField.requestFocus();
@ -926,8 +939,7 @@ public class AlphaFineDialog extends UIDialog {
int selectedIndex = getSelectedIndex(); int selectedIndex = getSelectedIndex();
AlphaCellModel selectedValue = getSelectedValue(); AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2 && selectedValue.hasAction()) { if (e.getClickCount() == 2 && selectedValue.hasAction()) {
doNavigate(); dealWithSearchResult(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()) {
dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue); dealWithMoreOrLessResult(selectedIndex, (MoreModel) selectedValue);

Loading…
Cancel
Save