From fbde5db5db35ff023e9eca58ce02c2de2227c8c2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 26 Aug 2021 11:17:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-58062=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E7=BB=86=E8=8A=82=E5=AE=9A=E5=88=B6?= =?UTF-8?q?-=E5=8D=95=E5=85=83=E6=A0=BC=E6=A0=B7=E5=BC=8F-=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=95=B0=E9=87=8F=E8=BE=83=E5=A4=9A=EF=BC=8C=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=8F=E4=B8=AD=E9=80=89=E6=8B=A9=E6=97=B6=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 模版主题功能中工具栏样式按钮中的预定义样式 下拉列表废弃,点击样式菜单直接跳转到右侧属 性面板中的单元格样式面板 2. 修复之前版本就有的单元格样式面板切换交互问题,以及不同单元格之间切换,其样式面板的展示问题. 正确的交互行为应该是: (1)如果之前有跟随主题的样式,则打开样式面板显示跟随主题,否则就是自定义 (2)对于同一个单元格,用户从自定义切换到跟随主题,则跟随主题没有选中项,且用户样式依然为自定义样式, 当用户在跟随主题面板中选择了某个样式,则用户样式变为跟随主题面板中的被选中样式 (3)对于同一个单元格,用户从跟随主题切换到自定义,如果跟随主题里之前有选中项,自定义的设置与那个被选中项 一致,否则为默认样式,且将单元格样式设置为自定义样式 【改动思路】 同上 --- .../actions/cell/CellStyleAttrAction.java | 26 +++++++++++ .../actions/cell/CustomCellStyleAction.java | 22 ++++++++++ .../actions/cell/GlobalStyleMenuDef.java | 7 +++ .../fr/design/actions/cell/StyleAction.java | 5 +++ .../mainframe/ElementCasePaneDelegate.java | 4 +- .../cell/settingpane/CellStylePane.java | 2 +- .../cell/settingpane/style/StylePane.java | 43 ++++++++++++++----- .../style/ThemedCellStyleListPane.java | 9 +++- .../com/fr/grid/selection/CellSelection.java | 25 +---------- .../java/com/fr/poly/creator/ECBlockPane.java | 4 +- 10 files changed, 106 insertions(+), 41 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java new file mode 100644 index 0000000000..a257ea95d6 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java @@ -0,0 +1,26 @@ +package com.fr.design.actions.cell; + +import com.fr.base.BaseUtils; +import com.fr.design.i18n.Toolkit; +import com.fr.design.menu.KeySetUtils; +import com.fr.general.IOUtils; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/8/26 + */ +public class CellStyleAttrAction extends CellAttributeTableAction { + + public CellStyleAttrAction() { + this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_format/cell.png")); + } + + @Override + protected String getID() { + return Toolkit.i18nText("Fine-Design_Form_Widget_Style"); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java new file mode 100644 index 0000000000..db34cea32c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java @@ -0,0 +1,22 @@ +package com.fr.design.actions.cell; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.CellElementPropertyPane; + +import java.awt.event.ActionEvent; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/8/26 + */ +public class CustomCellStyleAction extends CellStyleAttrAction { + + @Override + public void actionPerformed(ActionEvent e) { + CellElementPropertyPane.getInstance().GoToPane( + Toolkit.i18nText("Fine-Design_Report_Engine_Style"), + Toolkit.i18nText("Fine-Design_Report_Engine_Custom") + ); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 142b6a6e71..f72e708d37 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -28,6 +28,13 @@ import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.util.List; +/** + * 11.beta.1 + * REPORT-51919 主题切换 + * REPORT-58062 【主题切换】细节定制-单元格样式-样式数量较多,菜单栏中选择时没有滚动条 + * 模版主题化后,该菜单列表废弃,点击工具栏-单元格-样式菜单将直接跳转到右侧栏单元格样式面板 + * @deprecated + */ public class GlobalStyleMenuDef extends MenuDef { private static final int MAX_LENTH = 12; private ElementCasePane ePane; diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java index 1f77f9b935..707779c824 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java @@ -12,6 +12,11 @@ import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.menu.KeySetUtils; +/** + * 11.beta.1 + * REPORT-51919 主题切换 + * @deprecated + */ public class StyleAction extends UpdateAction { public StyleAction() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index 79b5c8dc5d..5cc095cfac 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -5,9 +5,9 @@ import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellExpandAttrAction; +import com.fr.design.actions.cell.CellStyleAttrAction; import com.fr.design.actions.cell.CellWidgetAttrAction; import com.fr.design.actions.cell.ConditionAttributesAction; -import com.fr.design.actions.cell.GlobalStyleMenuDef; import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertRowAction; import com.fr.design.actions.core.ActionFactory; @@ -201,7 +201,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic()); menuDef.addShortCut(new CellExpandAttrAction()); - menuDef.addShortCut(new GlobalStyleMenuDef(this)); + menuDef.addShortCut(new CellStyleAttrAction()); // 单元格形态 menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this)); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 049b0111ae..bbb63a3917 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -70,7 +70,7 @@ public class CellStylePane extends AbstractCellAttrPane { @Override public void updateBeans() { Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane); - if (stylePane.getSelectedIndex() == 1) { + if (stylePane.getSelectedIndex() == 0) { Style s = stylePane.updateBean(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); int cellRectangleCount = cs.getCellRectangleCount(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java index b95d2fc9ca..ced3495dca 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java @@ -8,17 +8,15 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.ComparatorUtils; -import com.teamdev.jxbrowser.deps.org.checkerframework.checker.guieffect.qual.UI; +import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; -import javax.swing.JScrollPane; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -69,8 +67,22 @@ public class StylePane extends BasicPane { int selectedIndex = followingThemeButtonGroup.getSelectedIndex(); cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]); if (selectedIndex == 1) { - customStylePane.populateBean(themedCellStyleListPane.updateBean()); + // 对于同一个单元格,跟随主题切换到自定义,若跟随主题面板有选中项,则自定义中的配置与其保持一致,否则自定义中配置保持不变 + NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean(); + if (lastSelectedNameStyle != null) { + Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle(); + try { + lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone(); + if (lastSelectedRealStyle != null) { + customStylePane.populateBean(lastSelectedRealStyle); + } + } catch (CloneNotSupportedException ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + } } else { + // 对于同一个单元格,自定义切换到跟随主题,跟随主题应当清除选中项,即没有选中任何主题中的单元格样式, + // 因为还未选中,所以自定义中的配置保持不变,此时若用户切换会自定义,配置应当与之前一样 themedCellStyleListPane.populateBean(null); } } @@ -153,9 +165,7 @@ public class StylePane extends BasicPane { } public void dealWithBorder(ElementCasePane ePane) { - if (getSelectedIndex() == 1) { - customStylePane.dealWithBorder(ePane); - } + customStylePane.dealWithBorder(ePane); } public void setSelctedByName(String id) { @@ -168,16 +178,27 @@ public class StylePane extends BasicPane { public Style updateBean() { if (getSelectedIndex() == 0) { - return themedCellStyleListPane.updateBean(); - } else { - return customStylePane.updateBean(); + NameStyle nameStyle = themedCellStyleListPane.updateBean(); + if (nameStyle != null) { + // 只有当前样式面板是跟随主题面板,且跟随主题面板中存在选中项,才使用该样式设置单元格 + return nameStyle; + } } + return customStylePane.updateBean(); } public void populateBean(Style style) { if (style instanceof NameStyle) { + NameStyle nameStyle = (NameStyle) style; setSelectedIndex(0); - themedCellStyleListPane.populateBean((NameStyle) style); + themedCellStyleListPane.populateBean(nameStyle); + Style realStyle = nameStyle.getRealStyle(); + try { + realStyle = (Style) realStyle.clone(); + customStylePane.populateBean(realStyle); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } } else { setSelectedIndex(1); customStylePane.populateBean(style); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java index a2bf4c2cd2..1ddf279c7a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java @@ -7,6 +7,7 @@ import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerContext; @@ -111,6 +112,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp @Override public void populateBean(NameStyle ob) { refreshBeanElement(); + if (ob == null) { + styleList.setSelectedIndex(-1); + return; + } for (int i = 0; i < defaultListModel.getSize(); i++) { if (ComparatorUtils.equals(ob, defaultListModel.get(i))) { styleList.setSelectedIndex(i); @@ -121,7 +126,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp @Override public NameStyle updateBean() { - return (NameStyle) styleList.getSelectedValue(); + return styleList.getSelectedValue(); } /** @@ -130,7 +135,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp * @return 标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Predefined_Style"); + return Toolkit.i18nText("Fine-Design_Report_Predefined_Style"); } /** diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 4abab05ef3..c2903f43a0 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -10,13 +10,11 @@ import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellExpandAttrAction; +import com.fr.design.actions.cell.CellStyleAttrAction; import com.fr.design.actions.cell.CellWidgetAttrAction; import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.ConditionAttributesAction; import com.fr.design.actions.cell.EditCellAction; -import com.fr.design.actions.cell.GlobalStyleMenuDef; -import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection; -import com.fr.design.actions.cell.StyleAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CutAction; @@ -29,7 +27,6 @@ import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellWidgetPropertyPane; @@ -470,26 +467,8 @@ public class CellSelection extends Selection { } popup.add(new EditCellAction(ePane).createMenuItem()); popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); - // richer:add global style menu popup.add(new CellExpandAttrAction().createMenuItem()); - if (!ServerPreferenceConfig.getInstance().hasStyle()) { - UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName()); - styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); - Iterator iterato = ServerPreferenceConfig.getInstance().getStyleNameIterator(); - while (iterato.hasNext()) { - String name = (String) iterato.next(); - name = GlobalStyleMenuDef.judgeChina(name); - NameStyle nameStyle = NameStyle.getInstance(name); - UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); - useMenuItem.setNameStyle(nameStyle); - styleMenu.add(useMenuItem); - } - styleMenu.addSeparator(); - styleMenu.add(new GlobalStyleMenuDef.CustomStyleAction(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"))); - popup.add(styleMenu); - } else { - popup.add(new StyleAction().createMenuItem()); - } + popup.add(new CellStyleAttrAction().createMenuItem()); popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); popup.add(new CellAttributeAction().createMenuItem()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java index bbf91f6409..9a584836be 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java @@ -8,9 +8,9 @@ import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellExpandAttrAction; +import com.fr.design.actions.cell.CellStyleAttrAction; import com.fr.design.actions.cell.CellWidgetAttrAction; import com.fr.design.actions.cell.ConditionAttributesAction; -import com.fr.design.actions.cell.GlobalStyleMenuDef; import com.fr.design.actions.columnrow.InsertColumnAction; import com.fr.design.actions.columnrow.InsertRowAction; import com.fr.design.actions.core.ActionFactory; @@ -151,7 +151,7 @@ public class ECBlockPane extends PolyElementCasePane { menuDef.addShortCut(new CellExpandAttrAction()); menuDef.addShortCut(new CellWidgetAttrAction()); - menuDef.addShortCut(new GlobalStyleMenuDef(this)); + menuDef.addShortCut(new CellStyleAttrAction()); menuDef.addShortCut(new ConditionAttributesAction()); // 单元格形态