|
|
|
@ -1,12 +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.DialectFactory; |
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
@ -37,6 +35,7 @@ import com.fr.general.IOUtils;
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
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; |
|
|
|
@ -61,9 +60,10 @@ import java.awt.event.FocusEvent;
|
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Enumeration; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author zhou |
|
|
|
@ -210,10 +210,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
protected void initDsNameComboBox() { |
|
|
|
|
dsNameComboBox.setRefreshingModel(true); |
|
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
|
|
List<String> dsList = new ArrayList<>(); |
|
|
|
|
dsList.addAll(connectionConfig.getConnections().keySet()); |
|
|
|
|
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(dsList); |
|
|
|
|
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections()); |
|
|
|
|
dsNameComboBox.setModel(dsNameComboBoxModel); |
|
|
|
|
dsNameComboBox.setRefreshingModel(false); |
|
|
|
|
} |
|
|
|
@ -322,14 +319,31 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
|
|
|
|
|
return null; // peter:选中了当前的零长度的节点,直接返回.
|
|
|
|
|
} |
|
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
|
|
for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) { |
|
|
|
|
if (ComparatorUtils.equals(selectedDSName, entry.getKey())) { |
|
|
|
|
return entry.getValue(); |
|
|
|
|
List<String> authConnections = getHasAuthConnections(); |
|
|
|
|
for (String name : authConnections) { |
|
|
|
|
if (ComparatorUtils.equals(selectedDSName, name)) { |
|
|
|
|
return connectionConfig.getConnection(name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<String> getHasAuthConnections() { |
|
|
|
|
List<String> authConnections = new ArrayList<>(); |
|
|
|
|
Set<String> allConnections = ConnectionConfig.getInstance().getConnections().keySet(); |
|
|
|
|
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); |
|
|
|
|
if (noAuthConnections == null) { |
|
|
|
|
return authConnections; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (String name : allConnections) { |
|
|
|
|
if (!noAuthConnections.contains(name)) { |
|
|
|
|
authConnections.add(name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return authConnections; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 刷新没多大用。而且要刷新也不是这儿刷新。 |
|
|
|
|
*/ |
|
|
|
|