From fc684822f2bb8fdcc6a18080aa1762ebf1977b45 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 23 Aug 2021 14:18:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-51919=20=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 新增模版主题功能: 1. 修复将主题应用到模版后,应用按钮未灰化的问题 2. 修复新自适应合并到feature/x中jar后,右侧栏样式面板不显示跟随主题或 自定义按钮的问题 【改动思路】 同上 --- .../dialog/TemplateThemeUsingDialog.java | 5 +- .../FRAbsoluteBodyLayoutExtendDefinePane.java | 113 ++++++++++++------ .../attrpane/FRFitLayoutExtendDefinePane.java | 106 ++++++++++------ 3 files changed, 150 insertions(+), 74 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java index e853f68e5..86ee48eb4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java @@ -127,7 +127,7 @@ public class TemplateThemeUsingDialog extends TemplateT button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - apply2CurrentTemplate(); + apply2CurrentTemplate(button); } }); return button; @@ -149,11 +149,12 @@ public class TemplateThemeUsingDialog extends TemplateT super.exit(); } - public void apply2CurrentTemplate() { + private void apply2CurrentTemplate(UIButton usingCurrentThemeButton) { TemplateTheme theme = themeListPane.getSelectedTheme(); if (theme != null) { currentTemplate.setTemplateTheme(theme); themeListPane.repaint(); + usingCurrentThemeButton.setEnabled(false); } } } diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java index 69781e7a6..e4863adf8 100644 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRAbsoluteBodyLayoutExtendDefinePane.java @@ -2,6 +2,8 @@ package com.fr.design.fit.attrpane; import com.fr.base.io.IOFile; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.TemplateTheme; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; @@ -11,19 +13,23 @@ import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.style.FollowingThemePane; +import com.fr.design.gui.xpane.LayoutStylePane; +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.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; -import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.general.act.BorderPacker; import com.fr.report.core.ReportUtils; import javax.swing.BorderFactory; @@ -38,7 +44,8 @@ import java.awt.Component; public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefinePane { private static final int MAX_LABEL_WIDTH = 80; - private AccessibleWLayoutBorderStyleEditor borderStyleEditor; + protected FollowingThemePane themePane; + private LayoutStylePane stylePane; private AccessibleBodyWatermarkEditor watermarkEditor; private UIComboBox layoutCombox; @@ -50,51 +57,80 @@ public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefine public void initComponent() { - initCenterPane(); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - borderStyleEditor = new AccessibleWLayoutBorderStyleEditor(); + initUIComboBox(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel panel1 = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(panel1, BorderLayout.CENTER); + + UIExpandablePane scalePane = new UIExpandablePane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Area_Scaling"), + 280, 20, + createAreaScalePane() + ); + panel1.add(scalePane, BorderLayout.NORTH); + + UIExpandablePane advancedPane = new UIExpandablePane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), + 280, 20, + this.createAdvancePane()); + panel1.add(advancedPane, BorderLayout.CENTER); + + } + + public JPanel createAdvancePane() { + JPanel advancedContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + themePane = new FollowingThemePane(Toolkit.i18nText("Fine-Design_Form_Widget_Style_Setting")); + stylePane = new LayoutStylePane(); + themePane.addFollowThemePane(stylePane, new FollowingThemePane.FollowingThemeActionChangeListener() { + @Override + public void onFollowingTheme(boolean following) { + stylePane.supportBodyStyle(!following); + + BorderPacker style = stylePane.updateBean(); + if (following) { + TemplateTheme theme = themePane.getUsingTheme(); + if (theme instanceof FormTheme) { + style = ((FormTheme) theme).getBodyStyle().merge(style); + } + } + stylePane.populateBean((LayoutBorderStyle) style); + } + }); + advancedContentPane.add(themePane, BorderLayout.NORTH); + watermarkEditor = new AccessibleBodyWatermarkEditor(); - JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane( + JPanel watermarkPane = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style")), borderStyleEditor}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), watermarkEditor} }, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - borderPane.add(jPanel, BorderLayout.CENTER); - UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, borderPane); - centerPane.add(advancedPane, BorderLayout.NORTH); - this.add(centerPane, BorderLayout.NORTH); - } - - private void initCenterPane(){ - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - initUIComboBox(); - JPanel thirdPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel jPanel = createThirdPane(); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - thirdPane.add(jPanel, BorderLayout.CENTER); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, thirdPane); - this.add(layoutExpandablePane, BorderLayout.CENTER); + watermarkPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + advancedContentPane.add(watermarkPane, BorderLayout.CENTER); + return advancedContentPane; } - public JPanel createThirdPane() { + public JPanel createAreaScalePane() { initLayoutComboBox(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] rowSize = {p}; - double[] colSize = {p, f}; UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")); - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane( + UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode")); + + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{ - new Component[]{layoutTypeLabel, UIComponentUtils.wrapWithBorderLayoutPane(layoutCombox)}}, - rowSize, colSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - jPanel.add(northPane, BorderLayout.NORTH); - return jPanel; + {layoutTypeLabel, layoutCombox}, + {scaleModeLabel, comboBox} + }, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + + contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + + JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + containerPane.add(contentPane, BorderLayout.CENTER); + containerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + return containerPane; } public void initLayoutComboBox() { @@ -114,7 +150,9 @@ public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefine public void populateSubPane(WAbsoluteLayout ob) { layoutCombox.setSelectedIndex(1); - borderStyleEditor.setValue(ob.getBorderStyle()); + themePane.supportFollowingTheme(ob.supportThemed()); + themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme()); + stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); } @@ -135,7 +173,8 @@ public class FRAbsoluteBodyLayoutExtendDefinePane extends FRAbsoluteLayoutDefine copyLayoutAttr(layout, xwFitLayout.toData()); } } - layout.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue()); + layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme()); + layout.setBorderStyle(stylePane.updateBean()); updateWatermark(); return layout; } diff --git a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java index 3dd0f1c48..77e468cb4 100644 --- a/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/fit/attrpane/FRFitLayoutExtendDefinePane.java @@ -1,7 +1,10 @@ package com.fr.design.fit.attrpane; + import com.fr.base.io.IOFile; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.TemplateTheme; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; @@ -15,14 +18,15 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.style.FollowingThemePane; +import com.fr.design.gui.xpane.LayoutStylePane; +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.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; -import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; @@ -34,6 +38,7 @@ import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.act.BorderPacker; import com.fr.log.FineLoggerFactory; import com.fr.report.core.ReportUtils; @@ -54,7 +59,8 @@ public class FRFitLayoutExtendDefinePane extends AbstractFRLayoutDefinePane