From bc4a6ce3d7790b9f8a5ff373e742d1ad045f6b29 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 14 Dec 2023 21:46:31 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-109672=20=E6=8E=A7=E4=BB=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=A2=9E=E5=BC=BA-=E5=AD=97=E4=BD=93=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/frpane}/FontSizeComboPane.java | 25 ++++--- .../widget/DesktopWidgetStyleEditPane.java | 28 +++++--- .../widget/MobileWidgetStyleEditPane.java | 13 ++-- .../edit/widget/WidgetStyleEditPane.java | 27 +++---- .../theme/panel/ControlPreviewCell.java | 5 +- .../theme/panel/NormalButtonPreviewCell.java | 2 +- .../theme/panel/WidgetTextStylePane.java | 70 +++++++++++++++++++ .../ui/designer/CheckBoxDefinePane.java | 2 +- .../ui/designer/FieldEditorDefinePane.java | 2 +- .../ui/designer/MultiFileEditorPane.java | 2 +- .../widgettheme/BaseStyleSettingPane.java | 51 +++++++++----- .../widgettheme/ParaButtonSettingPane.java | 8 +-- .../widgettheme/ParaEditorSettingPane.java | 12 ++-- .../ParaSelectEditorSettingPane.java | 50 +++++++++++++ .../ParaTreeEditorSettingPane.java | 7 +- .../fr/design/widgettheme/StyleSetting.java | 10 ++- .../common/SelectEditorSettingPane.java | 56 +++++++++++++++ .../WidgetThemeCreatorPaneAdder.java | 24 +++++-- .../WidgetThemeParaCreatorPaneAdder.java | 19 +++-- .../com/fr/design/webattr/EditToolBar.java | 37 +++++++++- .../java/com/fr/design/webattr/FToolBar.java | 10 +++ .../com/fr/design/webattr/ToolBarPane.java | 2 +- 22 files changed, 372 insertions(+), 90 deletions(-) rename {designer-form/src/main/java/com/fr/design/widget/ui/designer/component => designer-base/src/main/java/com/fr/design/gui/frpane}/FontSizeComboPane.java (60%) create mode 100644 designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java create mode 100644 designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/FontSizeComboPane.java similarity index 60% rename from designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java rename to designer-base/src/main/java/com/fr/design/gui/frpane/FontSizeComboPane.java index 57df97ee12..a89b41d4a1 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/FontSizeComboPane.java @@ -1,7 +1,9 @@ -package com.fr.design.widget.ui.designer.component; +package com.fr.design.gui.frpane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.stable.collections.CollectionUtils; + import javax.swing.JPanel; import java.awt.BorderLayout; import java.util.Vector; @@ -13,15 +15,22 @@ public class FontSizeComboPane extends JPanel{ private static final int MAX_FONT_SIZE = 100; private UIComboBox comboBox; public FontSizeComboPane(){ - initComponent(); + this(null); } - public void initComponent(){ - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - Vector integerList = new Vector(); - for (int i = 1; i < MAX_FONT_SIZE; i++) { - integerList.add(i); + + public FontSizeComboPane(Vector fontSizes){ + initComponent(fontSizes); + } + + public void initComponent(Vector fontSizes){ + if(CollectionUtils.isEmpty(fontSizes)) { + fontSizes = new Vector<>(); + for (int i = 1; i < MAX_FONT_SIZE; i++) { + fontSizes.add(i); + } } - comboBox = new UIComboBox(integerList); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + comboBox = new UIComboBox(fontSizes); comboBox.setEditable(true); this.add(comboBox, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java index 5c1ab0177e..7cfebf316a 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java @@ -2,14 +2,15 @@ package com.fr.widgettheme.theme.edit.widget; import com.fr.base.background.ColorBackground; import com.fr.base.theme.TemplateTheme; +import com.fr.design.style.color.NewColorSelectBox; import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.ButtonBackgroundStyle; -import com.fr.widgettheme.theme.widget.style.FontSizeStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import javax.swing.ButtonGroup; import javax.swing.JPanel; @@ -29,6 +30,10 @@ public class DesktopWidgetStyleEditPane extends WidgetS // 风格2 protected UIRadioButton style2; + /** + * 下拉面板背景颜色 + */ + private NewColorSelectBox selectBackgroundColorBox; public DesktopWidgetStyleEditPane() { super(); } @@ -36,19 +41,20 @@ public class DesktopWidgetStyleEditPane extends WidgetS @Override public Component[][] generateComponent() { initStyleEditor(); + initSelectBackgroundColorBox(); // 容纳风格1和风格2的panel JPanel stylePane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout()); stylePane.add(style1); stylePane.add(style2); - Component[][] components = new Component[][]{ + return new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color")), colorSelectBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Style")), stylePane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Font_Size")), fontSizeComoBox} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), textStylePane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box")), selectBackgroundColorBox} }; - return components; } @@ -60,6 +66,11 @@ public class DesktopWidgetStyleEditPane extends WidgetS buttonGroup.add(style2); } + private void initSelectBackgroundColorBox() { + selectBackgroundColorBox = new NewColorSelectBox(140, true); + selectBackgroundColorBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); + } + @Override public void populateBean(T t) { ThemedWidgetStyle style = (ThemedWidgetStyle) t.getWidgetStyle(); @@ -75,8 +86,8 @@ public class DesktopWidgetStyleEditPane extends WidgetS colorSelectBox.setSelectObject(style.getThemeColor()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); - fontSizeComoBox.setSelectedItem(style.getFontSizeStyle().getFontSize()); - + textStylePane.setTextStyle(style.getTextStyle()); + selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor()); } @Override @@ -91,9 +102,7 @@ public class DesktopWidgetStyleEditPane extends WidgetS borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setRadius((int) borderRadiusSpinner.getValue()); style.setBorderStyle(borderStyle); - FontSizeStyle fontSizeStyle = new FontSizeStyle(); - fontSizeStyle.setFontSize((Integer) fontSizeComoBox.getSelectedItem()); - style.setFontSizeStyle(fontSizeStyle); + style.setTextStyle(textStylePane.getTextStyle()); ButtonBackgroundStyle buttonBackgroundStyle = new ButtonBackgroundStyle(); ColorBackground buttonBackground = ColorBackground.getInstance(style.getThemeColor()); buttonBackgroundStyle.setInitialBackground(buttonBackground); @@ -101,5 +110,6 @@ public class DesktopWidgetStyleEditPane extends WidgetS buttonBackgroundStyle.setClickBackground(buttonBackground); style.setButtonBackgroundStyle(buttonBackgroundStyle); style.setStyleType(style1.isSelected() ? 1 : 2); + style.setSelectBackgroundColor(selectBackgroundColorBox.getSelectObject()); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java index 29a1de5742..228dce7b26 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java @@ -1,11 +1,10 @@ package com.fr.widgettheme.theme.edit.widget; import com.fr.base.theme.TemplateTheme; +import com.fr.widgettheme.theme.panel.WidgetTextStylePane; import com.fr.widgettheme.theme.widget.style.BorderStyle; -import com.fr.widgettheme.theme.widget.style.FontSizeStyle; import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle; import com.fr.design.gui.icombobox.LineComboBox; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import java.util.Arrays; @@ -39,8 +38,8 @@ public class MobileWidgetStyleEditPane extends WidgetSt } @Override - protected void initFontSizeComoBox() { - fontSizeComoBox = new UIComboBox(FONT_SIZES); + protected void initTextStylePane() { + textStylePane = new WidgetTextStylePane(FONT_SIZES, 140); } @Override @@ -53,7 +52,7 @@ public class MobileWidgetStyleEditPane extends WidgetSt colorSelectBox.setSelectObject(style.getThemeColor()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); - fontSizeComoBox.setSelectedItem(style.getFontSizeStyle().getFontSize()); + textStylePane.setTextStyle(style.getTextStyle()); } @Override @@ -68,9 +67,7 @@ public class MobileWidgetStyleEditPane extends WidgetSt borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setRadius((int) borderRadiusSpinner.getValue()); style.setBorderStyle(borderStyle); - FontSizeStyle fontSizeStyle = new FontSizeStyle(); - fontSizeStyle.setFontSize((Integer) fontSizeComoBox.getSelectedItem()); - style.setFontSizeStyle(fontSizeStyle); + style.setTextStyle(textStylePane.getTextStyle()); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java index 5faa1b42e5..9d568c2be6 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java @@ -4,7 +4,6 @@ import com.fr.base.theme.TemplateTheme; import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icombobox.LineComboBox; -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.FRFontPane; @@ -14,6 +13,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.NewColorSelectBox; import com.fr.stable.StringUtils; +import com.fr.widgettheme.theme.panel.WidgetTextStylePane; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import org.jetbrains.annotations.Nullable; @@ -39,9 +39,10 @@ public class WidgetStyleEditPane extends BasicBeanPane< protected LineComboBox lineComboBox; // 圆角边框 protected UISpinner borderRadiusSpinner; - // 字体大小 - protected UIComboBox fontSizeComoBox; - + /** + * 文本样式面板 + */ + protected WidgetTextStylePane textStylePane; public WidgetStyleEditPane() { initComponents(); @@ -52,9 +53,9 @@ public class WidgetStyleEditPane extends BasicBeanPane< initCommonStyleEditor(); double f = TableLayout.PREFERRED; final double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p, p}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = generateComponent(); JPanel customPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); customPane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10)); @@ -67,12 +68,12 @@ public class WidgetStyleEditPane extends BasicBeanPane< * @return components */ public Component[][] generateComponent() { - Component[][] components = new Component[][]{new Component[]{ + return new Component[][]{new Component[]{ new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color")), colorSelectBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Font_Size")), fontSizeComoBox}}; - return components; + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), textStylePane} + }; } private void initCommonStyleEditor() { @@ -80,12 +81,12 @@ public class WidgetStyleEditPane extends BasicBeanPane< colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); initLineBox(); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); - initFontSizeComoBox(); - fontSizeComoBox.setSelectedItem(16); + initTextStylePane(); + textStylePane.setFontSizeValue(16); } - protected void initFontSizeComoBox() { - fontSizeComoBox = new UIComboBox(FRFontPane.getFontSizes()); + protected void initTextStylePane() { + textStylePane = new WidgetTextStylePane(FRFontPane.getFontSizes(), 140); } /** diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java index c053737baf..7dca24b7c1 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java @@ -6,7 +6,6 @@ import com.fr.base.theme.TemplateTheme; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.FRFont; -import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.stable.Constants; import javax.swing.Icon; @@ -119,7 +118,7 @@ public class ControlPreviewCell extends JPanel { g.fillRoundRect(0, 0, getSize().width - 1, getSize().height - 1, widgetStyle.getBorderStyle().getRadius(), widgetStyle.getBorderStyle().getRadius()); //需要重新绘制一遍字体,否则会被颜色填充给遮住 Graphics2D g2d = (Graphics2D) g.create(); - FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getFontSizeStyle().getFontSize(), textColor); + FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), textColor); BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), this.value, Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT) .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), NO_SCALE_RESOLUTION); @@ -133,7 +132,7 @@ public class ControlPreviewCell extends JPanel { } Graphics2D g2d = (Graphics2D) g.create(); ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); - FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getFontSizeStyle().getFontSize(), textColor); + FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), textColor); //每个预览格子通用的字体绘制 BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), this.value, Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT) diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java index fe8a2076e5..7d734b2e16 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java @@ -43,7 +43,7 @@ public class NormalButtonPreviewCell extends ControlPreviewCell { ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); paintBgColor(g, widgetStyle); uiLabel.setForeground(Color.WHITE); - FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getFontSizeStyle().getFontSize(), Color.WHITE); + FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), Color.WHITE); uiLabel.setFont(font); this.add(uiLabel, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java new file mode 100644 index 0000000000..8223e60224 --- /dev/null +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java @@ -0,0 +1,70 @@ +package com.fr.widgettheme.theme.panel; + +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.frpane.FontSizeComboPane; +import com.fr.widgettheme.theme.widget.style.TextStyle; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.util.Vector; + +/** + * 控件文本样式配置面板 + * 包含文本字体大小和字体颜色 + * + * @author oBo + * @since 11.0 + * Created on 2023/12/13 + */ +public class WidgetTextStylePane extends JPanel { + + private final FontSizeComboPane fontSizePane; + + private final UIColorButton fontColorButton; + + public WidgetTextStylePane(int preferredWidth) { + this(null, preferredWidth); + } + + public WidgetTextStylePane(Vector fontSizes, int preferredWidth) { + this.setLayout(new FlowLayout(FlowLayout.LEFT)); + this.setBorder(BorderFactory.createEmptyBorder()); + fontSizePane = new FontSizeComboPane(fontSizes); + fontColorButton = new UIColorButton(); + fontSizePane.setPreferredSize(new Dimension(preferredWidth, fontSizePane.getPreferredSize().height)); + this.add(fontSizePane); + this.add(fontColorButton); + } + + public void setTextStyle(TextStyle textStyle) { + this.fontSizePane.setValue(textStyle.getFontSize()); + this.fontColorButton.setColor(textStyle.getFontColor()); + } + + public TextStyle getTextStyle() { + TextStyle textStyle = new TextStyle(); + textStyle.setFontSize(this.fontSizePane.getValue()); + textStyle.setFontColor(this.fontColorButton.getColor()); + return textStyle; + } + + public void setFontSizeValue(int fontSize) { + this.fontSizePane.setValue(fontSize); + } + + public void setFontColorValue(Color fontColor) { + this.fontColorButton.setColor(fontColor); + } + + public int getFontSizeValue() { + return this.fontSizePane.getValue(); + } + + public Color getFontColorValue() { + return this.fontColorButton.getColor(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java index 2a5061f3f6..d73582df7b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java @@ -13,7 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; -import com.fr.design.widget.ui.designer.component.FontSizeComboPane; +import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.CheckBox; import com.fr.general.GeneralContext; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 65aeec3a75..81499facc8 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -20,7 +20,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.widget.ui.designer.component.FontSizeComboPane; +import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.form.ui.FieldEditor; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/MultiFileEditorPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/MultiFileEditorPane.java index dcaee27789..254b592db5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/MultiFileEditorPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/MultiFileEditorPane.java @@ -10,7 +10,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.widget.ui.designer.component.FontSizeComboPane; +import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.form.ui.MultiFileEditor; diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java index 7530d2210c..3a6297b26f 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java @@ -1,8 +1,9 @@ package com.fr.design.widgettheme; import com.fr.base.theme.TemplateTheme; +import com.fr.widgettheme.theme.panel.WidgetTextStylePane; import com.fr.widgettheme.theme.widget.style.BorderStyle; -import com.fr.widgettheme.theme.widget.style.FontSizeStyle; +import com.fr.widgettheme.theme.widget.style.TextStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.widgettheme.theme.bean.ButtonBackground; import com.fr.design.beans.BasicBeanPane; @@ -19,7 +20,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.design.style.color.NewColorSelectBox; -import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.UIBoundSpinner; import com.fr.form.ui.Widget; import com.fr.general.FRFont; @@ -59,12 +59,16 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa protected LineComboBox lineComboBox; // 圆角边框 protected UIBoundSpinner borderRadiusSpinner; - // 字体大小 - protected FontSizeComboPane fontSizePane; // 字体详细设置 protected FRFontPane frFontPane; // 按钮背景设置 protected ButtonStyleDefinedPane buttonStyleDefinedPane; + /** + * 文本样式 + * 包含字体大小、字体颜色 + */ + protected WidgetTextStylePane textStylePane; + protected NewColorSelectBox selectBgColorBox; private final Map labelMap = new HashMap<>(); private final Map paneMap = new HashMap<>(); @@ -87,17 +91,19 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa initStyle(); colorSelectBox = new NewColorSelectBox(160, true); lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY); - fontSizePane = new FontSizeComboPane(); borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); frFontPane = new FRFontPane(); buttonStyleDefinedPane = new ButtonStyleDefinedPane(); + textStylePane = new WidgetTextStylePane(100); + selectBgColorBox = new NewColorSelectBox(160, true); paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); paneMap.put(StyleSetting.LINE_TYPE, lineComboBox); - paneMap.put(StyleSetting.FONT_SIZE, fontSizePane); + paneMap.put(StyleSetting.TEXT_STYLE, textStylePane); paneMap.put(StyleSetting.BORDER_RADIUS, borderRadiusSpinner); paneMap.put(StyleSetting.FONT, frFontPane); paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane); + paneMap.put(StyleSetting.SELECT_COLOR, selectBgColorBox); } /** @@ -200,9 +206,10 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa setStyle(widgetStyle); setLineComboBox(widgetStyle); setBorderRadiusSpinner(widgetStyle); - setFontSizePane(widgetStyle); - setFrFontPane(widgetStyle); + setTextStylePane(widgetStyle); + setFrFontPane(); setButtonStyleDefinedPane(widgetStyle); + setSelectBgColor(widgetStyle); } private void setColorSelectBox(ThemedWidgetStyle widgetStyle) { @@ -234,15 +241,13 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa } } - private void setFontSizePane(ThemedWidgetStyle widgetStyle) { - if (fontSizePane != null) { - fontSizePane.setValue(widgetStyle.getFontSizeStyle().getFontSize()); - } + private void setTextStylePane(ThemedWidgetStyle widgetStyle) { + this.textStylePane.setTextStyle(widgetStyle.getTextStyle()); } - private void setFrFontPane(ThemedWidgetStyle widgetStyle) { + private void setFrFontPane() { if (frFontPane != null) { - frFontPane.populateBean(widgetStyle.getFontStyle().getFont()); + frFontPane.populateBean(FRFont.getInstance()); } } @@ -264,12 +269,23 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa if (borderRadiusSpinner != null) { borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS); } - if (fontSizePane != null) { - fontSizePane.setValue(FontSizeStyle.DEFAULT_FONT_SIZE); + if (textStylePane != null) { + //后面看看怎么设置默认背景色 + textStylePane.setTextStyle(new TextStyle()); } if (frFontPane != null) { frFontPane.populateBean(FRFont.getInstance()); } + if (selectBgColorBox != null) { + //后面看看怎么设置默认背景色 + selectBgColorBox.setSelectObject(null); + } + } + + private void setSelectBgColor(ThemedWidgetStyle widgetStyle) { + if(selectBgColorBox != null) { + selectBgColorBox.setSelectObject(widgetStyle.getSelectBackgroundColor()); + } } /** @@ -277,11 +293,12 @@ public abstract class BaseStyleSettingPane extends BasicBeanPa */ private void initLabelMap() { labelMap.put(StyleSetting.THEME_COLOR, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color"))); - labelMap.put(StyleSetting.FONT_SIZE, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Font_Size"))); + labelMap.put(StyleSetting.TEXT_STYLE, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style"))); labelMap.put(StyleSetting.FONT, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Font"))); labelMap.put(StyleSetting.STYLE_TYPE, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Style"))); labelMap.put(StyleSetting.LINE_TYPE, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line"))); labelMap.put(StyleSetting.BORDER_RADIUS, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius"))); labelMap.put(StyleSetting.BTN_BACKGROUND, new UILabel(Toolkit.i18nText("Fine-Design_Theme_Widget_Background"))); + labelMap.put(StyleSetting.SELECT_COLOR, new UILabel(Toolkit.i18nText("下拉面板色"))); } } diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java index 4fb2e30f1e..5933cbc15c 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java @@ -1,8 +1,8 @@ package com.fr.design.widgettheme; -import com.fr.widgettheme.theme.widget.style.FontSizeStyle; import com.fr.design.widgettheme.common.ButtonSettingPane; import com.fr.form.ui.Widget; +import com.fr.widgettheme.theme.widget.style.TextStyle; import com.fr.widgettheme.theme.widget.theme.ParaButtonTheme; import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme; @@ -22,7 +22,7 @@ public class ParaButtonSettingPane extends ButtonSettingPane extends ButtonSettingPane extends EditorSettingPane styleSettingList) { + super(styleSettingList); + } + @Override protected void assignFontSizePane(EditorTheme widgetTheme) { ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; - fontSizePane.setValue(paraEditorTheme.getFontSizeStyle().getFontSize()); + textStylePane.setTextStyle(paraEditorTheme.getTextStyle()); } @Override protected void assignFontSizeStyle(EditorTheme widgetTheme) { ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; - paraEditorTheme.setFontSizeStyle(new FontSizeStyle(fontSizePane.getValue())); + paraEditorTheme.setTextStyle(textStylePane.getTextStyle()); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java new file mode 100644 index 0000000000..33f0704855 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java @@ -0,0 +1,50 @@ +package com.fr.design.widgettheme; + +import com.fr.form.ui.Widget; +import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme; +import com.fr.widgettheme.theme.widget.theme.ParaSelectEditorTheme; +import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; + +import java.util.Arrays; + +/** + * 参数面板下拉框编辑控件配置面板 + * 继承自编辑控件配置面板,添加一个下拉框背景色 + * + * @author obo + * @since 11.0 + * Created on 2023/12/13 + */ +public class ParaSelectEditorSettingPane extends ParaEditorSettingPane { + public ParaSelectEditorSettingPane() { + super(Arrays.asList( + StyleSetting.THEME_COLOR, + StyleSetting.SELECT_COLOR, + StyleSetting.STYLE_TYPE, + StyleSetting.LINE_TYPE, + StyleSetting.BORDER_RADIUS, + StyleSetting.TEXT_STYLE + )); + } + + @Override + protected void populateEditorBean(EditorTheme editorTheme) { + ParaSelectEditorTheme paraSelectEditorTheme= new ParaSelectEditorTheme(editorTheme); + if (!editorTheme.isFollowTheme()) { + selectBgColorBox.setSelectObject(paraSelectEditorTheme.getSelectBoxBgColor()); + } + super.populateEditorBean(editorTheme); + } + + @Override + protected void updateEditorStyleBean(EditorTheme editorTheme) { + ParaSelectEditorTheme paraSelectEditorTheme= new ParaSelectEditorTheme(editorTheme); + paraSelectEditorTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject()); + super.updateEditorStyleBean(editorTheme); + } + + @Override + protected EditorTheme getEditorTheme() { + return new ParaSelectEditorTheme(); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java index 96d202a0fc..21a637475b 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java @@ -1,6 +1,5 @@ package com.fr.design.widgettheme; -import com.fr.widgettheme.theme.widget.style.FontSizeStyle; import com.fr.design.widgettheme.common.TreeEditorSettingPane; import com.fr.form.ui.TreeEditor; import com.fr.widgettheme.theme.widget.theme.ParaTreeTheme; @@ -22,7 +21,7 @@ public class ParaTreeEditorSettingPane extends TreeEditorS super(Arrays.asList( StyleSetting.THEME_COLOR, StyleSetting.STYLE_TYPE, - StyleSetting.FONT_SIZE + StyleSetting.TEXT_STYLE )); } @@ -34,12 +33,12 @@ public class ParaTreeEditorSettingPane extends TreeEditorS @Override protected void assignFontSizePane(TreeTheme widgetTheme) { ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; - fontSizePane.setValue(paraTreeTheme.getFontSizeStyle().getFontSize()); + textStylePane.setTextStyle(paraTreeTheme.getTextStyle()); } @Override protected void assignFontSizeStyle(TreeTheme widgetTheme) { ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; - paraTreeTheme.setFontSizeStyle(new FontSizeStyle(fontSizePane.getValue())); + paraTreeTheme.setTextStyle(textStylePane.getTextStyle()); } } diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java b/designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java index 08adb11c14..bae829f031 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java @@ -26,9 +26,9 @@ public enum StyleSetting { */ BORDER_RADIUS, /** - * 字体大小 + * 文本样式 */ - FONT_SIZE, + TEXT_STYLE, /** * 字体 */ @@ -36,6 +36,10 @@ public enum StyleSetting { /** * 按钮背景 */ - BTN_BACKGROUND + BTN_BACKGROUND, + /** + * 自定义下拉框颜色 + */ + SELECT_COLOR } diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java b/designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java new file mode 100644 index 0000000000..f30645e97a --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java @@ -0,0 +1,56 @@ +package com.fr.design.widgettheme.common; + +import com.fr.design.widgettheme.StyleSetting; +import com.fr.form.ui.Widget; +import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; +import com.fr.widgettheme.theme.widget.theme.cell.SelectEditTheme; + +import java.util.Arrays; +import java.util.List; + +/** + * 单元格下拉框编辑控件配置面板 + * 继承自编辑控件配置面板,添加一个下拉框背景色 + * + * @author obo + * @since 11.0 + * Created on 2023/12/13 + */ +public class SelectEditorSettingPane extends EditorSettingPane { + + public SelectEditorSettingPane() { + super(Arrays.asList( + StyleSetting.THEME_COLOR, + StyleSetting.SELECT_COLOR, + StyleSetting.STYLE_TYPE, + StyleSetting.LINE_TYPE, + StyleSetting.BORDER_RADIUS + )); + } + + @Override + protected String title4PopupWindow() { + return "selectEditorSetting"; + } + + @Override + protected EditorTheme getEditorTheme() { + return new SelectEditTheme(); + } + + @Override + protected void populateEditorBean(EditorTheme editorTheme) { + SelectEditTheme selectEditTheme = new SelectEditTheme(editorTheme); + if (!selectEditTheme.isFollowTheme()) { + selectBgColorBox.setSelectObject(selectEditTheme.getSelectBoxBgColor()); + } + super.populateEditorBean(selectEditTheme); + } + + @Override + protected void updateEditorStyleBean(EditorTheme editorTheme) { + SelectEditTheme selectEditTheme = new SelectEditTheme(editorTheme); + selectEditTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject()); + super.updateEditorStyleBean(selectEditTheme); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java b/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java index 250da9915a..1e36b42e0e 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java @@ -1,5 +1,6 @@ package com.fr.design.widgettheme.processor; +import com.fr.design.widgettheme.common.SelectEditorSettingPane; import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.form.parameter.FormSubmitButton; @@ -50,11 +51,7 @@ public class WidgetThemeCreatorPaneAdder { TextArea.class, TextEditor.class, NumberEditor.class, - Password.class, - ComboBox.class, - ComboCheckBox.class, - DateEditor.class, - TreeComboBoxEditor.class + Password.class )); /** @@ -69,6 +66,16 @@ public class WidgetThemeCreatorPaneAdder { Button.class )); + /** + * 下拉框相关控件类 + */ + private static final Set> SELECT_SET = new HashSet<>(Arrays.asList( + DateEditor.class, + TreeComboBoxEditor.class, + ComboBox.class, + ComboCheckBox.class + )); + /** * 遍历判断当前控件creator类型,将符合条件的窗口添加到extraPaneList中 * @@ -81,6 +88,7 @@ public class WidgetThemeCreatorPaneAdder { acceptTree(creator, extraPaneList); acceptNormal(creator, extraPaneList); acceptButton(creator, extraPaneList); + acceptSelect(creator, extraPaneList); } } @@ -117,4 +125,10 @@ public class WidgetThemeCreatorPaneAdder { } } + private static void acceptSelect(Class creator, List> extraPaneList) { + boolean accept = SELECT_SET.contains(creator); + if (accept) { + insertShortCut(extraPaneList, new SelectEditorSettingPane<>()); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java b/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java index da35feb917..ebd268f79f 100644 --- a/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java +++ b/designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java @@ -1,5 +1,6 @@ package com.fr.design.widgettheme.processor; +import com.fr.design.widgettheme.ParaSelectEditorSettingPane; import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.creator.XButton; @@ -47,6 +48,7 @@ public class WidgetThemeParaCreatorPaneAdder { public static void add(XCreator creator, List> extraPaneList) { if (WidgetThemeDesignerUtils.enableWidgetEnhance()) { acceptEditor(creator, extraPaneList); + acceptSelect(creator, extraPaneList); acceptRoot(creator, extraPaneList); acceptTree(creator, extraPaneList); acceptLabel(creator, extraPaneList); @@ -60,17 +62,22 @@ public class WidgetThemeParaCreatorPaneAdder { } private static void acceptEditor(XCreator creator, List> extraPaneList) { - boolean accept = creator instanceof XWrapperedFieldEditor - || creator instanceof XTextArea - || creator instanceof XComboBox - || creator instanceof XDateEditor - || creator instanceof XTreeComboBoxEditor - || WidgetThemeServerUtils.isNewComboBoxTreeEditor(creator); + boolean accept = creator instanceof XWrapperedFieldEditor || creator instanceof XTextArea; if (accept) { insertShortCut(extraPaneList, new ParaEditorSettingPane<>()); } } + private static void acceptSelect(XCreator creator, List> extraPaneList) { + boolean accept = creator instanceof XComboBox + || creator instanceof XDateEditor + || creator instanceof XTreeComboBoxEditor + || WidgetThemeServerUtils.isNewComboBoxTreeEditor(creator); + if (accept) { + insertShortCut(extraPaneList, new ParaSelectEditorSettingPane<>()); + } + } + private static void acceptRoot(XCreator creator, List> extraPaneList) { boolean accept = creator instanceof XWParameterLayout; if (accept) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 0ce920d25d..216e82cff0 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -3,6 +3,7 @@ package com.fr.design.webattr; import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -10,11 +11,13 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.ExportToolBarProvider; import com.fr.design.fun.ExtraButtonToolBarProvider; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.JavaScriptActionPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -38,6 +41,7 @@ import com.fr.report.web.button.write.AppendColumnRow; import com.fr.report.web.button.write.Submit; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.write.JavaScriptResourceInfo; import javax.swing.BorderFactory; @@ -86,6 +90,8 @@ public class EditToolBar extends BasicPane { private Background background = null; private UICheckBox defaultCheckBox; + private UIButtonGroup bgColorButtonGroup; + private ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (lastButton != null) { @@ -163,12 +169,19 @@ public class EditToolBar extends BasicPane { splitPane.setDividerLocation(120); this.add(splitPane); list.addListSelectionListener(listSelectionListener); - JPanel backgroundPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel backgroundPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0); UIButton bgButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background")); defaultCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Background")); bgButton.addActionListener(actioner); backgroundPane.add(defaultCheckBox); backgroundPane.add(bgButton); + JPanel bgPanel = new JPanel(); + bgPanel.add(defaultCheckBox); + bgPanel.add(bgButton); + backgroundPane.add(bgPanel); + if(WidgetThemeDesignerUtils.enableWidgetEnhance()) { + backgroundPane.add(createButtonColorGroup()); + } backgroundPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background"))); this.add(backgroundPane, BorderLayout.SOUTH); } @@ -213,6 +226,9 @@ public class EditToolBar extends BasicPane { this.background = ftoolbar.getBackground(); this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false); + if (bgColorButtonGroup != null) { + this.bgColorButtonGroup.setSelectedIndex(ftoolbar.isBgColorLight() ? 0 : 1); + } } public FToolBar update() { @@ -246,6 +262,9 @@ public class EditToolBar extends BasicPane { if (!ftoolBar.isDefault()) { ftoolBar.setBackground(this.background); } + if (bgColorButtonGroup != null) { + ftoolBar.setBgColorLight(bgColorButtonGroup.getSelectedIndex() == 0); + } return ftoolBar; } @@ -708,4 +727,20 @@ public class EditToolBar extends BasicPane { } } + private JPanel createButtonColorGroup() { + UILabel headLabel = new UILabel(Toolkit.i18nText("Fine-Design_ToolBar_Button_Color")); + String[] titles = new String[]{Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Light"), Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Dark")}; + bgColorButtonGroup = new UIButtonGroup(titles) { + @Override + public void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { + super.setSelectedIndex(newSelectedIndex, fireChanged); + } + }; + bgColorButtonGroup.setPreferredSize(new Dimension(135, bgColorButtonGroup.getPreferredSize().height)); + JPanel headPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(IntervalConstants.INTERVAL_L5, 0); + headPane.add(headLabel); + headPane.add(bgColorButtonGroup); + headPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, 0, 0)); + return headPane; + } } diff --git a/designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java index 3941a0f599..06f7eebf5d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java @@ -12,6 +12,7 @@ public class FToolBar { private Background background = null; private boolean isDefault = true; + private boolean isBgColorLight = true; public List getButtonlist() { return buttonlist; } @@ -52,6 +53,14 @@ public class FToolBar { this.isDefault = isDefault; } + public boolean isBgColorLight() { + return isBgColorLight; + } + + public void setBgColorLight(boolean bgColorLight) { + this.isBgColorLight = bgColorLight; + } + public ToolBar getToolBar() { Widget[] n = new Widget[this.getButtonlist().size()]; for (int j = 0; j < this.getButtonlist().size(); j++) { @@ -60,6 +69,7 @@ public class FToolBar { ToolBar toolBar = new ToolBar(n); toolBar.setBackground(this.background); toolBar.setDefault(this.isDefault); + toolBar.setButtonBgColorLight(this.isBgColorLight); return toolBar; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java index c5acde0a63..9e9d71f5e8 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java @@ -12,7 +12,6 @@ import com.fr.form.ui.Widget; import com.fr.report.web.annotation.OldPrintMethod; import javax.swing.BorderFactory; -import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; import java.awt.Component; @@ -158,6 +157,7 @@ public class ToolBarPane extends BasicBeanPane { } this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setDefault(toolbar.isDefault()); + this.getFToolBar().setBgColorLight(toolbar.isButtonBgColorLight()); setPopulateFinished(true); }