diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index c191c0c11e..48cb40d88b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.search.manager; import com.fr.base.FRContext; import com.fr.base.Utils; +import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; @@ -233,8 +234,12 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear SearchResult searchResult = new SearchResult(); while (modelIterator.hasNext()) { AlphaCellModel model = modelIterator.next(); - if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) { - continue; + if (model.getType() == CellType.ACTION) { + UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName()); + if (action != null) { + ((ActionModel) model).setAction(action); + searchResult.add(model); + } } else { searchResult.add(model); } diff --git a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java index 6eac1c5710..5aafd01edb 100644 --- a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.general.Inter; import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; @@ -29,6 +30,7 @@ import com.fr.stable.Nameable; public class ConditionAttributesGroupPane extends UIListControlPane { private static ConditionAttributesGroupPane singleton; private TemplateCellElement editCellElement; // 当前单元格对象 + private Selection editSelection; // 当前编辑对象 private ElementCasePane ePane; private ConditionAttributesGroupPane() { @@ -52,10 +54,8 @@ public class ConditionAttributesGroupPane extends UIListControlPane { if (isPopulating) { return; } - final CellSelection finalCS = (CellSelection) ePane.getSelection(); final TemplateElementCase tplEC = ePane.getEditingElementCase(); - - ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() { + ReportActionUtils.actionIterateWithCellSelection((CellSelection) editSelection, tplEC, new ReportActionUtils.IterAction() { public void dealWith(CellElement editCellElement) { ((TemplateCellElement)editCellElement).setHighlightGroup(updateHighlightGroup()); } @@ -75,6 +75,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane { public void populate(ElementCasePane ePane) { this.ePane = ePane; + this.editSelection = ePane.getSelection(); CellSelection cs = (CellSelection) ePane.getSelection(); final TemplateElementCase tplEC = ePane.getEditingElementCase(); editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index f43419d47f..c8a4d25766 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -58,7 +58,6 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; -import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import javax.swing.*; @@ -132,6 +131,9 @@ public abstract class ToolBarMenuDock { }; private static final String FINEREPORT = "FineReport"; private static final int MENUBAR_HEIGHT = 22; + + private static final List PLUGIN_LISTENERS = new ArrayList<>(); + private MenuDef[] menus; private ToolBarDef toolBarDef; private List shortCutsList; @@ -177,7 +179,6 @@ public abstract class ToolBarMenuDock { return dim; } }; - this.menus = menus(plus); for (int i = 0; i < menus.length; i++) { UIMenu subMenu = menus[i].createJMenu(); @@ -201,6 +202,8 @@ public abstract class ToolBarMenuDock { } public MenuDef[] menus(final ToolBarMenuDockPlus plus) { + //删除之前创建的插件菜单监听 + clearPluginListeners(); java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -230,7 +233,15 @@ public abstract class ToolBarMenuDock { return menuList.toArray(new MenuDef[menuList.size()]); } - + + private static synchronized void clearPluginListeners() { + + for (PluginEventListener listener : PLUGIN_LISTENERS) { + GeneralContext.stopListenPlugin(listener); + } + PLUGIN_LISTENERS.clear(); + } + /** * 获取所有actionmodel * @@ -602,9 +613,9 @@ public abstract class ToolBarMenuDock { addExtraMenus(menuDef, anchor, action, set); } - - private void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) { - + + private static synchronized void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) { + PluginFilter filter = new PluginFilter() { @Override @@ -613,29 +624,35 @@ public abstract class ToolBarMenuDock { return context.contain(MenuHandler.MARK_STRING); } }; - - GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() { - + + PluginEventListener beforeStop = new PluginEventListener() { + @Override public void on(PluginEvent event) { PluginRuntime runtime = event.getContext().getRuntime(); Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); removeExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); - GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { - + }; + + PluginEventListener afterRun = new PluginEventListener() { + @Override public void on(PluginEvent event) { - + PluginRuntime runtime = event.getContext().getRuntime(); Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); addExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); + }; + + GeneralContext.listenPlugin(PluginEventType.BeforeStop, beforeStop, filter); + GeneralContext.listenPlugin(PluginEventType.AfterRun, afterRun, filter); + PLUGIN_LISTENERS.add(afterRun); + PLUGIN_LISTENERS.add(beforeStop); } - - private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { + + private static void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { List target = new ArrayList<>(); @@ -657,8 +674,8 @@ public abstract class ToolBarMenuDock { menuDef.removeShortCut(shortCut); } } - - private void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { + + private static void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { List target = new ArrayList<>(); for (MenuHandler handler : set) { diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index 845eb3660e..853ff15923 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java @@ -27,12 +27,18 @@ public class UpdateActionManager { this.updateActions = updateActions; } - public boolean isEnable(UpdateAction updateAction) { + /** + * 根据action name获取action对象 + * + * @param name + * @return + */ + public UpdateAction getActionByName(String name) { for (UpdateActionModel action : updateActions) { - if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) { - return true; + if (ComparatorUtils.equals(name, action.getActionName()) && action.getAction().isEnabled()) { + return action.getAction(); } } - return false; + return null; } } diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index 20702ec8f4..c7fbdb7592 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -98,11 +98,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr if (row == 0) { if (state == WBodyLayoutType.FIT.getTypeValue()) { return switch2FitBodyLayout(); - } else { - XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); - if (xfl.toData().removeMargin()) { - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } } } if (row == 1) { diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index d6d7c06c59..9ffad45338 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -152,7 +152,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xfl.getComponents(); xfl.removeAll(); - xfl.toData().removeMargin(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index b429ff84b4..be330d2f92 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -161,6 +161,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xWFitLayout.getComponents(); xWFitLayout.removeAll(); + layout.resetStyle(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) {