Browse Source

feat:插件内的方法替换为finekit中的

paid
zjz1993 5 years ago
parent
commit
8aaba80292
  1. BIN
      lib/finekit-10.0-20190828.jar
  2. 4
      src/main/java/com/fr/plugin/db/redis/RedisScriptTableDataDefine.java
  3. 7
      src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java
  4. 12
      src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java
  5. 36
      src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
  6. 14
      src/main/java/com/fr/plugin/db/redis/core/RedisNode.java
  7. 14
      src/main/java/com/fr/plugin/db/redis/core/RedisPool.java
  8. 6
      src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java
  9. 12
      src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java
  10. 10
      src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
  11. 4
      src/main/java/com/fr/plugin/db/redis/core/order/OrderValue.java
  12. 15
      src/main/java/com/fr/plugin/db/redis/core/order/impl/FormulaOrderValue.java
  13. 16
      src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionProxyConfig.java
  14. 4
      src/main/java/com/fr/plugin/db/redis/core/visit/AbstractVisitor.java
  15. 4
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/MGetVisitor.java
  16. 7
      src/main/java/com/fr/plugin/db/redis/help/Console.java
  17. 7
      src/main/java/com/fr/plugin/db/redis/help/client/BaseRedisClient.java
  18. 18
      src/main/java/com/fr/plugin/db/redis/help/client/RedisNashornClient.java
  19. 16
      src/main/java/com/fr/plugin/db/redis/help/client/RedisV8Client.java
  20. 19
      src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java
  21. 21
      src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java
  22. 18
      src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java
  23. 12
      src/main/java/com/fr/plugin/db/redis/ui/RedisScriptPane.java
  24. 4
      src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java
  25. 4
      src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java
  26. 12
      src/main/java/com/fr/plugin/db/redis/ui/pool/RedisConnectionPoolConfigPane.java
  27. 17
      src/main/java/com/fr/plugin/db/redis/ui/proxy/RedisConnectionProxyConfigPane.java

BIN
lib/finekit-10.0-20190828.jar

Binary file not shown.

4
src/main/java/com/fr/plugin/db/redis/RedisScriptTableDataDefine.java

@ -4,9 +4,9 @@ import com.fr.base.TableData;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.impl.AbstractTableDataDefineProvider;
import com.fr.locale.InterProviderFactory;
import com.fr.plugin.db.redis.core.RedisScriptTableData;
import com.fr.plugin.db.redis.ui.RedisScriptTableDataPane;
import com.fanruan.api.i18n.I18nKit;
/**
* @author richie
@ -37,7 +37,7 @@ public class RedisScriptTableDataDefine extends AbstractTableDataDefineProvider
@Override
public String nameForTableData() {
return InterProviderFactory.getProvider().getLocText("Plugin-Redis_Script_Table_Data");
return I18nKit.getLocText("Plugin-Redis_Script_Table_Data");
}
@Override

7
src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java

@ -1,9 +1,10 @@
package com.fr.plugin.db.redis.conf;
import com.fr.file.XMLFileManager;
import com.fanruan.api.xml.XmlKit;
import com.fanruan.api.xml.comopnent.XMLFileManager;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
@ -65,7 +66,7 @@ public class ShellConfigManager extends XMLFileManager implements ShellConfigMan
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
shellText = reader.getAttrAsString("shell", StringUtils.EMPTY);
shellText = reader.getAttrAsString("shell", StringKit.EMPTY);
}
}

12
src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java

@ -1,10 +1,10 @@
package com.fr.plugin.db.redis.core;
import com.fr.general.GeneralUtils;
import com.fanruan.api.util.GeneralKit;
import com.fanruan.api.log.LogKit;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.ScriptFactory;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.workspace.WorkContext;
import javax.script.ScriptEngine;
@ -46,7 +46,7 @@ public class DataWrapper<T> {
}
public void transform(String script) throws ScriptException {
if (StringUtils.isBlank(script)) {
if (StringKit.isBlank(script)) {
return;
}
String scriptText = null;
@ -55,7 +55,7 @@ public class DataWrapper<T> {
FileInputStream in = new FileInputStream(new File(readAndRenderScriptFile(script)));
scriptText = IOUtils.inputStream2String(in);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
LogKit.error(e.getMessage(), e);
}
} else {
scriptText = String.format("(function(){%s})()", script);
@ -70,7 +70,7 @@ public class DataWrapper<T> {
Object vector = map.get("column");
List<String> names = new ArrayList<String>();
for (Object name : ((Map)vector).values()) {
names.add(GeneralUtils.objectToString(name));
names.add(GeneralKit.objectToString(name));
}
columnNames = names.toArray(new String[0]);
Object content = map.get("content");

36
src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java

@ -5,12 +5,12 @@ import com.fr.config.holder.factory.Holders;
import com.fr.config.holder.impl.ColConf;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.locale.InterProviderFactory;
import com.fanruan.api.i18n.I18nKit;
import com.fr.plugin.db.redis.core.emb.Redis;
import com.fr.security.SecurityToolbox;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fanruan.api.security.SecurityKit;
import com.fanruan.api.util.ArrayKit;
import com.fanruan.api.util.ReflectKit;
import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.redis.clients.jedis.Jedis;
@ -24,9 +24,9 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
private static final int DEFAULT_REDIS_PORT = 6379;
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
private Conf<String> host = Holders.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT);
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
private Conf<String> password = Holders.simple(StringKit.EMPTY);
public RedisDatabaseConnection() {
@ -82,8 +82,8 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@Override
public String[] summary(String... args) {
if (ArrayUtils.isEmpty(args)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
if (ArrayKit.isEmpty(args)) {
return ArrayKit.EMPTY_STRING_ARRAY;
} else {
Redis redis = createRedisClient();
Set<String> keys = redis.getClient().keys(args[0]);
@ -96,16 +96,16 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@Override
public String connectMessage(boolean status) {
if (status) {
return InterProviderFactory.getProvider().getLocText("Plugin-Redis_Connection_Successfully") + "!";
return I18nKit.getLocText("Plugin-Redis_Connection_Successfully") + "!";
} else {
return InterProviderFactory.getProvider().getLocText("Plugin-Redis_Connection_Failed") + "!";
return I18nKit.getLocText("Plugin-Redis_Connection_Failed") + "!";
}
}
@Override
public void addConnection(List<String> list, String connectionName, Class<? extends Connection>[] acceptTypes) {
for (Class<? extends com.fr.data.impl.Connection> accept : acceptTypes) {
if (StableUtils.classInstanceOf(getClass(), accept)) {
if (ReflectKit.classInstanceOf(getClass(), accept)) {
list.add(connectionName);
break;
}
@ -143,11 +143,11 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if ("Attr".equals(tagName)) {
setHost(reader.getAttrAsString("host", StringUtils.EMPTY));
setHost(reader.getAttrAsString("host", StringKit.EMPTY));
setPort(reader.getAttrAsInt("port", DEFAULT_REDIS_PORT));
String pwd = reader.getAttrAsString("password", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(pwd)) {
setPassword(SecurityToolbox.encrypt(pwd));
String pwd = reader.getAttrAsString("password", StringKit.EMPTY);
if (StringKit.isNotEmpty(pwd)) {
setPassword(SecurityKit.encrypt(pwd));
}
}
}
@ -159,8 +159,8 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
writer.startTAG("Attr");
writer.attr("host", getHost());
writer.attr("port", getPort());
if (StringUtils.isNotEmpty(getPassword())) {
writer.attr("password", SecurityToolbox.decrypt(getPassword()));
if (StringKit.isNotEmpty(getPassword())) {
writer.attr("password", SecurityKit.decrypt(getPassword()));
}
writer.end();
}

14
src/main/java/com/fr/plugin/db/redis/core/RedisNode.java

@ -3,8 +3,8 @@ package com.fr.plugin.db.redis.core;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.config.utils.UniqueKey;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.AssistKit;
import com.fanruan.api.util.StringKit;
/**
* @author richie
@ -15,9 +15,9 @@ public class RedisNode extends UniqueKey {
public static final int DEFAULT_REDIS_PORT = 6379;
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
private Conf<String> host = Holders.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT);
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
private Conf<String> password = Holders.simple(StringKit.EMPTY);
public RedisNode(String host, int port, String password) {
this.setHost(host);
@ -52,14 +52,14 @@ public class RedisNode extends UniqueKey {
@Override
public boolean equals(Object obj) {
return obj instanceof RedisNode
&& AssistUtils.equals(((RedisNode) obj).getHost(), getHost())
&& AssistKit.equals(((RedisNode) obj).getHost(), getHost())
&& ((RedisNode) obj).getPort() == getPort()
&& AssistUtils.equals(((RedisNode) obj).getPassword(), getPassword());
&& AssistKit.equals(((RedisNode) obj).getPassword(), getPassword());
}
@Override
public int hashCode() {
return AssistUtils.hashCode(getHost(), getPort(), getPassword());
return AssistKit.hashCode(getHost(), getPort(), getPassword());
}
@Override

14
src/main/java/com/fr/plugin/db/redis/core/RedisPool.java

@ -2,7 +2,7 @@ package com.fr.plugin.db.redis.core;
import com.fr.config.Configuration;
import com.fr.config.holder.ConfigChangeListener;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.emb.Redis;
import com.fr.plugin.db.redis.core.emb.impl.ProxyRedis;
import com.fr.plugin.db.redis.core.emb.impl.SimpleRedis;
@ -11,7 +11,7 @@ import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig;
import com.fr.ssh.jsch.JSch;
import com.fr.ssh.jsch.JSchException;
import com.fr.ssh.jsch.Session;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.third.redis.clients.jedis.Jedis;
import com.fr.third.redis.clients.jedis.JedisCluster;
import com.fr.third.redis.clients.jedis.JedisPool;
@ -60,7 +60,7 @@ public class RedisPool {
try {
return createJedisBySSH(host, port, password);
} catch (JSchException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
LogKit.error(e.getMessage(), e);
}
} else {
String feature = host + ":" + port + "@" + password;
@ -109,7 +109,7 @@ public class RedisPool {
config.setTestWhileIdle(false);
//逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
config.setTimeBetweenEvictionRunsMillis(-1);
if (StringUtils.isNotBlank(password)) {
if (StringKit.isNotBlank(password)) {
return new JedisPool(config, host, port, poolConfig.getTimeout(), password);
} else {
return new JedisPool(config, host, port, poolConfig.getTimeout());
@ -119,11 +119,11 @@ public class RedisPool {
private Redis createJedisBySSH(String host, int port, String password) throws JSchException {
RedisConnectionProxyConfig proxyConfig = RedisConnectionProxyConfig.getInstance();
JSch jsch = new JSch();
if (StringUtils.isNotBlank(proxyConfig.getPrivateKeyPath())) {
if (StringKit.isNotBlank(proxyConfig.getPrivateKeyPath())) {
jsch.addIdentity(proxyConfig.getPrivateKeyPath());
}
Session session = jsch.getSession(proxyConfig.getUsername(), proxyConfig.getHost(), proxyConfig.getPort());
if (StringUtils.isNotBlank(proxyConfig.getPassword())) {
if (StringKit.isNotBlank(proxyConfig.getPassword())) {
session.setPassword(proxyConfig.getPassword());
}
session.setConfig("StrictHostKeyChecking", "no");
@ -133,7 +133,7 @@ public class RedisPool {
Jedis jedis = new Jedis(host, newPort);
if (StringUtils.isNotBlank(password)) {
if (StringKit.isNotBlank(password)) {
jedis.auth(password);
}
return new ProxyRedis(session, jedis);

6
src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java

@ -13,14 +13,14 @@ import com.fr.file.DatasourceManager;
import com.fr.general.data.DataModel;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.intelli.record.Focus;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue;
import com.fr.plugin.db.redis.util.RedisUtils;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -36,7 +36,7 @@ public class RedisScriptTableData extends AbstractParameterTableData {
private Conf<Connection> database = Holders.obj(null, Connection.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private Conf<String> script = Holders.simple(StringUtils.EMPTY);
private Conf<String> script = Holders.simple(StringKit.EMPTY);
public void setDatabase(Connection c) {
this.database.set(c);

12
src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java

@ -15,15 +15,15 @@ import com.fr.general.data.DataModel;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue;
import com.fr.plugin.db.redis.util.RedisUtils;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fanruan.api.util.ArrayKit;
import com.fanruan.api.util.StringKit;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -37,8 +37,8 @@ public class RedisTableData extends AbstractParameterTableData {
private static final long serialVersionUID = 7017455818551800001L;
private Conf<Connection> database = Holders.obj(null, Connection.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private Conf<String> query = Holders.simple(StringUtils.EMPTY);
private Conf<String> script = Holders.simple(StringUtils.EMPTY);
private Conf<String> query = Holders.simple(StringKit.EMPTY);
private Conf<String> script = Holders.simple(StringKit.EMPTY);
public void setDatabase(Connection c) {
this.database.set(c);
@ -97,7 +97,7 @@ public class RedisTableData extends AbstractParameterTableData {
RedisUtils.calculateQuery(query.get(), ps),
RedisUtils.calculateQuery(script.get(), ps),
rowCount);
FineLoggerFactory.getLogger().info("Build data model spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Build data model spend time {} ms.", System.currentTimeMillis() - start);
return model;
}
}

10
src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java

@ -2,14 +2,14 @@ package com.fr.plugin.db.redis.core;
import com.fr.base.Parameter;
import com.fr.data.AbstractDataModel;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.db.redis.core.emb.Redis;
import com.fr.plugin.db.redis.core.visit.VisitorFactory;
import com.fr.plugin.db.redis.util.RedisUtils;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.third.redis.clients.jedis.Jedis;
import java.util.List;
@ -28,16 +28,16 @@ public class RedisTableDataModel extends AbstractDataModel {
}
private synchronized void initRedisData(Calculator calculator, Parameter[] ps, RedisDatabaseConnection mc, int dbIndex, String query, String script, int rowCount) {
if (StringUtils.isEmpty(query)) {
if (StringKit.isEmpty(query)) {
return;
}
Redis redis = mc.createRedisClient();
redis.getClient().select(dbIndex);
FineLoggerFactory.getLogger().info("Connect to redis and select database:" + dbIndex);
LogKit.info("Connect to redis and select database:" + dbIndex);
try {
long start = System.currentTimeMillis();
DataWrapper<Object> wrapper = VisitorFactory.getKeyValueResult(calculator, ps, redis.getClient(), query, rowCount);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
wrapper.transform(script);
data = wrapper.getData();
columnNames = wrapper.getColumnNames();

4
src/main/java/com/fr/plugin/db/redis/core/order/OrderValue.java

@ -2,7 +2,7 @@ package com.fr.plugin.db.redis.core.order;
import com.fr.base.Parameter;
import com.fr.config.utils.UniqueKey;
import com.fr.general.GeneralUtils;
import com.fanruan.api.util.GeneralKit;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.xml.XMLPrintWriter;
@ -36,7 +36,7 @@ public abstract class OrderValue extends UniqueKey implements XMLable {
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("Attr");
writer.attr("value", GeneralUtils.objectToString(getValue()));
writer.attr("value", GeneralKit.objectToString(getValue()));
writer.end();
}

15
src/main/java/com/fr/plugin/db/redis/core/order/impl/FormulaOrderValue.java

@ -4,12 +4,13 @@ import com.fr.base.BaseFormula;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.base.ParameterMapNameSpace;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.util.GeneralKit;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fanruan.api.cal.ParameterKit;
import com.fr.stable.UtilEvalError;
import com.fr.stable.script.NameSpace;
import com.fr.stable.xml.XMLableReader;
@ -40,9 +41,9 @@ public class FormulaOrderValue extends OrderValue {
NameSpace nameSpace = ParameterMapNameSpace.create(ps);
cal.pushNameSpace(nameSpace);
try {
return GeneralUtils.objectToNumber(formula.eval(cal)).intValue();
return GeneralKit.objectToNumber(formula.eval(cal)).intValue();
} catch (UtilEvalError u) {
FineLoggerFactory.getLogger().error(u.getMessage(), u);
LogKit.error(u.getMessage(), u);
} finally {
cal.removeNameSpace(nameSpace);
}
@ -59,11 +60,11 @@ public class FormulaOrderValue extends OrderValue {
@Override
public void readValue(XMLableReader reader) {
this.formula = BaseFormula.createFormulaBuilder().build(reader.getAttrAsString("value", StringUtils.EMPTY));
this.formula = BaseFormula.createFormulaBuilder().build(reader.getAttrAsString("value", StringKit.EMPTY));
}
@Override
public String toString() {
return formula == null ? StringUtils.EMPTY : formula.getPureContent();
return formula == null ? StringKit.EMPTY : formula.getPureContent();
}
}

16
src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionProxyConfig.java

@ -4,8 +4,8 @@ import com.fr.config.ConfigContext;
import com.fr.config.DefaultConfiguration;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.security.SecurityToolbox;
import com.fr.stable.StringUtils;
import com.fanruan.api.security.SecurityKit;
import com.fanruan.api.util.StringKit;
/**
* @author richie
@ -25,15 +25,15 @@ public class RedisConnectionProxyConfig extends DefaultConfiguration {
private Conf<Boolean> open = Holders.simple(false);
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
private Conf<String> host = Holders.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(22);
private Conf<String> username = Holders.simple(StringUtils.EMPTY);
private Conf<String> username = Holders.simple(StringKit.EMPTY);
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
private Conf<String> password = Holders.simple(StringKit.EMPTY);
private Conf<String> privateKeyPath = Holders.simple(StringUtils.EMPTY);
private Conf<String> privateKeyPath = Holders.simple(StringKit.EMPTY);
public boolean isOpen() {
@ -70,11 +70,11 @@ public class RedisConnectionProxyConfig extends DefaultConfiguration {
public String getPassword() {
String text = password.get();
return SecurityToolbox.decrypt(text);
return SecurityKit.decrypt(text);
}
public void setPassword(String password) {
this.password.set(SecurityToolbox.encrypt(password));
this.password.set(SecurityKit.encrypt(password));
}
public String getPrivateKeyPath() {

4
src/main/java/com/fr/plugin/db/redis/core/visit/AbstractVisitor.java

@ -4,7 +4,7 @@ import com.fr.base.Parameter;
import com.fr.plugin.db.redis.core.DataWrapper;
import com.fr.plugin.db.redis.core.RedisConstants;
import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import com.fr.third.redis.clients.jedis.Jedis;
/**
@ -23,6 +23,6 @@ public abstract class AbstractVisitor<T> implements Visitor<T> {
}
protected String trimCommand(String cmd) {
return StringUtils.trim(cmd);
return StringKit.trim(cmd);
}
}

4
src/main/java/com/fr/plugin/db/redis/core/visit/impl/MGetVisitor.java

@ -3,7 +3,7 @@ package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fanruan.api.util.ArrayKit;
import com.fr.third.redis.clients.jedis.Jedis;
import java.util.ArrayList;
@ -19,7 +19,7 @@ public class MGetVisitor extends AbstractVisitor<String> {
if (arr.length < 2) {
throw new IllegalArgumentException("Illegal query:" + query);
}
String[] args = (String[]) ArrayUtils.remove(arr, 0);
String[] args = (String[]) ArrayKit.remove(arr, 0);
List<String> data = client.mget(args);
List<List<String>> result = new ArrayList<List<String>>();
result.add(data);

7
src/main/java/com/fr/plugin/db/redis/help/Console.java

@ -1,6 +1,7 @@
package com.fr.plugin.db.redis.help;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
/**
* @author richie
@ -15,12 +16,12 @@ public class Console {
@ScriptBridge
public void log(Object message) {
FineLoggerFactory.getLogger().info(message == null ? null : message.toString());
LogKit.info(message == null ? null : message.toString());
}
@ScriptBridge
public void error(Object message) {
FineLoggerFactory.getLogger().error(message == null ? null : message.toString());
LogKit.error(message == null ? null : message.toString());
}
@ScriptBridge

7
src/main/java/com/fr/plugin/db/redis/help/client/BaseRedisClient.java

@ -1,6 +1,7 @@
package com.fr.plugin.db.redis.help.client;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.help.ScriptBridge;
import com.fr.plugin.db.redis.help.RedisClient;
import com.fr.third.redis.clients.jedis.Jedis;
@ -24,7 +25,7 @@ public abstract class BaseRedisClient<A, O> implements RedisClient<A, O> {
try {
return jedis.get(key);
} finally {
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
}
}
@ -34,7 +35,7 @@ public abstract class BaseRedisClient<A, O> implements RedisClient<A, O> {
try {
return jedis.hget(key, field);
} finally {
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
}
}

18
src/main/java/com/fr/plugin/db/redis/help/client/RedisNashornClient.java

@ -1,7 +1,7 @@
package com.fr.plugin.db.redis.help.client;
import com.fr.base.TableData;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.emb.Redis;
import com.fr.plugin.db.redis.help.Console;
import com.fr.plugin.db.redis.help.ScriptBridge;
@ -42,7 +42,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Object[] hkeys(String key) {
long start = System.currentTimeMillis();
Set<String> set = jedis.keys(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return set.toArray(new String[0]);
}
@ -51,7 +51,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Object[] hmget(String key, String... fields) {
long start = System.currentTimeMillis();
List<String> list = jedis.hmget(key, fields);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return list.toArray(new String[0]);
}
@ -60,7 +60,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Map<Object, Object> hgetAll(String key) {
long start = System.currentTimeMillis();
Map<String, String> map = jedis.hgetAll(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return new TreeMap<Object, Object>(map);
}
@ -69,7 +69,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Object[] keys(String pattern) {
long start = System.currentTimeMillis();
Set<String> set = jedis.keys(pattern);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return set.toArray(new String[0]);
}
@ -78,7 +78,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Object[] lrange(String key, long start, long end) {
long start0 = System.currentTimeMillis();
List<String> list = jedis.lrange(key, start, end);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0);
return list.toArray(new String[0]);
}
@ -92,7 +92,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
parameters[i] = String.valueOf(keys[i]);
}
List<String> list = jedis.mget(parameters);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return list.toArray(new String[0]);
}
@ -101,7 +101,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
public Object[] smembers(String key) {
long start = System.currentTimeMillis();
Set<String> set = jedis.smembers(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return set.toArray(new String[0]);
}
@ -150,7 +150,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
}
return new SimpleDataModel(columnNames, data, realCount);
} catch (ScriptException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
LogKit.error(e.getMessage(), e);
}
return null;
}

16
src/main/java/com/fr/plugin/db/redis/help/client/RedisV8Client.java

@ -5,7 +5,7 @@ import com.eclipsesource.v8.V8Array;
import com.eclipsesource.v8.V8Object;
import com.eclipsesource.v8.utils.V8ObjectUtils;
import com.fr.base.TableData;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.emb.Redis;
import com.fr.plugin.db.redis.help.Console;
import com.fr.plugin.db.redis.help.Files;
@ -37,7 +37,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Array hkeys(String key) {
long start = System.currentTimeMillis();
Set<String> set = jedis.keys(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return V8ObjectUtils.toV8Array(v8, new ArrayList<String>(set));
}
@ -46,7 +46,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Array hmget(String key, String... fields) {
long start = System.currentTimeMillis();
List<String> list = jedis.hmget(key, fields);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return V8ObjectUtils.toV8Array(v8, list);
}
@ -55,7 +55,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Object hgetAll(String key) {
long start = System.currentTimeMillis();
Map<String, String> map = jedis.hgetAll(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return V8ObjectUtils.toV8Object(v8, map);
}
@ -64,7 +64,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Array keys(String pattern) {
long start = System.currentTimeMillis();
Set<String> set = jedis.keys(pattern);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return V8ObjectUtils.toV8Array(v8, new ArrayList<String>(set));
}
@ -73,7 +73,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Array lrange(String key, long start, long end) {
long start0 = System.currentTimeMillis();
List<String> list = jedis.lrange(key, start, end);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0);
return V8ObjectUtils.toV8Array(v8, list);
}
@ -87,7 +87,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
parameters[i] = keys.getString(i);
}
List<String> list = jedis.mget(parameters);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
keys.release();
return V8ObjectUtils.toV8Array(v8, list);
}
@ -97,7 +97,7 @@ public class RedisV8Client extends BaseRedisClient<V8Array, V8Object> {
public V8Array smembers(String key) {
long start = System.currentTimeMillis();
Set<String> set = jedis.smembers(key);
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start);
return V8ObjectUtils.toV8Array(v8, new ArrayList<String>(set));
}

19
src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java

@ -1,9 +1,10 @@
package com.fr.plugin.db.redis.ui;
import com.fr.base.BaseUtils;
import com.fanruan.api.util.IOKit;
import com.fanruan.api.cal.ParameterKit;
import com.fanruan.api.design.ui.action.UpdateAction;
import com.fr.base.ParameterHelper;
import com.fr.base.TableData;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -13,7 +14,7 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ToolBarDef;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.stable.ArrayUtils;
import com.fanruan.api.util.ArrayKit;
import com.fr.stable.ParameterProvider;
import javax.swing.*;
@ -50,7 +51,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
ParameterTableModel model = new ParameterTableModel() {
@Override
public UITableEditAction[] createAction() {
return ArrayUtils.add(super.createDBTableAction(), new RedisBaseTableDataPane.RefreshAction());
return ArrayKit.add(super.createDBTableAction(), new RedisBaseTableDataPane.RefreshAction());
}
};
editorPane = new UITableEditorPane<ParameterProvider>(model);
@ -94,11 +95,11 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
private void refresh() {
String[] paramTexts = paramTexts();
ParameterProvider[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
ParameterProvider[] parameters = ParameterKit.analyze4Parameters(paramTexts, false);
ParameterProvider[] providers = getOrderValue().analyze4Parameters();
editorPane.populate(ArrayUtils.addAll(parameters, providers));
editorPane.populate(ArrayKit.addAll(parameters, providers));
}
@ -106,7 +107,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
String[] paramTexts = paramTexts();
ParameterProvider[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
parameters = ArrayUtils.addAll(parameters, getOrderValue().analyze4Parameters());
parameters = ArrayKit.addAll(parameters, getOrderValue().analyze4Parameters());
if (parameters.length < 1 && editorPane.update().size() < 1) {
return;
@ -134,7 +135,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
public PreviewAction() {
this.setName(PREVIEW_BUTTON);
this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/m_file/preview.png"));
}
public void actionPerformed(ActionEvent evt) {
@ -147,7 +148,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
protected class RefreshAction extends UITableEditAction {
public RefreshAction() {
this.setName(REFRESH_BUTTON);
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
this.setSmallIcon(IOKit.readIcon("/com/fr/design/images/control/refresh.png"));
}
public void actionPerformed(ActionEvent e) {

21
src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java

@ -3,17 +3,18 @@ package com.fr.plugin.db.redis.ui;
import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.datapane.connect.ConnectionComboBoxPanel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.PlaceholderTextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.DatasourceManager;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.ui.event.DataLoadedListener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.ArrayKit;
import com.fanruan.api.util.StringKit;
import com.fanruan.api.log.LogKit;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.design.DesignKit;
import javax.swing.*;
import java.awt.*;
@ -61,7 +62,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
}
});
centerPane.add(GUICoreUtils.createBorderLayoutPane(
centerPane.add(DesignKit.createBorderLayoutPane(
keysPatternTextField, BorderLayout.CENTER,
searchButton, BorderLayout.EAST), BorderLayout.NORTH);
@ -72,9 +73,9 @@ public class RedisDBConnectionChosePane extends BasicPane {
private void loadKeys() {
String name = getSelectRedisConnectionName();
if (StringUtils.isEmpty(name)) {
if (StringKit.isEmpty(name)) {
clearList();
fireDataLoaded(ArrayUtils.EMPTY_STRING_ARRAY);
fireDataLoaded(ArrayKit.EMPTY_STRING_ARRAY);
return;
}
RedisDatabaseConnection connection = DatasourceManager.getProviderInstance().getConnection(name, RedisDatabaseConnection.class);
@ -94,8 +95,8 @@ public class RedisDBConnectionChosePane extends BasicPane {
@Override
protected String[] doInBackground() throws Exception {
String keysPattern = keysPatternTextField.getText();
if (StringUtils.isEmpty(keysPattern)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
if (StringKit.isEmpty(keysPattern)) {
return ArrayKit.EMPTY_STRING_ARRAY;
} else {
return DataOperator.getInstance().getTableSummary(connection, keysPattern);
}
@ -110,7 +111,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
}
fireDataLoaded(keys);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
LogKit.error(e.getMessage(), e);
}
}
}.execute();

18
src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java

@ -1,7 +1,10 @@
package com.fr.plugin.db.redis.ui;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.log.LogKit;
import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
@ -9,9 +12,6 @@ import com.fr.design.gui.itextarea.DescriptionTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.core.order.OrderValue;
@ -47,7 +47,7 @@ public class RedisQueryPane extends BasicPane {
try {
Desktop.getDesktop().browse(URI.create(SiteCenter.getInstance().acquireUrlByKind("help.redis")));
} catch (IOException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
LogKit.error(e1.getMessage(), e1);
}
}
});
@ -60,7 +60,7 @@ public class RedisQueryPane extends BasicPane {
Component[][] coms = new Component[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH),
{DesignKit.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH),
RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 300)}
};
@ -68,13 +68,13 @@ public class RedisQueryPane extends BasicPane {
// RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200)
// }
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double p = LayoutKit.PREFERRED;
double f = LayoutKit.FILL;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
add(TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize));
add(DesignKit.createTableLayoutPane(coms, rowSize, columnSize));
}

12
src/main/java/com/fr/plugin/db/redis/ui/RedisScriptPane.java

@ -1,13 +1,13 @@
package com.fr.plugin.db.redis.ui;
import com.fr.design.dialog.BasicPane;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.layout.LayoutKit;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory;
import com.fr.plugin.db.redis.util.RedisDesignUtils;
@ -38,13 +38,13 @@ public class RedisScriptPane extends BasicPane {
RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 350)},
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double p = LayoutKit.PREFERRED;
double f = LayoutKit.FILL;
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
add(TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize));
add(DesignKit.createTableLayoutPane(coms, rowSize, columnSize));
}

4
src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java

@ -5,7 +5,7 @@ import com.fr.plugin.db.redis.core.RedisScriptTableData;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import javax.swing.*;
import java.util.List;
@ -61,7 +61,7 @@ public class RedisScriptTableDataPane extends RedisBaseTableDataPane<RedisScript
public RedisScriptTableData updateBean() {
RedisScriptTableData tableData = new RedisScriptTableData();
String connectionName = chosePane.getSelectRedisConnectionName();
if (StringUtils.isNotEmpty(connectionName)) {
if (StringKit.isNotEmpty(connectionName)) {
tableData.setDatabase(new NameDatabaseConnection(connectionName));
}
List<ParameterProvider> parameterList = editorPane.update();

4
src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java

@ -6,7 +6,7 @@ import com.fr.plugin.db.redis.core.RedisTableData;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fanruan.api.util.StringKit;
import javax.swing.*;
import java.util.List;
@ -68,7 +68,7 @@ public class RedisTableDataPane extends RedisBaseTableDataPane<RedisTableData> {
RedisTableData tableData = new RedisTableData();
String connectionName = chosePane.getSelectRedisConnectionName();
if (StringUtils.isNotEmpty(connectionName)) {
if (StringKit.isNotEmpty(connectionName)) {
tableData.setDatabase(new NameDatabaseConnection(connectionName));
}

12
src/main/java/com/fr/plugin/db/redis/ui/pool/RedisConnectionPoolConfigPane.java

@ -1,13 +1,13 @@
package com.fr.plugin.db.redis.ui.pool;
import com.fr.design.dialog.BasicPane;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit;
import com.fanruan.api.design.DesignKit;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig;
import javax.swing.*;
@ -50,12 +50,12 @@ public class RedisConnectionPoolConfigPane extends BasicPane {
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Lifo") + ":"), lifoCheckBox},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Timeout") + ":"), timeoutNumberField}
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double p = LayoutKit.PREFERRED;
double f = LayoutKit.FILL;
double[] rowSize = new double[]{p, p, p, p, p, p};
double[] columnSize = new double[]{p, f};
add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
add(DesignKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
}
@Override

17
src/main/java/com/fr/plugin/db/redis/ui/proxy/RedisConnectionProxyConfigPane.java

@ -1,6 +1,8 @@
package com.fr.plugin.db.redis.ui.proxy;
import com.fr.design.dialog.BasicPane;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit;
import com.fanruan.api.design.DesignKit;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -8,9 +10,6 @@ import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig;
import javax.swing.*;
@ -54,7 +53,7 @@ public class RedisConnectionProxyConfigPane extends BasicPane {
UILabel description = new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Description"), SwingConstants.CENTER);
JComponent[][] comps = new JComponent[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Open") + ":"), GUICoreUtils.createBorderLayoutPane(
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Open") + ":"), DesignKit.createBorderLayoutPane(
openCheckBox, BorderLayout.WEST,
description, BorderLayout.CENTER
)},
@ -62,7 +61,7 @@ public class RedisConnectionProxyConfigPane extends BasicPane {
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Port") + ":"), portNumberField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Username") + ":"), usernameTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Password") + ":"), passwordTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Private_Key_Path") + ":"), GUICoreUtils.createBorderLayoutPane(
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Private_Key_Path") + ":"), DesignKit.createBorderLayoutPane(
privateKeyPathTextField, BorderLayout.CENTER,
fileSelectButton, BorderLayout.EAST
)},
@ -79,12 +78,12 @@ public class RedisConnectionProxyConfigPane extends BasicPane {
}
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double p = LayoutKit.PREFERRED;
double f = LayoutKit.FILL;
double[] rowSize = new double[]{p, p, p, p, p, p};
double[] columnSize = new double[]{p, f};
add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
add(DesignKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
}

Loading…
Cancel
Save