Browse Source

REPORT-6956 错误的调用

master
RichieJi 7 years ago
parent
commit
720b279a0f
  1. 33
      designer_base/src/com/fr/design/data/datapane/ChoosePane.java
  2. 11
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
  3. 7
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  4. 9
      designer_base/src/com/fr/design/formula/FunctionConstants.java

33
designer_base/src/com/fr/design/data/datapane/ChoosePane.java

@ -7,6 +7,7 @@ import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -17,7 +18,11 @@ import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.gui.icombobox.*; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterableComboBoxModel;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxEditor;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -37,7 +42,12 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import javax.swing.tree.*; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.*;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
@ -45,8 +55,8 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author zhou * @author zhou
@ -179,12 +189,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
protected void initDsNameComboBox() { protected void initDsNameComboBox() {
dsNameComboBox.setRefreshingModel(true); dsNameComboBox.setRefreshingModel(true);
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
@SuppressWarnings("unchecked") List<String> dsList = new ArrayList<>();
Iterator<String> datasourceNameIterator = connectionConfig.getConnectionNameIterator(); dsList.addAll(connectionConfig.getConnections().keySet());
List<String> dsList = new ArrayList<String>();
while (datasourceNameIterator.hasNext()) {
dsList.add((String) datasourceNameIterator.next());
}
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(dsList); FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(dsList);
dsNameComboBox.setModel(dsNameComboBoxModel); dsNameComboBox.setModel(dsNameComboBoxModel);
dsNameComboBox.setRefreshingModel(false); dsNameComboBox.setRefreshingModel(false);
@ -286,12 +292,9 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return null; // peter:选中了当前的零长度的节点,直接返回. return null; // peter:选中了当前的零长度的节点,直接返回.
} }
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
@SuppressWarnings("unchecked") for (Map.Entry<String, Connection> entry: connectionConfig.getConnections().entrySet()) {
Iterator<String> datasourceNameIterator = connectionConfig.getConnectionNameIterator(); if (ComparatorUtils.equals(selectedDSName, entry.getKey())) {
while (datasourceNameIterator.hasNext()) { return entry.getValue();
String datasourceName = datasourceNameIterator.next();
if (ComparatorUtils.equals(selectedDSName, datasourceName)) {
return connectionConfig.getConnection(datasourceName);
} }
} }
return null; return null;

11
designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -133,12 +133,9 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
* @param connectionConfig the new datasourceManager. * @param connectionConfig the new datasourceManager.
*/ */
public void populate(ConnectionConfig connectionConfig) { public void populate(ConnectionConfig connectionConfig) {
Iterator<String> nameIt = connectionConfig.getConnectionNameIterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>(); List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) { for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) {
String name = nameIt.next(); nameObjectList.add(new NameObject(entry.getKey(), entry.getValue()));
nameObjectList.add(new NameObject(name, connectionConfig.getConnection(name)));
} }
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
@ -153,11 +150,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
NameObject[] res_array = new NameObject[res.length]; NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array); java.util.Arrays.asList(res).toArray(res_array);
connectionConfig.clearAllConnection(); connectionConfig.removeAllConnection();
for (int i = 0; i < res_array.length; i++) { for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i]; NameObject nameObject = res_array[i];
connectionConfig.putConnection(nameObject.getName(), (Connection) nameObject.getObject()); connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject());
} }
} }
} }

7
designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -1,17 +1,14 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane { public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane {
@ -49,8 +46,8 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
} }
public void populate(ConnectionConfig datasourceManager) { public void populate(ConnectionConfig datasourceManager) {
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME // this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName()); // + File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager); this.connectionListPane.populate(datasourceManager);
} }

9
designer_base/src/com/fr/design/formula/FunctionConstants.java

@ -2,6 +2,15 @@ package com.fr.design.formula;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.file.FunctionConfig; import com.fr.file.FunctionConfig;
import com.fr.function.AVERAGE;
import com.fr.function.CHAR;
import com.fr.function.COUNT;
import com.fr.function.DATE;
import com.fr.function.MAX;
import com.fr.function.MIN;
import com.fr.function.RANGE;
import com.fr.function.SUM;
import com.fr.function.TIME;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;

Loading…
Cancel
Save