diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 575ab630ba..9ac46a4291 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -5,6 +5,7 @@ package com.fr.design.gui.icombobox; import com.fr.log.FineLoggerFactory; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.DefaultComboBoxModel; import javax.swing.SwingWorker; @@ -35,6 +36,10 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ private Object initialSelected = null; + //数据集和模板的名称 + private String oldDsName; + private String oldTemplateName; + protected LazyComboBox() { super(); @@ -53,6 +58,15 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen */ public abstract Object[] load(); + public void changeLoaded(String dsName, String templateName){ + if (!StringUtils.equals(dsName, oldDsName) || !StringUtils.equals(templateName, oldTemplateName)){ + this.setLoaded(false); + + oldDsName = dsName; + oldTemplateName = templateName; + } + } + @Override public void setSelectedItem(Object anObject) { initialSelected = anObject; diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 76ea00a029..181c5fb7ff 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -9,6 +9,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.ilable.UILabel; @@ -88,9 +89,6 @@ public class SelectedDataColumnPane extends BasicPane { private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]"); - //数据集和数据列上次的名称 - private String oldDsName; - private String oldColumnName; /** * 数据集下拉框变动后修改数据列下拉框加载状态的监听器 @@ -240,15 +238,12 @@ public class SelectedDataColumnPane extends BasicPane { String dsColumnName = TableDataColumn.getColumnName(dsColumn.getColumn()); columnNameComboBox.setSelectedItem(dsColumnName); ps = dsColumn.getParameters(); + //模板名称 + String templateName = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getName(); addListener(); - //比较上一次的数据集名称和数据列,不一样的话需要加载 - if(!StringUtils.equals(dsName,oldDsName) || !StringUtils.equals(dsColumnName,oldColumnName)){ - columnNameComboBox.setLoaded(false); - - oldDsName = dsName; - oldColumnName = dsColumnName; - } + //比较上一次的数据集名称和模板名称,不一样的话需要加载 + columnNameComboBox.changeLoaded(dsName, templateName); } /**