Browse Source

文档问题

pull/12/head
richie 6 years ago
parent
commit
24c327ec88
  1. 4
      plugin.xml
  2. 7
      pom.xml
  3. 26
      src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java
  4. 7
      src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
  5. 8
      src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java
  6. 10
      src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java
  7. 12
      src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java
  8. 3
      src/main/java/com/fr/plugin/db/redis/ui/value/FormulaEditor.java
  9. 6
      src/main/resources/com/fr/plugin/db/redis/locale/redis.properties
  10. 3
      src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties

4
plugin.xml

@ -18,12 +18,10 @@
<extra-core>
<LocaleFinder class="com.fr.plugin.db.redis.RedisLocaleFinder"/>
</extra-core>
<extra-report>
</extra-report>
<extra-designer>
<ConnectionProvider class="com.fr.plugin.db.redis.RedisConnectionImpl"/>
<TableDataDefineProvider class="com.fr.plugin.db.redis.RedisTableDataDefine"/>
<ServerTableDataDefineProvider class="com.fr.plugin.db.redis.RedisTableDataDefine"/>
</extra-designer>
<function-recorder class="com.fr.plugin.db.redis.core.RedisTableData"/>
</plugin>

7
pom.xml

@ -11,6 +11,13 @@
</parent>
<packaging>jar</packaging>
<artifactId>demo-tabledata-redis</artifactId>
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.solution.plugin.db.redis.v10-1.0/classes</outputDirectory>

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

@ -11,8 +11,11 @@ import com.fr.file.DatasourceManager;
import com.fr.general.Inter;
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.plugin.ExtraClassManager;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
@ -26,25 +29,9 @@ import java.util.HashMap;
import java.util.Map;
@EnableMetrics
public class RedisTableData extends AbstractParameterTableData {
private static final FunctionProcessor REDIS = new AbstractFunctionProcessor() {
@Override
public int getId() {
return FunctionHelper.generateFunctionID(RedisConstants.PLUGIN_ID);
}
@Override
public String getLocaleKey() {
return "Plugin-Redis_DB";
}
@Override
public String toString() {
return Inter.getLocText("Plugin-Redis_DB");
}
};
private Connection database;
private OrderValue dbIndex;
@ -85,11 +72,8 @@ public class RedisTableData extends AbstractParameterTableData {
}
@Override
@Focus(id = RedisConstants.PLUGIN_ID, text = "Plugin-Redis_DB", source = Original.PLUGIN)
public DataModel createDataModel(Calculator calculator, int rowCount) {
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(REDIS);
}
Parameter[] ps = Parameter.providers2Parameter(getParameters(calculator));
if (database instanceof NameDatabaseConnection) {
String name = ((NameDatabaseConnection) database).getName();

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

@ -1,10 +1,9 @@
package com.fr.plugin.db.redis.core;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.data.AbstractDataModel;
import com.fr.general.FRLogger;
import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.db.redis.core.visit.VisitorFactory;
@ -12,7 +11,7 @@ import com.fr.script.Calculator;
import com.fr.stable.StringUtils;
import redis.clients.jedis.Jedis;
import java.util.*;
import java.util.List;
public class RedisTableDataModel extends AbstractDataModel {
@ -37,7 +36,7 @@ public class RedisTableDataModel extends AbstractDataModel {
if (redisClient == null) {
redisClient = mc.createRedisClient();
redisClient.select(dbIndex);
FRContext.getLogger().info("Connect to redis and select database:" + dbIndex);
FineLoggerFactory.getLogger().info("Connect to redis and select database:" + dbIndex);
}
try {
DataWrapper<Object> wrapper = VisitorFactory.getKeyValueResult(calculator, ps, redisClient, query, rowCount);

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

@ -6,9 +6,11 @@ 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.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.ui.event.DataLoadedListener;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.stable.ArrayUtils;
@ -50,11 +52,11 @@ public class RedisDBConnectionChosePane extends BasicPane {
JList list = new JList(listModel);
keysPatternTextField = new PlaceholderTextField(10);
keysPatternTextField.setPlaceholder(Inter.getLocText("Plugin-Redis_Keys_Pattern"));
keysPatternTextField.setPlaceholder(Toolkit.i18nText("Plugin-Redis_Keys_Pattern"));
JPanel centerPane = new JPanel(new BorderLayout());
UIButton searchButton = new UIButton(Inter.getLocText("Plugin-Redis_Keys_Pattern_Search"));
UIButton searchButton = new UIButton(Toolkit.i18nText("Plugin-Redis_Keys_Pattern_Search"));
searchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -112,7 +114,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
}
fireDataLoaded(keys);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();

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

@ -9,12 +9,14 @@ import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
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.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory;
@ -37,21 +39,21 @@ public class RedisQueryPane extends BasicPane {
dbIndexEditor = IndexValuePaneFactory.createValueEditorPane();
ActionLabel helpLabel = new ActionLabel(Inter.getLocText("Plugin-Redis_Help"));
ActionLabel helpLabel = new ActionLabel(Toolkit.i18nText("Plugin-Redis_Help"));
helpLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Desktop.getDesktop().browse(URI.create(SiteCenter.getInstance().acquireUrlByKind("help.redis")));
} catch (IOException e1) {
FRLogger.getLogger().error(e1.getMessage(), e1);
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
}
}
});
Component[][] coms = new Component[][]{
{new UILabel(Inter.getLocText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{GUICoreUtils.createBorderLayoutPane(new UILabel(Inter.getLocText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH), createConditionTextPane(sqlTextPane)}
{new UILabel(Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH), createConditionTextPane(sqlTextPane)}
};
double p = TableLayout.PREFERRED;

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

@ -1,7 +1,6 @@
package com.fr.plugin.db.redis.ui;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.actions.UpdateAction;
@ -11,6 +10,7 @@ import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
@ -25,16 +25,12 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class RedisTableDataPane extends AbstractTableDataPane<RedisTableData> {
private static final String PREVIEW_BUTTON = Inter.getLocText("Preview");
private static final String REFRESH_BUTTON = Inter.getLocText("Refresh");
private static final String PREVIEW_BUTTON = Toolkit.i18nText("Plugin-Redis_Preview");
private static final String REFRESH_BUTTON = Toolkit.i18nText("Plugin-Redis_Refresh");
private RedisDBConnectionChosePane chosePane;
@ -100,7 +96,7 @@ public class RedisTableDataPane extends AbstractTableDataPane<RedisTableData> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("DS-Database_Query");
return Toolkit.i18nText("Plugin-Redis_Query");
}
private void refresh() {

3
src/main/java/com/fr/plugin/db/redis/ui/value/FormulaEditor.java

@ -6,6 +6,7 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.plugin.db.redis.core.order.impl.FormulaOrderValue;
@ -26,7 +27,7 @@ public class FormulaEditor extends Editor<FormulaOrderValue> {
* Constructor.
*/
public FormulaEditor() {
this("公式");
this(Toolkit.i18nText("Plugin-Redis_Formula"));
}
public FormulaEditor(String name) {

6
src/main/resources/com/fr/plugin/db/redis/locale/redis.properties

@ -7,4 +7,8 @@ Plugin-Redis_DB=RedisDB
Plugin-Redis_Help=Help Doc
Plugin-Redis_Keys_Pattern=Keys Pattern
Plugin-Redis_Keys_Pattern_Search=Search
Plugin-Redis_DB_Index=DB Index
Plugin-Redis_DB_Index=DB Index
Plugin-Redis_Preview=Preview
Plugin-Redis_Refresh=Refresh
Plugin-Redis_Formula=Formula
Plugin-Redis_Query=Query

3
src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties

@ -7,4 +7,5 @@ Plugin-Redis_DB=RedisDB\u6570\u636E\u96C6
Plugin-Redis_Help=\u5E2E\u52A9\u6587\u6863
Plugin-Redis_Keys_Pattern=\u952E\u503C\u7684\u6B63\u5219\u8868\u8FBE\u5F0F
Plugin-Redis_Keys_Pattern_Search=\u641C\u7D22
Plugin-Redis_DB_Index=\u6570\u636E\u5E93\u7F16\u53F7
Plugin-Redis_DB_Index=\u6570\u636E\u5E93\u7F16\u53F7
Plugin-Redis_Preview=\u9884\u89C8
Loading…
Cancel
Save