|
|
|
@ -4,6 +4,7 @@ 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.DBTableData; |
|
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
@ -37,11 +38,7 @@ import com.fr.stable.StringUtils;
|
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.server.connection.DBConnectAuth; |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
@ -52,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; |
|
|
|
@ -469,6 +464,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()); |
|
|
|
@ -491,11 +495,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) { |
|
|
|
@ -605,6 +609,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; |
|
|
|
|