Browse Source

连接集群说明

paid
richie 5 years ago
parent
commit
7ac0fa1f4e
  1. 36
      src/main/java/com/fr/plugin/db/redis/ui/RedisConnectionPane.java

36
src/main/java/com/fr/plugin/db/redis/ui/RedisConnectionPane.java

@ -3,6 +3,7 @@ package com.fr.plugin.db.redis.ui;
import com.fanruan.api.conf.ConfigurationKit; import com.fanruan.api.conf.ConfigurationKit;
import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.ui.component.UIActionLabel; import com.fanruan.api.design.ui.component.UIActionLabel;
import com.fanruan.api.design.ui.component.UIButton;
import com.fanruan.api.design.ui.component.UILabel; import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UIPasswordField; import com.fanruan.api.design.ui.component.UIPasswordField;
import com.fanruan.api.design.ui.component.UITextField; import com.fanruan.api.design.ui.component.UITextField;
@ -12,6 +13,7 @@ import com.fanruan.api.design.ui.layout.TableLayoutKit;
import com.fanruan.api.design.util.GUICoreKit; import com.fanruan.api.design.util.GUICoreKit;
import com.fanruan.api.design.work.DatabaseConnectionPane; import com.fanruan.api.design.work.DatabaseConnectionPane;
import com.fanruan.api.generic.Runner; import com.fanruan.api.generic.Runner;
import com.fanruan.api.util.IOKit;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection; import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig; import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig;
@ -41,11 +43,27 @@ public class RedisConnectionPane extends DatabaseConnectionPane<RedisDatabaseCon
JPanel globalConfigPane = new JPanel(); JPanel globalConfigPane = new JPanel();
GridLayout gridLayout = new GridLayout(1, 3); GridLayout gridLayout = new GridLayout(1, 2);
globalConfigPane.setLayout(gridLayout); globalConfigPane.setLayout(gridLayout);
UIButton helpButton = new UIButton();
helpButton.setIcon(IOKit.readIcon("/com/fr/plugin/db/redis/images/help.png"));
helpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(
SwingUtilities.getWindowAncestor(RedisConnectionPane.this),
DesignKit.i18nText("Plugin-Redis_Cluster_Config_Description"),
DesignKit.i18nText("Plugin-Redis_Connect_Cluster_Description"),
JOptionPane.INFORMATION_MESSAGE
);
}
});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{new UILabel(DesignKit.i18nText("Plugin-Redis_Host") + ":"), hostTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Host") + ":"),
GUICoreKit.createBorderLayoutPane(hostTextField, BorderLayout.CENTER, helpButton, BorderLayout.EAST)},
{new UILabel(DesignKit.i18nText("Plugin-Redis_Port") + ":"), portNumberField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Port") + ":"), portNumberField},
{new UILabel(DesignKit.i18nText("Plugin-Redis_Password") + ":"), passwordTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Password") + ":"), passwordTextField},
{null, globalConfigPane} {null, globalConfigPane}
@ -53,7 +71,6 @@ public class RedisConnectionPane extends DatabaseConnectionPane<RedisDatabaseCon
UIActionLabel poolConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Pool_Config")); UIActionLabel poolConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Pool_Config"));
UIActionLabel proxyConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Proxy_Config")); UIActionLabel proxyConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Proxy_Config"));
UIActionLabel clusterConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Connect_Cluster_Description"));
poolConfigLabel.addActionListener(new ActionListener() { poolConfigLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -94,20 +111,9 @@ public class RedisConnectionPane extends DatabaseConnectionPane<RedisDatabaseCon
dialog.setVisible(true); dialog.setVisible(true);
} }
}); });
clusterConfigLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(
SwingUtilities.getWindowAncestor(RedisConnectionPane.this),
DesignKit.i18nText("Plugin-Redis_Cluster_Config_Description"),
DesignKit.i18nText("Plugin-Redis_Connect_Cluster_Description"),
JOptionPane.INFORMATION_MESSAGE
);
}
});
globalConfigPane.add(GUICoreKit.createFlowPane(poolConfigLabel, FlowLayout.LEFT)); globalConfigPane.add(GUICoreKit.createFlowPane(poolConfigLabel, FlowLayout.LEFT));
globalConfigPane.add(GUICoreKit.createFlowPane(proxyConfigLabel, FlowLayout.LEFT)); globalConfigPane.add(GUICoreKit.createFlowPane(proxyConfigLabel, FlowLayout.LEFT));
globalConfigPane.add(GUICoreKit.createFlowPane(clusterConfigLabel, FlowLayout.LEFT));
double p = TableLayoutKit.PREFERRED; double p = TableLayoutKit.PREFERRED;
double[] rowSize = new double[]{p, p, p, p, p}; double[] rowSize = new double[]{p, p, p, p, p};

Loading…
Cancel
Save