diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java index 8b5c626571..8964ff8de0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java @@ -69,7 +69,16 @@ public class TreeTableDataComboBox extends UIComboBox { } } } - + + /** + * 带参刷新方法 + * @param source 数据源数据集 + */ + public void refresh(TableDataSource source) { + this.source = source; + refresh(); + } + public void setSelectedTableDataByName(String name) { TableDataWrapper tableDataWrapper; if (res_map.get(name) != null) { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java index 46cdae35bd..6103e68002 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java @@ -26,14 +26,14 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.stable.StringUtils; - -import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; +import javax.swing.*; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable { private TreeTableDataComboBox treeTableDataComboBox; @@ -61,6 +61,23 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe tdChange(); } }); + // REPORT-38762 加一个展开监听事件,下拉框展开时刷新一下数据集 + treeTableDataComboBox.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + treeTableDataComboBox.refresh(DesignTableDataManager.getEditingTableDataSource()); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); selectTreeDataPanel.add(treeTableDataComboBox); treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); treeTableDataComboBox.setSelectedIndex(-1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index fe0276b384..2f65fca0a8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -746,10 +746,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void checkCombineUp(boolean flag, ArrayList al) { //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 - if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getMenuState() == DesignState.WORK_SHEET) { - return; + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jTemplate != null) { + // 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return + if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) { + return; + } + combineUp.checkComponentsByNames(flag, al); } - combineUp.checkComponentsByNames(flag, al); } /**