Browse Source

优化键盘选择逻辑

master
XiaXiang 8 years ago
parent
commit
3f4c27053a
  1. 2
      designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java
  2. 9
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

2
designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java

@ -24,7 +24,7 @@ public class MoreModel extends AlphaCellModel {
}
public MoreModel(String name, boolean isLoading) {
super(name, null);
super(name, null, CellType.MORE);
this.isLoading = isLoading;
}

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

@ -587,8 +587,9 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP) {
if (e.getKeyCode() == KeyEvent.VK_DOWN && searchTextField.hasFocus()) {
searchResultList.requestFocus();
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
}
}
});
@ -813,7 +814,7 @@ public class AlphaFineDialog extends UIDialog {
*/
@Override
public void setSelectedIndex(int index) {
if (index >= 0 && checkSelectedIndex(index)) {
if (index > 0 && checkSelectedIndex(index)) {
int previousIndex = getSelectedIndex();
super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue();
@ -845,6 +846,10 @@ public class AlphaFineDialog extends UIDialog {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
doNavigate();
saveHistory(getSelectedValue());
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
if (getSelectedIndex() == 1) {
searchTextField.requestFocus();
}
}
}
});

Loading…
Cancel
Save