|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
|
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
|
import com.fr.data.pool.DBCPConnectionPoolAttr; |
|
|
|
@ -16,7 +17,9 @@ import com.fr.design.layout.TableLayoutHelper;
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
|
import com.fr.design.editor.editor.IntegerEditor; |
|
|
|
|
import com.fr.design.utils.BrowseUtils; |
|
|
|
|
import com.fr.file.filter.ChooseFileFilter; |
|
|
|
|
import com.fr.general.CloudCenter; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
@ -45,8 +48,8 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"), |
|
|
|
|
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/"), |
|
|
|
|
new DriverURLName("com.fr.swift.jdbc.Driver", "jdbc:swift:emb://default")}); |
|
|
|
|
jdbcMap.put("Inceptor",new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver","jdbc:inceptor2://localhost:10000/default"), |
|
|
|
|
new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:inceptor://localhost:10000/default")}); |
|
|
|
|
jdbcMap.put("Inceptor", new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver", "jdbc:inceptor2://localhost:10000/default"), |
|
|
|
|
new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver", "jdbc:inceptor://localhost:10000/default")}); |
|
|
|
|
jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")}); |
|
|
|
|
jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")}); |
|
|
|
|
jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")}); |
|
|
|
@ -65,8 +68,9 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
private UITextField urlTextField; |
|
|
|
|
private UITextField userNameTextField; |
|
|
|
|
private JPasswordField passwordTextField; |
|
|
|
|
private ActionLabel odbcTipsLink; |
|
|
|
|
// 请不要改动dbtype,只应该最后添加
|
|
|
|
|
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre","SQLite","Inceptor", OTHER_DB}; |
|
|
|
|
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; |
|
|
|
|
|
|
|
|
|
// carl:DBCP的一些属性
|
|
|
|
|
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); |
|
|
|
@ -121,6 +125,28 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
|
|
|
|
|
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
driverPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Driver") + ":")); |
|
|
|
|
// 选择ODBC数据源的时候的提示链接
|
|
|
|
|
JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
odbcTipsLink = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) { |
|
|
|
|
@Override |
|
|
|
|
public void paintComponent(Graphics _gfx) { |
|
|
|
|
super.paintComponent(_gfx); |
|
|
|
|
_gfx.setColor(Color.blue); |
|
|
|
|
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
odbcTipsPane.add(odbcTipsLink); |
|
|
|
|
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); |
|
|
|
|
odbcTipsLink.addActionListener(new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout()); |
|
|
|
|
driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST); |
|
|
|
|
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
urlPane.add(new UILabel("URL:")); |
|
|
|
@ -141,7 +167,7 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
passwordPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Password") + ":")); |
|
|
|
|
|
|
|
|
|
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBox}, {urlPane, urlComPane}, {userPane, userComPane},}; |
|
|
|
|
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},}; |
|
|
|
|
|
|
|
|
|
double[] rowSize = {p, p, p, p}; |
|
|
|
|
double[] columnSize = {p, f, 22}; |
|
|
|
@ -264,9 +290,10 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
|
|
|
|
|
ActionListener driverListener = new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
if (driverComboBox.getSelectedItem() == null ||ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { |
|
|
|
|
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示
|
|
|
|
|
Iterator<Entry<String, DriverURLName[]>> jdbc = jdbcMap.entrySet().iterator(); |
|
|
|
|
while (jdbc.hasNext()) { |
|
|
|
|
Entry<String, DriverURLName[]> entry = jdbc.next(); |
|
|
|
@ -340,7 +367,7 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":" , SwingConstants.RIGHT), DBCP_MAX_WAIT}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN}, |
|
|
|
@ -348,7 +375,7 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT), |
|
|
|
|
DBCP_TIMEBETWEENEVICTIONRUNSMILLS}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN}, |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":" , SwingConstants.RIGHT), |
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT), |
|
|
|
|
DBCP_MINEVICTABLEIDLETIMEMILLIS}}; |
|
|
|
|
|
|
|
|
|
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); |
|
|
|
|