|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.fr.plugin.db.redis.ui; |
|
|
|
|
|
|
|
|
|
import com.fanruan.api.design.ui.component.UIIntNumberField; |
|
|
|
|
import com.fanruan.api.design.ui.component.UILabel; |
|
|
|
|
import com.fanruan.api.design.work.ConnectionComboBoxPanel; |
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
@ -29,6 +31,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
|
|
|
|
|
private DefaultListModel listModel = new DefaultListModel(); |
|
|
|
|
private List<DataLoadedListener> listeners = new ArrayList<DataLoadedListener>(); |
|
|
|
|
private UIPlaceholderTextField keysPatternTextField; |
|
|
|
|
private UIIntNumberField dbIndexNumberField; |
|
|
|
|
|
|
|
|
|
public RedisDBConnectionChosePane() { |
|
|
|
|
setLayout(new BorderLayout(4, 4)); |
|
|
|
@ -51,6 +54,10 @@ public class RedisDBConnectionChosePane extends BasicPane {
|
|
|
|
|
keysPatternTextField = new UIPlaceholderTextField(10); |
|
|
|
|
keysPatternTextField.setPlaceholder(DesignKit.i18nText("Plugin-Redis_Keys_Pattern")); |
|
|
|
|
|
|
|
|
|
dbIndexNumberField = new UIIntNumberField(); |
|
|
|
|
dbIndexNumberField.setColumns(2); |
|
|
|
|
dbIndexNumberField.setInt(0); |
|
|
|
|
|
|
|
|
|
JPanel centerPane = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
UIButton searchButton = new UIButton(DesignKit.i18nText("Plugin-Redis_Keys_Pattern_Search")); |
|
|
|
@ -63,6 +70,10 @@ public class RedisDBConnectionChosePane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
centerPane.add(GUICoreKit.createBorderLayoutPane( |
|
|
|
|
keysPatternTextField, BorderLayout.CENTER, |
|
|
|
|
GUICoreKit.createBorderLayoutPane( |
|
|
|
|
new UILabel(DesignKit.i18nText("Plugin-Redis_DB_Simple_Index")), BorderLayout.WEST, |
|
|
|
|
dbIndexNumberField, BorderLayout.CENTER |
|
|
|
|
), BorderLayout.WEST, |
|
|
|
|
searchButton, BorderLayout.EAST), BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
centerPane.add(list, BorderLayout.CENTER); |
|
|
|
@ -97,7 +108,8 @@ public class RedisDBConnectionChosePane extends BasicPane {
|
|
|
|
|
if (StringKit.isEmpty(keysPattern)) { |
|
|
|
|
return ArrayKit.EMPTY_STRING_ARRAY; |
|
|
|
|
} else { |
|
|
|
|
return DataOperator.getInstance().getTableSummary(connection, keysPattern); |
|
|
|
|
String dbIndex = String.valueOf(dbIndexNumberField.getInt()); |
|
|
|
|
return DataOperator.getInstance().getTableSummary(connection, keysPattern, dbIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|