diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index b358b5302..bbc87fa78 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -176,6 +176,9 @@ public class ElementCasePaneDelegate extends ElementCasePane { for (int i = 0; i < actions.length; i++) { subMenuDef.addShortCut(actions[i]); } + + // 顺便更新右侧属性面板悬浮元素tab中的菜单项 + ReportFloatPane.getInstance().refreshInsertFloatMenu(this); } // 格式菜单 diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index 9f579f4f9..e75960042 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -23,7 +23,6 @@ import java.awt.*; public class ReportFloatPane extends JPanel { private static ReportFloatPane THIS; - private ElementCasePaneDelegate elementCasePaneDelegate; private MenuDef insertFloatMenu; private ReportFloatPane() { @@ -37,12 +36,20 @@ public class ReportFloatPane extends JPanel { return THIS; } + public void refreshInsertFloatMenu(ElementCasePaneDelegate elementCasePaneDelegate) { + insertFloatMenu.clearShortCuts(); + UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); + for (int i = 0; i < actions.length; i++) { + insertFloatMenu.addShortCut(actions[i]); + } + } + private void initComponent() { this.setLayout(new BorderLayout()); UIToolbar topToolBar = new UIToolbar(); topToolBar.setLayout(new BorderLayout()); - insertFloatMenu = createInsertToolBar(); + initInsertToolBar(); topToolBar.setPreferredSize(new Dimension(155,20)); topToolBar.add(createButtonUI(), BorderLayout.CENTER); topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1)); @@ -66,19 +73,14 @@ public class ReportFloatPane extends JPanel { this.add(leftTopPane, BorderLayout.NORTH); } - private MenuDef createInsertToolBar() { - MenuDef insertFloatMenu = new MenuDef(true); + private void initInsertToolBar() { + insertFloatMenu = new MenuDef(true); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float")); insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png"); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); - UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); - for (int i = 0; i < actions.length; i++) { - insertFloatMenu.addShortCut(actions[i]); - } - return insertFloatMenu; - + ElementCasePaneDelegate elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); + refreshInsertFloatMenu(elementCasePaneDelegate); } private UIButton createButtonUI() {