Browse Source

REPORT-109672 控件显示增强-字体颜色优化

feature/x
obo 1 year ago
parent
commit
bc4a6ce3d7
  1. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/FontSizeComboPane.java
  2. 28
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java
  3. 13
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java
  4. 27
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java
  5. 5
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java
  6. 2
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java
  7. 70
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java
  8. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  9. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  10. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  11. 51
      designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java
  12. 8
      designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java
  13. 12
      designer-form/src/main/java/com/fr/design/widgettheme/ParaEditorSettingPane.java
  14. 50
      designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java
  15. 7
      designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java
  16. 10
      designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java
  17. 56
      designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java
  18. 24
      designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java
  19. 15
      designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java
  20. 37
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  21. 10
      designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java
  22. 2
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java

23
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java → 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.gui.icombobox.UIComboBox;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.collections.CollectionUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.Vector; import java.util.Vector;
@ -13,15 +15,22 @@ public class FontSizeComboPane extends JPanel{
private static final int MAX_FONT_SIZE = 100; private static final int MAX_FONT_SIZE = 100;
private UIComboBox comboBox; private UIComboBox comboBox;
public FontSizeComboPane(){ public FontSizeComboPane(){
initComponent(); this(null);
} }
public void initComponent(){
this.setLayout(FRGUIPaneFactory.createBorderLayout()); public FontSizeComboPane(Vector<Integer> fontSizes){
Vector<Integer> integerList = new Vector<Integer>(); initComponent(fontSizes);
}
public void initComponent(Vector<Integer> fontSizes){
if(CollectionUtils.isEmpty(fontSizes)) {
fontSizes = new Vector<>();
for (int i = 1; i < MAX_FONT_SIZE; i++) { for (int i = 1; i < MAX_FONT_SIZE; i++) {
integerList.add(i); fontSizes.add(i);
}
} }
comboBox = new UIComboBox(integerList); this.setLayout(FRGUIPaneFactory.createBorderLayout());
comboBox = new UIComboBox(fontSizes);
comboBox.setEditable(true); comboBox.setEditable(true);
this.add(comboBox, BorderLayout.CENTER); this.add(comboBox, BorderLayout.CENTER);
} }

28
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.background.ColorBackground;
import com.fr.base.theme.TemplateTheme; 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.BorderStyle;
import com.fr.widgettheme.theme.widget.style.ButtonBackgroundStyle; 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.widgettheme.theme.widget.style.ThemedWidgetStyle;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -29,6 +30,10 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
// 风格2 // 风格2
protected UIRadioButton style2; protected UIRadioButton style2;
/**
* 下拉面板背景颜色
*/
private NewColorSelectBox selectBackgroundColorBox;
public DesktopWidgetStyleEditPane() { public DesktopWidgetStyleEditPane() {
super(); super();
} }
@ -36,19 +41,20 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
@Override @Override
public Component[][] generateComponent() { public Component[][] generateComponent() {
initStyleEditor(); initStyleEditor();
initSelectBackgroundColorBox();
// 容纳风格1和风格2的panel // 容纳风格1和风格2的panel
JPanel stylePane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout()); JPanel stylePane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout());
stylePane.add(style1); stylePane.add(style1);
stylePane.add(style2); 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_Color")), colorSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Style")), stylePane}, 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_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_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<T extends TemplateTheme> extends WidgetS
buttonGroup.add(style2); buttonGroup.add(style2);
} }
private void initSelectBackgroundColorBox() {
selectBackgroundColorBox = new NewColorSelectBox(140, true);
selectBackgroundColorBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
}
@Override @Override
public void populateBean(T t) { public void populateBean(T t) {
ThemedWidgetStyle style = (ThemedWidgetStyle) t.getWidgetStyle(); ThemedWidgetStyle style = (ThemedWidgetStyle) t.getWidgetStyle();
@ -75,8 +86,8 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
fontSizeComoBox.setSelectedItem(style.getFontSizeStyle().getFontSize()); textStylePane.setTextStyle(style.getTextStyle());
selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor());
} }
@Override @Override
@ -91,9 +102,7 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
FontSizeStyle fontSizeStyle = new FontSizeStyle(); style.setTextStyle(textStylePane.getTextStyle());
fontSizeStyle.setFontSize((Integer) fontSizeComoBox.getSelectedItem());
style.setFontSizeStyle(fontSizeStyle);
ButtonBackgroundStyle buttonBackgroundStyle = new ButtonBackgroundStyle(); ButtonBackgroundStyle buttonBackgroundStyle = new ButtonBackgroundStyle();
ColorBackground buttonBackground = ColorBackground.getInstance(style.getThemeColor()); ColorBackground buttonBackground = ColorBackground.getInstance(style.getThemeColor());
buttonBackgroundStyle.setInitialBackground(buttonBackground); buttonBackgroundStyle.setInitialBackground(buttonBackground);
@ -101,5 +110,6 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
buttonBackgroundStyle.setClickBackground(buttonBackground); buttonBackgroundStyle.setClickBackground(buttonBackground);
style.setButtonBackgroundStyle(buttonBackgroundStyle); style.setButtonBackgroundStyle(buttonBackgroundStyle);
style.setStyleType(style1.isSelected() ? 1 : 2); style.setStyleType(style1.isSelected() ? 1 : 2);
style.setSelectBackgroundColor(selectBackgroundColorBox.getSelectObject());
} }
} }

13
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java

@ -1,11 +1,10 @@
package com.fr.widgettheme.theme.edit.widget; package com.fr.widgettheme.theme.edit.widget;
import com.fr.base.theme.TemplateTheme; 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.BorderStyle;
import com.fr.widgettheme.theme.widget.style.FontSizeStyle;
import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import java.util.Arrays; import java.util.Arrays;
@ -39,8 +38,8 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
} }
@Override @Override
protected void initFontSizeComoBox() { protected void initTextStylePane() {
fontSizeComoBox = new UIComboBox(FONT_SIZES); textStylePane = new WidgetTextStylePane(FONT_SIZES, 140);
} }
@Override @Override
@ -53,7 +52,7 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
fontSizeComoBox.setSelectedItem(style.getFontSizeStyle().getFontSize()); textStylePane.setTextStyle(style.getTextStyle());
} }
@Override @Override
@ -68,9 +67,7 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
FontSizeStyle fontSizeStyle = new FontSizeStyle(); style.setTextStyle(textStylePane.getTextStyle());
fontSizeStyle.setFontSize((Integer) fontSizeComoBox.getSelectedItem());
style.setFontSizeStyle(fontSizeStyle);
} }
} }

27
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.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icombobox.LineComboBox; 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.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.style.FRFontPane; 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.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.theme.panel.WidgetTextStylePane;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -39,9 +39,10 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
protected LineComboBox lineComboBox; protected LineComboBox lineComboBox;
// 圆角边框 // 圆角边框
protected UISpinner borderRadiusSpinner; protected UISpinner borderRadiusSpinner;
// 字体大小 /**
protected UIComboBox fontSizeComoBox; * 文本样式面板
*/
protected WidgetTextStylePane textStylePane;
public WidgetStyleEditPane() { public WidgetStyleEditPane() {
initComponents(); initComponents();
@ -52,9 +53,9 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
initCommonStyleEditor(); initCommonStyleEditor();
double f = TableLayout.PREFERRED; double f = TableLayout.PREFERRED;
final double p = 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}; 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(); Component[][] components = generateComponent();
JPanel customPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel customPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
customPane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10)); customPane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10));
@ -67,12 +68,12 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
* @return components * @return components
*/ */
public Component[][] generateComponent() { 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 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_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_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}
return components; };
} }
private void initCommonStyleEditor() { private void initCommonStyleEditor() {
@ -80,12 +81,12 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
initLineBox(); initLineBox();
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
initFontSizeComoBox(); initTextStylePane();
fontSizeComoBox.setSelectedItem(16); textStylePane.setFontSizeValue(16);
} }
protected void initFontSizeComoBox() { protected void initTextStylePane() {
fontSizeComoBox = new UIComboBox(FRFontPane.getFontSizes()); textStylePane = new WidgetTextStylePane(FRFontPane.getFontSizes(), 140);
} }
/** /**

5
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.widgettheme.theme.widget.style.ThemedWidgetStyle;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.Icon; 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()); g.fillRoundRect(0, 0, getSize().width - 1, getSize().height - 1, widgetStyle.getBorderStyle().getRadius(), widgetStyle.getBorderStyle().getRadius());
//需要重新绘制一遍字体,否则会被颜色填充给遮住 //需要重新绘制一遍字体,否则会被颜色填充给遮住
Graphics2D g2d = (Graphics2D) g.create(); 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, BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), this.value,
Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT) Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), NO_SCALE_RESOLUTION); .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), NO_SCALE_RESOLUTION);
@ -133,7 +132,7 @@ public class ControlPreviewCell extends JPanel {
} }
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); 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, BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), this.value,
Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT) Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT)

2
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(); ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
paintBgColor(g, widgetStyle); paintBgColor(g, widgetStyle);
uiLabel.setForeground(Color.WHITE); 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); uiLabel.setFont(font);
this.add(uiLabel, BorderLayout.CENTER); this.add(uiLabel, BorderLayout.CENTER);
} }

70
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<Integer> 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();
}
}

2
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; 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.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;

2
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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; 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.form.ui.FieldEditor;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

2
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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; 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; import com.fr.form.ui.MultiFileEditor;

51
designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java

@ -1,8 +1,9 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.base.theme.TemplateTheme; 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.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.widget.style.ThemedWidgetStyle;
import com.fr.widgettheme.theme.bean.ButtonBackground; import com.fr.widgettheme.theme.bean.ButtonBackground;
import com.fr.design.beans.BasicBeanPane; 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.layout.TableLayoutHelper;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.style.color.NewColorSelectBox; 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.design.widget.ui.designer.component.UIBoundSpinner;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -59,12 +59,16 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
protected LineComboBox lineComboBox; protected LineComboBox lineComboBox;
// 圆角边框 // 圆角边框
protected UIBoundSpinner borderRadiusSpinner; protected UIBoundSpinner borderRadiusSpinner;
// 字体大小
protected FontSizeComboPane fontSizePane;
// 字体详细设置 // 字体详细设置
protected FRFontPane frFontPane; protected FRFontPane frFontPane;
// 按钮背景设置 // 按钮背景设置
protected ButtonStyleDefinedPane buttonStyleDefinedPane; protected ButtonStyleDefinedPane buttonStyleDefinedPane;
/**
* 文本样式
* 包含字体大小字体颜色
*/
protected WidgetTextStylePane textStylePane;
protected NewColorSelectBox selectBgColorBox;
private final Map<StyleSetting, UILabel> labelMap = new HashMap<>(); private final Map<StyleSetting, UILabel> labelMap = new HashMap<>();
private final Map<StyleSetting, Component> paneMap = new HashMap<>(); private final Map<StyleSetting, Component> paneMap = new HashMap<>();
@ -87,17 +91,19 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
initStyle(); initStyle();
colorSelectBox = new NewColorSelectBox(160, true); colorSelectBox = new NewColorSelectBox(160, true);
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY); lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY);
fontSizePane = new FontSizeComboPane();
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
buttonStyleDefinedPane = new ButtonStyleDefinedPane(); buttonStyleDefinedPane = new ButtonStyleDefinedPane();
textStylePane = new WidgetTextStylePane(100);
selectBgColorBox = new NewColorSelectBox(160, true);
paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane());
paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox);
paneMap.put(StyleSetting.LINE_TYPE, lineComboBox); 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.BORDER_RADIUS, borderRadiusSpinner);
paneMap.put(StyleSetting.FONT, frFontPane); paneMap.put(StyleSetting.FONT, frFontPane);
paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane); paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane);
paneMap.put(StyleSetting.SELECT_COLOR, selectBgColorBox);
} }
/** /**
@ -200,9 +206,10 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
setStyle(widgetStyle); setStyle(widgetStyle);
setLineComboBox(widgetStyle); setLineComboBox(widgetStyle);
setBorderRadiusSpinner(widgetStyle); setBorderRadiusSpinner(widgetStyle);
setFontSizePane(widgetStyle); setTextStylePane(widgetStyle);
setFrFontPane(widgetStyle); setFrFontPane();
setButtonStyleDefinedPane(widgetStyle); setButtonStyleDefinedPane(widgetStyle);
setSelectBgColor(widgetStyle);
} }
private void setColorSelectBox(ThemedWidgetStyle widgetStyle) { private void setColorSelectBox(ThemedWidgetStyle widgetStyle) {
@ -234,15 +241,13 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
} }
} }
private void setFontSizePane(ThemedWidgetStyle widgetStyle) { private void setTextStylePane(ThemedWidgetStyle widgetStyle) {
if (fontSizePane != null) { this.textStylePane.setTextStyle(widgetStyle.getTextStyle());
fontSizePane.setValue(widgetStyle.getFontSizeStyle().getFontSize());
}
} }
private void setFrFontPane(ThemedWidgetStyle widgetStyle) { private void setFrFontPane() {
if (frFontPane != null) { if (frFontPane != null) {
frFontPane.populateBean(widgetStyle.getFontStyle().getFont()); frFontPane.populateBean(FRFont.getInstance());
} }
} }
@ -264,12 +269,23 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
if (borderRadiusSpinner != null) { if (borderRadiusSpinner != null) {
borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS); borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS);
} }
if (fontSizePane != null) { if (textStylePane != null) {
fontSizePane.setValue(FontSizeStyle.DEFAULT_FONT_SIZE); //后面看看怎么设置默认背景色
textStylePane.setTextStyle(new TextStyle());
} }
if (frFontPane != null) { if (frFontPane != null) {
frFontPane.populateBean(FRFont.getInstance()); 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<T extends Widget> extends BasicBeanPa
*/ */
private void initLabelMap() { private void initLabelMap() {
labelMap.put(StyleSetting.THEME_COLOR, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color"))); 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.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.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.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.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.BTN_BACKGROUND, new UILabel(Toolkit.i18nText("Fine-Design_Theme_Widget_Background")));
labelMap.put(StyleSetting.SELECT_COLOR, new UILabel(Toolkit.i18nText("下拉面板色")));
} }
} }

8
designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java

@ -1,8 +1,8 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.widgettheme.theme.widget.style.FontSizeStyle;
import com.fr.design.widgettheme.common.ButtonSettingPane; import com.fr.design.widgettheme.common.ButtonSettingPane;
import com.fr.form.ui.Widget; 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.ParaButtonTheme;
import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme; import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme;
@ -22,7 +22,7 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.STYLE_TYPE,
StyleSetting.FONT_SIZE StyleSetting.TEXT_STYLE
)); ));
} }
@ -34,13 +34,13 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
@Override @Override
protected void assignFontSizePane(ButtonTheme buttonTheme) { protected void assignFontSizePane(ButtonTheme buttonTheme) {
ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme; ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme;
fontSizePane.setValue(paraButtonTheme.getFontSizeStyle().getFontSize()); textStylePane.setTextStyle(paraButtonTheme.getTextStyle());
} }
@Override @Override
protected void assignFontSizeStyle(ButtonTheme buttonTheme) { protected void assignFontSizeStyle(ButtonTheme buttonTheme) {
ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme; ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme;
paraButtonTheme.setFontSizeStyle(new FontSizeStyle(fontSizePane.getValue())); paraButtonTheme.setTextStyle(textStylePane.getTextStyle());
} }
} }

12
designer-form/src/main/java/com/fr/design/widgettheme/ParaEditorSettingPane.java

@ -1,12 +1,12 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.widgettheme.theme.widget.style.FontSizeStyle;
import com.fr.design.widgettheme.common.EditorSettingPane; import com.fr.design.widgettheme.common.EditorSettingPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme; import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme;
import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
@ -25,20 +25,24 @@ public class ParaEditorSettingPane<T extends Widget> extends EditorSettingPane<T
StyleSetting.STYLE_TYPE, StyleSetting.STYLE_TYPE,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.BORDER_RADIUS, StyleSetting.BORDER_RADIUS,
StyleSetting.FONT_SIZE StyleSetting.TEXT_STYLE
)); ));
} }
public ParaEditorSettingPane(List<StyleSetting> styleSettingList) {
super(styleSettingList);
}
@Override @Override
protected void assignFontSizePane(EditorTheme widgetTheme) { protected void assignFontSizePane(EditorTheme widgetTheme) {
ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme;
fontSizePane.setValue(paraEditorTheme.getFontSizeStyle().getFontSize()); textStylePane.setTextStyle(paraEditorTheme.getTextStyle());
} }
@Override @Override
protected void assignFontSizeStyle(EditorTheme widgetTheme) { protected void assignFontSizeStyle(EditorTheme widgetTheme) {
ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme;
paraEditorTheme.setFontSizeStyle(new FontSizeStyle(fontSizePane.getValue())); paraEditorTheme.setTextStyle(textStylePane.getTextStyle());
} }
@Override @Override

50
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<T extends Widget> extends ParaEditorSettingPane<T> {
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();
}
}

7
designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java

@ -1,6 +1,5 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.widgettheme.theme.widget.style.FontSizeStyle;
import com.fr.design.widgettheme.common.TreeEditorSettingPane; import com.fr.design.widgettheme.common.TreeEditorSettingPane;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.widgettheme.theme.widget.theme.ParaTreeTheme; import com.fr.widgettheme.theme.widget.theme.ParaTreeTheme;
@ -22,7 +21,7 @@ public class ParaTreeEditorSettingPane<T extends TreeEditor> extends TreeEditorS
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.STYLE_TYPE,
StyleSetting.FONT_SIZE StyleSetting.TEXT_STYLE
)); ));
} }
@ -34,12 +33,12 @@ public class ParaTreeEditorSettingPane<T extends TreeEditor> extends TreeEditorS
@Override @Override
protected void assignFontSizePane(TreeTheme widgetTheme) { protected void assignFontSizePane(TreeTheme widgetTheme) {
ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme;
fontSizePane.setValue(paraTreeTheme.getFontSizeStyle().getFontSize()); textStylePane.setTextStyle(paraTreeTheme.getTextStyle());
} }
@Override @Override
protected void assignFontSizeStyle(TreeTheme widgetTheme) { protected void assignFontSizeStyle(TreeTheme widgetTheme) {
ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme;
paraTreeTheme.setFontSizeStyle(new FontSizeStyle(fontSizePane.getValue())); paraTreeTheme.setTextStyle(textStylePane.getTextStyle());
} }
} }

10
designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java

@ -26,9 +26,9 @@ public enum StyleSetting {
*/ */
BORDER_RADIUS, BORDER_RADIUS,
/** /**
* 字体大小 * 文本样式
*/ */
FONT_SIZE, TEXT_STYLE,
/** /**
* 字体 * 字体
*/ */
@ -36,6 +36,10 @@ public enum StyleSetting {
/** /**
* 按钮背景 * 按钮背景
*/ */
BTN_BACKGROUND BTN_BACKGROUND,
/**
* 自定义下拉框颜色
*/
SELECT_COLOR
} }

56
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 <T extends Widget> extends EditorSettingPane<T> {
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);
}
}

24
designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeCreatorPaneAdder.java

@ -1,5 +1,6 @@
package com.fr.design.widgettheme.processor; package com.fr.design.widgettheme.processor;
import com.fr.design.widgettheme.common.SelectEditorSettingPane;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
@ -50,11 +51,7 @@ public class WidgetThemeCreatorPaneAdder {
TextArea.class, TextArea.class,
TextEditor.class, TextEditor.class,
NumberEditor.class, NumberEditor.class,
Password.class, Password.class
ComboBox.class,
ComboCheckBox.class,
DateEditor.class,
TreeComboBoxEditor.class
)); ));
/** /**
@ -69,6 +66,16 @@ public class WidgetThemeCreatorPaneAdder {
Button.class Button.class
)); ));
/**
* 下拉框相关控件类
*/
private static final Set<Class<?>> SELECT_SET = new HashSet<>(Arrays.asList(
DateEditor.class,
TreeComboBoxEditor.class,
ComboBox.class,
ComboCheckBox.class
));
/** /**
* 遍历判断当前控件creator类型将符合条件的窗口添加到extraPaneList中 * 遍历判断当前控件creator类型将符合条件的窗口添加到extraPaneList中
* *
@ -81,6 +88,7 @@ public class WidgetThemeCreatorPaneAdder {
acceptTree(creator, extraPaneList); acceptTree(creator, extraPaneList);
acceptNormal(creator, extraPaneList); acceptNormal(creator, extraPaneList);
acceptButton(creator, extraPaneList); acceptButton(creator, extraPaneList);
acceptSelect(creator, extraPaneList);
} }
} }
@ -117,4 +125,10 @@ public class WidgetThemeCreatorPaneAdder {
} }
} }
private static <T> void acceptSelect(Class<?> creator, List<BasicBeanPane<T>> extraPaneList) {
boolean accept = SELECT_SET.contains(creator);
if (accept) {
insertShortCut(extraPaneList, new SelectEditorSettingPane<>());
}
}
} }

15
designer-form/src/main/java/com/fr/design/widgettheme/processor/WidgetThemeParaCreatorPaneAdder.java

@ -1,5 +1,6 @@
package com.fr.design.widgettheme.processor; package com.fr.design.widgettheme.processor;
import com.fr.design.widgettheme.ParaSelectEditorSettingPane;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XButton;
@ -47,6 +48,7 @@ public class WidgetThemeParaCreatorPaneAdder {
public static <T> void add(XCreator creator, List<BasicBeanPane<T>> extraPaneList) { public static <T> void add(XCreator creator, List<BasicBeanPane<T>> extraPaneList) {
if (WidgetThemeDesignerUtils.enableWidgetEnhance()) { if (WidgetThemeDesignerUtils.enableWidgetEnhance()) {
acceptEditor(creator, extraPaneList); acceptEditor(creator, extraPaneList);
acceptSelect(creator, extraPaneList);
acceptRoot(creator, extraPaneList); acceptRoot(creator, extraPaneList);
acceptTree(creator, extraPaneList); acceptTree(creator, extraPaneList);
acceptLabel(creator, extraPaneList); acceptLabel(creator, extraPaneList);
@ -60,14 +62,19 @@ public class WidgetThemeParaCreatorPaneAdder {
} }
private static <T> void acceptEditor(XCreator creator, List<BasicBeanPane<T>> extraPaneList) { private static <T> void acceptEditor(XCreator creator, List<BasicBeanPane<T>> extraPaneList) {
boolean accept = creator instanceof XWrapperedFieldEditor boolean accept = creator instanceof XWrapperedFieldEditor || creator instanceof XTextArea;
|| creator instanceof XTextArea if (accept) {
|| creator instanceof XComboBox insertShortCut(extraPaneList, new ParaEditorSettingPane<>());
}
}
private static <T> void acceptSelect(XCreator creator, List<BasicBeanPane<T>> extraPaneList) {
boolean accept = creator instanceof XComboBox
|| creator instanceof XDateEditor || creator instanceof XDateEditor
|| creator instanceof XTreeComboBoxEditor || creator instanceof XTreeComboBoxEditor
|| WidgetThemeServerUtils.isNewComboBoxTreeEditor(creator); || WidgetThemeServerUtils.isNewComboBoxTreeEditor(creator);
if (accept) { if (accept) {
insertShortCut(extraPaneList, new ParaEditorSettingPane<>()); insertShortCut(extraPaneList, new ParaSelectEditorSettingPane<>());
} }
} }

37
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.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; 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.ExportToolBarProvider;
import com.fr.design.fun.ExtraButtonToolBarProvider; import com.fr.design.fun.ExtraButtonToolBarProvider;
import com.fr.design.gui.ibutton.UIButton; 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.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptActionPane; import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; 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.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.write.JavaScriptResourceInfo; import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -86,6 +90,8 @@ public class EditToolBar extends BasicPane {
private Background background = null; private Background background = null;
private UICheckBox defaultCheckBox; private UICheckBox defaultCheckBox;
private UIButtonGroup<String> bgColorButtonGroup;
private ListSelectionListener listSelectionListener = new ListSelectionListener() { private ListSelectionListener listSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) { public void valueChanged(ListSelectionEvent evt) {
if (lastButton != null) { if (lastButton != null) {
@ -163,12 +169,19 @@ public class EditToolBar extends BasicPane {
splitPane.setDividerLocation(120); splitPane.setDividerLocation(120);
this.add(splitPane); this.add(splitPane);
list.addListSelectionListener(listSelectionListener); 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")); 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")); defaultCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Background"));
bgButton.addActionListener(actioner); bgButton.addActionListener(actioner);
backgroundPane.add(defaultCheckBox); backgroundPane.add(defaultCheckBox);
backgroundPane.add(bgButton); 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"))); backgroundPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background")));
this.add(backgroundPane, BorderLayout.SOUTH); this.add(backgroundPane, BorderLayout.SOUTH);
} }
@ -213,6 +226,9 @@ public class EditToolBar extends BasicPane {
this.background = ftoolbar.getBackground(); this.background = ftoolbar.getBackground();
this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false); this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false);
if (bgColorButtonGroup != null) {
this.bgColorButtonGroup.setSelectedIndex(ftoolbar.isBgColorLight() ? 0 : 1);
}
} }
public FToolBar update() { public FToolBar update() {
@ -246,6 +262,9 @@ public class EditToolBar extends BasicPane {
if (!ftoolBar.isDefault()) { if (!ftoolBar.isDefault()) {
ftoolBar.setBackground(this.background); ftoolBar.setBackground(this.background);
} }
if (bgColorButtonGroup != null) {
ftoolBar.setBgColorLight(bgColorButtonGroup.getSelectedIndex() == 0);
}
return ftoolBar; 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<String>(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;
}
} }

10
designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java

@ -12,6 +12,7 @@ public class FToolBar {
private Background background = null; private Background background = null;
private boolean isDefault = true; private boolean isDefault = true;
private boolean isBgColorLight = true;
public List<ToolBarButton> getButtonlist() { public List<ToolBarButton> getButtonlist() {
return buttonlist; return buttonlist;
} }
@ -52,6 +53,14 @@ public class FToolBar {
this.isDefault = isDefault; this.isDefault = isDefault;
} }
public boolean isBgColorLight() {
return isBgColorLight;
}
public void setBgColorLight(boolean bgColorLight) {
this.isBgColorLight = bgColorLight;
}
public ToolBar getToolBar() { public ToolBar getToolBar() {
Widget[] n = new Widget[this.getButtonlist().size()]; Widget[] n = new Widget[this.getButtonlist().size()];
for (int j = 0; j < this.getButtonlist().size(); j++) { for (int j = 0; j < this.getButtonlist().size(); j++) {
@ -60,6 +69,7 @@ public class FToolBar {
ToolBar toolBar = new ToolBar(n); ToolBar toolBar = new ToolBar(n);
toolBar.setBackground(this.background); toolBar.setBackground(this.background);
toolBar.setDefault(this.isDefault); toolBar.setDefault(this.isDefault);
toolBar.setButtonBgColorLight(this.isBgColorLight);
return toolBar; return toolBar;
} }
} }

2
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 com.fr.report.web.annotation.OldPrintMethod;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.TransferHandler; import javax.swing.TransferHandler;
import java.awt.Component; import java.awt.Component;
@ -158,6 +157,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setDefault(toolbar.isDefault());
this.getFToolBar().setBgColorLight(toolbar.isButtonBgColorLight());
setPopulateFinished(true); setPopulateFinished(true);
} }

Loading…
Cancel
Save