|
|
@ -127,11 +127,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* 初始化全部组件 |
|
|
|
* 初始化全部组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
searchTextField = new AlphaFineTextField("AlphaFine"); |
|
|
|
initSearchTextField(); |
|
|
|
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); |
|
|
|
|
|
|
|
searchTextField.setBackground(Color.white); |
|
|
|
|
|
|
|
searchTextField.setBorderPainted(false); |
|
|
|
|
|
|
|
searchTextField.initKeyListener(this); |
|
|
|
|
|
|
|
JPanel topPane = new JPanel(new BorderLayout()); |
|
|
|
JPanel topPane = new JPanel(new BorderLayout()); |
|
|
|
UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); |
|
|
|
UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); |
|
|
|
iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); |
|
|
|
iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); |
|
|
@ -171,6 +167,17 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 初始化输入框 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void initSearchTextField() { |
|
|
|
|
|
|
|
searchTextField = new AlphaFineTextField("AlphaFine"); |
|
|
|
|
|
|
|
initTextFieldKeyListener(); |
|
|
|
|
|
|
|
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); |
|
|
|
|
|
|
|
searchTextField.setBackground(Color.white); |
|
|
|
|
|
|
|
searchTextField.setBorderPainted(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -249,7 +256,6 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
private void showSearchResult() { |
|
|
|
private void showSearchResult() { |
|
|
|
if (searchResultPane == null) { |
|
|
|
if (searchResultPane == null) { |
|
|
|
initSearchResultComponents(); |
|
|
|
initSearchResultComponents(); |
|
|
|
initTextFieldKeyListener(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
initSearchWorker(); |
|
|
|
initSearchWorker(); |
|
|
|
} |
|
|
|
} |
|
|
@ -580,18 +586,36 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
initMouseListener(); |
|
|
|
initMouseListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 为textfield添加键盘监听器 |
|
|
|
|
|
|
|
*/ |
|
|
|
private void initTextFieldKeyListener() { |
|
|
|
private void initTextFieldKeyListener() { |
|
|
|
/** |
|
|
|
|
|
|
|
* 为textField添加键盘监听器,按上下方向键时把焦点给list,实现键盘操作 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
|
|
|
|
|
|
doNavigate(); |
|
|
|
|
|
|
|
saveHistory(searchResultList.getSelectedValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
|
|
|
|
int keyCode = e.getKeyCode(); |
|
|
|
|
|
|
|
if (keyCode == KeyEvent.VK_ESCAPE) { |
|
|
|
|
|
|
|
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) { |
|
|
|
|
|
|
|
AlphaFineDialog.this.setVisible(false); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
searchTextField.setText(null); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -709,11 +733,11 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
para.put("token", CodeUtils.md5Encode(date, "", "MD5")); |
|
|
|
para.put("token", CodeUtils.md5Encode(date, "", "MD5")); |
|
|
|
para.put("content", object.toString()); |
|
|
|
para.put("content", object.toString()); |
|
|
|
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true); |
|
|
|
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true); |
|
|
|
httpClient.setTimeout(5000); |
|
|
|
|
|
|
|
httpClient.asGet(); |
|
|
|
httpClient.asGet(); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -826,6 +850,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
showResult(getSelectedValue()); |
|
|
|
ensureIndexIsVisible(getSelectedIndex()); |
|
|
|
ensureIndexIsVisible(getSelectedIndex()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|