Browse Source

Merge pull request #13655 in DESIGN/design from final/11.0 to persist/11.0

* commit 'b3d8d8e83003c19ebf24dc5b126545a968b08f38': (29 commits)
  REPORT-115175 模板主题按钮显示不全
  REPORT-114522 /remote/design/service接口可以未鉴权获取源码信息
  REPORT-114494 fix:【FR国际化】启动页logo新版本显示中文
  REPORT-114548 【控件显示增强-按钮控件边框线型颜色】按钮控件的边框线型颜色自定义保存后,再打开颜色会变为跟随的主题色。且边框线型颜色展示异常
  视图树也补一下
  REPORT-114524 【控件显示增强-复选按钮组控件】自定义,自定义修改控件背景后会报错
  REPORT-114501 【控件显示增强-边框颜色】边框颜色传到前端为null
  REPORT-114164 控件扩展样式-图文按钮图标格添加至12个以上,显示异常
  fix: 回退代码 fvs.chart和fvs.ec.chart都不走refresh逻辑 原始问题fvs.ec.chart的邮件使用chartemailpane才没有正文勾选项不通过refresh实现 通过插件DuchampHyperlinkGroup重写实现邮件&联动fvs组件 #REPORT-111618
  REPORT-111619 控件增强-更多的样式配置--报表支撑 主题预览界面支持控件及提升跟随tab切换
  REPORT-114305 控件扩展样式—等分布局、自然布局效果都反了
  REPORT-114164 控件扩展样式-图文按钮图标格添加至12个以上,显示异常
  REPORT-111619 控件增强-更多的样式配置--报表支撑 自测问题修复3
  REPORT-111619 控件基础面板的字体名面板初始化
  REPORT-111619 控件增强-更多的样式配置--报表支撑 自测问题修复
  REPORT-111619 控件增强-更多的样式配置--报表支撑 自测问题修复
  REPORT-111619 控件增强-更多的样式配置--报表支撑 移动端部分代码之前在别的工程漏提了,补一下
  REPORT-114161 控件扩展样式—图文按钮新增的图标格没有默认选中
  REPORT-114070 控件扩展样式—布局方式固定列数,应该只支持正整数
  REPORT-114115 控件扩展样式—新建模板,联排按钮、图文按钮排布方式默认要选"等分布局"
  ...
persist/11.0
superman 3 months ago
parent
commit
58acddae49
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 25
      designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java
  3. 21
      designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java
  4. 41
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java
  5. 40
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java
  6. 40
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java
  7. 141
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java
  8. 195
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java
  9. 193
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java
  10. 16
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/UnitedCustomDefinePane.java
  11. 9
      designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java
  12. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java
  13. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  14. 30
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  15. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ThemePreviewed.java
  16. 2
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  17. 62
      designer-base/src/main/java/com/fr/widgettheme/ThemePreviewTerminal.java
  18. 118
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java
  19. 15
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java
  20. 5
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditContainerPane.java
  21. 57
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java
  22. 2
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ButtonStyleDefinedPane.java
  23. 44
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java
  24. 9
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCellWithIcon.java
  25. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewPane.java
  26. 15
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java
  27. 3
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/RoundControlPreviewCell.java
  28. 17
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/TextPreviewCell.java
  29. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java
  30. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java
  31. 40
      designer-base/src/main/java/com/fr/widgettheme/util/ThemeTextStylePaneCreator.java
  32. 131
      designer-base/src/main/java/com/fr/widgettheme/util/WidgetStyleComponentCombiner.java
  33. 34
      designer-base/src/main/java/com/fr/widgettheme/util/WidgetThemeDesignerUtils.java
  34. 104
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/DisplayEnhanceMobileStyleDefinePane.java
  35. 11
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FileEditorMobileStyleDefinePane.java
  36. 66
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FreeButtonMobileStyleDefinePane.java
  37. 36
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/IconColorMobileStyleDefinePane.java
  38. 48
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/LabelMobileStyleDefinePane.java
  39. 33
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/TextAreaMobileStyleDefinePane.java
  40. 16
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/provider/DisplayEnhanceMobileStyleFactory.java
  41. 79
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/provider/WidgetThemeMobileStyleDefinePaneCreator.java
  42. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_add.png
  43. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete.png
  44. 43
      designer-base/src/test/java/com/fr/design/jxbrowser/JxUIPaneTest.java
  45. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  46. BIN
      designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata.png
  47. BIN
      designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_en.png
  48. BIN
      designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_zh.png
  49. BIN
      designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_zh_TW.png
  50. 229
      designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java
  51. 15
      designer-form/src/main/java/com/fr/design/widgettheme/LabelSettingPane.java
  52. 6
      designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java
  53. 8
      designer-form/src/main/java/com/fr/design/widgettheme/ParaEditorSettingPane.java
  54. 1
      designer-form/src/main/java/com/fr/design/widgettheme/ParaNormalButtonSettingPane.java
  55. 10
      designer-form/src/main/java/com/fr/design/widgettheme/ParaSelectEditorSettingPane.java
  56. 2
      designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java
  57. 42
      designer-form/src/main/java/com/fr/design/widgettheme/StyleSetting.java
  58. 15
      designer-form/src/main/java/com/fr/design/widgettheme/common/ButtonSettingPane.java
  59. 20
      designer-form/src/main/java/com/fr/design/widgettheme/common/EditorSettingPane.java
  60. 10
      designer-form/src/main/java/com/fr/design/widgettheme/common/NormalButtonSettingPane.java
  61. 8
      designer-form/src/main/java/com/fr/design/widgettheme/common/SelectEditorSettingPane.java
  62. 15
      designer-form/src/main/java/com/fr/design/widgettheme/common/TreeEditorSettingPane.java
  63. 3
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  64. 3
      designer-realize/src/main/java/com/fr/start/common/SplashPane.java
  65. 7
      designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

2
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -431,7 +431,7 @@ public class EnvChangeEntrance {
Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet(); Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet();
try { try {
JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList(); JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList(info);
for (int i = 0; i < serviceArray.size(); i++) { for (int i = 0; i < serviceArray.size(); i++) {
try { try {
Class clazz = Class.forName((String) serviceArray.get(i)); Class clazz = Class.forName((String) serviceArray.get(i));

25
designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java

@ -46,10 +46,10 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -137,7 +137,9 @@ public class TranslucentBorderSpecialPane extends AbstractBorderPackerPane imple
} }
}); });
tweakNinePointButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill")); String buttonText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill");
tweakNinePointButton = new UIButton(buttonText);
tweakNinePointButton.setToolTipText(buttonText);
borderImageOpacityPane = new UIPercentDragPane(); borderImageOpacityPane = new UIPercentDragPane();
} }
@ -174,23 +176,28 @@ public class TranslucentBorderSpecialPane extends AbstractBorderPackerPane imple
borderedImagePreviewPane.setPreferredSize(new Dimension(145, 145)); borderedImagePreviewPane.setPreferredSize(new Dimension(145, 145));
borderedImagePreviewPane.add(imagePreviewPane, BorderLayout.CENTER); borderedImagePreviewPane.add(imagePreviewPane, BorderLayout.CENTER);
JPanel tweakNinePointComposedPane = new JPanel();
tweakNinePointComposedPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
tweakNinePointButton.setPreferredSize(new Dimension(145, 16));
tweakNinePointComposedPane.add(tweakNinePointHelpButton);
tweakNinePointComposedPane.add(tweakNinePointButton);
return TableLayoutHelper.createGapTableLayoutPane( return TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{ new JComponent[][]{
{null, borderedImagePreviewPane}, {null, borderedImagePreviewPane},
{null, chooseImageButton}, {null, chooseImageButton},
{tweakNinePointComposedPane, null}, {null, createTweakNinePointComposedPane()},
{null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))},
{null, this.borderImageOpacityPane} {null, this.borderImageOpacityPane}
}, },
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
} }
private JPanel createTweakNinePointComposedPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
return TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{
{tweakNinePointHelpButton, tweakNinePointButton}
},
new double[]{p},
new double[]{p, f},
new int[][]{{1, 1}}, 0, 0);
}
private void initImageFileChooserIfNotExist() { private void initImageFileChooserIfNotExist() {
if (imageFileChooser == null) { if (imageFileChooser == null) {
imageFileChooser = new ImageFileChooser(); imageFileChooser = new ImageFileChooser();

21
designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java

@ -206,12 +206,11 @@ public class JxUIPane<T> extends ModernUIPane<T> {
* 执行一段js * 执行一段js
* *
* @param javaScript 待执行的js脚本 * @param javaScript 待执行的js脚本
* @see JxUIPane#executeJS(String)
*/ */
public void executeJavaScript(String javaScript) { public void executeJavaScript(String javaScript) {
if (browser != null) { if (browser != null) {
browser.mainFrame().ifPresent(frame -> { browser.mainFrame().ifPresent(frame -> frame.executeJavaScript(javaScript));
frame.executeJavaScript(javaScript);
});
} }
} }
@ -227,6 +226,22 @@ public class JxUIPane<T> extends ModernUIPane<T> {
return Optional.ofNullable(frame.executeJavaScript(name)); return Optional.ofNullable(frame.executeJavaScript(name));
} }
/**
* 执行js脚本并返回,使用范围包含{@link JxUIPane#executeJavaScript(String)},可以代替使用
*
* @param name 变量命名
* @return js对象
*/
public <P> Optional<P> executeJS(String name) {
if (browser != null) {
Optional<Frame> frame = browser.mainFrame();
if (frame.isPresent()) {
return Optional.ofNullable(frame.get().executeJavaScript(name));
}
}
return Optional.empty();
}
/** /**
* 由于自定义scheme目前走的是url因此路径会被自动转化比如windows路径下对冒号问题 * 由于自定义scheme目前走的是url因此路径会被自动转化比如windows路径下对冒号问题
* C:\\abc 变成 /C/abc这里对冒号进行编码转义 * C:\\abc 变成 /C/abc这里对冒号进行编码转义

41
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/CapsuleCheckboxGroupStyleProvider.java

@ -0,0 +1,41 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.mainframe.mobile.ui.radiogroup.CapsuleCustomDefinePane;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.form.ui.mobile.radiogroup.CapsuleMobileStyle;
/**
* 移动端复选框provider
* @author crawford.zhou
* @since 11.0
* Created on 2024/1/25
*/
public class CapsuleCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider {
@Override
public Class<? extends MobileStyle> classForMobileStyle() {
return CapsuleMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return CapsuleCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Capsule_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/ImageCheckboxGroupStyleProvider.java

@ -0,0 +1,40 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.mainframe.mobile.ui.radiogroup.ImageCustomDefinePane;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle;
/**
* 移动端复选框provider
* @author crawford.zhou
* @since 11.0
* Created on 2024/1/25
*/
public class ImageCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider {
@Override
public Class<? extends MobileStyle> classForMobileStyle() {
return ImageMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return ImageCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Graphic_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

40
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/checkboxgroup/UnitedCheckboxGroupStyleProvider.java

@ -0,0 +1,40 @@
package com.fr.design.mainframe.mobile.provider.checkboxgroup;
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.mainframe.mobile.ui.radiogroup.UnitedCustomDefinePane;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.form.ui.mobile.radiogroup.UnitedMobileStyle;
/**
* 移动端复选框provider
* @author crawford.zhou
* @since 11.0
* Created on 2024/1/25
*/
public class UnitedCheckboxGroupStyleProvider extends AbstractMobileWidgetStyleProvider {
@Override
public Class<? extends MobileStyle> classForMobileStyle() {
return UnitedMobileStyle.class;
}
@Override
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() {
return UnitedCustomDefinePane.class;
}
@Override
public String xTypeForWidget() {
return "checkboxgroup";
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Linkage_Button");
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

141
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java

@ -36,11 +36,23 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
private UIComboBox custom; private UIComboBox custom;
private JPanel centerPane; private JPanel centerPane;
// 按钮排布+按钮排布下拉框panel;
private JPanel buttonAlignPane;
// 固定列数 数字panel
private JPanel columnSizePane;
private UISpinner leftSpinner; private UISpinner leftSpinner;
private UISpinner rightSpinner; private UISpinner rightSpinner;
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox layoutTypeCombo;
private UIComboBox buttonAlignCombo;
private UISpinner columnSizeSpinner;
private JRadioButton leftAlignRadioButton; private JRadioButton leftAlignRadioButton;
private JRadioButton centerAlignRadioButton; private JRadioButton centerAlignRadioButton;
@ -121,13 +133,95 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
} }
/**
* 初始化布局方式下拉框
*/
private void initLayoutCombo() {
layoutTypeCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed")
});
layoutTypeCombo.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20));
layoutTypeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) {
buttonAlignPane.setVisible(true);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_FIXED) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(true);
}
}
});
}
/**
* 初始化按钮排布面板
*/
private void initButtonAlignPane() {
UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
buttonAlignCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"),
});
buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
buttonAlignPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{buttonAlignLabel, buttonAlignCombo}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1,
LayoutConstants.VGAP_SMALL
);
}
/**
* 初始化固定列数面板
*/
private void initColumnSizePane() {
UILabel columnSizeLabel = DesignerUtils.createConfigLabel("");
columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.INITIAL_COLUMN_SIZE);
columnSizeSpinner.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
columnSizePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{columnSizeLabel, columnSizeSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
columnSizePane.setVisible(false);
}
private JPanel initVPaddingConfig() {
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top"));
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom"));
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
}
private JPanel initHPaddingConfig() {
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left"));
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right"));
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
}
private void addPaddingPane() { private void addPaddingPane() {
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, p};
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout")));
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding"));
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText(""));
UILabel buttonAlignHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left"));
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
@ -140,33 +234,33 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom"));
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type"));
initLayoutCombo();
initButtonAlignPane();
initColumnSizePane();
leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true); leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true);
centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false); centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false);
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); JPanel layoutTypePanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{layoutTypeCombo}},
JPanel layoutPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftAlignRadioButton, centerAlignRadioButton}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); TableLayoutHelper.FILL_LASTCOLUMN,
IntervalConstants.INTERVAL_W1,
LayoutConstants.VGAP_SMALL
);
ButtonGroup layoutRadioButtonGroup = new ButtonGroup(); ButtonGroup layoutRadioButtonGroup = new ButtonGroup();
layoutRadioButtonGroup.add(leftAlignRadioButton); layoutRadioButtonGroup.add(leftAlignRadioButton);
layoutRadioButtonGroup.add(centerAlignRadioButton); layoutRadioButtonGroup.add(centerAlignRadioButton);
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, initVPaddingConfig()},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, initHPaddingConfig()},
{buttonAlignHintLabel, layoutPanel}, {layoutTypeLabel, layoutTypePanel},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
centerPane.add(buttonAlignPane);
centerPane.add(columnSizePane);
} }
private void addBackgroundPane() { private void addBackgroundPane() {
@ -240,7 +334,7 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init"));
initialFontConfPane = new FontConfigPane(); initialFontConfPane = new FontConfigPane();
initialFontConfPane.setFontColor(new Color(204, 204, 204)); initialFontConfPane.setFontColor(new Color(102, 102, 102));
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
centerPane.add(fontPanel); centerPane.add(fontPanel);
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select"));
@ -260,6 +354,9 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
layoutTypeCombo.setSelectedIndex(mobileStyle.getButtonLayoutType());
buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
columnSizeSpinner.setValue(mobileStyle.getButtonColumnSize());
leftAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignLeft); leftAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignLeft);
centerAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignCenter); centerAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignCenter);
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor());
@ -285,7 +382,9 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonAlign(leftAlignRadioButton.isSelected() ? DesignerUtils.kAlignLeft : DesignerUtils.kAlignCenter); mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setButtonLayoutType(layoutTypeCombo.getSelectedIndex());
mobileStyle.setButtonColumnSize((int)columnSizeSpinner.getValue());
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject());
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject());
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle());

195
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.mobile.ui.radiogroup; package com.fr.design.mainframe.mobile.ui.radiogroup;
import com.fr.base.BaseUtils;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -12,11 +13,13 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -24,24 +27,125 @@ import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
public class IconConfigPane extends JPanel { public class IconConfigPane extends JPanel {
private final int northPaneWidth = 330;
private final int listenerStep = 2;
private final Icon addIcon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/icon_add.png");
private final Icon deleteIcon = BaseUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete.png");
private UIButton editIconButton; private UIButton editIconButton;
private UIButton deleteIconButton; private UIButton deleteIconButton;
private String curIconName; private String curIconName;
private IconButton selectIconButton; private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
private UIButton addCountButton;
private UIButton deleteCountButton;
private EventListenerList addCountListener = new EventListenerList();
private EventListenerList deleteCountListener = new EventListenerList();
private JPanel northPane;
public IconConfigPane(int count) { public IconConfigPane(int count) {
initComp(count); initComp(count, false);
}
public IconConfigPane(int count, boolean canChangeCount) {
initComp(count, canChangeCount);
} }
public void initComp(int count) { /**
this.setLayout(FRGUIPaneFactory.createBorderLayout()); * 删除一个图标
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); */
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); public void deleteCount() {
if (!iconButtons.isEmpty()) {
northPane.remove(iconButtons.get(iconButtons.size() - 1));
iconButtons.remove(iconButtons.size() - 1);
adjustNorthPaneHeight();
IconConfigPane.this.revalidate(); // 重新验证并更新布局
IconConfigPane.this.repaint(); // 可选:刷新JPanel以更新界面显示
deleteCountButton.setEnabled(!iconButtons.isEmpty());
}
deleteCountButton.setEnabled(!iconButtons.isEmpty());
}
/**
* 添加一个图标
*/
public void addCount() {
deleteCountButton.setEnabled(true);
IconButton iconButton = new IconButton("");
selectIconButton = iconButton;
editIconButton.setEnabled(true);
iconButtons.add(iconButton);
int indexToInsert = northPane.getComponentCount() - 2;
deleteCountButton.setEnabled(!iconButtons.isEmpty());
// 创建新的按钮并插入到倒数第三个组件后面
northPane.add(iconButton, indexToInsert);
adjustNorthPaneHeight();
IconConfigPane.this.revalidate(); // 重新验证并更新布局
IconConfigPane.this.repaint(); // 可选:刷新JPanel以更新界面显示
}
private void adjustNorthPaneHeight() {
northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(iconButtons.size())));
}
private int getNorthPanelHeight(int iconNum) {
return (int) Math.ceil((iconNum + 2) / 13.0) * 30;
}
private void initAddAndDeleteCountButton(Boolean deleteCountButtonEnabled) {
addCountButton = new UIButton(addIcon);
addCountButton.setPreferredSize(new Dimension(20, 20));
addCountButton.setName("add");
deleteCountButton = new UIButton(deleteIcon);
deleteCountButton.setPreferredSize(new Dimension(20, 20));
deleteCountButton.setName("delete");
deleteCountButton.setEnabled(deleteCountButtonEnabled);
addCountButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireAddCountListener();
}
});
deleteCountButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireDeleteCountListener();
}
});
northPane.add(addCountButton);
northPane.add(deleteCountButton);
}
/**
* 根据图标名称刷新字体配置面板
* @param names 字体名称
* @param canChangeCount 是否支持改变数目
*/
public void refreshByIconNames(String[] names, Boolean canChangeCount) {
northPane.removeAll();
northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(names.length)));
ArrayList<IconButton> newIconButtons = new ArrayList<>();
for (String name : names) {
IconButton iconButton = new IconButton(name);
northPane.add(iconButton);
newIconButtons.add(iconButton);
}
iconButtons = newIconButtons;
if (canChangeCount) {
initAddAndDeleteCountButton(!ArrayUtils.isEmpty(names));
}
IconConfigPane.this.revalidate();
IconConfigPane.this.repaint();
}
/**
* 初始化编辑按钮
*/
private void initEditIconButton() {
editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
editIconButton.setPreferredSize(new Dimension(62, 20)); editIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(editIconButton);
editIconButton.addActionListener(new ActionListener() { editIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final CustomIconPane cip = new CustomIconPane(){ final CustomIconPane cip = new CustomIconPane(){
@ -62,11 +166,14 @@ public class IconConfigPane extends JPanel {
} }
}); });
editIconButton.setEnabled(false); editIconButton.setEnabled(false);
}
/**
* 初始化删除按钮
*/
private void initDeleteIconButton() {
deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete")); deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20)); deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() { deleteIconButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -75,30 +182,89 @@ public class IconConfigPane extends JPanel {
} }
}); });
deleteIconButton.setEnabled(false); deleteIconButton.setEnabled(false);
}
/**
* 重载形式
* @param count 图标数目
* @param canChangeCount 是否可以动态增减
*/
public void initComp(int count, boolean canChangeCount) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
initEditIconButton();
initDeleteIconButton();
panel.add(editIconButton);
panel.add(deleteIconButton);
northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
northPane.setPreferredSize(new Dimension(northPaneWidth, getNorthPanelHeight(count)));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel();
northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
IconButton iconButton = new IconButton(""); IconButton iconButton = new IconButton("");
northPane.add(iconButton); northPane.add(iconButton);
iconButtons.add(iconButton); iconButtons.add(iconButton);
} }
if (canChangeCount) {
initAddAndDeleteCountButton(count != 0);
}
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
} }
public void setShowIconImage() { public void setShowIconImage() {
selectIconButton.setIconName(curIconName); selectIconButton.setIconName(curIconName);
} }
/**
* 添加事件的监听
* @param changeListener 监听列表
*/
public void addAddCountListener(ChangeListener changeListener) {
addCountListener.add(ChangeListener.class, changeListener);
}
/**
* 删除事件的监听
* @param changeListener 监听列表
*/
public void addDeleteCountListener(ChangeListener changeListener) {
deleteCountListener.add(ChangeListener.class, changeListener);
}
/**
* 点击增加按钮
*/
public void fireAddCountListener() {
Object[] listeners = addCountListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
/**
* 点击删除按钮
*/
public void fireDeleteCountListener() {
Object[] listeners = deleteCountListener.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - listenerStep; i >= 0; i -= listenerStep) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
public void populate(ArrayList<String> iconArr) { public void populate(ArrayList<String> iconArr) {
for (int i = 0; i < iconButtons.size(); i++) { for (int i = 0; i < iconButtons.size(); i++) {
iconButtons.get(i).setIconName(iconArr.get(i)); iconButtons.get(i).setIconName(iconArr.get(i));
} }
} }
public ArrayList<String> update() { public ArrayList<String> update() {
ArrayList<String> iconNames = new ArrayList<String>(); ArrayList<String> iconNames = new ArrayList<String>();
for (int i = 0; i < iconButtons.size(); i++) { for (int i = 0; i < iconButtons.size(); i++) {
@ -107,7 +273,6 @@ public class IconConfigPane extends JPanel {
return iconNames; return iconNames;
} }
private class IconButton extends JToggleButton implements ActionListener { private class IconButton extends JToggleButton implements ActionListener {
private String iconName; private String iconName;
private Image iconImage = null; private Image iconImage = null;

193
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java

@ -9,6 +9,7 @@ import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox; 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.iscrollbar.UIScrollBar;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -23,11 +24,13 @@ import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
@ -36,12 +39,21 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
private JPanel scrollPanel; private JPanel scrollPanel;
private UIComboBox custom; private UIComboBox custom;
private JPanel centerPane; private JPanel centerPane;
// 按钮排布+按钮排布下拉框panel;
private JPanel buttonAlignPane;
// 固定列数 数字panel
private JPanel columnSizePane;
private UISpinner leftSpinner; private UISpinner leftSpinner;
private UISpinner rightSpinner; private UISpinner rightSpinner;
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox layoutTypeCombo;
private UIComboBox buttonAlignCombo;
private UISpinner columnSizeSpinner;
private IconConfigPane initialIconConfigPane; private IconConfigPane initialIconConfigPane;
private IconConfigPane selectedIconConfigPane; private IconConfigPane selectedIconConfigPane;
@ -73,6 +85,14 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
protected JPanel createContentPane() { protected JPanel createContentPane() {
return scrollPanel; return scrollPanel;
} }
@Override
protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) {
int width = parent.getWidth();
int height = parent.getHeight();
leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() + getOverWidth(), leftcontentPane.getPreferredSize().height);
scrollBar.setBounds(width - scrollBar.getWidth(), 0, scrollBar.getWidth(), height);
}
}; };
this.add(basicScrollPane); this.add(basicScrollPane);
} }
@ -115,67 +135,172 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
} }
private void addPaddingPane() { private void initLayoutCombo() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); layoutTypeCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Single_Line"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Auto"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed")
});
layoutTypeCombo.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
layoutTypeCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_SINGLE) {
buttonAlignPane.setVisible(true);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_AUTO) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(false);
}
if (layoutTypeCombo.getSelectedIndex() == DesignerUtils.K_LAYOUT_FIXED) {
buttonAlignPane.setVisible(false);
columnSizePane.setVisible(true);
}
}
});
}
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); /**
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); * 初始化按钮排布面板
*/
private void initButtonAlignPane() {
UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
buttonAlignCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split"),
});
buttonAlignCombo.setSelectedIndex(1);
buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
buttonAlignPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{buttonAlignLabel, buttonAlignCombo}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
}
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); /**
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); * 初始化固定列数面板
*/
private void initColumnSizePane() {
UILabel columnSizeLabel = DesignerUtils.createConfigLabel("");
columnSizeSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, DesignerUtils.INITIAL_COLUMN_SIZE);
columnSizeSpinner.setPreferredSize(new Dimension(DesignerUtils.LARGE_COMBO_WIDTH, 20));
columnSizePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{columnSizeLabel, columnSizeSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
columnSizePane.setVisible(false);
}
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); private JPanel initVPaddingConfig() {
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top"));
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom"));
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding);
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
}
private JPanel initHPaddingConfig() {
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left"));
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right"));
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding);
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL);
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); }
private void addPaddingPane() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout")));
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding"));
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText(""));
UILabel layoutTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Type"));
initLayoutCombo();
initButtonAlignPane();
initColumnSizePane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, initVPaddingConfig()},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, initHPaddingConfig()},
{layoutTypeLabel, layoutTypeCombo},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
centerPane.add(buttonAlignPane);
centerPane.add(columnSizePane);
} }
private void addIconPane() { /**
* 初始化默认字体配置面版
*/
private void initInitialIconConfigPane() {
initialIconConfigPane = new IconConfigPane(8, true);
initialIconConfigPane.addAddCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.addCount();
selectedIconConfigPane.addCount();
}
});
initialIconConfigPane.addDeleteCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.deleteCount();
selectedIconConfigPane.deleteCount();
}
});
}
/**
* 初始化选择字体配置面板
*/
private void initSelectedIconConfigPane() {
selectedIconConfigPane = new IconConfigPane(8, true);
selectedIconConfigPane.addAddCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.addCount();
selectedIconConfigPane.addCount();
}
});
selectedIconConfigPane.addDeleteCountListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initialIconConfigPane.deleteCount();
selectedIconConfigPane.deleteCount();
}
});
}
private void addIconPane() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon")));
UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init")); UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init"));
UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select")); UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select"));
initialLabel.setVerticalAlignment(SwingConstants.TOP);
initialIconConfigPane = new IconConfigPane(8); initialLabel.setBorder(new EmptyBorder(5, 0, 0, 0));
selectedIconConfigPane = new IconConfigPane(8); selectedLabel.setVerticalAlignment(SwingConstants.TOP);
selectedLabel.setBorder(new EmptyBorder(5, 0, 0, 0));
initInitialIconConfigPane();
initSelectedIconConfigPane();
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5);
JPanel initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel initialPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initialPane.add(initialLabel); initialPane.add(initialLabel, BorderLayout.WEST);
initialPane.add(initialIconConfigPane); initialPane.add(initialIconConfigPane, BorderLayout.CENTER);
container.add(initialPane); container.add(initialPane);
JPanel selectedPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel selectedPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
selectedPane.add(selectedLabel); selectedPane.add(selectedLabel, BorderLayout.WEST);
selectedPane.add(selectedIconConfigPane); selectedPane.add(selectedIconConfigPane, BorderLayout.CENTER);
container.add(selectedPane); container.add(selectedPane);
centerPane.add(container); centerPane.add(container);
} }
private void addFontPane() { private void addFontPane() {
@ -183,7 +308,7 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init"));
initialFontConfPane = new FontConfigPane(); initialFontConfPane = new FontConfigPane();
initialFontConfPane.setFontColor(new Color(204, 204, 204)); initialFontConfPane.setFontColor(new Color(102, 102, 102));
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
centerPane.add(fontPanel); centerPane.add(fontPanel);
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select"));
@ -205,8 +330,11 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
initialIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getInitialIconNames()))); layoutTypeCombo.setSelectedIndex(mobileStyle.getButtonLayoutType());
selectedIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getSelectedIconNames()))); buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
columnSizeSpinner.setValue(mobileStyle.getButtonColumnSize());
initialIconConfigPane.refreshByIconNames(mobileStyle.getInitialIconNames(), true);
selectedIconConfigPane.refreshByIconNames(mobileStyle.getSelectedIconNames(), true);
if(mobileStyle.getInitialFont() != null) { if(mobileStyle.getInitialFont() != null) {
initialFontConfPane.populate(mobileStyle.getInitialFont()); initialFontConfPane.populate(mobileStyle.getInitialFont());
} }
@ -224,6 +352,9 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonLayoutType(layoutTypeCombo.getSelectedIndex());
mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setButtonColumnSize((int)columnSizeSpinner.getValue());
ArrayList<String> initialIconNamesList = initialIconConfigPane.update(); ArrayList<String> initialIconNamesList = initialIconConfigPane.update();
ArrayList<String> selectedIconNamesList = selectedIconConfigPane.update(); ArrayList<String> selectedIconNamesList = selectedIconConfigPane.update();
mobileStyle.setInitialIconNames(initialIconNamesList.toArray(new String[initialIconNamesList.size()])); mobileStyle.setInitialIconNames(initialIconNamesList.toArray(new String[initialIconNamesList.size()]));

16
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/UnitedCustomDefinePane.java

@ -41,6 +41,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
private UISpinner topSpinner; private UISpinner topSpinner;
private UISpinner bottomSpinner; private UISpinner bottomSpinner;
private UIComboBox buttonAlignCombo;
private NewColorSelectBox initialColorSelectBox; private NewColorSelectBox initialColorSelectBox;
private NewColorSelectBox selectedColorSelectBox; private NewColorSelectBox selectedColorSelectBox;
@ -117,7 +118,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
private void addPaddingPane() { private void addPaddingPane() {
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout")));
UILabel buttonAlignLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment"));
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding"));
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText(""));
@ -140,13 +141,20 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL);
// 按钮排布下拉框
buttonAlignCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split")
});
buttonAlignCombo.setSelectedIndex(1);
buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, p};
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{
{paddingHintLabel, vPaddingSpinnerPanel}, {paddingHintLabel, vPaddingSpinnerPanel},
{emptyHintLabel, hPaddingSpinnerPanel}, {emptyHintLabel, hPaddingSpinnerPanel},
{buttonAlignLabel, buttonAlignCombo}
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
centerPane.add(paddingPanel); centerPane.add(paddingPanel);
@ -234,6 +242,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
rightSpinner.setValue(mobileStyle.getRightPadding()); rightSpinner.setValue(mobileStyle.getRightPadding());
topSpinner.setValue(mobileStyle.getTopPadding()); topSpinner.setValue(mobileStyle.getTopPadding());
bottomSpinner.setValue(mobileStyle.getBottomPadding()); bottomSpinner.setValue(mobileStyle.getBottomPadding());
buttonAlignCombo.setSelectedIndex(mobileStyle.getButtonAlign());
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor());
selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor()); selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor());
borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType()); borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType());
@ -256,6 +265,7 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
mobileStyle.setRightPadding(rightSpinner.getValue()); mobileStyle.setRightPadding(rightSpinner.getValue());
mobileStyle.setTopPadding(topSpinner.getValue()); mobileStyle.setTopPadding(topSpinner.getValue());
mobileStyle.setBottomPadding(bottomSpinner.getValue()); mobileStyle.setBottomPadding(bottomSpinner.getValue());
mobileStyle.setButtonAlign(buttonAlignCombo.getSelectedIndex());
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject());
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject());
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle());

9
designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/DesignerUtils.java

@ -16,10 +16,19 @@ import java.awt.*;
public class DesignerUtils { public class DesignerUtils {
public static final int NORMAL_COMBO_WIDTH = 152; public static final int NORMAL_COMBO_WIDTH = 152;
public static final int LARGE_COMBO_WIDTH = 174;
public static final int kDefaultHorizontalPadding = 0; public static final int kDefaultHorizontalPadding = 0;
public static final int kDefaultVerticalPadding = 15; public static final int kDefaultVerticalPadding = 15;
public static final int kAlignLeft = 0; public static final int kAlignLeft = 0;
public static final int kAlignCenter = 1; public static final int kAlignCenter = 1;
public static final int K_LAYOUT_SINGLE = 0;
public static final int K_LAYOUT_AUTO = 1;
public static final int K_LAYOUT_FIXED = 2;
public static final int INITIAL_COLUMN_SIZE = 1;
public static final int[] BORDER_LINE_STYLE_ARRAY = new int[]{ public static final int[] BORDER_LINE_STYLE_ARRAY = new int[]{
Constants.LINE_NONE, Constants.LINE_NONE,
Constants.LINE_THIN, Constants.LINE_THIN,

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/MobileStyleProviderManager.java

@ -1,5 +1,8 @@
package com.fr.design.mainframe.mobile.utils; package com.fr.design.mainframe.mobile.utils;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.CapsuleCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.ImageCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.checkboxgroup.UnitedCheckboxGroupStyleProvider;
import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider; import com.fr.design.mainframe.mobile.provider.combo.SimpleComboCheckBoxStyleProvider;
import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider; import com.fr.design.mainframe.mobile.provider.combo.SimpleComboStyleProvider;
import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider; import com.fr.design.mainframe.mobile.provider.date.NavigationStyleProvider;
@ -26,6 +29,9 @@ public class MobileStyleProviderManager {
add(new CapsuleRadioGroupStyleProvider()); add(new CapsuleRadioGroupStyleProvider());
add(new UnitedRadioGroupStyleProvider()); add(new UnitedRadioGroupStyleProvider());
add(new ImageRadioGroupStyleProvider()); add(new ImageRadioGroupStyleProvider());
add(new CapsuleCheckboxGroupStyleProvider());
add(new UnitedCheckboxGroupStyleProvider());
add(new ImageCheckboxGroupStyleProvider());
}}; }};
private static Set<Mutable> mobileParamUIProviderSet = new HashSet<Mutable>() {{ private static Set<Mutable> mobileParamUIProviderSet = new HashSet<Mutable>() {{
add(new MobileTopParamStyleProvider()); add(new MobileTopParamStyleProvider());

17
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -5,6 +5,7 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedColorScheme; import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.widgettheme.ThemePreviewTerminal;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils; import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -340,4 +341,20 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
} }
} }
} }
/**
* 开启控件显示增强时从配置面板处获取主题样式预览的终端类型
* 默认为PC端兼容原有场景
*/
public ThemePreviewTerminal getWidgetStyleEditorTerminal() {
if (!WidgetThemeDesignerUtils.enableWidgetEnhance()) {
return ThemePreviewTerminal.PC;
}
for (BasicBeanPane<T> pane : extraPaneList) {
if (pane instanceof WidgetStyleEditContainerPane) {
return ((WidgetStyleEditContainerPane<T>) pane).getTerminalStyle();
}
}
return ThemePreviewTerminal.PC;
}
} }

30
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -14,12 +14,13 @@ import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils; import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.AutoCheckTextField; import com.fr.design.mainframe.theme.ui.AutoCheckTextField;
import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField; import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField;
import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.widgettheme.ThemePreviewTerminal;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -51,7 +52,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
protected TemplateThemePreviewPane<T> themePreviewPane; protected TemplateThemePreviewPane<T> themePreviewPane;
protected TemplateThemeEditorPane<T> themeEditorPane; protected TemplateThemeEditorPane<T> themeEditorPane;
protected UILabel leftTitleLabel;
protected UILabel leftTitlePromptLabel;
protected boolean isPopulating = false; protected boolean isPopulating = false;
protected boolean isMutable = false; protected boolean isMutable = false;
@ -83,10 +85,9 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private JPanel createLeftPane() { private JPanel createLeftPane() {
JPanel titleContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel titleContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
titleContainer.setPreferredSize(new Dimension(LEFT_TITLE_PANE_WIDTH, LEFT_TITLE_PANE_HEIGHT)); titleContainer.setPreferredSize(new Dimension(LEFT_TITLE_PANE_WIDTH, LEFT_TITLE_PANE_HEIGHT));
titleContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Preview_Pane_Title"), TITLE_BORDER_FONT));
JPanel previewContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewContainer.setBorder(BorderFactory.createEmptyBorder(5, 4, 10, 4)); previewContainer.setBorder(BorderFactory.createEmptyBorder(5, 4, 10, 4));
titleContainer.add(createTitlePane(), BorderLayout.NORTH);
titleContainer.add(previewContainer, BorderLayout.CENTER); titleContainer.add(previewContainer, BorderLayout.CENTER);
themePreviewPane = createThemePreviewPane(); themePreviewPane = createThemePreviewPane();
@ -103,7 +104,10 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (isPopulating) { if (isPopulating) {
return; return;
} }
themePreviewPane.refresh(updateBean()); ThemePreviewTerminal terminal = themeEditorPane.getWidgetStyleEditorTerminal();
themePreviewPane.refresh(updateBean(), terminal);
String prompt = terminal == ThemePreviewTerminal.PC ? Toolkit.i18nText("Fine-Design_Theme_Control_PC_Prompt") : Toolkit.i18nText("Fine-Design_Theme_Control_Mobile_Prompt");
leftTitlePromptLabel.setText(prompt);
saveButton.setEnabled(themeEditorPane.checkNameValid() && isMutable); saveButton.setEnabled(themeEditorPane.checkNameValid() && isMutable);
} }
}); });
@ -367,4 +371,20 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void onSaved(TemplateTheme theme) {} public void onSaved(TemplateTheme theme) {}
} }
/**
* 创建预览界面标题面板
*/
protected JPanel createTitlePane() {
JPanel titlePane = new JPanel();
titlePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
titlePane.setLayout(new BorderLayout());
leftTitleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Preview_Pane_Title"));
leftTitlePromptLabel = new UILabel(Toolkit.i18nText("Fine-Design_Theme_Control_PC_Prompt"));
leftTitleLabel.setForeground(WidgetThemeDisplayConstants.THEME_PREVIEW_TITLE_COLOR);
leftTitlePromptLabel.setForeground(WidgetThemeDisplayConstants.COMPATIBLE_STYLE_FONT_COLOR);
titlePane.add(leftTitleLabel, BorderLayout.WEST);
titlePane.add(leftTitlePromptLabel, BorderLayout.EAST);
return titlePane;
}
} }

12
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ThemePreviewed.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.theme.preview; package com.fr.design.mainframe.theme.preview;
import com.fr.widgettheme.ThemePreviewTerminal;
/** /**
* @author Starryi * @author Starryi
* @version 1.0 * @version 1.0
@ -7,4 +9,14 @@ package com.fr.design.mainframe.theme.preview;
*/ */
public interface ThemePreviewed<T> { public interface ThemePreviewed<T> {
void refresh(T style); void refresh(T style);
/**
* 根据主题预览样式类型进行刷新
*
* @param style 样式可以包含多个终端展现效果
* @param terminal 终端类型
*/
default void refresh(T style, ThemePreviewTerminal terminal) {
refresh(style);
}
} }

2
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -228,7 +228,7 @@ public class VersionCheckUtils {
Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet(); Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet();
try { try {
JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList(); JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList(info);
for (int i = 0; i < serviceArray.size(); i++) { for (int i = 0; i < serviceArray.size(); i++) {
try { try {
Class clazz = Class.forName((String) serviceArray.get(i)); Class clazz = Class.forName((String) serviceArray.get(i));

62
designer-base/src/main/java/com/fr/widgettheme/ThemePreviewTerminal.java

@ -0,0 +1,62 @@
package com.fr.widgettheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
/**
* 主题样式预览终端类型
*
* @author obo
* @since 11.0
* Created on 2024/2/2
*/
public enum ThemePreviewTerminal {
/**
* 桌面端,为默认类型
*/
PC(0) {
@Override
public ThemedWidgetStyle getThemeWidgetStyle(TemplateTheme theme) {
return (ThemedWidgetStyle) theme.getWidgetStyle();
}
},
/**
* 移动端
*/
MOBILE(1) {
@Override
public ThemedWidgetStyle getThemeWidgetStyle(TemplateTheme theme) {
return (MobileThemedWidgetStyle) theme.getMobileWidgetStyle();
}
};
/**
* 类型码
*/
final int code;
ThemePreviewTerminal(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public abstract ThemedWidgetStyle getThemeWidgetStyle(TemplateTheme theme);
/**
* 根据code获取对应的枚举
*/
public static ThemePreviewTerminal getTypeByCode(int code) {
for (ThemePreviewTerminal type : ThemePreviewTerminal.values()) {
if (type.code == code) {
return type;
}
}
throw new IllegalArgumentException("Invalid ThemePreviewTerminalType code :" + code);
}
}

118
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java

@ -2,20 +2,24 @@ 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.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.DesignUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.StringUtils;
import com.fr.util.ColorUtils;
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.ThemeTextStyle; import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
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.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.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator; import com.fr.widgettheme.util.WidgetStyleComponentCombiner;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import javax.swing.ButtonGroup; import java.awt.Color;
import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
@ -27,52 +31,47 @@ import java.awt.Component;
* Created on 2023/3/28 * Created on 2023/3/28
*/ */
public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetStyleEditPane<T> { public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetStyleEditPane<T> {
// 风格1
protected UIRadioButton style1; /**
// 风格2 * 字体名选择器
protected UIRadioButton style2; */
protected UIComboBox fontNameSelectBox;
/** /**
* 下拉面板背景颜色 * 下拉面板背景颜色
*/ */
private NewColorSelectBox selectBackgroundColorBox; private NewColorSelectBox selectBackgroundColorBox;
public DesktopWidgetStyleEditPane() { public DesktopWidgetStyleEditPane() {
super(); super();
} }
@Override @Override
public Component[][] generateComponent() { public Component[][] generateComponent() {
initStyleEditor();
initSelectBackgroundColorBox(); initSelectBackgroundColorBox();
// 容纳风格1和风格2的panel initFontNameSelectBox();
JPanel stylePane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout());
stylePane.add(style1);
stylePane.add(style2);
return 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[]{WidgetThemeDesignerUtils.createTopAlignmentLabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Widget_Background")), WidgetStyleComponentCombiner.combineWidgetBackgroundComponent(widgetBgColorSelectBox, widgetBgAlphaDragPane, colorSelectBox.getPreferredSize().width)},
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[]{null, lineComboColorSelectBox},
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_Text_Style")), ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Icon_Color")), iconColorSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), fontNameSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), WidgetStyleComponentCombiner.combineTextStyleComponent(fontSizePane, fontColorButton, italic, bold)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box")), selectBackgroundColorBox} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box")), selectBackgroundColorBox}
}; };
} }
private void initStyleEditor() {
style1 = new UIRadioButton(Toolkit.i18nText("Fine-Design_Widget_Theme_Style_1"));
style2 = new UIRadioButton(Toolkit.i18nText("Fine-Design_Widget_Theme_Style_2"));
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(style1);
buttonGroup.add(style2);
}
private void initSelectBackgroundColorBox() { private void initSelectBackgroundColorBox() {
selectBackgroundColorBox = new NewColorSelectBox(140, true); selectBackgroundColorBox = new NewColorSelectBox(140, true);
selectBackgroundColorBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); selectBackgroundColorBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
} }
private void initFontNameSelectBox() {
fontNameSelectBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
}
@Override @Override
public void populateBean(T t) { public void populateBean(T t) {
ThemedWidgetStyle style = (ThemedWidgetStyle) t.getWidgetStyle(); ThemedWidgetStyle style = (ThemedWidgetStyle) t.getWidgetStyle();
@ -80,17 +79,12 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
style = new ThemedWidgetStyle(); style = new ThemedWidgetStyle();
t.setWidgetStyle(style); t.setWidgetStyle(style);
} }
if (style.getStyleType() == 1) {
style1.setSelected(true);
} else {
style2.setSelected(true);
}
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
fontSizePane.setValue(style.getTextStyle().getFontSize());
fontColorButton.setColor(style.getTextStyle().getFontColor());
selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor()); selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor());
iconColorSelectBox.setSelectObject(style.getIconColor());
populateBorder(style);
populateTextStyle(style);
populateWidgetBackground(style);
} }
@Override @Override
@ -100,22 +94,72 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
style = new ThemedWidgetStyle(); style = new ThemedWidgetStyle();
t.setWidgetStyle(style); t.setWidgetStyle(style);
} }
updateBorderStyle(style);
updateTextStyle(style);
updateButtonBackground(style);
updateWidgetBackground(style);
style.setThemeColor(colorSelectBox.getSelectObject()); style.setThemeColor(colorSelectBox.getSelectObject());
style.setSelectBackgroundColor(selectBackgroundColorBox.getSelectObject());
style.setIconColor(iconColorSelectBox.getSelectObject());
}
private void updateBorderStyle(ThemedWidgetStyle style) {
BorderStyle borderStyle = new BorderStyle(); BorderStyle borderStyle = new BorderStyle();
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
borderStyle.setBorderColor(lineComboColorSelectBox.getSelectObject());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
}
private void updateTextStyle(ThemedWidgetStyle style) {
ThemeTextStyle textStyle = new ThemeTextStyle(); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue()); textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor()); textStyle.setFontColor(fontColorButton.getColor());
textStyle.setName((String) fontNameSelectBox.getSelectedItem());
textStyle.setBold(bold.isSelected());
textStyle.setItalic(italic.isSelected());
style.setTextStyle(textStyle); style.setTextStyle(textStyle);
}
private void updateButtonBackground(ThemedWidgetStyle style) {
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);
buttonBackgroundStyle.setOverBackground(buttonBackground); buttonBackgroundStyle.setOverBackground(buttonBackground);
buttonBackgroundStyle.setClickBackground(buttonBackground); buttonBackgroundStyle.setClickBackground(buttonBackground);
style.setButtonBackgroundStyle(buttonBackgroundStyle); style.setButtonBackgroundStyle(buttonBackgroundStyle);
style.setStyleType(style1.isSelected() ? 1 : 2); }
style.setSelectBackgroundColor(selectBackgroundColorBox.getSelectObject());
private void updateWidgetBackground(ThemedWidgetStyle style) {
Color bgColor = widgetBgColorSelectBox.getSelectObject();
style.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(bgColor, widgetBgAlphaDragPane.updateBean()));
}
private void populateTextStyle(ThemedWidgetStyle style) {
ThemeTextStyle textStyle = style.getTextStyle();
fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor());
bold.setSelected(textStyle.isBold());
italic.setSelected(textStyle.isItalic());
String fontName = StringUtils.isEmpty(textStyle.getName()) ? InterProviderFactory.getProvider().getLocText("Fine-Engine_Base_Song_TypeFace") : textStyle.getName();
fontNameSelectBox.setSelectedItem(fontName);
}
private void populateBorder(ThemedWidgetStyle style) {
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
lineComboColorSelectBox.setSelectObject(style.getBorderStyle().getBorderColor());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
}
private void populateWidgetBackground(ThemedWidgetStyle style) {
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(style.getWidgetBackground().getColor()));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(style.getWidgetBackground().getColor()));
}
@Override
public void initLineBox() {
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY);
lineComboColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
lineComboBox.addItemListener(e -> lineComboColorSelectBox.setVisible(!Integer.valueOf(0).equals(e.getItem())));
} }
} }

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

@ -2,6 +2,8 @@ package com.fr.widgettheme.theme.edit.widget;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.BorderStyle;
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;
@ -36,6 +38,8 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
public void initLineBox() { public void initLineBox() {
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY); lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY);
lineComboBox.setSelectedLineStyle(com.fr.stable.Constants.LINE_THIN); lineComboBox.setSelectedLineStyle(com.fr.stable.Constants.LINE_THIN);
lineComboColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
lineComboBox.addItemListener(e -> lineComboColorSelectBox.setVisible(!Integer.valueOf(0).equals(e.getItem())));
} }
@Override @Override
@ -51,10 +55,16 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
t.setMobileWidgetStyle(style); t.setMobileWidgetStyle(style);
} }
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(style.getWidgetBackground().getColor()));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(style.getWidgetBackground().getColor()));
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
lineComboColorSelectBox.setSelectObject(style.getBorderStyle().getBorderColor());
iconColorSelectBox.setSelectObject(style.getIconColor());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
fontSizePane.setValue(style.getTextStyle().getFontSize()); fontSizePane.setValue(style.getTextStyle().getFontSize());
fontColorButton.setColor(style.getTextStyle().getFontColor()); fontColorButton.setColor(style.getTextStyle().getFontColor());
bold.setSelected(style.getTextStyle().isBold());
italic.setSelected(style.getTextStyle().isItalic());
} }
@Override @Override
@ -65,13 +75,18 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
t.setMobileWidgetStyle(style); t.setMobileWidgetStyle(style);
} }
style.setThemeColor(colorSelectBox.getSelectObject()); style.setThemeColor(colorSelectBox.getSelectObject());
style.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
BorderStyle borderStyle = new BorderStyle(); BorderStyle borderStyle = new BorderStyle();
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
borderStyle.setBorderColor(lineComboColorSelectBox.getSelectObject());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
style.setIconColor(iconColorSelectBox.getSelectObject());
ThemeTextStyle textStyle = new ThemeTextStyle(); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue()); textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor()); textStyle.setFontColor(fontColorButton.getColor());
textStyle.setBold(bold.isSelected());
textStyle.setItalic(italic.isSelected());
style.setTextStyle(textStyle); style.setTextStyle(textStyle);
} }

5
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditContainerPane.java

@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
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.widgettheme.ThemePreviewTerminal;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -133,4 +134,8 @@ public class WidgetStyleEditContainerPane<T extends TemplateTheme> extends Basic
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Theme_Widget_Style"); return Toolkit.i18nText("Fine-Design_Theme_Widget_Style");
} }
public ThemePreviewTerminal getTerminalStyle() {
return ThemePreviewTerminal.getTypeByCode(terminalStyleGroup.getSelectedIndex());
}
} }

57
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java

@ -4,8 +4,11 @@ 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.frpane.FontSizeComboPane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
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,9 +17,11 @@ 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.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator; import com.fr.widgettheme.util.WidgetStyleComponentCombiner;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -39,6 +44,11 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
// 边框线型 // 边框线型
protected LineComboBox lineComboBox; protected LineComboBox lineComboBox;
/**
* 边框颜色
*/
protected NewColorSelectBox lineComboColorSelectBox;
// 圆角边框 // 圆角边框
protected UISpinner borderRadiusSpinner; protected UISpinner borderRadiusSpinner;
/** /**
@ -48,6 +58,24 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
protected UIColorButton fontColorButton; protected UIColorButton fontColorButton;
/**
* 控件背景和透明度配置面板
*/
protected NewColorSelectBox widgetBgColorSelectBox;
protected UIPercentDragPane widgetBgAlphaDragPane;
/**
* 图标颜色
*/
protected NewColorSelectBox iconColorSelectBox;
/**
* 字体粗体斜体配置
*/
protected UIToggleButton bold;
protected UIToggleButton italic;
protected JPanel leftPanel;
public WidgetStyleEditPane() { public WidgetStyleEditPane() {
initComponents(); initComponents();
} }
@ -55,15 +83,17 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
initCommonStyleEditor(); initCommonStyleEditor();
double f = TableLayout.PREFERRED; double f = TableLayout.FILL;
final double p = TableLayout.PREFERRED; final double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENTS_COL_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {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, 20, 10));
this.add(customPane, BorderLayout.NORTH); this.add(customPane, BorderLayout.NORTH);
UIScrollPane scrollPane = new UIScrollPane(customPane);
this.add(scrollPane);
} }
/** /**
@ -72,21 +102,29 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
* @return components * @return components
*/ */
public Component[][] generateComponent() { public Component[][] generateComponent() {
return new Component[][]{new Component[]{ return 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[]{WidgetThemeDesignerUtils.createTopAlignmentLabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Widget_Background")), WidgetStyleComponentCombiner.combineWidgetBackgroundComponent(widgetBgColorSelectBox, widgetBgAlphaDragPane, colorSelectBox.getPreferredSize().width)},
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[]{null, lineComboColorSelectBox},
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_Text_Style")), ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Icon_Color")), iconColorSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), WidgetStyleComponentCombiner.combineTextStyleComponent(fontSizePane, fontColorButton, italic, bold)}
}; };
} }
private void initCommonStyleEditor() { private void initCommonStyleEditor() {
colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true); colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
widgetBgAlphaDragPane = new UIPercentDragPane();
initLineBox(); initLineBox();
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
initFontSizePane(); initFontSizePane();
fontColorButton = new UIColorButton(); fontColorButton = new UIColorButton();
bold = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
} }
protected void initFontSizePane() { protected void initFontSizePane() {
@ -97,7 +135,6 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
* 初始化边框线型 * 初始化边框线型
*/ */
public void initLineBox() { public void initLineBox() {
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY);
} }

2
designer-base/src/main/java/com/fr/widgettheme/theme/panel/ButtonStyleDefinedPane.java

@ -10,7 +10,6 @@ import com.fr.widgettheme.theme.bean.ButtonBackground;
import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -48,7 +47,6 @@ public class ButtonStyleDefinedPane extends BasicPane {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")), clickBackgroundPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")), clickBackgroundPane},
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 7, 7);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }

44
designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java

@ -3,17 +3,19 @@ package com.fr.widgettheme.theme.panel;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.widgettheme.ThemePreviewTerminal;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
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.stable.Constants; import com.fr.stable.Constants;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.LayoutManager; import java.awt.LayoutManager;
@ -38,6 +40,11 @@ public class ControlPreviewCell extends JPanel {
*/ */
protected String value; protected String value;
protected TemplateTheme reportTheme; protected TemplateTheme reportTheme;
/**
* 主题预览类型默认为PC端
*/
protected ThemePreviewTerminal themePreviewTerminal = ThemePreviewTerminal.PC;
/** /**
* 字体的颜色 * 字体的颜色
*/ */
@ -69,9 +76,10 @@ public class ControlPreviewCell extends JPanel {
/** /**
* 主题样式变化后监听改变 * 主题样式变化后监听改变
*/ */
public void refresh(TemplateTheme reportTheme) { public void refresh(TemplateTheme reportTheme, ThemePreviewTerminal type) {
this.reportTheme = reportTheme; this.reportTheme = reportTheme;
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) this.reportTheme.getWidgetStyle(); this.themePreviewTerminal = type;
ThemedWidgetStyle widgetStyle = this.themePreviewTerminal.getThemeWidgetStyle(reportTheme);
//主题色设置为透明或者插件启动前已有的主题启动插件后主题色为null //主题色设置为透明或者插件启动前已有的主题启动插件后主题色为null
if (widgetStyle.getThemeColor() == null) { if (widgetStyle.getThemeColor() == null) {
widgetStyle.setThemeColor(DEFAULT_THEME_COLOR); widgetStyle.setThemeColor(DEFAULT_THEME_COLOR);
@ -85,24 +93,15 @@ public class ControlPreviewCell extends JPanel {
this.paintBgColor(g, widgetStyle, DEFAULT_ALPHA); this.paintBgColor(g, widgetStyle, DEFAULT_ALPHA);
} }
public boolean isDefaultStyle() { public Color getIconColor() {
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); return this.themePreviewTerminal.getThemeWidgetStyle(reportTheme).getIconColor();
return widgetStyle.getStyleType() == ThemedWidgetStyle.DEFAULT_STYLE;
}
public Color getThemeColor() {
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
return widgetStyle.getThemeColor();
} }
protected Icon setStyleTwoIcon(Icon icon, Icon defaultIcon) { protected Icon setStyleTwoIcon(Icon icon, Icon defaultIcon) {
if (this.reportTheme != null && !isDefaultStyle()) { if (this.reportTheme != null) {
if (icon instanceof ImageIcon) { if (icon instanceof ImageIcon) {
ImageIcon imageIcon = (ImageIcon) icon; ImageIcon imageIcon = (ImageIcon) icon;
BufferedImage bufferedImage = ImageUtils.colorImage(ImageUtils.imageIconToBufferedImage(imageIcon), getThemeColor()); BufferedImage bufferedImage = ImageUtils.colorImage(ImageUtils.imageIconToBufferedImage(imageIcon), getIconColor());
return new ImageIcon(bufferedImage); return new ImageIcon(bufferedImage);
} }
} }
@ -113,12 +112,15 @@ public class ControlPreviewCell extends JPanel {
* 填充圆角矩形背景色 * 填充圆角矩形背景色
*/ */
public void paintBgColor(Graphics g, ThemedWidgetStyle widgetStyle, int alpha) { public void paintBgColor(Graphics g, ThemedWidgetStyle widgetStyle, int alpha) {
Color themeColor = widgetStyle.getThemeColor(); ThemedWidgetStyle themeWidgetStyle = this.themePreviewTerminal.getThemeWidgetStyle(this.reportTheme);
Color themeColor = themeWidgetStyle.getThemeColor();
themeColor = themeColor == null ? WidgetThemeDisplayConstants.DEFAULT_TRANSPARENT_COLOR : themeColor;
g.setColor(new Color(themeColor.getRed(), themeColor.getGreen(), themeColor.getBlue(), alpha)); g.setColor(new Color(themeColor.getRed(), themeColor.getGreen(), themeColor.getBlue(), alpha));
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, (int) widgetStyle.getBorderStyle().getRadius(), (int) widgetStyle.getBorderStyle().getRadius());
//需要重新绘制一遍字体,否则会被颜色填充给遮住 //需要重新绘制一遍字体,否则会被颜色填充给遮住
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), textColor); ThemeTextStyle textStyle = themeWidgetStyle.getTextStyle();
FRFont font = FRFont.getInstance(textStyle.getName(), textStyle.getCompositeFontStyle(), textStyle.getFontSize(), textStyle.getFontColor());
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);
@ -131,8 +133,8 @@ public class ControlPreviewCell extends JPanel {
return; return;
} }
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); ThemeTextStyle textStyle = this.themePreviewTerminal.getThemeWidgetStyle(reportTheme).getTextStyle();
FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), textColor); FRFont font = FRFont.getInstance(textStyle.getName(), textStyle.getCompositeFontStyle(), textStyle.getFontSize(), textStyle.getFontColor());
//每个预览格子通用的字体绘制 //每个预览格子通用的字体绘制
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)

9
designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCellWithIcon.java

@ -5,7 +5,6 @@ import com.fr.base.svg.IconUtils;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -64,14 +63,12 @@ public class ControlPreviewCellWithIcon extends ControlPreviewCell {
super.paintComponent(g); super.paintComponent(g);
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
//风格一边框不显示主题色 //风格一边框不显示主题色
Color borderColor = isDefaultStyle() ? DEFAULT_COLOR : widgetStyle.getThemeColor(); Color borderColor = widgetStyle.getBorderStyle().getBorderColor();
this.setBorder(new UIRoundedBorder(widgetStyle.getBorderStyle().getLineType() this.setBorder(new UIRoundedBorder(widgetStyle.getBorderStyle().getLineType()
, borderColor, widgetStyle.getBorderStyle().getRadius())); , borderColor, (int) widgetStyle.getBorderStyle().getRadius()));
icon = setStyleTwoIcon(icon, defaultIcon); icon = setStyleTwoIcon(icon, defaultIcon);
this.jLabel.setIcon(icon); this.jLabel.setIcon(icon);
this.add(jLabel, BorderLayout.EAST); this.add(jLabel, BorderLayout.EAST);
if (widgetStyle.getStyleType() != ThemedWidgetStyle.DEFAULT_STYLE) { paintBgColor(g, widgetStyle, CONTROL_ALPHA);
paintBgColor(g, widgetStyle, CONTROL_ALPHA);
}
} }
} }

8
designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewPane.java

@ -6,6 +6,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.preview.ThemePreviewed; import com.fr.design.mainframe.theme.preview.ThemePreviewed;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.widgettheme.ThemePreviewTerminal;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
@ -42,9 +43,14 @@ public class ControlPreviewPane extends JPanel implements ThemePreviewed<Templat
@Override @Override
public void refresh(TemplateTheme style) { public void refresh(TemplateTheme style) {
refresh(style, ThemePreviewTerminal.PC);
}
@Override
public void refresh(TemplateTheme style, ThemePreviewTerminal type) {
this.background = style.getParamContainerStyle().getBackground(); this.background = style.getParamContainerStyle().getBackground();
for (ControlPreviewCell controlPreviewCell : list) { for (ControlPreviewCell controlPreviewCell : list) {
controlPreviewCell.refresh(style); controlPreviewCell.refresh(style, type);
} }
} }

15
designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java

@ -1,12 +1,15 @@
package com.fr.widgettheme.theme.panel; package com.fr.widgettheme.theme.panel;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
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.general.FRFont; import com.fr.general.FRFont;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.LayoutManager;
/** /**
* 主题参数面板按钮预览格子 * 主题参数面板按钮预览格子
@ -40,10 +43,12 @@ public class NormalButtonPreviewCell extends ControlPreviewCell {
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); ThemedWidgetStyle widgetStyle = this.themePreviewTerminal.getThemeWidgetStyle(this.reportTheme);
paintBgColor(g, widgetStyle); paintBgColor(g, widgetStyle);
uiLabel.setForeground(Color.WHITE); uiLabel.setBackground(widgetStyle.getThemeColor());
FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), Color.WHITE); ThemeTextStyle textStyle = widgetStyle.getTextStyle();
uiLabel.setForeground(textStyle.getFontColor());
FRFont font = FRFont.getInstance(textStyle.getName(), textStyle.getCompositeFontStyle(), textStyle.getFontSize(), textStyle.getFontColor());
uiLabel.setFont(font); uiLabel.setFont(font);
this.add(uiLabel, BorderLayout.CENTER); this.add(uiLabel, BorderLayout.CENTER);
} }

3
designer-base/src/main/java/com/fr/widgettheme/theme/panel/RoundControlPreviewCell.java

@ -36,8 +36,7 @@ public class RoundControlPreviewCell extends ControlPreviewCell {
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle(); ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
//风格一边框不显示主题色 Color borderColor = widgetStyle.getBorderStyle().getBorderColor();
Color borderColor = isDefaultStyle() ? DEFAULT_COLOR : widgetStyle.getThemeColor();
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
g2d.setColor(borderColor); g2d.setColor(borderColor);
g2d.drawOval(5, 9, 15, 15); g2d.drawOval(5, 9, 15, 15);

17
designer-base/src/main/java/com/fr/widgettheme/theme/panel/TextPreviewCell.java

@ -1,9 +1,10 @@
package com.fr.widgettheme.theme.panel; package com.fr.widgettheme.theme.panel;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.widgettheme.ThemePreviewTerminal;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import java.awt.*; import java.awt.LayoutManager;
/** /**
* 文字预览格子 * 文字预览格子
@ -24,13 +25,9 @@ public class TextPreviewCell extends ControlPreviewCell {
} }
@Override @Override
public void refresh(TemplateTheme reportTheme) { public void refresh(TemplateTheme reportTheme, ThemePreviewTerminal type) {
super.refresh(reportTheme); super.refresh(reportTheme, type);
// 文字根据是否深色主题自适应改变 ThemeTextStyle textStyle = type.getThemeWidgetStyle(reportTheme).getTextStyle();
if (reportTheme.isDark()) { textColor = textStyle.getFontColor();
textColor = Color.WHITE;
} else {
textColor = Color.BLACK;
}
} }
} }

8
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java

@ -21,6 +21,7 @@ import com.fr.plugin.chart.type.RadiusType;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.ThemePreviewTerminal;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
@ -100,12 +101,17 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
@Override @Override
public void refresh(FormTheme theme) { public void refresh(FormTheme theme) {
refresh(theme, ThemePreviewTerminal.PC);
}
@Override
public void refresh(FormTheme theme, ThemePreviewTerminal themeStyleType) {
background = theme.getBodyStyle().getStyle().getBackground(); background = theme.getBodyStyle().getStyle().getBackground();
alpha = theme.getBodyStyle().getStyle().getAlpha(); alpha = theme.getBodyStyle().getStyle().getAlpha();
elementCasePane.refresh(theme); elementCasePane.refresh(theme);
columnChartPreviewPane.refresh(theme); columnChartPreviewPane.refresh(theme);
pieChartPreviewPane.refresh(theme); pieChartPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme); controlPreviewPane.refresh(theme, themeStyleType);
repaint(); repaint();
} }

8
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java

@ -13,6 +13,7 @@ import com.fr.general.Background;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.widgettheme.ThemePreviewTerminal;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -59,10 +60,15 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
@Override @Override
public void refresh(ReportTheme theme) { public void refresh(ReportTheme theme) {
refresh(theme, ThemePreviewTerminal.PC);
}
@Override
public void refresh(ReportTheme theme, ThemePreviewTerminal terminal) {
background = theme.getBodyStyle().getBackground(); background = theme.getBodyStyle().getBackground();
reportPreviewPane.refresh(theme); reportPreviewPane.refresh(theme);
chartPreviewPane.refresh(theme); chartPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme); controlPreviewPane.refresh(theme, terminal);
repaint(); repaint();
} }

40
designer-base/src/main/java/com/fr/widgettheme/util/ThemeTextStylePaneCreator.java

@ -1,40 +0,0 @@
package com.fr.widgettheme.util;
import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.Box;
import javax.swing.JPanel;
import java.awt.Component;
/**
* 创建主题文本样式的工具类
*
* @author obo
* @since 11.0
* Created on 2023/12/21
*/
public class ThemeTextStylePaneCreator {
private ThemeTextStylePaneCreator() {}
/**
* 创建主题文本样式配置面板
* 包含字体大小下拉框和字体颜色按钮
* 可以自适应布局
*
* @param fontSizePane 字体大小配置
* @param fontColorButton 字体颜色配置
* @return 文本样式面板
*/
public static JPanel create(FontSizeComboPane fontSizePane, UIColorButton fontColorButton) {
Component[][] components = {{fontSizePane, Box.createHorizontalStrut(5), fontColorButton}};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = {f, p, p};
int[][] rowCount = {{1, 1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, 0);
}
}

131
designer-base/src/main/java/com/fr/widgettheme/util/WidgetStyleComponentCombiner.java

@ -0,0 +1,131 @@
package com.fr.widgettheme.util;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.widget.FRWidgetFactory;
import javax.swing.JPanel;
import java.awt.Component;
/**
* 创建控件样式组合配置面板的工具类
*
* @author obo
* @since 11.0
* Created on 2023/12/21
*/
public class WidgetStyleComponentCombiner {
private static final double F = TableLayout.FILL;
private static final double P = TableLayout.PREFERRED;
private WidgetStyleComponentCombiner() {
}
/**
* 组合主题文本样式配置面板
* 包含字体大小下拉框和字体颜色按钮
*
* @param fontSizePane 字体大小配置
* @param fontColorButton 字体颜色配置
* @param bold 粗体
* @param italic 斜体
* @return 文本样式面板
*/
public static JPanel combineTextStyleComponent(FontSizeComboPane fontSizePane, UIColorButton fontColorButton, UIToggleButton bold, UIToggleButton italic) {
Component[][] components = {{fontSizePane, fontColorButton, bold, italic}};
double[] rowSize = {P};
double[] columnSize = {F, P, P, P};
int[][] rowCount = {{1, 1, 1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 5, 5);
}
/**
* 组合主题文本样式配置面板
* 包含字体大小下拉框和字体颜色按钮
*
* @param fontNameSelectBox 字体名配置
* @param fontSizePane 字体大小配置
* @param fontColorButton 字体颜色配置
* @param bold 粗体
* @param italic 斜体
* @return 文本样式面板
*/
public static JPanel combineTextStyleComponent(UIComboBox fontNameSelectBox, FontSizeComboPane fontSizePane, UIColorButton fontColorButton, UIToggleButton bold, UIToggleButton italic) {
Component[][] components = {
{fontNameSelectBox, null, null, null},
{fontSizePane, fontColorButton, bold, italic}
};
double[] rowSize = {P, P};
double[] columnSize = {F, P, P, P};
int[][] rowCount = {
{1, 1, 1, 1},
{1, 1, 1, 1}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 5, 5);
}
/**
* 组合控件背景配置面板
*
* @param colorSelectBox 颜色下拉框
* @param alphaDragPane 透明度
* @param columnWidth 列宽
* @return 文本样式面板
*/
public static JPanel combineWidgetBackgroundComponent(NewColorSelectBox colorSelectBox,
UIPercentDragPane alphaDragPane,
double columnWidth) {
Component[][] components = {
{colorSelectBox},
{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))},
{alphaDragPane}
};
double[] rowSize = {P, P, P};
double[] columnSize = {columnWidth};
int[][] rowCount = {{1}, {1}, {1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
}
/**
* 组合控件边框配置面板
*
* @param lineComboBox 字体大小配置
* @param lineComboColorSelectBox 字体颜色配置
* @return 文本样式面板
*/
public static JPanel combineWidgetBorderComponent(LineComboBox lineComboBox, NewColorSelectBox lineComboColorSelectBox) {
return combineWidgetBorderComponent(lineComboBox, lineComboColorSelectBox, P);
}
/**
* 组合控件边框配置面板
*
* @param lineComboBox 字体大小配置
* @param lineComboColorSelectBox 字体颜色配置
* @param columnWidth 指定的列宽
* @return 文本样式面板
*/
public static JPanel combineWidgetBorderComponent(LineComboBox lineComboBox,
NewColorSelectBox lineComboColorSelectBox,
double columnWidth) {
Component[][] components = {
{lineComboBox},
{lineComboColorSelectBox}
};
double[] rowSize = {P, P};
double[] columnSize = {columnWidth};
int[][] rowCount = {{1}, {1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
}
}

34
designer-base/src/main/java/com/fr/widgettheme/util/WidgetThemeDesignerUtils.java

@ -2,10 +2,17 @@ package com.fr.widgettheme.util;
import com.fr.base.io.AttrMark; import com.fr.base.io.AttrMark;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.control.attr.WidgetDisplayEnhanceMarkAttr; import com.fr.widgettheme.control.attr.WidgetDisplayEnhanceMarkAttr;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import org.jetbrains.annotations.NotNull;
import javax.swing.SwingConstants;
import java.awt.Color;
/** /**
* 控件主题设计器部分工具类 * 控件主题设计器部分工具类
@ -43,4 +50,31 @@ public class WidgetThemeDesignerUtils {
} }
return false; return false;
} }
/**
* 返回当前编辑模版的主题深浅
*/
public static boolean isCurrentTemplateThemeDark() {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(jTemplate)) {
TemplateTheme theme = jTemplate.getTemplateTheme();
if (theme != null) {
return theme.isDark();
}
return false;
}
throw new IllegalArgumentException("The current template is not valid");
}
/**
* 创建垂直方向顶部对齐的label
*/
@NotNull
public static UILabel createTopAlignmentLabel(String labelName) {
if(StringUtils.isEmpty(labelName)) {
return new UILabel("");
}
UILabel label = new UILabel(labelName);
label.setVerticalAlignment(SwingConstants.TOP);
return label;
}
} }

104
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/DisplayEnhanceMobileStyleDefinePane.java

@ -1,6 +1,8 @@
package com.fr.widgettheme.widget.mobile.pane; package com.fr.widgettheme.widget.mobile.pane;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle;
import com.fr.widgettheme.theme.widget.mobile.style.WidgetThemeMobileCommonExtraStyle; import com.fr.widgettheme.theme.widget.mobile.style.WidgetThemeMobileCommonExtraStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
@ -16,7 +18,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -27,8 +28,11 @@ import com.fr.invoke.Reflect;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.util.WidgetStyleComponentCombiner;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -59,9 +63,13 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
protected Color titleColor = new Color(47, 142, 241); protected Color titleColor = new Color(47, 142, 241);
protected JPanel commonPane; protected JPanel commonPane;
protected LineComboBox borderType; protected LineComboBox borderType;
protected NewColorSelectBox borderColorSelectBox;
protected UISpinner borderRadius; protected UISpinner borderRadius;
protected MobileStyleFontConfigPane fontConfigPane; protected MobileStyleFontConfigPane fontConfigPane;
protected ColorSelectBox widgetBackgroundSelectBox; protected NewColorSelectBox widgetBackgroundSelectBox;
protected UIPercentDragPane widgetBgAlphaDragPane;
protected NewColorSelectBox iconColorSelectBox;
protected MobileStyle mobileStyle; protected MobileStyle mobileStyle;
@ -94,7 +102,15 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
fontConfigPane.populateBean(style.getNewFont()); fontConfigPane.populateBean(style.getNewFont());
} }
if (style.getWidgetBackground() != null) { if (style.getWidgetBackground() != null) {
widgetBackgroundSelectBox.setSelectObject(((ColorBackground) style.getWidgetBackground()).getColor()); Color color = ((ColorBackground) style.getWidgetBackground()).getColor();
widgetBackgroundSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(color));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(color));
}
if (style.getBorderColor() != null) {
borderColorSelectBox.setSelectObject(style.getBorderColor());
}
if (style.getIconColor() != null) {
iconColorSelectBox.setSelectObject(style.getIconColor());
} }
} }
this.customBeanPane.populateBean(ob); this.customBeanPane.populateBean(ob);
@ -105,11 +121,13 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
mobileStyle = Reflect.on(mobileStyleClazz).create().get(); mobileStyle = Reflect.on(mobileStyleClazz).create().get();
WidgetThemeMobileCommonExtraStyle extraStyle = new WidgetThemeMobileCommonExtraStyle(); WidgetThemeMobileCommonExtraStyle extraStyle = new WidgetThemeMobileCommonExtraStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1); extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
extraStyle.setThemeColor(themeColorSelectBox.getSelectObject()); setThemeColor(extraStyle);
extraStyle.setBorderType(borderType.getSelectedLineStyle()); setIconColor(extraStyle);
extraStyle.setBorderRadius(borderRadius.getValue()); setBorderType(extraStyle);
extraStyle.setNewFont(fontConfigPane.updateBean()); setBorderRadius(extraStyle);
extraStyle.setWidgetBackground(ColorBackground.getInstance(widgetBackgroundSelectBox.getSelectObject())); setBorderColor(extraStyle);
setFontConfig(extraStyle);
setWidgetBackground(extraStyle);
mobileStyle.setMobileCommonExtraStyle(extraStyle); mobileStyle.setMobileCommonExtraStyle(extraStyle);
this.widget.setMobileStyle(mobileStyle); this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean(); this.customBeanPane.updateBean();
@ -127,8 +145,9 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
createCustomPane(); createCustomPane();
} }
protected void createFontPane(Color defaultFontColor) { protected void createFontPane() {
fontConfigPane = new MobileStyleFontConfigPane(defaultFontColor); Color fontColor = ColorUtils.hexToColor(WidgetThemeDesignerUtils.isCurrentTemplateThemeDark() ? WidgetThemeDisplayConstants.COLOR_CCFFFFFF_HEX : WidgetThemeDisplayConstants.COLOR_CC000000_HEX);
fontConfigPane = new MobileStyleFontConfigPane(fontColor);
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane)); settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane));
} }
@ -185,19 +204,22 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
// 圆角边框 // 圆角边框
createBorderRadiusPane(); createBorderRadiusPane();
// 字体 // 字体
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK); createFontPane();
} }
protected void createBackgroundPane() { protected void createBackgroundPane() {
widgetBackgroundSelectBox = new ColorSelectBox(NORMAL_COMBO_WIDTH); widgetBackgroundSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
widgetBgAlphaDragPane = new UIPercentDragPane();
JPanel widgetBackgroundComponent = WidgetStyleComponentCombiner.combineWidgetBackgroundComponent(widgetBackgroundSelectBox, widgetBgAlphaDragPane, WidgetThemeDisplayConstants.THEME_MOBILE_WIDGET_BACKGROUND_WIDTH);
initBackgroundColor(); initBackgroundColor();
JPanel backgroundPane = createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Background")), widgetBackgroundSelectBox); settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Background")), widgetBackgroundComponent));
settingPane.add(backgroundPane);
} }
protected void initBackgroundColor() { protected void initBackgroundColor() {
widgetBackgroundSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_TRANSPARENT_COLOR); Color widgetBackgroundColor = ColorUtils.hexToColor(WidgetThemeDesignerUtils.isCurrentTemplateThemeDark() ? WidgetThemeDisplayConstants.COLOR_000000_HEX : WidgetThemeDisplayConstants.COLOR_FFFFFF_HEX);
widgetBackgroundSelectBox.setSelectObject(widgetBackgroundColor);
widgetBgAlphaDragPane.populateBean(0);
} }
protected void createThemePane() { protected void createThemePane() {
@ -210,14 +232,17 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
protected void createBorderLinePane() { protected void createBorderLinePane() {
borderType = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY); borderType = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY);
initDefaultLineType(); borderColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
JPanel borderComponent = WidgetStyleComponentCombiner.combineWidgetBorderComponent(borderType, borderColorSelectBox);
initDefaultBorder();
borderType.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20)); borderType.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20));
// 边框线型 // 边框线型
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderType)); settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderComponent));
} }
protected void initDefaultLineType() { protected void initDefaultBorder() {
borderType.setSelectedLineStyle(Constants.LINE_THIN); borderType.setSelectedLineStyle(Constants.LINE_THIN);
borderColorSelectBox.setSelectObject(ColorUtils.hexToColor(WidgetThemeDesignerUtils.isCurrentTemplateThemeDark() ? WidgetThemeDisplayConstants.COLOR_26FFFFFF_HEX : WidgetThemeDisplayConstants.COLOR_26000000_HEX));
} }
protected void createBorderRadiusPane() { protected void createBorderRadiusPane() {
@ -245,6 +270,7 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
protected UILabel createConfigLabel(String title) { protected UILabel createConfigLabel(String title) {
UILabel label = new UILabel(title, UILabel.LEFT); UILabel label = new UILabel(title, UILabel.LEFT);
label.setVerticalAlignment(SwingConstants.TOP);
label.setPreferredSize(new Dimension(75, 20)); label.setPreferredSize(new Dimension(75, 20));
label.setBorder(new EmptyBorder(0, 15, 0, 0)); label.setBorder(new EmptyBorder(0, 15, 0, 0));
return label; return label;
@ -270,4 +296,46 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
} }
return themeColor; return themeColor;
} }
protected void createIconColorSelectBox() {
iconColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
iconColorSelectBox.setSelectObject(getCurrentTemplateThemeColor());
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Icon_Color")), iconColorSelectBox));
}
protected void setThemeColor(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(themeColorSelectBox != null) {
extraStyle.setThemeColor(themeColorSelectBox.getSelectObject());
}
}
protected void setIconColor(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(iconColorSelectBox != null) {
extraStyle.setIconColor(iconColorSelectBox.getSelectObject());
}
}
protected void setBorderType(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(borderType != null) {
extraStyle.setBorderType(borderType.getSelectedLineStyle());
}
}
protected void setBorderRadius(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(borderRadius != null) {
extraStyle.setBorderRadius(borderRadius.getValue());
}
}
protected void setBorderColor(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(borderColorSelectBox != null) {
extraStyle.setBorderColor(borderColorSelectBox.getSelectObject());
}
}
protected void setFontConfig(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(fontConfigPane != null) {
extraStyle.setNewFont(fontConfigPane.updateBean());
}
}
protected void setWidgetBackground(WidgetThemeMobileCommonExtraStyle extraStyle) {
if(widgetBackgroundSelectBox != null && widgetBgAlphaDragPane != null) {
extraStyle.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBackgroundSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
}
}
} }

11
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FileEditorMobileStyleDefinePane.java

@ -1,6 +1,7 @@
package com.fr.widgettheme.widget.mobile.pane; package com.fr.widgettheme.widget.mobile.pane;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.mobile.style.FileEditorStyle; import com.fr.widgettheme.theme.widget.mobile.style.FileEditorStyle;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -8,6 +9,8 @@ import com.fr.form.ui.mobile.MobileCommonExtraStyle;
import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.MobileStyle;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import java.awt.Color;
/** /**
* 文件属性定义面板 * 文件属性定义面板
* *
@ -28,10 +31,13 @@ public class FileEditorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDe
FileEditorStyle style = (FileEditorStyle) extraStyle; FileEditorStyle style = (FileEditorStyle) extraStyle;
customCombo.setSelectedIndex(style.isCustom() ? 1 : 0); customCombo.setSelectedIndex(style.isCustom() ? 1 : 0);
if (style.getWidgetBackground() != null) { if (style.getWidgetBackground() != null) {
widgetBackgroundSelectBox.setSelectObject(((ColorBackground) style.getWidgetBackground()).getColor()); Color widgetBackgroundColor = ((ColorBackground) style.getWidgetBackground()).getColor();
widgetBackgroundSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(widgetBackgroundColor));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(widgetBackgroundColor));
} }
borderType.setSelectedLineStyle(style.getBorderType()); borderType.setSelectedLineStyle(style.getBorderType());
borderRadius.setValue(style.getBorderRadius()); borderRadius.setValue(style.getBorderRadius());
borderColorSelectBox.setSelectObject(style.getBorderColor());
} }
this.customBeanPane.populateBean(ob); this.customBeanPane.populateBean(ob);
} }
@ -41,9 +47,10 @@ public class FileEditorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDe
mobileStyle = Reflect.on(mobileStyleClazz).create().get(); mobileStyle = Reflect.on(mobileStyleClazz).create().get();
FileEditorStyle extraStyle = new FileEditorStyle(); FileEditorStyle extraStyle = new FileEditorStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1); extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
extraStyle.setWidgetBackground(ColorBackground.getInstance(widgetBackgroundSelectBox.getSelectObject())); extraStyle.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBackgroundSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
extraStyle.setBorderType(borderType.getSelectedLineStyle()); extraStyle.setBorderType(borderType.getSelectedLineStyle());
extraStyle.setBorderRadius(borderRadius.getValue()); extraStyle.setBorderRadius(borderRadius.getValue());
extraStyle.setBorderColor(borderColorSelectBox.getSelectObject());
mobileStyle.setMobileCommonExtraStyle(extraStyle); mobileStyle.setMobileCommonExtraStyle(extraStyle);
this.widget.setMobileStyle(mobileStyle); this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean(); this.customBeanPane.updateBean();

66
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FreeButtonMobileStyleDefinePane.java

@ -1,14 +1,10 @@
package com.fr.widgettheme.widget.mobile.pane; package com.fr.widgettheme.widget.mobile.pane;
import com.fr.base.background.ColorBackground;
import com.fr.widgettheme.theme.widget.mobile.style.FreeButtonStyle;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileCommonExtraStyle;
import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.MobileStyle;
import com.fr.invoke.Reflect; import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
/** /**
@ -19,75 +15,33 @@ import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
* Created on 2023/5/25 * Created on 2023/5/25
*/ */
public class FreeButtonMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane { public class FreeButtonMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane {
private NewColorSelectBox borderColorSelectBox;
private NewColorSelectBox iconColorSelectBox;
public FreeButtonMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, Class<? extends MobileStyle> mobileStyleClazz) { public FreeButtonMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, Class<? extends MobileStyle> mobileStyleClazz) {
super(widget, customBeanPaneClass, mobileStyleClazz); super(widget, customBeanPaneClass, mobileStyleClazz);
} }
@Override
public void populateBean(MobileStyle ob) {
super.populateBean(ob);
MobileCommonExtraStyle extraStyle = ob.getMobileCommonExtraStyle();
if (extraStyle instanceof FreeButtonStyle) {
FreeButtonStyle style = (FreeButtonStyle) extraStyle;
if (style.getBorderColor() != null) {
borderColorSelectBox.setSelectObject(style.getBorderColor());
}
if (style.getIconColor() != null) {
iconColorSelectBox.setSelectObject(style.getIconColor());
}
}
}
@Override
public MobileStyle updateBean() {
mobileStyle = Reflect.on(mobileStyleClazz).create().get();
FreeButtonStyle extraStyle = new FreeButtonStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
extraStyle.setWidgetBackground(ColorBackground.getInstance(widgetBackgroundSelectBox.getSelectObject()));
extraStyle.setBorderType(borderType.getSelectedLineStyle());
extraStyle.setBorderColor(borderColorSelectBox.getSelectObject());
extraStyle.setBorderRadius(borderRadius.getValue());
extraStyle.setNewFont(fontConfigPane.updateBean());
extraStyle.setIconColor(iconColorSelectBox.getSelectObject());
mobileStyle.setMobileCommonExtraStyle(extraStyle);
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
return mobileStyle;
}
@Override @Override
protected void createUniversalPane() { protected void createUniversalPane() {
createBackgroundPane(); createBackgroundPane();
createBorderLinePane(); createBorderLinePane();
initBorderColor();
createBorderRadiusPane(); createBorderRadiusPane();
initIconColor(); createFontPane();
createFontPane(WidgetThemeDisplayConstants.DEFAULT_WHITE_COLOR);
}
private void initIconColor() {
iconColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
iconColorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_WHITE_COLOR);
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColorSelectBox));
} }
@Override @Override
protected void initDefaultLineType() { protected void initDefaultBorder() {
borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE); borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE);
} }
private void initBorderColor() {
borderColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
borderColorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderColor")), borderColorSelectBox));
}
@Override @Override
protected void initBackgroundColor() { protected void initBackgroundColor() {
widgetBackgroundSelectBox.setSelectObject(getCurrentTemplateThemeColor()); widgetBackgroundSelectBox.setSelectObject(getCurrentTemplateThemeColor());
widgetBgAlphaDragPane.populateBean(1);
}
@Override
protected void createFontPane() {
fontConfigPane = new MobileStyleFontConfigPane(ColorUtils.hexToColor(WidgetThemeDisplayConstants.COLOR_FFFFFF_HEX));
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane));
} }
} }

36
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/IconColorMobileStyleDefinePane.java

@ -0,0 +1,36 @@
package com.fr.widgettheme.widget.mobile.pane;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
/**
* 带有图标颜色的移动端控件通用配置面板
*
* @author obo
* @since 11.0
* Created on 2024/1/25
*/
public class IconColorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane{
public IconColorMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, Class<? extends MobileStyle> mobileStyleClazz) {
super(widget, customBeanPaneClass, mobileStyleClazz);
}
@Override
protected void createUniversalPane() {
// 主题色
createThemePane();
// 组件背景
createBackgroundPane();
// 边框线型
createBorderLinePane();
// 圆角边框
createBorderRadiusPane();
//图标颜色
createIconColorSelectBox();
// 字体
createFontPane();
}
}

48
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/LabelMobileStyleDefinePane.java

@ -1,14 +1,8 @@
package com.fr.widgettheme.widget.mobile.pane; package com.fr.widgettheme.widget.mobile.pane;
import com.fr.base.background.ColorBackground;
import com.fr.widgettheme.theme.widget.mobile.style.LabelIconSettingStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileCommonExtraStyle;
import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.MobileStyle;
import com.fr.invoke.Reflect;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
/** /**
@ -19,59 +13,21 @@ import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
* Created on 2023/5/15 * Created on 2023/5/15
*/ */
public class LabelMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane { public class LabelMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane {
private NewColorSelectBox borderColorSelectBox;
public LabelMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, public LabelMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
Class<? extends MobileStyle> mobileStyleClazz) { Class<? extends MobileStyle> mobileStyleClazz) {
super(widget, customBeanPaneClass, mobileStyleClazz); super(widget, customBeanPaneClass, mobileStyleClazz);
} }
@Override
public void populateBean(MobileStyle ob) {
super.populateBean(ob);
MobileCommonExtraStyle extraStyle = ob.getMobileCommonExtraStyle();
if (extraStyle instanceof LabelIconSettingStyle) {
LabelIconSettingStyle style = (LabelIconSettingStyle) extraStyle;
if (style.getBorderColor() != null) {
borderColorSelectBox.setSelectObject(style.getBorderColor());
}
}
}
@Override
public MobileStyle updateBean() {
mobileStyle = Reflect.on(mobileStyleClazz).create().get();
LabelIconSettingStyle extraStyle = new LabelIconSettingStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
extraStyle.setWidgetBackground(ColorBackground.getInstance(widgetBackgroundSelectBox.getSelectObject()));
extraStyle.setBorderType(borderType.getSelectedLineStyle());
extraStyle.setBorderColor(borderColorSelectBox.getSelectObject());
extraStyle.setBorderRadius(borderRadius.getValue());
extraStyle.setNewFont(fontConfigPane.updateBean());
mobileStyle.setMobileCommonExtraStyle(extraStyle);
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
return mobileStyle;
}
@Override @Override
protected void createUniversalPane() { protected void createUniversalPane() {
createBackgroundPane(); createBackgroundPane();
createBorderLinePane(); createBorderLinePane();
initBorderColor();
createBorderRadiusPane(); createBorderRadiusPane();
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK); createFontPane();
}
private void initBorderColor() {
borderColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
borderColorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_TRANSPARENT_COLOR);
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderColor")), borderColorSelectBox));
} }
@Override @Override
protected void initDefaultLineType() { protected void initDefaultBorder() {
borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE); borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE);
} }
} }

33
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/TextAreaMobileStyleDefinePane.java

@ -0,0 +1,33 @@
package com.fr.widgettheme.widget.mobile.pane;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
/**
* 文本域控件移动端配置面板
*
* @author obo
* @since 11.0
* Created on 2024/1/25
*/
public class TextAreaMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefinePane{
public TextAreaMobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass, Class<? extends MobileStyle> mobileStyleClazz) {
super(widget, customBeanPaneClass, mobileStyleClazz);
}
@Override
protected void createUniversalPane() {
// 主题色
createThemePane();
// 组件背景
createBackgroundPane();
// 边框线型
createBorderLinePane();
// 圆角边框
createBorderRadiusPane();
// 字体
createFontPane();
}
}

16
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/provider/DisplayEnhanceMobileStyleFactory.java

@ -1,11 +1,11 @@
package com.fr.widgettheme.widget.mobile.provider; package com.fr.widgettheme.widget.mobile.provider;
import com.fr.form.ui.TextArea;
import com.fr.widgettheme.theme.widget.mobile.style.WidgetThemeMobileCommonExtraStyle;
import com.fr.widgettheme.widget.mobile.pane.FileEditorMobileStyleDefinePane; import com.fr.widgettheme.widget.mobile.pane.FileEditorMobileStyleDefinePane;
import com.fr.widgettheme.widget.mobile.pane.FreeButtonMobileStyleDefinePane; import com.fr.widgettheme.widget.mobile.pane.FreeButtonMobileStyleDefinePane;
import com.fr.widgettheme.widget.mobile.pane.LabelMobileStyleDefinePane; import com.fr.widgettheme.widget.mobile.pane.LabelMobileStyleDefinePane;
import com.fr.widgettheme.theme.widget.mobile.style.FileEditorStyle; import com.fr.widgettheme.theme.widget.mobile.style.FileEditorStyle;
import com.fr.widgettheme.theme.widget.mobile.style.FreeButtonStyle;
import com.fr.widgettheme.theme.widget.mobile.style.LabelIconSettingStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.FreeButton; import com.fr.form.ui.FreeButton;
@ -14,6 +14,7 @@ import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileCommonExtraStyle; import com.fr.form.ui.mobile.MobileCommonExtraStyle;
import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.MobileStyle;
import com.fr.widgettheme.widget.mobile.pane.TextAreaMobileStyleDefinePane;
/** /**
* 样式创建工厂 * 样式创建工厂
@ -40,6 +41,9 @@ public class DisplayEnhanceMobileStyleFactory {
if (widget instanceof FreeButton) { if (widget instanceof FreeButton) {
return new FreeButtonMobileStyleDefinePane(widget, customDefinePane, mobileStyle); return new FreeButtonMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
} }
if (widget instanceof TextArea) {
return new TextAreaMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
}
return null; return null;
} }
@ -50,16 +54,10 @@ public class DisplayEnhanceMobileStyleFactory {
* @return * @return
*/ */
public static Class<? extends MobileCommonExtraStyle> classForWidgetCommonExtraStyle(Widget widget) { public static Class<? extends MobileCommonExtraStyle> classForWidgetCommonExtraStyle(Widget widget) {
if (widget instanceof Label) {
return LabelIconSettingStyle.class;
}
if (widget instanceof MultiFileEditor) { if (widget instanceof MultiFileEditor) {
return FileEditorStyle.class; return FileEditorStyle.class;
} }
if (widget instanceof FreeButton) { return WidgetThemeMobileCommonExtraStyle.class;
return FreeButtonStyle.class;
}
return null;
} }
} }

79
designer-base/src/main/java/com/fr/widgettheme/widget/mobile/provider/WidgetThemeMobileStyleDefinePaneCreator.java

@ -1,11 +1,19 @@
package com.fr.widgettheme.widget.mobile.provider; package com.fr.widgettheme.widget.mobile.provider;
import com.fr.base.io.IOFile; import com.fr.form.ui.ComboBox;
import com.fr.form.ui.ComboCheckBox;
import com.fr.form.ui.DateEditor;
import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.Password;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.widgettheme.utils.WidgetThemeServerUtils;
import com.fr.widgettheme.widget.mobile.pane.DisplayEnhanceMobileStyleDefinePane; import com.fr.widgettheme.widget.mobile.pane.DisplayEnhanceMobileStyleDefinePane;
import com.fr.widgettheme.theme.widget.mobile.style.WidgetThemeMobileCommonExtraStyle; import com.fr.widgettheme.theme.widget.mobile.style.WidgetThemeMobileCommonExtraStyle;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.FreeButton; import com.fr.form.ui.FreeButton;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
@ -14,9 +22,12 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileCommonExtraStyle; import com.fr.form.ui.mobile.MobileCommonExtraStyle;
import com.fr.form.ui.mobile.MobileStyle; import com.fr.form.ui.mobile.MobileStyle;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.widgettheme.control.attr.WidgetDisplayEnhanceMarkAttr; import com.fr.widgettheme.widget.mobile.pane.IconColorMobileStyleDefinePane;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.Set;
/** /**
* 控件主题移动端样式窗口创建类 * 控件主题移动端样式窗口创建类
* *
@ -29,6 +40,29 @@ public class WidgetThemeMobileStyleDefinePaneCreator {
private WidgetThemeMobileStyleDefinePaneCreator() { private WidgetThemeMobileStyleDefinePaneCreator() {
} }
/**
* 需要特殊处理的控件集合
*/
private static final Set<Class<? extends Widget>> SPECIAL_WIDGET_SET = new HashSet<>();
/**
* 带有图标颜色的控件集合
*/
private static final Set<Class<? extends Widget>> ICON_WIDGET_SET = new HashSet<>();
static {
SPECIAL_WIDGET_SET.add(FreeButton.class);
SPECIAL_WIDGET_SET.add(Label.class);
SPECIAL_WIDGET_SET.add(MultiFileEditor.class);
SPECIAL_WIDGET_SET.add(TextArea.class);
ICON_WIDGET_SET.add(TextEditor.class);
ICON_WIDGET_SET.add(NumberEditor.class);
ICON_WIDGET_SET.add(Password.class);
ICON_WIDGET_SET.add(DateEditor.class);
ICON_WIDGET_SET.add(ComboBox.class);
ICON_WIDGET_SET.add(ComboCheckBox.class);
ICON_WIDGET_SET.add(TreeComboBoxEditor.class);
ICON_WIDGET_SET.add(TreeEditor.class);
}
/** /**
* 创建移动端控件样式属性窗口 * 创建移动端控件样式属性窗口
* *
@ -39,16 +73,13 @@ public class WidgetThemeMobileStyleDefinePaneCreator {
*/ */
public static BasicBeanPane<MobileStyle> createBaseBeanPane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customDefinePane, Class<? extends MobileStyle> mobileStyle) { public static BasicBeanPane<MobileStyle> createBaseBeanPane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customDefinePane, Class<? extends MobileStyle> mobileStyle) {
try { try {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (WidgetThemeDesignerUtils.enableWidgetEnhance()) {
if (JTemplate.isValid(jTemplate)) { if (isSpecialWidget(widget)) {
IOFile ioFile = (IOFile) jTemplate.getTarget(); return DisplayEnhanceMobileStyleFactory.createWidgetMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
WidgetDisplayEnhanceMarkAttr mark = ioFile.getAttrMark(WidgetDisplayEnhanceMarkAttr.XML_TAG); } else if (isIconWidget(widget)) {
if (mark != null && mark.isWidgetEnhance()) { return new IconColorMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
if (commonWidget(widget)) { } else {
return new DisplayEnhanceMobileStyleDefinePane(widget, customDefinePane, mobileStyle); return new DisplayEnhanceMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
} else {
return DisplayEnhanceMobileStyleFactory.createWidgetMobileStyleDefinePane(widget, customDefinePane, mobileStyle);
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -64,10 +95,10 @@ public class WidgetThemeMobileStyleDefinePaneCreator {
* @return class * @return class
*/ */
public static @NotNull Class<? extends MobileCommonExtraStyle> classForCommonExtraStyle(Widget widget) { public static @NotNull Class<? extends MobileCommonExtraStyle> classForCommonExtraStyle(Widget widget) {
if (commonWidget(widget)) { if (isSpecialWidget(widget)) {
return WidgetThemeMobileCommonExtraStyle.class;
} else {
return DisplayEnhanceMobileStyleFactory.classForWidgetCommonExtraStyle(widget); return DisplayEnhanceMobileStyleFactory.classForWidgetCommonExtraStyle(widget);
} else {
return WidgetThemeMobileCommonExtraStyle.class;
} }
} }
@ -78,7 +109,17 @@ public class WidgetThemeMobileStyleDefinePaneCreator {
* @param widget 控件 * @param widget 控件
* @return / * @return /
*/ */
private static boolean commonWidget(Widget widget) { private static boolean isSpecialWidget(Widget widget) {
return !((widget instanceof FreeButton) || (widget instanceof Label) || (widget instanceof MultiFileEditor)); return SPECIAL_WIDGET_SET.contains(widget.getClass());
}
/**
* 是否为带图标的控件
*
* @param widget 控件
* @return /
*/
private static boolean isIconWidget(Widget widget) {
return ICON_WIDGET_SET.contains(widget.getClass()) || WidgetThemeServerUtils.isNewComboBoxTreeEditor(widget);
} }
} }

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

43
designer-base/src/test/java/com/fr/design/jxbrowser/JxUIPaneTest.java

@ -2,6 +2,7 @@ package com.fr.design.jxbrowser;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.teamdev.jxbrowser.js.JsAccessible; import com.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.js.JsObject;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFrame; import javax.swing.JFrame;
@ -10,6 +11,7 @@ import javax.swing.JPanel;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.util.Optional;
public class JxUIPaneTest { public class JxUIPaneTest {
@ -30,16 +32,49 @@ public class JxUIPaneTest {
JPanel panel = new JPanel(new FlowLayout()); JPanel panel = new JPanel(new FlowLayout());
contentPane.add(panel, BorderLayout.SOUTH); contentPane.add(panel, BorderLayout.SOUTH);
testJxUIPaneUpdate(panel, pane);
testExecuteJS1(panel, pane);
testExecuteJS2(panel, pane);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
private static void testJxUIPaneUpdate(JPanel container, JxUIPane<Model> pane) {
JButton button = new JButton("点击我可以看到Swing的弹框,输出填写的信息"); JButton button = new JButton("点击我可以看到Swing的弹框,输出填写的信息");
panel.add(button);
button.addActionListener(e -> { button.addActionListener(e -> {
Model returnValue = pane.update(); Model returnValue = pane.update();
if (returnValue != null) { if (returnValue != null) {
JOptionPane.showMessageDialog(frame, String.format("姓名为:%s,年龄为:%d", returnValue.getName(), returnValue.getAge())); JOptionPane.showMessageDialog(container.getRootPane(), String.format("姓名为:%s,年龄为:%d", returnValue.getName(), returnValue.getAge()));
} }
}); });
frame.setVisible(true); container.add(button);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
private static void testExecuteJS1(JPanel container, JxUIPane<Model> pane) {
JButton button = new JButton("执行回显js对象内容");
button.addActionListener(e -> {
pane.executeJavaScript("var pagesize={\"page\":1,\"size\":10};");
Optional<JsObject> value = pane.executeJS("pagesize");
value.ifPresent(v -> JOptionPane.showMessageDialog(container.getRootPane(),
String.format("page为:%s,年龄为:%s", v.property("page").get(), v.property("size").get())));
});
container.add(button);
}
private static void testExecuteJS2(JPanel container, JxUIPane<Model> pane) {
JButton button = new JButton("执行回显数字内容");
button.addActionListener(e -> {
pane.executeJavaScript("var tom = {\"age\":18};");
Optional<Double> value = pane.executeJS("tom.age");
JOptionPane.showMessageDialog(container.getRootPane(),
String.format("var tom = {\"age\":18}; age:%s", value.get()));
});
container.add(button);
} }
@JsAccessible @JsAccessible

4
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -6,6 +6,7 @@ import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.javascript.ChartEmailPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane;
@ -24,7 +25,6 @@ import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
@ -149,7 +149,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
} }
private void refreshNameableCreator() { private void refreshNameableCreator() {
if (ChartEditContext.duchampMode()) { if (DesignModeContext.isDuchampMode()) {
return; return;
} }
HashMap paneMap = getHyperlinkMap(); HashMap paneMap = getHyperlinkMap();

BIN
designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_zh.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
designer-chart/src/main/resources/com/fr/design/images/emptydata/emptydata_zh_TW.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

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

@ -1,9 +1,17 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.base.background.ColorBackground;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.utils.DesignUtils;
import com.fr.general.IOUtils;
import com.fr.util.ColorUtils;
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.ThemeTextStyle; import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
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;
@ -11,7 +19,6 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FRFontPane; import com.fr.design.gui.style.FRFontPane;
@ -26,10 +33,10 @@ import com.fr.form.ui.Widget;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.widgettheme.theme.panel.ButtonStyleDefinedPane; import com.fr.widgettheme.theme.panel.ButtonStyleDefinedPane;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator; import com.fr.widgettheme.util.WidgetStyleComponentCombiner;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -54,12 +61,12 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
protected JPanel customPane; protected JPanel customPane;
// 主题色 // 主题色
protected NewColorSelectBox colorSelectBox; protected NewColorSelectBox colorSelectBox;
// 风格1
protected UIRadioButton style1;
// 风格2
protected UIRadioButton style2;
// 边框线型 // 边框线型
protected LineComboBox lineComboBox; protected LineComboBox lineComboBox;
/**
* 边框颜色
*/
protected NewColorSelectBox borderColorSelectBox;
// 圆角边框 // 圆角边框
protected UIBoundSpinner borderRadiusSpinner; protected UIBoundSpinner borderRadiusSpinner;
// 字体详细设置 // 字体详细设置
@ -79,6 +86,33 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
*/ */
protected UIColorButton fontColorButton; protected UIColorButton fontColorButton;
/**
* 字体名选择器
*/
protected UIComboBox fontNameSelectBox;
/**
* 字体粗体配置
*/
protected UIToggleButton bold;
/**
* 字体斜体配置
*/
protected UIToggleButton italic;
/**
* 控件背景颜色配置面板
*/
protected NewColorSelectBox widgetBgColorSelectBox;
/**
* 控件背景透明度配置面板
*/
protected UIPercentDragPane widgetBgAlphaDragPane;
/**
* 控件图标颜色
*/
protected NewColorSelectBox iconColorSelectBox;
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<>();
public BaseStyleSettingPane(List<StyleSetting> styleSettingList) { public BaseStyleSettingPane(List<StyleSetting> styleSettingList) {
@ -97,34 +131,29 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
protected void initStyleEditor() { protected void initStyleEditor() {
initStyle(); colorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, false);
colorSelectBox = new NewColorSelectBox(160, true); initBorderPane();
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY);
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
buttonStyleDefinedPane = new ButtonStyleDefinedPane(); buttonStyleDefinedPane = new ButtonStyleDefinedPane();
selectBgColorBox = new NewColorSelectBox(160, true); selectBgColorBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
iconColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
fontNameSelectBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontSizePane = new FontSizeComboPane(); fontSizePane = new FontSizeComboPane();
fontColorButton = new UIColorButton(); fontColorButton = new UIColorButton();
paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); bold = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
widgetBgColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
widgetBgAlphaDragPane = new UIPercentDragPane();
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.TEXT_STYLE, ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)); paneMap.put(StyleSetting.LINE_COLOR, borderColorSelectBox);
paneMap.put(StyleSetting.TEXT_STYLE, WidgetStyleComponentCombiner.combineTextStyleComponent(fontNameSelectBox, fontSizePane, fontColorButton, italic, bold));
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); paneMap.put(StyleSetting.SELECT_COLOR, selectBgColorBox);
} paneMap.put(StyleSetting.WIDGET_BACKGROUND, WidgetStyleComponentCombiner.combineWidgetBackgroundComponent(widgetBgColorSelectBox, widgetBgAlphaDragPane, WidgetThemeDisplayConstants.THEME_PC_WIDGET_BACKGROUND_WIDTH));
paneMap.put(StyleSetting.ICON_COLOR, iconColorSelectBox);
/**
* 初始化style1和style2
*/
private void initStyle() {
style1 = new UIRadioButton(Toolkit.i18nText("Fine-Design_Widget_Theme_Style_1"));
style2 = new UIRadioButton(Toolkit.i18nText("Fine-Design_Widget_Theme_Style_2"));
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(style1);
buttonGroup.add(style2);
} }
protected JPanel createHeadPane() { protected JPanel createHeadPane() {
@ -143,14 +172,6 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
return headPane; return headPane;
} }
protected JPanel createStyleTypePane() {
// 容纳风格1和风格2的panel
JPanel stylePane = new JPanel(FRGUIPaneFactory.createBoxFlowLayout());
stylePane.add(style1);
stylePane.add(style2);
return stylePane;
}
protected JPanel createCustomPane() { protected JPanel createCustomPane() {
int size = styleSettingList.size(); int size = styleSettingList.size();
@ -212,92 +233,104 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
} }
private void setThemedStyle(ThemedWidgetStyle widgetStyle) { private void setThemedStyle(ThemedWidgetStyle widgetStyle) {
setColorSelectBox(widgetStyle); setColorSelectBox(widgetStyle.getThemeColor());
setStyle(widgetStyle); setLineComboBox(widgetStyle.getBorderStyle().getLineType());
setLineComboBox(widgetStyle); setBorderRadiusSpinner(widgetStyle.getBorderStyle().getRadius());
setBorderRadiusSpinner(widgetStyle); setTextStylePane(widgetStyle.getTextStyle());
setTextStylePane(widgetStyle); setFrFontPane(widgetStyle.getFontStyle().getFont());
setFrFontPane(widgetStyle); setButtonStyleDefinedPane(widgetStyle.getButtonBackgroundStyle());
setButtonStyleDefinedPane(widgetStyle); setSelectBgColor(widgetStyle.getSelectBackgroundColor());
setSelectBgColor(widgetStyle); setWidgetBackground(widgetStyle.getWidgetBackground());
setBorderColor(widgetStyle.getBorderStyle().getBorderColor());
setIconColor(widgetStyle.getIconColor());
} }
private void setColorSelectBox(ThemedWidgetStyle widgetStyle) { private void setColorSelectBox(Color themeColor) {
if (colorSelectBox != null) { if (colorSelectBox != null) {
colorSelectBox.setSelectObject(widgetStyle.getThemeColor()); colorSelectBox.setSelectObject(themeColor);
}
}
private void setStyle(ThemedWidgetStyle widgetStyle) {
if (widgetStyle.getStyleType() == ThemedWidgetStyle.DEFAULT_STYLE) {
if (style1 != null) {
style1.setSelected(true);
}
} else {
if (style2 != null) {
style2.setSelected(true);
}
} }
} }
private void setLineComboBox(ThemedWidgetStyle widgetStyle) { private void setLineComboBox(int lineType) {
if (lineComboBox != null) { if (lineComboBox != null) {
lineComboBox.setSelectedLineStyle(widgetStyle.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(lineType);
} }
} }
private void setBorderRadiusSpinner(ThemedWidgetStyle widgetStyle) { private void setBorderRadiusSpinner(double radius) {
if (borderRadiusSpinner != null) { if (borderRadiusSpinner != null) {
borderRadiusSpinner.setValue(widgetStyle.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(radius);
} }
} }
private void setTextStylePane(ThemedWidgetStyle widgetStyle) { private void setTextStylePane(ThemeTextStyle textStyle) {
ThemeTextStyle textStyle = widgetStyle.getTextStyle(); if (fontSizePane != null) {
this.fontSizePane.setValue(textStyle.getFontSize()); this.fontSizePane.setValue(textStyle.getFontSize());
this.fontColorButton.setColor(textStyle.getFontColor()); }
if (fontColorButton != null) {
this.fontColorButton.setColor(textStyle.getFontColor());
}
if (bold != null) {
this.bold.setSelected(textStyle.isBold());
}
if (italic != null) {
this.italic.setSelected(textStyle.isItalic());
}
if (fontNameSelectBox != null) {
this.fontNameSelectBox.setSelectedItem(textStyle.getName());
}
} }
private void setFrFontPane(ThemedWidgetStyle widgetStyle) { private void setFrFontPane(FRFont font) {
if (frFontPane != null) { if (frFontPane != null) {
frFontPane.populateBean(widgetStyle.getFontStyle().getFont()); frFontPane.populateBean(font);
} }
} }
private void setButtonStyleDefinedPane(ThemedWidgetStyle widgetStyle) { private void setButtonStyleDefinedPane(ButtonBackgroundStyle backgroundStyle) {
if (buttonStyleDefinedPane != null) { if (buttonStyleDefinedPane != null) {
buttonStyleDefinedPane.populate(ButtonBackground.create(widgetStyle.getButtonBackgroundStyle())); buttonStyleDefinedPane.populate(ButtonBackground.create(backgroundStyle));
} }
} }
private void setDefaultStyle() { private void setDefaultStyle() {
if (colorSelectBox != null) { setColorSelectBox(ThemedWidgetStyle.DEFAULT_COLOR);
colorSelectBox.setSelectObject(ThemedWidgetStyle.DEFAULT_COLOR); setLineComboBox(BorderStyle.DEFAULT_LINE_TYPE);
} setBorderRadiusSpinner(BorderStyle.DEFAULT_BORDER_RADIUS);
if (style1 != null) { setTextStylePane(ThemeTextStyle.DEFAULT_WIDGET_STYLE);
style1.setSelected(true); setFrFontPane(FRFont.getInstance());
} setSelectBgColor(WidgetThemeDisplayConstants.DEFAULT_TRANSPARENT_COLOR);
if (lineComboBox != null) { setWidgetBackground(WidgetThemeDisplayConstants.DEFAULT_COLOR_BACKGROUND);
lineComboBox.setSelectedLineStyle(BorderStyle.DEFAULT_LINE_TYPE); setBorderColor(BorderStyle.DEFAULT_WIDGET_BORDER_COLOR);
} setIconColor(Color.BLACK);
if (borderRadiusSpinner != null) { }
borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS);
} private void setSelectBgColor(Color selectBgColor) {
if (fontSizePane != null) { if (selectBgColorBox != null) {
fontSizePane.setValue(ThemeTextStyle.DEFAULT_FONT_SIZE); selectBgColorBox.setSelectObject(selectBgColor);
} }
if (fontColorButton != null) { }
fontColorButton.setColor(Color.BLACK);
private void setWidgetBackground(ColorBackground background) {
if (widgetBgColorSelectBox != null) {
widgetBgColorSelectBox.setSelectObject(background.getColor());
} }
if (frFontPane != null) { if (widgetBgAlphaDragPane != null) {
frFontPane.populateBean(FRFont.getInstance()); //0-255,需要转化为
double alpha = ColorUtils.roundColorAlphaDouble(background.getColor());
widgetBgAlphaDragPane.populateBean(alpha);
} }
if (selectBgColorBox != null) { }
selectBgColorBox.setSelectObject(null);
private void setBorderColor(Color borderColor) {
if(borderColorSelectBox != null) {
borderColorSelectBox.setSelectObject(borderColor);
} }
} }
private void setSelectBgColor(ThemedWidgetStyle widgetStyle) { private void setIconColor(Color iconColor) {
if(selectBgColorBox != null) { if(iconColorSelectBox != null) {
selectBgColorBox.setSelectObject(widgetStyle.getSelectBackgroundColor()); iconColorSelectBox.setSelectObject(iconColor);
} }
} }
@ -305,13 +338,15 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
* 初始化枚举和UILabel对应的map * 初始化枚举和UILabel对应的map
*/ */
private void initLabelMap() { private void initLabelMap() {
labelMap.put(StyleSetting.THEME_COLOR, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color"))); for (StyleSetting setting : StyleSetting.values()) {
labelMap.put(StyleSetting.TEXT_STYLE, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style"))); labelMap.put(setting, WidgetThemeDesignerUtils.createTopAlignmentLabel(Toolkit.i18nText(setting.getLabelI18nKey())));
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"))); private void initBorderPane() {
labelMap.put(StyleSetting.BTN_BACKGROUND, new UILabel(Toolkit.i18nText("Fine-Design_Theme_Widget_Background"))); lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.BORDER_LINE_STYLE_ARRAY);
labelMap.put(StyleSetting.SELECT_COLOR, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box"))); borderColorSelectBox = new NewColorSelectBox(WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH, true);
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
lineComboBox.addItemListener(e -> borderColorSelectBox.setVisible(!Integer.valueOf(0).equals(e.getItem())));
} }
} }

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

@ -1,11 +1,15 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.style.FontStyle; import com.fr.widgettheme.theme.widget.style.FontStyle;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.widgettheme.theme.widget.theme.LabelTheme; import com.fr.widgettheme.theme.widget.theme.LabelTheme;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import java.awt.Color;
import java.util.Collections; import java.util.Collections;
/** /**
@ -37,7 +41,7 @@ public class LabelSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
private LabelTheme initLabelTheme(T t) { private LabelTheme initLabelTheme(T t) {
LabelTheme widgetTheme = (LabelTheme) t.getWidgetTheme(); LabelTheme widgetTheme = (LabelTheme) t.getWidgetTheme();
if (widgetTheme == null) { if (widgetTheme == null) {
widgetTheme = new LabelTheme(); widgetTheme = initLabelTheme();
Label label = (Label) t; Label label = (Label) t;
if (!label.getDefaultFont().equals(label.getFont())) { if (!label.getDefaultFont().equals(label.getFont())) {
widgetTheme.setFollowTheme(false); widgetTheme.setFollowTheme(false);
@ -48,6 +52,15 @@ public class LabelSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
return widgetTheme; return widgetTheme;
} }
private LabelTheme initLabelTheme() {
LabelTheme labelTheme = new LabelTheme();
Color fontColor = WidgetThemeDesignerUtils.isCurrentTemplateThemeDark() ?
ColorUtils.hexToColor(WidgetThemeDisplayConstants.COLOR_FFFFFF_HEX) :
ColorUtils.hexToColor(WidgetThemeDisplayConstants.COLOR_091E40_HEX);
labelTheme.getFontStyle().setFont(FRFont.getInstance().applyForeground(fontColor));
return labelTheme;
}
@Override @Override
public void updateBean(T t) { public void updateBean(T t) {
LabelTheme widgetTheme = initLabelTheme(t); LabelTheme widgetTheme = initLabelTheme(t);

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

@ -21,7 +21,7 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
public ParaButtonSettingPane() { public ParaButtonSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.TEXT_STYLE StyleSetting.TEXT_STYLE
)); ));
} }
@ -36,6 +36,8 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
ThemeTextStyle textStyle = ((ParaButtonTheme) buttonTheme).getTextStyle(); ThemeTextStyle textStyle = ((ParaButtonTheme) buttonTheme).getTextStyle();
fontSizePane.setValue(textStyle.getFontSize()); fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor()); fontColorButton.setColor(textStyle.getFontColor());
bold.setSelected(textStyle.isBold());
italic.setSelected(textStyle.isItalic());
} }
@Override @Override
@ -44,6 +46,8 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
ThemeTextStyle textStyle = new ThemeTextStyle(); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue()); textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor()); textStyle.setFontColor(fontColorButton.getColor());
textStyle.setBold(bold.isSelected());
textStyle.setItalic(italic.isSelected());
paraButtonTheme.setTextStyle(textStyle); paraButtonTheme.setTextStyle(textStyle);
} }

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

@ -9,7 +9,6 @@ import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* 设计器控件属性的高级设置增加主题样式设置项包括 * 设计器控件属性的高级设置增加主题样式设置项包括
* 文本控件/数字控件/密码控件/文本域控件/下拉框控件/下拉复选框控件/下拉树控件/日期控件 * 文本控件/数字控件/密码控件/文本域控件/下拉框控件/下拉复选框控件/下拉树控件/日期控件
@ -23,8 +22,9 @@ public class ParaEditorSettingPane<T extends Widget> extends EditorSettingPane<T
public ParaEditorSettingPane() { public ParaEditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS, StyleSetting.BORDER_RADIUS,
StyleSetting.TEXT_STYLE StyleSetting.TEXT_STYLE
)); ));
@ -39,6 +39,8 @@ public class ParaEditorSettingPane<T extends Widget> extends EditorSettingPane<T
ThemeTextStyle textStyle = ((ParaEditorTheme) widgetTheme).getTextStyle(); ThemeTextStyle textStyle = ((ParaEditorTheme) widgetTheme).getTextStyle();
fontSizePane.setValue(textStyle.getFontSize()); fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor()); fontColorButton.setColor(textStyle.getFontColor());
bold.setSelected(textStyle.isBold());
italic.setSelected(textStyle.isItalic());
} }
@Override @Override
@ -47,6 +49,8 @@ public class ParaEditorSettingPane<T extends Widget> extends EditorSettingPane<T
ThemeTextStyle textStyle = new ThemeTextStyle(); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue()); textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor()); textStyle.setFontColor(fontColorButton.getColor());
textStyle.setBold(bold.isSelected());
textStyle.setItalic(italic.isSelected());
paraEditorTheme.setTextStyle(textStyle); paraEditorTheme.setTextStyle(textStyle);
} }

1
designer-form/src/main/java/com/fr/design/widgettheme/ParaNormalButtonSettingPane.java

@ -23,6 +23,7 @@ public class ParaNormalButtonSettingPane<T extends Widget> extends NormalButtonS
super(Arrays.asList( super(Arrays.asList(
StyleSetting.BTN_BACKGROUND, StyleSetting.BTN_BACKGROUND,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS, StyleSetting.BORDER_RADIUS,
StyleSetting.FONT StyleSetting.FONT
)); ));

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

@ -16,12 +16,14 @@ public class ParaSelectEditorSettingPane<T extends Widget> extends ParaEditorSet
public ParaSelectEditorSettingPane() { public ParaSelectEditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.SELECT_COLOR, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.STYLE_TYPE,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS, StyleSetting.BORDER_RADIUS,
StyleSetting.TEXT_STYLE StyleSetting.ICON_COLOR,
)); StyleSetting.TEXT_STYLE,
StyleSetting.SELECT_COLOR
));
} }
@Override @Override

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

@ -21,7 +21,7 @@ public class ParaTreeEditorSettingPane<T extends TreeEditor> extends TreeEditorS
public ParaTreeEditorSettingPane() { public ParaTreeEditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.TEXT_STYLE StyleSetting.TEXT_STYLE
)); ));
} }

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

@ -12,34 +12,56 @@ public enum StyleSetting {
/** /**
* 主题颜色 * 主题颜色
*/ */
THEME_COLOR, THEME_COLOR("Fine-Design_Widget_Theme_Color"),
/** /**
* 风格 * 线型
*/ */
STYLE_TYPE, LINE_TYPE("Fine-Design_Widget_Theme_Border_Line"),
/** /**
* 线型 * 线型颜色
*/ */
LINE_TYPE, LINE_COLOR(""),
/** /**
* 边框圆角 * 边框圆角
*/ */
BORDER_RADIUS, BORDER_RADIUS("Fine-Design_Widget_Theme_Border_Radius"),
/** /**
* 文本样式 * 文本样式
*/ */
TEXT_STYLE, TEXT_STYLE("Fine-Design_Widget_Theme_Text_Style"),
/** /**
* 字体 * 字体
*/ */
FONT, FONT("Fine-Design_Widget_Theme_Font"),
/** /**
* 按钮背景 * 按钮背景
*/ */
BTN_BACKGROUND, BTN_BACKGROUND("Fine-Design_Theme_Widget_Background"),
/** /**
* 自定义下拉框颜色 * 自定义下拉框颜色
*/ */
SELECT_COLOR SELECT_COLOR("Fine-Design_Widget_Background_Select_Box"),
/**
* 控件背景
*/
WIDGET_BACKGROUND("Fine-Design_Widget_Theme_Widget_Background"),
/**
* 图标颜色
*/
ICON_COLOR("Fine-Design_Widget_Theme_Icon_Color");
/**
* label标签i18n key
*/
private final String labelI18nKey;
StyleSetting(String labelI18nKey) {
this.labelI18nKey = labelI18nKey;
}
public String getLabelI18nKey() {
return labelI18nKey;
}
} }

15
designer-form/src/main/java/com/fr/design/widgettheme/common/ButtonSettingPane.java

@ -3,10 +3,11 @@ package com.fr.design.widgettheme.common;
import com.fr.design.widgettheme.StyleSetting; import com.fr.design.widgettheme.StyleSetting;
import com.fr.design.widgettheme.BaseStyleSettingPane; import com.fr.design.widgettheme.BaseStyleSettingPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme; import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.awt.Color;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -23,7 +24,7 @@ public class ButtonSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
public ButtonSettingPane() { public ButtonSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE StyleSetting.WIDGET_BACKGROUND
)); ));
} }
@ -65,11 +66,9 @@ public class ButtonSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
} else { } else {
styleSettingHead.setSelectedIndex(1); styleSettingHead.setSelectedIndex(1);
colorSelectBox.setSelectObject(buttonTheme.getThemeColor()); colorSelectBox.setSelectObject(buttonTheme.getThemeColor());
if (buttonTheme.getStyleType() == WidgetThemeDisplayConstants.STYLE_1) { Color widgetBgColor = buttonTheme.getWidgetBackground().getColor();
style1.setSelected(true); widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(widgetBgColor));
} else { widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(widgetBgColor));
style2.setSelected(true);
}
assignFontSizePane(buttonTheme); assignFontSizePane(buttonTheme);
} }
switchCard(); switchCard();
@ -89,7 +88,7 @@ public class ButtonSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
protected void updateButtonStyleBean(ButtonTheme buttonTheme) { protected void updateButtonStyleBean(ButtonTheme buttonTheme) {
buttonTheme.setThemeColor(colorSelectBox.getSelectObject()); buttonTheme.setThemeColor(colorSelectBox.getSelectObject());
buttonTheme.setStyleType(style1.isSelected() ? WidgetThemeDisplayConstants.STYLE_1 : WidgetThemeDisplayConstants.STYLE_2); buttonTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
assignFontSizeStyle(buttonTheme); assignFontSizeStyle(buttonTheme);
switchCard(); switchCard();
} }

20
designer-form/src/main/java/com/fr/design/widgettheme/common/EditorSettingPane.java

@ -1,12 +1,13 @@
package com.fr.design.widgettheme.common; package com.fr.design.widgettheme.common;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.BorderStyle;
import com.fr.design.widgettheme.BaseStyleSettingPane; import com.fr.design.widgettheme.BaseStyleSettingPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.design.widgettheme.StyleSetting; import com.fr.design.widgettheme.StyleSetting;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays; import java.util.Arrays;
@ -25,8 +26,9 @@ public class EditorSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
public EditorSettingPane() { public EditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS StyleSetting.BORDER_RADIUS
)); ));
} }
@ -74,13 +76,12 @@ public class EditorSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
} else { } else {
styleSettingHead.setSelectedIndex(1); styleSettingHead.setSelectedIndex(1);
colorSelectBox.setSelectObject(editorTheme.getThemeColor()); colorSelectBox.setSelectObject(editorTheme.getThemeColor());
if (editorTheme.getStyleType() == WidgetThemeDisplayConstants.STYLE_1) {
style1.setSelected(true);
} else {
style2.setSelected(true);
}
lineComboBox.setSelectedLineStyle(editorTheme.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(editorTheme.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(editorTheme.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(editorTheme.getBorderStyle().getRadius());
borderColorSelectBox.setSelectObject(editorTheme.getBorderStyle().getBorderColor());
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(editorTheme.getWidgetBackground().getColor()));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(editorTheme.getWidgetBackground().getColor()));
iconColorSelectBox.setSelectObject(editorTheme.getIconColor());
selectBgColorBox.setSelectObject(editorTheme.getSelectBoxBgColor()); selectBgColorBox.setSelectObject(editorTheme.getSelectBoxBgColor());
assignFontSizePane(editorTheme); assignFontSizePane(editorTheme);
} }
@ -108,8 +109,9 @@ public class EditorSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
protected void updateEditorStyleBean(EditorTheme editorTheme) { protected void updateEditorStyleBean(EditorTheme editorTheme) {
editorTheme.setThemeColor(colorSelectBox.getSelectObject()); editorTheme.setThemeColor(colorSelectBox.getSelectObject());
editorTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject()); editorTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject());
editorTheme.setStyleType(style1.isSelected() ? WidgetThemeDisplayConstants.STYLE_1 : WidgetThemeDisplayConstants.STYLE_2); editorTheme.setBorderStyle(new BorderStyle((int) borderRadiusSpinner.getValue(), lineComboBox.getSelectedLineStyle(), borderColorSelectBox.getSelectObject()));
editorTheme.setBorderStyle(new BorderStyle((int) borderRadiusSpinner.getValue(), lineComboBox.getSelectedLineStyle())); editorTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
editorTheme.setIconColor(iconColorSelectBox.getSelectObject());
assignFontSizeStyle(editorTheme); assignFontSizeStyle(editorTheme);
switchCard(); switchCard();
} }

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

@ -27,6 +27,7 @@ public class NormalButtonSettingPane<T extends Widget> extends BaseStyleSettingP
super(Arrays.asList( super(Arrays.asList(
StyleSetting.BTN_BACKGROUND, StyleSetting.BTN_BACKGROUND,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS StyleSetting.BORDER_RADIUS
)); ));
} }
@ -60,8 +61,10 @@ public class NormalButtonSettingPane<T extends Widget> extends BaseStyleSettingP
styleSettingHead.setSelectedIndex(0); styleSettingHead.setSelectedIndex(0);
} else { } else {
styleSettingHead.setSelectedIndex(1); styleSettingHead.setSelectedIndex(1);
lineComboBox.setSelectedLineStyle(widgetTheme.getBorderStyle().getLineType()); BorderStyle borderStyle = widgetTheme.getBorderStyle();
borderRadiusSpinner.setValue(widgetTheme.getBorderStyle().getRadius()); lineComboBox.setSelectedLineStyle(borderStyle.getLineType());
borderRadiusSpinner.setValue(borderStyle.getRadius());
borderColorSelectBox.setSelectObject(borderStyle.getBorderColor());
assignFontPane(widgetTheme); assignFontPane(widgetTheme);
buttonStyleDefinedPane.populate(ButtonBackground.create(widgetTheme.getButtonBackgroundStyle())); buttonStyleDefinedPane.populate(ButtonBackground.create(widgetTheme.getButtonBackgroundStyle()));
} }
@ -118,8 +121,7 @@ public class NormalButtonSettingPane<T extends Widget> extends BaseStyleSettingP
protected void updateNormalButtonStyleBean(NormalButtonTheme normalButtonTheme) { protected void updateNormalButtonStyleBean(NormalButtonTheme normalButtonTheme) {
assignFontStyle(normalButtonTheme); assignFontStyle(normalButtonTheme);
normalButtonTheme.setButtonBackgroundStyle(buttonStyleDefinedPane.update()); normalButtonTheme.setButtonBackgroundStyle(buttonStyleDefinedPane.update());
normalButtonTheme.setBorderStyle(new BorderStyle((int) borderRadiusSpinner.getValue(), lineComboBox.getSelectedLineStyle())); normalButtonTheme.setBorderStyle(new BorderStyle((int) borderRadiusSpinner.getValue(), lineComboBox.getSelectedLineStyle(), borderColorSelectBox.getSelectObject()));
switchCard(); switchCard();
} }

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

@ -18,10 +18,12 @@ public class SelectEditorSettingPane <T extends Widget> extends EditorSettingPan
public SelectEditorSettingPane() { public SelectEditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.SELECT_COLOR, StyleSetting.WIDGET_BACKGROUND,
StyleSetting.STYLE_TYPE,
StyleSetting.LINE_TYPE, StyleSetting.LINE_TYPE,
StyleSetting.BORDER_RADIUS StyleSetting.LINE_COLOR,
StyleSetting.BORDER_RADIUS,
StyleSetting.ICON_COLOR,
StyleSetting.SELECT_COLOR
)); ));
} }

15
designer-form/src/main/java/com/fr/design/widgettheme/common/TreeEditorSettingPane.java

@ -3,10 +3,11 @@ package com.fr.design.widgettheme.common;
import com.fr.design.widgettheme.StyleSetting; import com.fr.design.widgettheme.StyleSetting;
import com.fr.design.widgettheme.BaseStyleSettingPane; import com.fr.design.widgettheme.BaseStyleSettingPane;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.cell.TreeTheme; import com.fr.widgettheme.theme.widget.theme.cell.TreeTheme;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.awt.Color;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -23,7 +24,7 @@ public class TreeEditorSettingPane<T extends TreeEditor> extends BaseStyleSettin
public TreeEditorSettingPane() { public TreeEditorSettingPane() {
super(Arrays.asList( super(Arrays.asList(
StyleSetting.THEME_COLOR, StyleSetting.THEME_COLOR,
StyleSetting.STYLE_TYPE StyleSetting.WIDGET_BACKGROUND
)); ));
} }
@ -57,11 +58,9 @@ public class TreeEditorSettingPane<T extends TreeEditor> extends BaseStyleSettin
} else { } else {
styleSettingHead.setSelectedIndex(1); styleSettingHead.setSelectedIndex(1);
colorSelectBox.setSelectObject(treeTheme.getThemeColor()); colorSelectBox.setSelectObject(treeTheme.getThemeColor());
if (treeTheme.getStyleType() == WidgetThemeDisplayConstants.STYLE_1) { Color widgetBgColor = treeTheme.getWidgetBackground().getColor();
style1.setSelected(true); widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(widgetBgColor));
} else { widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(widgetBgColor));
style2.setSelected(true);
}
assignFontSizePane(treeTheme); assignFontSizePane(treeTheme);
} }
switchCard(); switchCard();
@ -89,7 +88,7 @@ public class TreeEditorSettingPane<T extends TreeEditor> extends BaseStyleSettin
protected void updateTreeStyleBean(TreeTheme treeTheme) { protected void updateTreeStyleBean(TreeTheme treeTheme) {
treeTheme.setThemeColor(colorSelectBox.getSelectObject()); treeTheme.setThemeColor(colorSelectBox.getSelectObject());
treeTheme.setStyleType(style1.isSelected() ? WidgetThemeDisplayConstants.STYLE_1 : WidgetThemeDisplayConstants.STYLE_2); treeTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
assignFontSizeStyle(treeTheme); assignFontSizeStyle(treeTheme);
switchCard(); switchCard();
} }

3
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -1,6 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.design.mainframe.bbs.BBSConstants;
@ -186,6 +187,6 @@ public class SplashContext {
} }
private static String getSplashPath() { private static String getSplashPath() {
return I18nImage.getImagePath(SPLASH_IMAGE_PATH); return I18nImage.getImagePath(SPLASH_IMAGE_PATH, DesignerEnvManager.getEnvManager().getLanguage());
} }
} }

3
designer-realize/src/main/java/com/fr/start/common/SplashPane.java

@ -3,6 +3,7 @@ package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.bulenkov.iconloader.util.JBUI; import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.general.locale.image.I18nImage; import com.fr.general.locale.image.I18nImage;
import com.fr.stable.GraphDrawHelper; import com.fr.stable.GraphDrawHelper;
import com.fr.stable.GraphicsConfig; import com.fr.stable.GraphicsConfig;
@ -59,7 +60,7 @@ public class SplashPane extends JPanel {
} }
private static String getSplashPath() { private static String getSplashPath() {
return I18nImage.getImagePath(SPLASH_PATH); return I18nImage.getImagePath(SPLASH_PATH, DesignerEnvManager.getEnvManager().getLanguage());
} }
private NotNullLazyValue<Font> fontValue = new NotNullLazyValue<Font>() { private NotNullLazyValue<Font> fontValue = new NotNullLazyValue<Font>() {

7
designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

@ -2,6 +2,7 @@ package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.locale.image.I18nImage; import com.fr.general.locale.image.I18nImage;
@ -11,6 +12,7 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.Locale;
/** /**
* @author Yvan * @author Yvan
@ -43,8 +45,9 @@ public class SplashPane4WinAndJDK11 extends SplashPane{
} }
private String getSplashPath4WinAndJdk11() { private String getSplashPath4WinAndJdk11() {
String path = I18nImage.getImagePath(SPLASH_PATH); Locale locale = DesignerEnvManager.getEnvManager().getLanguage();
String pathOfDouble = I18nImage.getImagePath(DOUBLE_SPLASH_PATH); String path = I18nImage.getImagePath(SPLASH_PATH, locale);
String pathOfDouble = I18nImage.getImagePath(DOUBLE_SPLASH_PATH, locale);
// 为图片加上"@2x" // 为图片加上"@2x"
// 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path
if (IOUtils.readResource(pathOfDouble) != null) { if (IOUtils.readResource(pathOfDouble) != null) {

Loading…
Cancel
Save