Browse Source

代码质量 bug fix

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

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

@ -295,7 +295,7 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
protected void done() { protected void done() {
if (!isCancelled()) { if (!isCancelled() && getModel().getSize() > 0) {
searchResultList.setSelectedIndex(0); searchResultList.setSelectedIndex(0);
showResult(searchResultList.getSelectedValue()); showResult(searchResultList.getSelectedValue());
} }
@ -311,9 +311,7 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void rebuildList(String searchText) { private void rebuildList(String searchText) {
searchResultList.resetSelectedIndex(); resetContainer();
searchListModel.removeAllElements();
searchResultList.resetSelectedIndex();
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());
@ -341,6 +339,17 @@ public class AlphaFineDialog extends UIDialog {
} }
/**
* 重置面板
*/
private void resetContainer() {
searchResultList.resetSelectedIndex();
searchListModel.removeAllElements();
rightSearchResultPane.removeAll();
rightSearchResultPane.validate();
rightSearchResultPane.repaint();
}
/** /**
* 普通搜索 * 普通搜索
* *
@ -570,8 +579,6 @@ public class AlphaFineDialog extends UIDialog {
}); });
} }
/** /**
* 窗口拖拽 * 窗口拖拽
*/ */
@ -773,6 +780,11 @@ public class AlphaFineDialog extends UIDialog {
this.storeText = storeText; this.storeText = storeText;
} }
//------------------------------------------------------
//----------------------自定义list-----------------------
//------------------------------------------------------
/** /**
* 自定义JList * 自定义JList
*/ */
@ -795,7 +807,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
@Override @Override
public void setSelectedIndex(int index) { public void setSelectedIndex(int index) {
if (index >= 0 && index <= getModel().getSize()) { if (index >=0 && checkSelectedIndex(index)) {
int previousIndex = getSelectedIndex(); int previousIndex = getSelectedIndex();
super.setSelectedIndex(index); super.setSelectedIndex(index);
AlphaCellModel cellModel = getSelectedValue(); AlphaCellModel cellModel = getSelectedValue();
@ -811,6 +823,11 @@ public class AlphaFineDialog extends UIDialog {
ensureIndexIsVisible(getSelectedIndex()); ensureIndexIsVisible(getSelectedIndex());
} }
private boolean checkSelectedIndex(int index) {
int size = getModel().getSize();
return size > 0 && index < size;
}
private void initListListener() { private void initListListener() {
/** /**
@ -834,7 +851,7 @@ public class AlphaFineDialog extends UIDialog {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
int selectedIndex = getSelectedIndex(); int selectedIndex = getSelectedIndex();
AlphaCellModel selectedValue = getSelectedValue(); AlphaCellModel selectedValue = getSelectedValue();
if (e.getClickCount() == 2) { if (e.getClickCount() == 2 && !selectedValue.hasNoResult()) {
doNavigate(); doNavigate();
saveHistory(selectedValue); saveHistory(selectedValue);
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {

Loading…
Cancel
Save