Browse Source

提供示例供10.0版本开发者使用

master
richie 6 years ago
parent
commit
ba2db8f8bd
  1. 5
      .gitignore
  2. 14
      build.xml
  3. BIN
      install/fr-plugin-better-sql-editor-2.4.zip
  4. 23
      plugin-bettersqleditor.iml
  5. 9
      plugin.xml
  6. 29
      pom.xml
  7. 1
      src/com/fr/solution/plugin/better/sql/editor/locale/better.properties
  8. 1
      src/com/fr/solution/plugin/better/sql/editor/locale/better_en_US.properties
  9. 1
      src/com/fr/solution/plugin/better/sql/editor/locale/better_ja_JP.properties
  10. 1
      src/com/fr/solution/plugin/better/sql/editor/locale/better_zh_CN.properties
  11. 0
      src/main/java/com/fr/solution/plugin/better/sql/editor/BetterConstants.java
  12. 0
      src/main/java/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataImpl.java
  13. 28
      src/main/java/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataPane.java
  14. 2
      src/main/java/com/fr/solution/plugin/better/sql/editor/BetterLocaleFinder.java
  15. 0
      src/main/java/com/fr/solution/plugin/better/sql/editor/FullScreenSQLEditorDialog.java
  16. 29
      src/main/java/com/fr/solution/plugin/better/sql/editor/FullScreenSQLPane.java
  17. 0
      src/main/resources/com/fr/solution/plugin/better/sql/editor/images/full.png
  18. 8
      src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better.properties
  19. 8
      src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_en_US.properties
  20. 8
      src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_ja_JP.properties
  21. 8
      src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_zh_CN.properties

5
.gitignore vendored

@ -1 +1,6 @@
*.iml
.idea/
lib/report/*.jar
.DS_Store
target/

14
build.xml

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/JDK1.8/Contents/Home"/>
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/lib/report"/>
<property name="reportLibs" value="${basedir}/../webroot/WEB-INF/lib"/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
@ -48,7 +48,7 @@
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/>
<delete dir="tmp"/>
<copy todir="tmp">
<fileset dir="${resources_from}\src">
<fileset dir="${resources_from}/src/main/resources">
<patternset refid="resources4Jar"/>
</fileset>
</copy>
@ -63,11 +63,15 @@
target="${target_jdk_version}"
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}"
executable="${compile_jdk_version}/bin/javac">
<src path="${basedir}/src"/>
<src path="${basedir}/src/main/java"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>
</target>
<target name="jar_classes">
@ -123,4 +127,4 @@
</zip>
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/>
</target>
</project>
</project>

BIN
install/fr-plugin-better-sql-editor-2.4.zip

Binary file not shown.

23
plugin-bettersqleditor.iml

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../env/8.0/WebReport/WEB-INF/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="module" module-name="base" />
<orderEntry type="module" module-name="base-basic" />
<orderEntry type="module" module-name="base-calculate" />
<orderEntry type="module" module-name="base-data" />
<orderEntry type="module" module-name="base-file" />
<orderEntry type="module" module-name="base-performance" />
<orderEntry type="module" module-name="base-stable" />
<orderEntry type="module" module-name="chart-base" />
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="engine" />
</component>
</module>

9
plugin.xml

@ -3,9 +3,9 @@
<name><![CDATA[数据集中SQL可全屏]]></name>
<active>yes</active>
<version>2.4</version>
<env-version>8.0</env-version>
<jartime>2015-12-20</jartime>
<vendor>solution</vendor>
<env-version>10.0</env-version>
<jartime>2018-10-20</jartime>
<vendor>author</vendor>
<description><![CDATA[在数据库数据集中,自带的编写SQL的区域比较小,在编写和查看比较大的SQL语句时很不方便,该插件提供SQL编辑区域全屏功能]]></description>
<change-notes><![CDATA[
[2018-05-23]修复服务器数据集无法新建的问题。<br/>
@ -14,10 +14,11 @@
]]>
</change-notes>
<extra-core>
<LocaleFinder class="com.fr.solution.plugin.better.sql.editor.locale.BetterLocaleFinder"/>
<LocaleFinder class="com.fr.solution.plugin.better.sql.editor.BetterLocaleFinder"/>
</extra-core>
<extra-designer>
<TableDataDefineProvider class="com.fr.solution.plugin.better.sql.editor.BetterDBTableDataImpl"/>
<ServerTableDataDefineProvider class="com.fr.solution.plugin.better.sql.editor.BetterDBTableDataImpl"/>
</extra-designer>
<function-recorder class="com.fr.solution.plugin.better.sql.editor.FullScreenSQLPane"/>
</plugin>

29
pom.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId>
<version>10.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>demo-better-sql-editor</artifactId>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.solution.plugin.better.sql.editor-1.0/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

1
src/com/fr/solution/plugin/better/sql/editor/locale/better.properties

@ -1 +0,0 @@
Plugin-Better_SQL_Editor=Better SQL Editor

1
src/com/fr/solution/plugin/better/sql/editor/locale/better_en_US.properties

@ -1 +0,0 @@
Plugin-Better_SQL_Editor=Better SQL Editor

1
src/com/fr/solution/plugin/better/sql/editor/locale/better_ja_JP.properties

@ -1 +0,0 @@
Plugin-Better_SQL_Editor=SQL\u30A8\u30C7\u30A3\u30BF\u30FC

1
src/com/fr/solution/plugin/better/sql/editor/locale/better_zh_CN.properties

@ -1 +0,0 @@
Plugin-Better_SQL_Editor=SQL\u7F16\u8F91\u5668

0
src/com/fr/solution/plugin/better/sql/editor/BetterConstants.java → src/main/java/com/fr/solution/plugin/better/sql/editor/BetterConstants.java

0
src/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataImpl.java → src/main/java/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataImpl.java

28
src/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataPane.java → src/main/java/com/fr/solution/plugin/better/sql/editor/BetterDBTableDataPane.java

@ -31,6 +31,7 @@ import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
@ -51,8 +52,8 @@ import java.util.ArrayList;
* @since 8.0
*/
public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
private static final String PREVIEW_BUTTON = Inter.getLocText("Preview");
private static final String REFRESH_BUTTON = Inter.getLocText("Refresh");
private static final String PREVIEW_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Preview");
private static final String REFRESH_BUTTON = com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Refresh");
private ConnectionTableProcedurePane connectionTableProcedurePane;
private UITableEditorPane<ParameterProvider> editorPane;
@ -101,7 +102,6 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
JPanel sqlSplitPane = new JPanel(new BorderLayout(4, 4));
sqlSplitPane.add(box, BorderLayout.CENTER);
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table
connectionTableProcedurePane = new ConnectionTableProcedurePane();
connectionTableProcedurePane.addDoubleClickListener(new ConnectionTableProcedurePane.DoubleClickSelectedNodeOnTreeListener() {
@ -111,11 +111,8 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
try {
document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null);
} catch (BadLocationException e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
// 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的,
// 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了.
// sqlTextPane.syntaxTexts();
sqlTextPane.requestFocus();
}
});
@ -145,7 +142,7 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("DS-Database_Query");
return com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Database_Query");
}
private void refresh() {
@ -168,7 +165,7 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
toolBarDef.addShortCut(SeparatorDef.DEFAULT);
toolBarDef.addShortCut(new FullScreenAction());
isShareCheckBox = new UICheckBox(Inter.getLocText("Is_Share_DBTableData"));
isShareCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Is_Shared_Table_Data"));
maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null);
UIToolbar editToolBar = ToolBarDef.createJToolBar();
@ -242,10 +239,9 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) {
try {
throw new Exception(Inter.getLocText("Connect_SQL_Cannot_Null") + ".");
} catch (Exception e) {
// JOptionPane.showMessageDialog(DBTableDataPane.this,
// Inter.getLocText("Connect_SQL_Cannot_Null") + ".");
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_SQL_Cannot_Null") + ".");
} catch (Exception ignore) {
}
}
@ -284,7 +280,7 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
private class FullScreenAction extends UpdateAction {
public FullScreenAction() {
this.setName(Inter.getLocText("Plugin-Better_SQL_Editor"));
this.setName(com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor"));
this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/solution/plugin/better/sql/editor/images/full.png"));
}
@ -323,7 +319,7 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
private class EditPageQueryAction extends UpdateAction {
public EditPageQueryAction() {
this.setName(Inter.getLocText("LayerPageReport_PageQuery"));
this.setName(com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Page_Query"));
this.setMnemonic('L');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png"));
}
@ -373,7 +369,7 @@ public class BetterDBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("LayerPageReport_Define_PageQuerySQL");
return com.fr.design.i18n.Toolkit.i18nText("Plugin-Better_SQL_Editor_Define_Page_Query_SQL");
}
}
}

2
src/com/fr/solution/plugin/better/sql/editor/locale/BetterLocaleFinder.java → src/main/java/com/fr/solution/plugin/better/sql/editor/BetterLocaleFinder.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.better.sql.editor.locale;
package com.fr.solution.plugin.better.sql.editor;
import com.fr.stable.fun.impl.AbstractLocaleFinder;

0
src/com/fr/solution/plugin/better/sql/editor/FullScreenSQLEditorDialog.java → src/main/java/com/fr/solution/plugin/better/sql/editor/FullScreenSQLEditorDialog.java

29
src/com/fr/solution/plugin/better/sql/editor/FullScreenSQLPane.java → src/main/java/com/fr/solution/plugin/better/sql/editor/FullScreenSQLPane.java

@ -4,10 +4,9 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.fun.FunctionHelper;
import com.fr.stable.fun.FunctionProcessor;
import com.fr.stable.fun.impl.AbstractFunctionProcessor;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import java.awt.*;
@ -16,31 +15,14 @@ import java.awt.*;
* @date 2015-06-04
* @since 8.0
*/
@EnableMetrics
public class FullScreenSQLPane extends BasicPane {
private static final FunctionProcessor SQL = new AbstractFunctionProcessor() {
@Override
public int getId() {
return FunctionHelper.generateFunctionID(BetterConstants.PLUGIN_ID);
}
public String getLocaleKey() {
return Inter.getLocText("Plugin-Better_SQL_Editor");
}
@Override
public String toString() {
return Inter.getLocText("Plugin-Better_SQL_Editor");
}
};
private SQLEditPane sqlTextPane;
public FullScreenSQLPane(String text) {
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(SQL);
}
setLayout(new BorderLayout());
sqlTextPane = new SQLEditPane();
sqlTextPane.setText(text);
@ -55,6 +37,7 @@ public class FullScreenSQLPane extends BasicPane {
return Inter.getLocText("Plugin-Better_SQL_Editor");
}
@Focus(id = "com.fr.solution.plugin.better.sql.editor", text = "Plugin-Better_SQL_Editor", source = Original.PLUGIN)
public String getText() {
return sqlTextPane.getText();
}

0
src/com/fr/solution/plugin/better/sql/editor/images/full.png → src/main/resources/com/fr/solution/plugin/better/sql/editor/images/full.png

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 972 B

8
src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better.properties

@ -0,0 +1,8 @@
Plugin-Better_SQL_Editor=Better SQL Editor
Plugin-Better_SQL_Editor_Refresh=Refresh
Plugin-Better_SQL_Editor_Preview=Preview
Plugin-Better_SQL_Editor_Is_Shared_Table_Data=Shared Table Data Or Not
Plugin-Better_SQL_Editor_Database_Query=Database Query
Plugin-Better_SQL_Editor_SQL_Cannot_Null=SQL Cannot Null
Plugin-Better_SQL_Editor_Page_Query=Page Query
Plugin-Better_SQL_Editor_Define_Page_Query_SQL=Define Page Query SQL

8
src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_en_US.properties

@ -0,0 +1,8 @@
Plugin-Better_SQL_Editor=Better SQL Editor
Plugin-Better_SQL_Editor_Refresh=Refresh
Plugin-Better_SQL_Editor_Preview=Preview
Plugin-Better_SQL_Editor_Is_Shared_Table_Data=Shared Table Data Or Not
Plugin-Better_SQL_Editor_Database_Query=Database Query
Plugin-Better_SQL_Editor_SQL_Cannot_Null=SQL Cannot Null
Plugin-Better_SQL_Editor_Page_Query=Page Query
Plugin-Better_SQL_Editor_Define_Page_Query_SQL=Define Page Query SQL

8
src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_ja_JP.properties

@ -0,0 +1,8 @@
Plugin-Better_SQL_Editor=SQL\u30A8\u30C7\u30A3\u30BF\u30FC
Plugin-Better_SQL_Editor_Refresh=Refresh
Plugin-Better_SQL_Editor_Preview=Preview
Plugin-Better_SQL_Editor_Is_Shared_Table_Data=Shared Table Data Or Not
Plugin-Better_SQL_Editor_Database_Query=Database Query
Plugin-Better_SQL_Editor_SQL_Cannot_Null=SQL Cannot Null
Plugin-Better_SQL_Editor_Page_Query=Page Query
Plugin-Better_SQL_Editor_Define_Page_Query_SQL=Define Page Query SQL

8
src/main/resources/com/fr/solution/plugin/better/sql/editor/locale/better_zh_CN.properties

@ -0,0 +1,8 @@
Plugin-Better_SQL_Editor=SQL\u7F16\u8F91\u5668
Plugin-Better_SQL_Editor_Refresh=\u5237\u65B0
Plugin-Better_SQL_Editor_Preview=\u9884\u89C8
Plugin-Better_SQL_Editor_Is_Shared_Table_Data=\u5171\u4EAB\u6570\u636E\u96C6
Plugin-Better_SQL_Editor_Database_Query=\u6570\u636E\u5E93\u67E5\u8BE2
Plugin-Better_SQL_Editor_SQL_Cannot_Null=SQL\u8BED\u53E5\u4E0D\u80FD\u4E3A\u7A7A
Plugin-Better_SQL_Editor_Page_Query=\u5206\u9875\u67E5\u8BE2
Plugin-Better_SQL_Editor_Define_Page_Query_SQL=\u5B9A\u4E49\u5206\u9875SQL
Loading…
Cancel
Save