|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.fr.design.gui.icombobox; |
|
|
|
package com.fr.design.gui.icombobox; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.data.core.DataCoreUtils; |
|
|
|
import com.fr.data.core.DataCoreUtils; |
|
|
|
import com.fr.data.core.db.TableProcedure; |
|
|
|
import com.fr.data.core.db.TableProcedure; |
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
import com.fr.data.impl.Connection; |
|
|
@ -24,6 +25,8 @@ import javax.swing.tree.TreeCellRenderer; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.Enumeration; |
|
|
|
|
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
|
|
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 实现模糊搜索表名的FRTreeComboBox |
|
|
|
* 实现模糊搜索表名的FRTreeComboBox |
|
|
@ -37,6 +40,10 @@ import java.util.Enumeration; |
|
|
|
public class TableSearchTreeComboBox extends FRTreeComboBox { |
|
|
|
public class TableSearchTreeComboBox extends FRTreeComboBox { |
|
|
|
// 持有父容器,需要实时获取其他组件值
|
|
|
|
// 持有父容器,需要实时获取其他组件值
|
|
|
|
private final ChoosePane parent; |
|
|
|
private final ChoosePane parent; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 保证模糊搜索的原子性操作 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private final ExecutorService singleExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); |
|
|
|
|
|
|
|
|
|
|
|
public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { |
|
|
|
public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { |
|
|
|
super(tree, renderer); |
|
|
|
super(tree, renderer); |
|
|
@ -69,14 +76,16 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void searchExecute() { |
|
|
|
private void searchExecute() { |
|
|
|
UIComboBoxEditor searchEditor = (UIComboBoxEditor) this.getEditor(); |
|
|
|
UIComboBoxEditor searchEditor = (UIComboBoxEditor) this.getEditor(); |
|
|
|
new SwingWorker<Void, Void>() { |
|
|
|
String searchText = (String) searchEditor.getItem(); |
|
|
|
|
|
|
|
singleExecutor.execute( |
|
|
|
|
|
|
|
new SwingWorker<Void, Void>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Void doInBackground() { |
|
|
|
protected Void doInBackground() { |
|
|
|
processTableDataNames( |
|
|
|
processTableDataNames( |
|
|
|
parent.getDSName(), |
|
|
|
parent.getDSName(), |
|
|
|
parent.getConnection(), |
|
|
|
parent.getConnection(), |
|
|
|
parent.getSchema(), |
|
|
|
parent.getSchema(), |
|
|
|
createFilter((String) searchEditor.getItem())); |
|
|
|
createFilter(searchText)); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -86,7 +95,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { |
|
|
|
// 输入框获取焦点
|
|
|
|
// 输入框获取焦点
|
|
|
|
searchEditor.getEditorComponent().requestFocus(); |
|
|
|
searchEditor.getEditorComponent().requestFocus(); |
|
|
|
} |
|
|
|
} |
|
|
|
}.execute(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TableNameFilter createFilter(String text) { |
|
|
|
private TableNameFilter createFilter(String text) { |
|
|
|