|
|
|
@ -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"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |