Browse Source

REPORT-137698 fix修复数据字典数据查询无法展开数据列选择问题

fbp/release
Richard.Fang 1 month ago
parent
commit
eabaf76e27
  1. 26
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java

26
designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java

@ -1,6 +1,8 @@
package com.fr.design.data.datapane;
import com.fr.design.constants.UIConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.util.Iterator;
import java.util.Map.Entry;
@ -43,22 +45,29 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
this.treeName = treeName;
this.setRenderer(new UIComboBoxRenderer() {
private static final long serialVersionUID = 1L;
private boolean labelVisible = true;
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (index == -1 && value == null) {
// 显示空白
if (value instanceof TableDataWrapper) {
labelVisible = true;
TableDataWrapper tableDataWrapper = (TableDataWrapper)value;
renderer.setIcon(tableDataWrapper.getIcon());
renderer.setText(tableDataWrapper.getTableDataName());
renderer.setToolTipText(tableDataWrapper.getTableDataName());
} else {
labelVisible = false;
renderer.setIcon(null);
renderer.setText(StringUtils.EMPTY);
}else if (value instanceof TableDataWrapper) {
TableDataWrapper tabledatawrappe = (TableDataWrapper)value;
renderer.setIcon(tabledatawrappe.getIcon());
renderer.setText(tabledatawrappe.getTableDataName());
renderer.setToolTipText(tabledatawrappe.getTableDataName());
}
return renderer;
}
@Override
public Dimension getPreferredSize() {
return labelVisible ? super.getPreferredSize() : new Dimension(super.getPreferredSize().width, 0);
}
});
refresh(source);
registerDSChangeListener();
@ -75,6 +84,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
setDsMap();
DefaultComboBoxModel model = new DefaultComboBoxModel();
this.setModel(model);
model.addElement(UIConstants.PENDING);
// 遍历添加所有数据项到模型
Iterator<Entry<String, TableDataWrapper>> entryIt = dsMap.entrySet().iterator();
while (entryIt.hasNext()) {
@ -83,8 +93,6 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
model.addElement(tableDataWrapper);
}
}
// 设置默认选项为空白
this.setSelectedItem(null);
if (dataWrapper != null) {
if (DesignTableDataManager.isDsNameChanged(dataWrapper.getTableDataName())) {
this.setSelectedTableDataByName(DesignTableDataManager.getChangedDsNameByOldDsName(dataWrapper.getTableDataName()));

Loading…
Cancel
Save