|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
package com.fr.design.data.datapane; |
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
import com.fr.base.TableData; |
|
|
|
|
import com.fr.data.core.DataCoreUtils; |
|
|
|
|
import com.fr.data.core.db.DBUtils; |
|
|
|
|
import com.fr.data.core.db.TableProcedure; |
|
|
|
|
import com.fr.data.core.db.dialect.Dialect; |
|
|
|
|
import com.fr.data.core.db.dialect.DialectFactory; |
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
@ -38,11 +38,7 @@ import com.fr.log.FineLoggerFactory;
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
|
|
import javax.swing.JList; |
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JTree; |
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.PopupMenuEvent; |
|
|
|
@ -53,9 +49,7 @@ import javax.swing.tree.DefaultTreeModel;
|
|
|
|
|
import javax.swing.tree.TreeCellRenderer; |
|
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.event.FocusAdapter; |
|
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
@ -455,6 +449,15 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
|
|
|
|
|
* @return 数据集数据 |
|
|
|
|
*/ |
|
|
|
|
public TableData createSelectTableData() { |
|
|
|
|
return createSelectTableData(new SelectSqlProcessor() { |
|
|
|
|
@Override |
|
|
|
|
public String createSelectSql(String schema, String tableName, Dialect dialect) { |
|
|
|
|
return DataCoreUtils.createSelectSQL(schema, tableName, dialect); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public TableData createSelectTableData(SelectSqlProcessor sqlProcessor) { |
|
|
|
|
DataBaseItems paras = this.updateBean(); |
|
|
|
|
boolean connect = false; |
|
|
|
|
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName()); |
|
|
|
@ -477,11 +480,11 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
|
|
|
|
|
|
|
|
|
|
TableData tableData = null; |
|
|
|
|
if (WorkContext.getCurrent().isLocal()) { |
|
|
|
|
tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), |
|
|
|
|
tableData = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), |
|
|
|
|
DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
|
TableData tableDataLocal = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
|
tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP, |
|
|
|
|
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -591,6 +594,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 数据集选择面板里的生成sql语句的接口 |
|
|
|
|
*/ |
|
|
|
|
public interface SelectSqlProcessor { |
|
|
|
|
String createSelectSql(String schema, String tableName, Dialect dialect); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected class StringUIComboBox extends UIComboBox { |
|
|
|
|
private boolean refreshingModel = false; |
|
|
|
|