From ef2d65581066c301ae265f881e778a63a59a26b9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Thu, 20 Dec 2018 16:30:52 +0800 Subject: [PATCH] REPORT-13689 & REPORT-13733 & REPORT-13716 & REPORT-13720 --- .../design/file/HistoryTemplateListCache.java | 5 ++ .../fr/design/mainframe/DesignerFrame.java | 26 ++++--- .../mainframe/EastRegionContainerPane.java | 2 + .../actions/server/StyleListAction.java | 77 ++++++++++--------- .../com/fr/design/present/StyleArrayPane.java | 16 ++-- 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..b41e15e80c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,6 +2,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent { public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); + //直接关闭模板的时候退出权限编辑 + if (DesignModeContext.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().closeAuthorityEditing(); + } if (contains(selected) == -1) { return; } 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 5c262da9de..d7c40e6bdd 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 @@ -10,6 +10,7 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; @@ -224,16 +226,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMAL); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); + if (DesignModeContext.isAuthorityEditing()) { + closeAuthorityEditing(); } } @@ -332,6 +326,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } + public void closeAuthorityEditing(){ + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + /** * 注册app. * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a49d66791f..97ce22814d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { propertyCard.show(rightPane, tabName); propertyItem.setTabButtonSelected(); + //从单元格菜单过来也要关闭弹出窗 + hideCurrentPopupPane(); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 61276163d5..4f57bdc2ac 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerCallBack; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import java.awt.event.ActionEvent; @@ -21,16 +24,17 @@ import java.awt.event.ActionEvent; * StyleList Action */ public class StyleListAction extends UpdateAction { - public StyleListAction() { + public StyleListAction() { this.setMenuKeySet(PREDEFINED_STYLES); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); - this.generateAndSetSearchText(StyleManagerPane.class.getName()); - } + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.generateAndSetSearchText(StyleManagerPane.class.getName()); + } /** * 动作 + * * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { @@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { styleListPane.update(ServerPreferenceConfig.getInstance()); } + }.addCallBack(new CallBackAdaptor(){ + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); + } + })); - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); - - } + } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); - styleListDialog.setVisible(true); - - } - - @Override - public void update() { - this.setEnabled(true); - } + ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); + styleListPane.populate(mirror); + styleListDialog.setVisible(true); + } + + @Override + public void update() { + this.setEnabled(true); + } - public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'K'; - } + public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'K'; + } - @Override - public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); - } + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); + } - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; } diff --git a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java index bd7602ee79..76c1e72617 100644 --- a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.present; import com.fr.base.Style; import com.fr.config.ServerPreferenceConfig; +import com.fr.config.StyleMap; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -13,6 +14,8 @@ import com.fr.design.style.StylePane; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; import java.util.ArrayList; import java.util.Iterator; @@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ServerPreferenceConfig configManager) { - configManager.clearAllStyle(); + public void update(final ServerPreferenceConfig configManager) { + //configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] nameables = this.update(); - + final StyleMap styleMap = new StyleMap(); for (int i = 0; i < nameables.length; i++) { - configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); + styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); } - DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); - } - + configManager.setStyleMap(styleMap); + } }