richie
7 years ago
commit
e40702dd81
20 changed files with 717 additions and 0 deletions
@ -0,0 +1,5 @@
|
||||
# SQL全屏编辑 |
||||
操作界面 |
||||
![1](effect/better.png) |
||||
全屏界面 |
||||
![2](effect/full.png) |
@ -0,0 +1,126 @@
|
||||
<?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="libs" value="${basedir}/lib"/> |
||||
<property name="publicLibs" value=""/> |
||||
<property name="reportLibs" value="${basedir}/lib/report"/> |
||||
<property name="destLoc" value="."/> |
||||
<property name="classes" value="classes"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<property name="current-version" value="${plugin.version}"/> |
||||
|
||||
<!-- 插件版本--> |
||||
<property name="plugin-version" value="${current-version}"/> |
||||
<!-- 插件名字--> |
||||
<property name="plugin-name" value="better-sql-editor"/> |
||||
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/> |
||||
|
||||
<target name="prepare"> |
||||
<delete dir="${classes}"/> |
||||
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<delete dir="${destLoc}/${plugin.name}"/> |
||||
</target> |
||||
<path id="compile.classpath"> |
||||
<fileset dir="${libs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${publicLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${reportLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
</path> |
||||
<patternset id="resources4Jar"> |
||||
<exclude name="**/.settings/**"/> |
||||
<exclude name=".classpath"/> |
||||
<exclude name=".project"/> |
||||
|
||||
<exclude name="**/*.java"/> |
||||
<exclude name="**/*.db"/> |
||||
<exclude name="**/*.g"/> |
||||
<exclude name="**/package.html"/> |
||||
</patternset> |
||||
<target name="copy_resources"> |
||||
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/> |
||||
<delete dir="tmp"/> |
||||
<copy todir="tmp"> |
||||
<fileset dir="${resources_from}\src"> |
||||
<patternset refid="resources4Jar"/> |
||||
</fileset> |
||||
</copy> |
||||
<copy todir="${classes}"> |
||||
<fileset dir="tmp"/> |
||||
</copy> |
||||
<delete dir="tmp"/> |
||||
</target> |
||||
<target name="compile_javas"> |
||||
<echo message="编译${compile_files}下的Java文件"/> |
||||
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}" |
||||
target="${target_jdk_version}" |
||||
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" |
||||
executable="${compile_jdk_version}/bin/javac"> |
||||
<src path="${basedir}/src"/> |
||||
<exclude name="**/.svn/**"/> |
||||
<compilerarg line="-encoding UTF8 "/> |
||||
<classpath refid="compile.classpath"/> |
||||
</javac> |
||||
</target> |
||||
|
||||
<target name="jar_classes"> |
||||
<echo message="打Jar包:${jar_name}"/> |
||||
<delete file="${basedir}/${jar_name}"/> |
||||
<jar jarfile="${basedir}/${jar_name}"> |
||||
<fileset dir="${classes}"> |
||||
</fileset> |
||||
</jar> |
||||
</target> |
||||
|
||||
<target name="super_jar" depends="prepare"> |
||||
<antcall target="copy_resources"> |
||||
<param name="resources_from" value="${basedir}"/> |
||||
</antcall> |
||||
<antcall target="compile_javas"> |
||||
<param name="source_jdk_version" value="1.6"/> |
||||
<param name="target_jdk_version" value="1.6"/> |
||||
<param name="compile_jdk_version" value="${jdk.home}"/> |
||||
<param name="compile_files" value="${basedir}/src"/> |
||||
</antcall> |
||||
<echo message="compile plugin success!"/> |
||||
|
||||
<antcall target="jar_classes"> |
||||
<param name="jar_name" value="${plugin-jar}"/> |
||||
</antcall> |
||||
<delete dir="${classes}"/> |
||||
|
||||
</target> |
||||
|
||||
<target name="jar" depends="super_jar"> |
||||
<antcall target="zip"/> |
||||
</target> |
||||
|
||||
<target name="zip"> |
||||
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<echo message="----------zip files----------"/> |
||||
<mkdir dir="${plugin-folder}"/> |
||||
<copy todir="${plugin-folder}"> |
||||
<fileset dir="."> |
||||
<include name="${plugin-jar}"/> |
||||
<include name="plugin.xml"/> |
||||
</fileset> |
||||
<fileset dir="${libs}"> |
||||
<include name="*.jar"/> |
||||
<include name="*.dll"/> |
||||
</fileset> |
||||
</copy> |
||||
<zip destfile="${basedir}/${plugin-folder}.zip" basedir="."> |
||||
<include name="${plugin-folder}/*.jar"/> |
||||
<include name="${plugin-folder}/*.dll"/> |
||||
<include name="${plugin-folder}/plugin.xml"/> |
||||
</zip> |
||||
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/> |
||||
</target> |
||||
</project> |
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
<?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> |
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||
<id>com.fr.solution.plugin.better.sql.editor</id> |
||||
<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> |
||||
<description><![CDATA[在数据库数据集中,自带的编写SQL的区域比较小,在编写和查看比较大的SQL语句时很不方便,该插件提供SQL编辑区域全屏功能]]></description> |
||||
<change-notes><![CDATA[ |
||||
[2018-05-23]修复服务器数据集无法新建的问题。<br/> |
||||
[2015-12-20]修复在新版本中无法使用的情况。<br/> |
||||
[2016-03-25]国际化。<br/> |
||||
]]> |
||||
</change-notes> |
||||
<extra-core> |
||||
<LocaleFinder class="com.fr.solution.plugin.better.sql.editor.locale.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> |
||||
</plugin> |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,9 @@
|
||||
package com.fr.solution.plugin.better.sql.editor; |
||||
|
||||
/** |
||||
* Created by richie on 16/3/25. |
||||
*/ |
||||
public class BetterConstants { |
||||
|
||||
public static final String PLUGIN_ID = "com.fr.solution.plugin.better.sql.editor"; |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.solution.plugin.better.sql.editor; |
||||
|
||||
import com.fr.base.TableData; |
||||
import com.fr.data.impl.DBTableData; |
||||
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; |
||||
import com.fr.design.fun.ServerTableDataDefineProvider; |
||||
import com.fr.design.fun.impl.AbstractTableDataDefineProvider; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-04 |
||||
* @since 8.0 |
||||
*/ |
||||
public class BetterDBTableDataImpl extends AbstractTableDataDefineProvider implements ServerTableDataDefineProvider { |
||||
|
||||
@Override |
||||
public Class<? extends TableData> classForTableData() { |
||||
return DBTableData.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends TableData> classForInitTableData() { |
||||
return DBTableData.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends AbstractTableDataPane> appearanceForTableData() { |
||||
return BetterDBTableDataPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String nameForTableData() { |
||||
return Inter.getLocText("DS-Database_Query"); |
||||
} |
||||
|
||||
@Override |
||||
public String prefixForTableData() { |
||||
return "ds"; |
||||
} |
||||
|
||||
@Override |
||||
public String iconPathForTableData() { |
||||
return "/com/fr/design/images/data/database.png"; |
||||
} |
||||
} |
@ -0,0 +1,379 @@
|
||||
package com.fr.solution.plugin.better.sql.editor; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Parameter; |
||||
import com.fr.base.ParameterHelper; |
||||
import com.fr.data.core.db.TableProcedure; |
||||
import com.fr.data.impl.DBTableData; |
||||
import com.fr.data.impl.NameDatabaseConnection; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.border.UIRoundedBorder; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; |
||||
import com.fr.design.data.datapane.preview.PreviewTablePane; |
||||
import com.fr.design.data.datapane.sqlpane.SQLEditPane; |
||||
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; |
||||
import com.fr.design.data.tabledata.tabledatapane.MaxMemRowCountPanel; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; |
||||
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
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.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.ParameterProvider; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.text.BadLocationException; |
||||
import javax.swing.text.Document; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.FocusEvent; |
||||
import java.awt.event.FocusListener; |
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-04 |
||||
* @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 ConnectionTableProcedurePane connectionTableProcedurePane; |
||||
private UITableEditorPane<ParameterProvider> editorPane; |
||||
|
||||
private SQLEditPane sqlTextPane; |
||||
private RTextScrollPane sqlTextScrollPane; |
||||
private UICheckBox isShareCheckBox; |
||||
private MaxMemRowCountPanel maxPanel; |
||||
private String pageQuery = null; |
||||
|
||||
|
||||
public BetterDBTableDataPane() { |
||||
this.setLayout(new BorderLayout(4, 4)); |
||||
|
||||
Box box = new Box(BoxLayout.Y_AXIS); |
||||
|
||||
sqlTextPane = new SQLEditPane(); |
||||
sqlTextPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); |
||||
JPanel northPane = new JPanel(new BorderLayout(4, 4)); |
||||
JToolBar editToolBar = createToolBar(); |
||||
northPane.add(editToolBar, BorderLayout.CENTER); |
||||
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); |
||||
|
||||
sqlTextScrollPane = new RTextScrollPane(sqlTextPane); |
||||
sqlTextScrollPane.setLineNumbersEnabled(true); |
||||
sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); |
||||
sqlTextScrollPane.setPreferredSize(new Dimension(680, 600)); |
||||
|
||||
JPanel paraMeanPane = new JPanel(new BorderLayout()); |
||||
paraMeanPane.setPreferredSize(new Dimension(680, 90)); |
||||
UILabel paraMean = new UILabel(Inter.getLocText("Datasource-Param_DES")); |
||||
paraMeanPane.add(paraMean, BorderLayout.CENTER); |
||||
|
||||
ParameterTableModel model = new ParameterTableModel() { |
||||
@Override |
||||
public UITableEditAction[] createAction() { |
||||
return (UITableEditAction[]) ArrayUtils.add(super.createDBTableAction(), new RefreshAction()); |
||||
} |
||||
}; |
||||
editorPane = new UITableEditorPane<ParameterProvider>(model); |
||||
|
||||
box.add(northPane); |
||||
box.add(sqlTextScrollPane); |
||||
box.add(paraMeanPane); |
||||
box.add(editorPane); |
||||
|
||||
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() { |
||||
|
||||
@Override |
||||
public void actionPerformed(TableProcedure target) { |
||||
Document document = sqlTextPane.getDocument(); |
||||
try { |
||||
document.insertString(sqlTextPane.getCaretPosition(), target.toString(), null); |
||||
} catch (BadLocationException e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
} |
||||
// 这里开始作色,本来可以给sqlTextPane添加DocumentListener来实现的,
|
||||
// 后来发现insertString的时候,锁定了JTextPane,不能调用setXXX来作色,先这样了.
|
||||
// sqlTextPane.syntaxTexts();
|
||||
sqlTextPane.requestFocus(); |
||||
} |
||||
}); |
||||
sqlTextPane.addFocusListener(new FocusListener() { |
||||
public void focusGained(FocusEvent e) { |
||||
|
||||
} |
||||
|
||||
public void focusLost(FocusEvent e) { |
||||
if (isPreviewOrRefreshButton(e)) { |
||||
checkParameter(); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
this.add(connectionTableProcedurePane, BorderLayout.WEST); |
||||
this.add(sqlSplitPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private boolean isPreviewOrRefreshButton (FocusEvent e) { |
||||
if (e.getOppositeComponent() != null) { |
||||
String name = e.getOppositeComponent().getName(); |
||||
return ComparatorUtils.equals(name, PREVIEW_BUTTON) || ComparatorUtils.equals(name, REFRESH_BUTTON); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("DS-Database_Query"); |
||||
} |
||||
|
||||
private void refresh() { |
||||
String[] paramTexts = new String[2]; |
||||
paramTexts[0] = sqlTextPane.getText(); |
||||
paramTexts[1] = pageQuery; |
||||
|
||||
java.util.List<ParameterProvider> existParameterList = editorPane.update(); |
||||
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); |
||||
|
||||
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps)); |
||||
} |
||||
|
||||
private JToolBar createToolBar() { |
||||
// p:工具栏.
|
||||
ToolBarDef toolBarDef = new ToolBarDef(); |
||||
toolBarDef.addShortCut(new PreviewAction()); |
||||
toolBarDef.addShortCut(SeparatorDef.DEFAULT); |
||||
toolBarDef.addShortCut(new EditPageQueryAction()); |
||||
toolBarDef.addShortCut(SeparatorDef.DEFAULT); |
||||
toolBarDef.addShortCut(new FullScreenAction()); |
||||
|
||||
isShareCheckBox = new UICheckBox(Inter.getLocText("Is_Share_DBTableData")); |
||||
maxPanel = new MaxMemRowCountPanel(); |
||||
maxPanel.setBorder(null); |
||||
UIToolbar editToolBar = ToolBarDef.createJToolBar(); |
||||
toolBarDef.updateToolBar(editToolBar); |
||||
editToolBar.add(isShareCheckBox); |
||||
editToolBar.add(maxPanel); |
||||
|
||||
return editToolBar; |
||||
} |
||||
|
||||
private void checkParameter() { |
||||
String[] paramTexts = new String[2]; |
||||
paramTexts[0] = sqlTextPane.getText(); |
||||
paramTexts[1] = pageQuery; |
||||
|
||||
Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); |
||||
|
||||
if (parameters.length < 1 && editorPane.update().size() < 1) { |
||||
return; |
||||
} |
||||
boolean isIn = true; |
||||
java.util.List<ParameterProvider> list = editorPane.update(); |
||||
java.util.List<String> name = new ArrayList<String>(); |
||||
for (int i = 0; i < list.size(); i++) { |
||||
name.add(list.get(i).getName()); |
||||
} |
||||
for (int i = 0; i < parameters.length; i++) { |
||||
if (!name.contains(parameters[i].getName())) { |
||||
isIn = false; |
||||
break; |
||||
} |
||||
} |
||||
if (list.size() == parameters.length && isIn) { |
||||
return; |
||||
} |
||||
// bug:34175 删了是否刷新对话框, 均直接刷新
|
||||
refresh(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(DBTableData dbtabledata) { |
||||
ParameterProvider[] parameters = null; |
||||
|
||||
Calculator c = Calculator.createCalculator(); |
||||
|
||||
parameters = dbtabledata.getParameters(c); |
||||
editorPane.populate(parameters); |
||||
|
||||
com.fr.data.impl.Connection db = null; |
||||
String query = null; |
||||
boolean isShare = false; |
||||
int maxMemeryRow = -1; |
||||
|
||||
db = dbtabledata.getDatabase(); |
||||
query = dbtabledata.getQuery(); |
||||
isShare = dbtabledata.isShare(); |
||||
maxMemeryRow = dbtabledata.getMaxMemRowCount(); |
||||
this.pageQuery = dbtabledata.getPageQuerySql(); |
||||
|
||||
this.connectionTableProcedurePane.setSelectedDatabaseConnection(db); |
||||
this.sqlTextPane.setText(query); |
||||
this.sqlTextPane.requestFocus(); |
||||
this.sqlTextPane.moveCaretPosition(this.sqlTextPane.getCaretPosition()); |
||||
|
||||
isShareCheckBox.setSelected(isShare); |
||||
maxPanel.setValue(maxMemeryRow); |
||||
} |
||||
|
||||
@Override |
||||
public DBTableData updateBean() { |
||||
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") + ".");
|
||||
} |
||||
} |
||||
|
||||
java.util.List<ParameterProvider> parameterList = editorPane.update(); |
||||
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); |
||||
|
||||
DBTableData dbTableData = new DBTableData(); |
||||
dbTableData.setDatabase(new NameDatabaseConnection(dbName)); |
||||
|
||||
// p:必须先设置Parameters数组,因为setQuery里面会自动设置的
|
||||
|
||||
dbTableData.setParameters(parameters); |
||||
dbTableData.setQuery(this.sqlTextPane.getText()); |
||||
|
||||
dbTableData.setShare(isShareCheckBox.isSelected()); |
||||
dbTableData.setMaxMemRowCount(maxPanel.getValue()); |
||||
dbTableData.setPageQuerySql(this.pageQuery); |
||||
|
||||
return dbTableData; |
||||
} |
||||
|
||||
protected class RefreshAction extends UITableEditAction { |
||||
public RefreshAction() { |
||||
this.setName(REFRESH_BUTTON); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent e) { |
||||
refresh(); |
||||
} |
||||
|
||||
@Override |
||||
public void checkEnabled() { |
||||
} |
||||
} |
||||
|
||||
private class FullScreenAction extends UpdateAction { |
||||
public FullScreenAction() { |
||||
this.setName(Inter.getLocText("Plugin-Better_SQL_Editor")); |
||||
this.setMnemonic('P'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/solution/plugin/better/sql/editor/images/full.png")); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent evt) { |
||||
final FullScreenSQLPane fullScreenSQLPane = new FullScreenSQLPane(sqlTextPane.getText()); |
||||
FullScreenSQLEditorDialog dialog = new FullScreenSQLEditorDialog(DesignerContext.getDesignerFrame(), fullScreenSQLPane); |
||||
dialog.setSize(Toolkit.getDefaultToolkit().getScreenSize()); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
sqlTextPane.setText(fullScreenSQLPane.getText()); |
||||
} |
||||
|
||||
@Override |
||||
public void doCancel() { |
||||
|
||||
} |
||||
}); |
||||
dialog.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private class PreviewAction extends UpdateAction { |
||||
public PreviewAction() { |
||||
this.setName(PREVIEW_BUTTON); |
||||
this.setMnemonic('P'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent evt) { |
||||
checkParameter(); |
||||
PreviewTablePane.previewTableData(BetterDBTableDataPane.this.updateBean()); |
||||
} |
||||
} |
||||
|
||||
private class EditPageQueryAction extends UpdateAction { |
||||
public EditPageQueryAction() { |
||||
this.setName(Inter.getLocText("LayerPageReport_PageQuery")); |
||||
this.setMnemonic('L'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent e) { |
||||
final PageQueryPane pane = new PageQueryPane(); |
||||
pane.populate(pageQuery); |
||||
BasicDialog dialog = pane.showWindow(DesignerContext.getDesignerFrame()); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
pageQuery = pane.update(); |
||||
checkParameter(); |
||||
} |
||||
}); |
||||
dialog.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private class PageQueryPane extends BasicPane { |
||||
private SQLEditPane pageQueryPane; |
||||
|
||||
public PageQueryPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
public void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
pageQueryPane = new SQLEditPane(); |
||||
this.add(new JScrollPane(pageQueryPane)); |
||||
} |
||||
|
||||
public void populate(String text) { |
||||
if (StringUtils.isBlank(text)) { |
||||
return; |
||||
} |
||||
pageQueryPane.setText(text); |
||||
} |
||||
|
||||
public String update() { |
||||
String text = pageQueryPane.getText(); |
||||
if (StringUtils.isBlank(text)) { |
||||
return null; |
||||
} else { |
||||
return text; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("LayerPageReport_Define_PageQuerySQL"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.solution.plugin.better.sql.editor; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.UIDialog; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-04 |
||||
* @since 8.0 |
||||
*/ |
||||
public class FullScreenSQLEditorDialog extends UIDialog { |
||||
|
||||
public FullScreenSQLEditorDialog(Frame parent, BasicPane pane) { |
||||
super(parent, pane); |
||||
} |
||||
|
||||
public FullScreenSQLEditorDialog(Dialog parent, BasicPane pane) { |
||||
super(parent, pane); |
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,61 @@
|
||||
package com.fr.solution.plugin.better.sql.editor; |
||||
|
||||
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 java.awt.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-04 |
||||
* @since 8.0 |
||||
*/ |
||||
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); |
||||
RTextScrollPane sqlTextScrollPane = new RTextScrollPane(sqlTextPane); |
||||
sqlTextScrollPane.setLineNumbersEnabled(true); |
||||
|
||||
add(sqlTextScrollPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-Better_SQL_Editor"); |
||||
} |
||||
|
||||
public String getText() { |
||||
return sqlTextPane.getText(); |
||||
} |
||||
} |
After Width: | Height: | Size: 972 B |
@ -0,0 +1,13 @@
|
||||
package com.fr.solution.plugin.better.sql.editor.locale; |
||||
|
||||
import com.fr.stable.fun.impl.AbstractLocaleFinder; |
||||
|
||||
/** |
||||
* Created by richie on 16/3/25. |
||||
*/ |
||||
public class BetterLocaleFinder extends AbstractLocaleFinder { |
||||
@Override |
||||
public String find() { |
||||
return "com/fr/solution/plugin/better/sql/editor/locale/better"; |
||||
} |
||||
} |
@ -0,0 +1 @@
|
||||
Plugin-Better_SQL_Editor=Better SQL Editor |
@ -0,0 +1 @@
|
||||
Plugin-Better_SQL_Editor=Better SQL Editor |
@ -0,0 +1 @@
|
||||
Plugin-Better_SQL_Editor=SQL\u30A8\u30C7\u30A3\u30BF\u30FC |
Loading…
Reference in new issue