Browse Source

Merge pull request #967 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit '886bc4ef7ad01f2914cd03ea78fcbcbc74d58296':
  bug fix PMD
  bug fix 方向键选择bug
  bug fix
master
superman 8 years ago
parent
commit
0e96409e6f
  1. 23
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 4
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

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

@ -587,9 +587,8 @@ public class AlphaFineDialog extends UIDialog {
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 && searchTextField.hasFocus()) { if (e.getKeyCode() == KeyEvent.VK_DOWN) {
searchResultList.requestFocus(); searchResultList.requestFocus();
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} }
} }
}); });
@ -836,10 +835,6 @@ public class AlphaFineDialog extends UIDialog {
} }
private void initListListener() { private void initListListener() {
/**
* 为list添加键盘监听器
*/
addKeyListener(new KeyAdapter() { addKeyListener(new KeyAdapter() {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
@ -854,9 +849,6 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
/**
* 为list添加鼠标监听器
*/
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -873,21 +865,22 @@ public class AlphaFineDialog extends UIDialog {
} }
}); });
/**
*单击时触发右侧面板展示搜索结果
*/
addListSelectionListener(new ListSelectionListener() { addListSelectionListener(new ListSelectionListener() {
@Override @Override
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting() && getSelectedValue() != null) { if (!e.getValueIsAdjusting() && getSelectedValue() != null) {
showResult(getSelectedValue()); showResult(getSelectedValue());
} }
} }
}); });
}
addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setSelectedIndex(searchResultList.getSelectedIndex() + 1);
}
});
}
} }
/** /**

4
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -230,7 +230,9 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
Collections.sort(resultModelList); Collections.sort(resultModelList);
int size = resultModelList.size(); int size = resultModelList.size();
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
return (SearchResult) resultModelList.subList(0, MAX_SIZE); SearchResult result = new SearchResult();
result.addAll(resultModelList.subList(0, MAX_SIZE));
return result;
} }
return resultModelList; return resultModelList;
} }

Loading…
Cancel
Save