Browse Source

Pull request #1733: 无jira任务, bugfix -> release

Merge in DESIGN/design from bugfix/10.0 to release/10.0

* commit '86520a15681580cc050736b7ca1fd503a8e9e5e4':
  REPORT-31879 gauss表的字段获取不到
feature/big-screen
neil 5 years ago
parent
commit
5363b1f737
  1. 31
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

31
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -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;

10
designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

@ -2,7 +2,9 @@ package com.fr.design.present.dict;
import com.fr.base.BaseFormula;
import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane;
@ -23,7 +25,6 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -215,7 +216,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
*
*/
public void dbChange() {
TableData tableData = this.chooseTable.createSelectTableData();
TableData tableData = this.chooseTable.createSelectTableData(new ChoosePane.SelectSqlProcessor() {
@Override
public String createSelectSql(String schema, String tableName, Dialect dialect) {
return DataCoreUtils.createColumnSelectSQL(schema, tableName, dialect);
}
});
String[] columnNames = DesignTableDataManager.getColumnNamesByTableData(tableData).toArray(new String[0]);
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames);
columnNameEditor1.addItemListener(itemListener);

Loading…
Cancel
Save