Browse Source

修复数据库表名带.引起的bug

loy 7 years ago
parent
commit
82fc86da68
  1. 7
      designer_base/src/com/fr/design/data/datapane/ChoosePane.java
  2. 13
      designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

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

@ -466,9 +466,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
protected String getTableName() { protected String getTableName() {
String tableName = ""; String tableName = "";
Object obj = this.tableNameComboBox.getSelectedItem(); Object obj = this.tableNameComboBox.getSelectedItemObject();
if (obj == null) { if (obj == null) {
obj = this.tableNameComboBox.getEditor().getItem(); obj = this.tableNameComboBox.getSelectedItem();
if (obj == null) {
obj = this.tableNameComboBox.getEditor().getItem();
}
} }
if (obj instanceof TreePath) { if (obj instanceof TreePath) {
Object tp = ((ExpandMutableTreeNode) ((TreePath) obj).getLastPathComponent()).getUserObject(); Object tp = ((ExpandMutableTreeNode) ((TreePath) obj).getLastPathComponent()).getUserObject();

13
designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -57,6 +57,7 @@ public class FRTreeComboBox extends UIComboBox {
// richer:下拉展示用的tree // richer:下拉展示用的tree
protected JTree tree; protected JTree tree;
private boolean onlyLeafSelectable = true; private boolean onlyLeafSelectable = true;
private Object selectedObject = null;
public FRTreeComboBox() { public FRTreeComboBox() {
this(new JTree()); this(new JTree());
@ -162,6 +163,7 @@ public class FRTreeComboBox extends UIComboBox {
} }
public void setSelectedItem(Object o) { public void setSelectedItem(Object o) {
selectedObject = o;
if (o instanceof String) { if (o instanceof String) {
this.setSelectedItemString((String) o); this.setSelectedItemString((String) o);
return; return;
@ -174,6 +176,10 @@ public class FRTreeComboBox extends UIComboBox {
} }
} }
public Object getSelectedItemObject() {
return selectedObject;
}
private boolean validTreePath(String treePath){ private boolean validTreePath(String treePath){
return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]"); return StringUtils.isNotEmpty(treePath) && treePath.charAt(0) == '[' && treePath.endsWith("]");
} }
@ -183,12 +189,7 @@ public class FRTreeComboBox extends UIComboBox {
if (validTreePath(temp)) { if (validTreePath(temp)) {
temp = temp.substring(2, temp.length() - 1); temp = temp.substring(2, temp.length() - 1);
String[] selectedtable = temp.split(","); String[] selectedtable = temp.split(",");
String table = selectedtable[selectedtable.length - 1].trim(); return selectedtable[selectedtable.length - 1].trim();
if (table.contains(".")) {
String[] temp2 = table.split("\\.");
table = temp2[temp2.length - 1].trim();
}
return table;
} }
return ""; return "";
} }

Loading…
Cancel
Save