|
|
@ -37,7 +37,11 @@ import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JList; |
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.JTree; |
|
|
|
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
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; |
|
|
@ -48,7 +52,9 @@ import javax.swing.tree.DefaultTreeModel; |
|
|
|
import javax.swing.tree.TreeCellRenderer; |
|
|
|
import javax.swing.tree.TreeCellRenderer; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.event.FocusAdapter; |
|
|
|
import java.awt.event.FocusAdapter; |
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
@ -85,6 +91,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
|
|
|
|
|
|
|
|
private PopupMenuListener popupMenuListener = new PopupMenuListener() { |
|
|
|
private PopupMenuListener popupMenuListener = new PopupMenuListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
|
|
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
|
|
new Thread() { |
|
|
|
new Thread() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -94,26 +101,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
}.start(); |
|
|
|
}.start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
|
|
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuCanceled(PopupMenuEvent e) { |
|
|
|
public void popupMenuCanceled(PopupMenuEvent e) { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private PopupMenuListener listener = new PopupMenuListener() { |
|
|
|
private PopupMenuListener listener = new PopupMenuListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuCanceled(PopupMenuEvent e) { |
|
|
|
public void popupMenuCanceled(PopupMenuEvent e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
|
|
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
|
|
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
|
|
|
executePopulateWorker(); |
|
|
|
executePopulateWorker(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FocusAdapter focusAdapter = new FocusAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
|
|
|
|
if (schemaBox.getSelectedIndex() == -1) { |
|
|
|
|
|
|
|
schemaBox.updateUI(); |
|
|
|
|
|
|
|
schemaBox.showPopup(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
public ChoosePane() { |
|
|
|
public ChoosePane() { |
|
|
|
this(null); |
|
|
|
this(null); |
|
|
|
} |
|
|
|
} |
|
|
@ -146,6 +168,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
private void initBoxListener() { |
|
|
|
private void initBoxListener() { |
|
|
|
addDSBoxListener(); |
|
|
|
addDSBoxListener(); |
|
|
|
schemaBox.addItemListener(new ItemListener() { |
|
|
|
schemaBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void itemStateChanged(ItemEvent evt) { |
|
|
|
public void itemStateChanged(ItemEvent evt) { |
|
|
|
tableNameComboBox.setSelectedItem(""); |
|
|
|
tableNameComboBox.setSelectedItem(""); |
|
|
|
} |
|
|
|
} |
|
|
@ -176,16 +199,9 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void addFocusListener() { |
|
|
|
protected void addFocusListener() { |
|
|
|
schemaBox.addFocusListener(new FocusAdapter() { |
|
|
|
|
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
|
|
|
|
if (schemaBox.getSelectedIndex() == -1) { |
|
|
|
|
|
|
|
schemaBox.updateUI(); |
|
|
|
|
|
|
|
schemaBox.showPopup(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
protected void initDsNameComboBox() { |
|
|
|
protected void initDsNameComboBox() { |
|
|
|
dsNameComboBox.setRefreshingModel(true); |
|
|
|
dsNameComboBox.setRefreshingModel(true); |
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
@ -233,12 +249,18 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() { |
|
|
|
populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() { |
|
|
|
|
|
|
|
|
|
|
|
protected com.fr.data.impl.Connection doInBackground() throws Exception { |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected com.fr.data.impl.Connection doInBackground() { |
|
|
|
|
|
|
|
schemaBox.setRefreshingModel(true); |
|
|
|
schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "..."); |
|
|
|
schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "..."); |
|
|
|
schemaBox.setSelectedItem(null); |
|
|
|
schemaBox.setSelectedItem(null); |
|
|
|
|
|
|
|
schemaBox.setRefreshingModel(false); |
|
|
|
return getConnection(); |
|
|
|
return getConnection(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
|
|
|
@Override |
|
|
|
public void done() { |
|
|
|
public void done() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
com.fr.data.impl.Connection selectedDatabase = get(); |
|
|
|
com.fr.data.impl.Connection selectedDatabase = get(); |
|
|
@ -267,6 +289,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
schemaBox.removePopupMenuListener(listener); |
|
|
|
schemaBox.removePopupMenuListener(listener); |
|
|
|
schemaBox.setPopupVisible(true); |
|
|
|
schemaBox.setPopupVisible(true); |
|
|
|
schemaBox.addPopupMenuListener(listener); |
|
|
|
schemaBox.addPopupMenuListener(listener); |
|
|
|
|
|
|
|
schemaBox.removeFocusListener(focusAdapter); |
|
|
|
|
|
|
|
schemaBox.addFocusListener(focusAdapter); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
populateWorker.execute(); |
|
|
|
populateWorker.execute(); |
|
|
@ -292,7 +316,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
return null; // peter:选中了当前的零长度的节点,直接返回.
|
|
|
|
return null; // peter:选中了当前的零长度的节点,直接返回.
|
|
|
|
} |
|
|
|
} |
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
|
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); |
|
|
|
for (Map.Entry<String, Connection> entry: connectionConfig.getConnections().entrySet()) { |
|
|
|
for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) { |
|
|
|
if (ComparatorUtils.equals(selectedDSName, entry.getKey())) { |
|
|
|
if (ComparatorUtils.equals(selectedDSName, entry.getKey())) { |
|
|
|
return entry.getValue(); |
|
|
|
return entry.getValue(); |
|
|
|
} |
|
|
|
} |
|
|
@ -303,6 +327,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 刷新没多大用。而且要刷新也不是这儿刷新。 |
|
|
|
* 刷新没多大用。而且要刷新也不是这儿刷新。 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void refresh() { |
|
|
|
public void refresh() { |
|
|
|
DBUtils.refreshDatabase(); |
|
|
|
DBUtils.refreshDatabase(); |
|
|
|
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); |
|
|
|
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); |
|
|
@ -312,6 +337,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() { |
|
|
|
TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
|
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
|
|
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
|
|
|
if (value instanceof DefaultMutableTreeNode) { |
|
|
|
if (value instanceof DefaultMutableTreeNode) { |
|
|
@ -328,6 +354,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() { |
|
|
|
public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
|
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
|
|
if (value instanceof TreePath) { |
|
|
|
if (value instanceof TreePath) { |
|
|
@ -344,16 +371,18 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 添加项目监听事件 |
|
|
|
* 添加项目监听事件 |
|
|
|
* @param aListener 事件监听器 |
|
|
|
* |
|
|
|
|
|
|
|
* @param aListener 事件监听器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addItemListener(ItemListener aListener) { |
|
|
|
public void addItemListener(ItemListener aListener) { |
|
|
|
this.tableNameComboBox.addItemListener(aListener); |
|
|
|
this.tableNameComboBox.addItemListener(aListener); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除项目监听事件 |
|
|
|
* 删除项目监听事件 |
|
|
|
* @param aListener 事件监听器 |
|
|
|
* |
|
|
|
|
|
|
|
* @param aListener 事件监听器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeItemListener(ItemListener aListener) { |
|
|
|
public void removeItemListener(ItemListener aListener) { |
|
|
|
this.tableNameComboBox.removeItemListener(aListener); |
|
|
|
this.tableNameComboBox.removeItemListener(aListener); |
|
|
@ -398,9 +427,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
((DefaultTreeModel) tree.getModel()).reload(); |
|
|
|
((DefaultTreeModel) tree.getModel()).reload(); |
|
|
|
/** |
|
|
|
// daniel 展开所有tree
|
|
|
|
* daniel 展开所有tree |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
TreeNode root = (TreeNode) tree.getModel().getRoot(); |
|
|
|
TreeNode root = (TreeNode) tree.getModel().getRoot(); |
|
|
|
TreePath parent = new TreePath(root); |
|
|
|
TreePath parent = new TreePath(root); |
|
|
|
TreeNode node = (TreeNode) parent.getLastPathComponent(); |
|
|
|
TreeNode node = (TreeNode) parent.getLastPathComponent(); |
|
|
@ -416,42 +443,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 创建选中的数据集数据 |
|
|
|
* 创建选中的数据集数据 |
|
|
|
* @return 数据集数据 |
|
|
|
* |
|
|
|
|
|
|
|
* @return 数据集数据 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public TableData createSelectTableData() { |
|
|
|
public TableData createSelectTableData() { |
|
|
|
DataBaseItems paras = this.updateBean(); |
|
|
|
DataBaseItems paras = this.updateBean(); |
|
|
|
boolean connect = false; |
|
|
|
boolean connect = false; |
|
|
|
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName()); |
|
|
|
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName()); |
|
|
|
if (database == null) { |
|
|
|
if (database == null) { |
|
|
|
failedToFindTable(); |
|
|
|
failedToFindTable(); |
|
|
|
return TableData.EMPTY_TABLEDATA; |
|
|
|
return TableData.EMPTY_TABLEDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
connect = FRContext.getCurrentEnv().testConnection(database); |
|
|
|
connect = FRContext.getCurrentEnv().testConnection(database); |
|
|
|
} catch (Exception e1) { |
|
|
|
} catch (Exception ignored) { |
|
|
|
connect = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (!connect) { |
|
|
|
if (!connect) { |
|
|
|
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
|
|
|
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
|
|
|
JOptionPane.showMessageDialog(designerFrame, Inter.getLocText("Datasource-Connection_failed"), |
|
|
|
JOptionPane.showMessageDialog(designerFrame, Inter.getLocText("Datasource-Connection_failed"), |
|
|
|
Inter.getLocText("FR-Designer_Failed"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
Inter.getLocText("FR-Designer_Failed"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
failedToFindTable(); |
|
|
|
failedToFindTable(); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
// 显示Table数据.
|
|
|
|
// 显示Table数据.
|
|
|
|
|
|
|
|
|
|
|
|
TableData tableData = null; |
|
|
|
TableData tableData = null; |
|
|
|
if (FRContext.getCurrentEnv() instanceof LocalEnv) { |
|
|
|
if (FRContext.getCurrentEnv() instanceof LocalEnv) { |
|
|
|
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), |
|
|
|
tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), |
|
|
|
DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
tableData = tableDataLocal; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
try { |
|
|
|
try { |
|
|
|
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); |
|
|
|
tableData = FRContext.getCurrentEnv().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP, |
|
|
|
tableData = FRContext.getCurrentEnv().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP, |
|
|
|
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); |
|
|
|
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
failedToFindTable(); |
|
|
|
failedToFindTable(); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -463,8 +489,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
return this.dsNameComboBox.getSelectedItem(); |
|
|
|
return this.dsNameComboBox.getSelectedItem(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void failedToFindTable() { |
|
|
|
protected void failedToFindTable() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected String getTableName() { |
|
|
|
protected String getTableName() { |
|
|
|
String tableName = ""; |
|
|
|
String tableName = ""; |
|
|
@ -485,7 +511,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 得到当前的ColumnName[] |
|
|
|
* 得到当前的ColumnName[] |
|
|
|
* @return 返回当前的ColumnName[] |
|
|
|
* |
|
|
|
|
|
|
|
* @return 返回当前的ColumnName[] |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String[] currentColumnNames() { |
|
|
|
public String[] currentColumnNames() { |
|
|
|
String[] colNames = null; |
|
|
|
String[] colNames = null; |
|
|
@ -493,21 +520,19 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
DataBaseItems paras = this.updateBean(); |
|
|
|
DataBaseItems paras = this.updateBean(); |
|
|
|
String selectedDSName = paras.getDatabaseName(); |
|
|
|
String selectedDSName = paras.getDatabaseName(); |
|
|
|
if (StringUtils.isBlank(selectedDSName)) { |
|
|
|
if (StringUtils.isBlank(selectedDSName)) { |
|
|
|
return colNames = new String[0]; // peter:选中了当前的零长度的节点,直接返回.
|
|
|
|
// peter:选中了当前的零长度的节点,直接返回.
|
|
|
|
|
|
|
|
return new String[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String selectedTableObject = paras.getTableName(); |
|
|
|
String selectedTableObject = paras.getTableName(); |
|
|
|
if (StringUtils.isEmpty(selectedTableObject)) { |
|
|
|
if (StringUtils.isEmpty(selectedTableObject)) { |
|
|
|
return colNames = new String[0]; |
|
|
|
return new String[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
java.sql.Connection conn = null; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// daniel:增加参数
|
|
|
|
// daniel:增加参数
|
|
|
|
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); |
|
|
|
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); |
|
|
|
} catch (Exception e2) { |
|
|
|
} catch (Exception e2) { |
|
|
|
FRContext.getLogger().error(e2.getMessage(), e2); |
|
|
|
FRContext.getLogger().error(e2.getMessage(), e2); |
|
|
|
} finally { |
|
|
|
|
|
|
|
DBUtils.closeConnection(conn); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (colNames == null) { |
|
|
|
if (colNames == null) { |
|
|
@ -517,9 +542,10 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 预览key value对应的数据 |
|
|
|
* 预览key value对应的数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param key 键 |
|
|
|
* @param key 键 |
|
|
|
* @param value 值 |
|
|
|
* @param value 值 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void preview(int key, int value) { |
|
|
|
public void preview(int key, int value) { |
|
|
|
PreviewTablePane.previewTableData(createSelectTableData(), key, value); |
|
|
|
PreviewTablePane.previewTableData(createSelectTableData(), key, value); |
|
|
@ -528,6 +554,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 默认预览 |
|
|
|
* 默认预览 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void preview() { |
|
|
|
public void preview() { |
|
|
|
preview(-1, -1); |
|
|
|
preview(-1, -1); |
|
|
|
} |
|
|
|
} |
|
|
@ -540,10 +567,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*注册listener,相应数据集改变 |
|
|
|
* 注册listener,相应数据集改变 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void registerDSChangeListener() { |
|
|
|
public void registerDSChangeListener() { |
|
|
|
DesignTableDataManager.addDsChangeListener(new ChangeListener() { |
|
|
|
DesignTableDataManager.addDsChangeListener(new ChangeListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
initDsNameComboBox(); |
|
|
|
initDsNameComboBox(); |
|
|
|
} |
|
|
|
} |
|
|
@ -578,6 +607,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
this.refreshingModel = refreshingModel; |
|
|
|
this.refreshingModel = refreshingModel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void setSelectedItem(Object ob) { |
|
|
|
public void setSelectedItem(Object ob) { |
|
|
|
this.getModel().setSelectedItem(ob); |
|
|
|
this.getModel().setSelectedItem(ob); |
|
|
|
if (ob != null && StringUtils.isEmpty(ob.toString())) { |
|
|
|
if (ob != null && StringUtils.isEmpty(ob.toString())) { |
|
|
@ -591,11 +621,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha |
|
|
|
private class ComboBoxEditor extends UIComboBoxEditor { |
|
|
|
private class ComboBoxEditor extends UIComboBoxEditor { |
|
|
|
private Object item; |
|
|
|
private Object item; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void setItem(Object item) { |
|
|
|
public void setItem(Object item) { |
|
|
|
this.item = item; |
|
|
|
this.item = item; |
|
|
|
textField.setText((item == null) ? "" : item.toString()); |
|
|
|
textField.setText((item == null) ? "" : item.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Object getItem() { |
|
|
|
public Object getItem() { |
|
|
|
return this.item; |
|
|
|
return this.item; |
|
|
|
} |
|
|
|
} |
|
|
|