Browse Source

Merge pull request #13592 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '3d4b546f5459bc2a6c1a967bd9d9033fad0f4a19':
  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 控件扩展样式—新建模板,联排按钮、图文按钮排布方式默认要选"等分布局"
  REPORT-112769 JxUIPane新增执行js方法
  REPORT-112501 模板主题管理英文显示不全
bugfix/11.0
superman 9 months ago
parent
commit
57096dbdec
  1. 21
      designer-base/src/main/java/com/fr/design/jxbrowser/JxUIPane.java
  2. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/CapsuleCustomDefinePane.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/IconConfigPane.java
  4. 31
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/ImageCustomDefinePane.java
  5. 3
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/radiogroup/UnitedCustomDefinePane.java
  6. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  7. 30
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  8. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartTitleAndBackgroundStylePane.java
  9. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ThemePreviewed.java
  10. 62
      designer-base/src/main/java/com/fr/widgettheme/ThemePreviewTerminal.java
  11. 10
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java
  12. 15
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java
  13. 5
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditContainerPane.java
  14. 5
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java
  15. 26
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java
  16. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewPane.java
  17. 15
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/NormalButtonPreviewCell.java
  18. 17
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/TextPreviewCell.java
  19. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayFormThemePreviewPane.java
  20. 8
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetDisplayReportThemePreviewPane.java
  21. 24
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/DisplayEnhanceMobileStyleDefinePane.java
  22. 11
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FileEditorMobileStyleDefinePane.java
  23. 13
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/FreeButtonMobileStyleDefinePane.java
  24. 2
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/IconColorMobileStyleDefinePane.java
  25. 4
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/LabelMobileStyleDefinePane.java
  26. 2
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/pane/TextAreaMobileStyleDefinePane.java
  27. 2
      designer-base/src/main/java/com/fr/widgettheme/widget/mobile/provider/WidgetThemeMobileStyleDefinePaneCreator.java
  28. 43
      designer-base/src/test/java/com/fr/design/jxbrowser/JxUIPaneTest.java
  29. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  30. 13
      designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java
  31. 6
      designer-form/src/main/java/com/fr/design/widgettheme/common/ButtonSettingPane.java
  32. 2
      designer-form/src/main/java/com/fr/design/widgettheme/common/EditorSettingPane.java
  33. 6
      designer-form/src/main/java/com/fr/design/widgettheme/common/NormalButtonSettingPane.java
  34. 6
      designer-form/src/main/java/com/fr/design/widgettheme/common/TreeEditorSettingPane.java

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

@ -206,12 +206,11 @@ public class JxUIPane<T> extends ModernUIPane<T> {
* 执行一段js
*
* @param javaScript 待执行的js脚本
* @see JxUIPane#executeJS(String)
*/
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.mainFrame().ifPresent(frame -> {
frame.executeJavaScript(javaScript);
});
browser.mainFrame().ifPresent(frame -> frame.executeJavaScript(javaScript));
}
}
@ -227,6 +226,22 @@ public class JxUIPane<T> extends ModernUIPane<T> {
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路径下对冒号问题
* C:\\abc 变成 /C/abc这里对冒号进行编码转义

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

@ -183,7 +183,7 @@ public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane {
* 初始化固定列数面板
*/
private void initColumnSizePane() {
UILabel columnSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed_Number"));
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);

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

@ -74,6 +74,8 @@ public class IconConfigPane extends JPanel {
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());

31
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.icombobox.UIComboBox;
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.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
@ -23,6 +24,7 @@ import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle;
import com.fr.general.FRFont;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
@ -83,6 +85,14 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
protected JPanel createContentPane() {
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);
}
@ -160,6 +170,7 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
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);
}
@ -168,8 +179,8 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
* 初始化固定列数面板
*/
private void initColumnSizePane() {
UILabel columnSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout_Fixed_Number"));
columnSizeSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.INITIAL_COLUMN_SIZE);
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);
@ -271,18 +282,22 @@ public class ImageCustomDefinePane extends MobileStyleCustomDefinePane {
UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init"));
UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select"));
initialLabel.setVerticalAlignment(SwingConstants.TOP);
initialLabel.setBorder(new EmptyBorder(5, 0, 0, 0));
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 initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
initialPane.add(initialLabel);
initialPane.add(initialIconConfigPane);
JPanel initialPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initialPane.add(initialLabel, BorderLayout.WEST);
initialPane.add(initialIconConfigPane, BorderLayout.CENTER);
container.add(initialPane);
JPanel selectedPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
selectedPane.add(selectedLabel);
selectedPane.add(selectedIconConfigPane);
JPanel selectedPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
selectedPane.add(selectedLabel, BorderLayout.WEST);
selectedPane.add(selectedIconConfigPane, BorderLayout.CENTER);
container.add(selectedPane);
centerPane.add(container);

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

@ -144,8 +144,9 @@ public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane {
// 按钮排布下拉框
buttonAlignCombo = new UIComboBox(new String[]{
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Nature"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split"),
Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Split")
});
buttonAlignCombo.setSelectedIndex(1);
buttonAlignCombo.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};

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.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.widgettheme.ThemePreviewTerminal;
import com.fr.widgettheme.util.WidgetThemeDesignerUtils;
import com.fr.design.ExtraDesignClassManager;
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.ui.AutoCheckTextField;
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.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
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.JDialog;
@ -51,7 +52,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
protected TemplateThemePreviewPane<T> themePreviewPane;
protected TemplateThemeEditorPane<T> themeEditorPane;
protected UILabel leftTitleLabel;
protected UILabel leftTitlePromptLabel;
protected boolean isPopulating = false;
protected boolean isMutable = false;
@ -83,10 +85,9 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private JPanel createLeftPane() {
JPanel titleContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
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();
previewContainer.setBorder(BorderFactory.createEmptyBorder(5, 4, 10, 4));
titleContainer.add(createTitlePane(), BorderLayout.NORTH);
titleContainer.add(previewContainer, BorderLayout.CENTER);
themePreviewPane = createThemePreviewPane();
@ -103,7 +104,10 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (isPopulating) {
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);
}
});
@ -367,4 +371,20 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override
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;
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartTitleAndBackgroundStylePane.java

@ -83,10 +83,13 @@ public class ChartTitleAndBackgroundStylePane extends AbstractChartStylePane {
}
protected Component[][] getComponent() {
String chartAreaBgLabelName = Toolkit.i18nText("Fine-Design_Chart_Area_Background_Color");
UILabel chartAreaBgLabel = new UILabel(chartAreaBgLabelName);
chartAreaBgLabel.setToolTipText(chartAreaBgLabelName);
return new Component[][]{
new Component[]{chartFontPane, null},
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Background_Color")), typeComboBox},
new Component[]{chartAreaBgLabel, typeComboBox},
new Component[]{null, centerPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Grid_Line_Color")), mainGridColor}
};

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

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);
}
}

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

@ -2,6 +2,7 @@ package com.fr.widgettheme.theme.edit.widget;
import com.fr.base.background.ColorBackground;
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.utils.DesignUtils;
@ -57,7 +58,7 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner},
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, bold, italic)},
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}
};
}
@ -154,4 +155,11 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
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.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.MobileThemedWidgetStyle;
import com.fr.design.gui.icombobox.LineComboBox;
@ -36,6 +38,8 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
public void initLineBox() {
lineComboBox = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY);
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
@ -51,10 +55,16 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
t.setMobileWidgetStyle(style);
}
colorSelectBox.setSelectObject(style.getThemeColor());
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(style.getWidgetBackground().getColor()));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(style.getWidgetBackground().getColor()));
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
lineComboColorSelectBox.setSelectObject(style.getBorderStyle().getBorderColor());
iconColorSelectBox.setSelectObject(style.getIconColor());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
fontSizePane.setValue(style.getTextStyle().getFontSize());
fontColorButton.setColor(style.getTextStyle().getFontColor());
bold.setSelected(style.getTextStyle().isBold());
italic.setSelected(style.getTextStyle().isItalic());
}
@Override
@ -65,13 +75,18 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
t.setMobileWidgetStyle(style);
}
style.setThemeColor(colorSelectBox.getSelectObject());
style.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
BorderStyle borderStyle = new BorderStyle();
borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue());
borderStyle.setBorderColor(lineComboColorSelectBox.getSelectObject());
style.setBorderStyle(borderStyle);
style.setIconColor(iconColorSelectBox.getSelectObject());
ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
textStyle.setBold(bold.isSelected());
textStyle.setItalic(italic.isSelected());
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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.widgettheme.ThemePreviewTerminal;
import org.jetbrains.annotations.Nullable;
import javax.swing.JPanel;
@ -133,4 +134,8 @@ public class WidgetStyleEditContainerPane<T extends TemplateTheme> extends Basic
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Theme_Widget_Style");
}
public ThemePreviewTerminal getTerminalStyle() {
return ThemePreviewTerminal.getTypeByCode(terminalStyleGroup.getSelectedIndex());
}
}

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

@ -109,7 +109,7 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
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_Icon_Color")), iconColorSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), WidgetStyleComponentCombiner.combineTextStyleComponent(fontSizePane, fontColorButton, bold, italic)}
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), WidgetStyleComponentCombiner.combineTextStyleComponent(fontSizePane, fontColorButton, italic, bold)}
};
}
@ -135,9 +135,6 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
* 初始化边框线型
*/
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())));
}

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

@ -3,6 +3,8 @@ package com.fr.widgettheme.theme.panel;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
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.design.layout.FRGUIPaneFactory;
import com.fr.general.FRFont;
@ -14,7 +16,6 @@ import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
@ -39,6 +40,11 @@ public class ControlPreviewCell extends JPanel {
*/
protected String value;
protected TemplateTheme reportTheme;
/**
* 主题预览类型默认为PC端
*/
protected ThemePreviewTerminal themePreviewTerminal = ThemePreviewTerminal.PC;
/**
* 字体的颜色
*/
@ -70,9 +76,10 @@ public class ControlPreviewCell extends JPanel {
/**
* 主题样式变化后监听改变
*/
public void refresh(TemplateTheme reportTheme) {
public void refresh(TemplateTheme reportTheme, ThemePreviewTerminal type) {
this.reportTheme = reportTheme;
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) this.reportTheme.getWidgetStyle();
this.themePreviewTerminal = type;
ThemedWidgetStyle widgetStyle = this.themePreviewTerminal.getThemeWidgetStyle(reportTheme);
//主题色设置为透明或者插件启动前已有的主题启动插件后主题色为null
if (widgetStyle.getThemeColor() == null) {
widgetStyle.setThemeColor(DEFAULT_THEME_COLOR);
@ -87,8 +94,7 @@ public class ControlPreviewCell extends JPanel {
}
public Color getIconColor() {
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
return widgetStyle.getIconColor();
return this.themePreviewTerminal.getThemeWidgetStyle(reportTheme).getIconColor();
}
protected Icon setStyleTwoIcon(Icon icon, Icon defaultIcon) {
@ -106,13 +112,15 @@ public class ControlPreviewCell extends JPanel {
* 填充圆角矩形背景色
*/
public void paintBgColor(Graphics g, ThemedWidgetStyle widgetStyle, int alpha) {
Color themeColor = widgetStyle.getWidgetBackground().getColor();
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.fillRoundRect(0, 0, getSize().width - 1, getSize().height - 1, (int) widgetStyle.getBorderStyle().getRadius(), (int) widgetStyle.getBorderStyle().getRadius());
//需要重新绘制一遍字体,否则会被颜色填充给遮住
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,
Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), NO_SCALE_RESOLUTION);
@ -125,8 +133,8 @@ public class ControlPreviewCell extends JPanel {
return;
}
Graphics2D g2d = (Graphics2D) g.create();
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), textColor);
ThemeTextStyle textStyle = this.themePreviewTerminal.getThemeWidgetStyle(reportTheme).getTextStyle();
FRFont font = FRFont.getInstance(textStyle.getName(), textStyle.getCompositeFontStyle(), textStyle.getFontSize(), textStyle.getFontColor());
//每个预览格子通用的字体绘制
BaseUtils.drawStringStyleInRotation(g2d, getWidth(), getHeight(), this.value,
Style.getInstance(font).deriveHorizontalAlignment(Constants.LEFT)

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.mainframe.theme.preview.ThemePreviewed;
import com.fr.general.Background;
import com.fr.widgettheme.ThemePreviewTerminal;
import javax.swing.JPanel;
import java.awt.Color;
@ -42,9 +43,14 @@ public class ControlPreviewPane extends JPanel implements ThemePreviewed<Templat
@Override
public void refresh(TemplateTheme style) {
refresh(style, ThemePreviewTerminal.PC);
}
@Override
public void refresh(TemplateTheme style, ThemePreviewTerminal type) {
this.background = style.getParamContainerStyle().getBackground();
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;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
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
public void paintComponent(Graphics g) {
super.paintComponent(g);
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
ThemedWidgetStyle widgetStyle = this.themePreviewTerminal.getThemeWidgetStyle(this.reportTheme);
paintBgColor(g, widgetStyle);
uiLabel.setForeground(Color.WHITE);
FRFont font = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, Font.PLAIN, widgetStyle.getTextStyle().getFontSize(), Color.WHITE);
uiLabel.setBackground(widgetStyle.getThemeColor());
ThemeTextStyle textStyle = widgetStyle.getTextStyle();
uiLabel.setForeground(textStyle.getFontColor());
FRFont font = FRFont.getInstance(textStyle.getName(), textStyle.getCompositeFontStyle(), textStyle.getFontSize(), textStyle.getFontColor());
uiLabel.setFont(font);
this.add(uiLabel, BorderLayout.CENTER);
}

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

@ -1,9 +1,10 @@
package com.fr.widgettheme.theme.panel;
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
public void refresh(TemplateTheme reportTheme) {
super.refresh(reportTheme);
// 文字根据是否深色主题自适应改变
if (reportTheme.isDark()) {
textColor = Color.WHITE;
} else {
textColor = Color.BLACK;
}
public void refresh(TemplateTheme reportTheme, ThemePreviewTerminal type) {
super.refresh(reportTheme, type);
ThemeTextStyle textStyle = type.getThemeWidgetStyle(reportTheme).getTextStyle();
textColor = textStyle.getFontColor();
}
}

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.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.widgettheme.ThemePreviewTerminal;
import javax.swing.JPanel;
import java.awt.AlphaComposite;
@ -100,12 +101,17 @@ public class WidgetDisplayFormThemePreviewPane extends TemplateThemePreviewPane<
@Override
public void refresh(FormTheme theme) {
refresh(theme, ThemePreviewTerminal.PC);
}
@Override
public void refresh(FormTheme theme, ThemePreviewTerminal themeStyleType) {
background = theme.getBodyStyle().getStyle().getBackground();
alpha = theme.getBodyStyle().getStyle().getAlpha();
elementCasePane.refresh(theme);
columnChartPreviewPane.refresh(theme);
pieChartPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme, themeStyleType);
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.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.widgettheme.ThemePreviewTerminal;
import java.awt.BorderLayout;
import java.awt.Color;
@ -59,10 +60,15 @@ public class WidgetDisplayReportThemePreviewPane extends TemplateThemePreviewPan
@Override
public void refresh(ReportTheme theme) {
refresh(theme, ThemePreviewTerminal.PC);
}
@Override
public void refresh(ReportTheme theme, ThemePreviewTerminal terminal) {
background = theme.getBodyStyle().getBackground();
reportPreviewPane.refresh(theme);
chartPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme);
controlPreviewPane.refresh(theme, terminal);
repaint();
}

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

@ -121,6 +121,7 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
mobileStyle = Reflect.on(mobileStyleClazz).create().get();
WidgetThemeMobileCommonExtraStyle extraStyle = new WidgetThemeMobileCommonExtraStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
setThemeColor(extraStyle);
setIconColor(extraStyle);
setBorderType(extraStyle);
setBorderRadius(extraStyle);
@ -144,8 +145,9 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
createCustomPane();
}
protected void createFontPane(Color defaultFontColor) {
fontConfigPane = new MobileStyleFontConfigPane(defaultFontColor);
protected void createFontPane() {
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));
}
@ -202,7 +204,7 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
// 圆角边框
createBorderRadiusPane();
// 字体
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK);
createFontPane();
}
@ -215,7 +217,9 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
}
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() {
@ -230,14 +234,15 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
borderType = new LineComboBox(WidgetThemeDisplayConstants.MOBILE_BORDER_LINE_STYLE_ARRAY);
borderColorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
JPanel borderComponent = WidgetStyleComponentCombiner.combineWidgetBorderComponent(borderType, borderColorSelectBox);
initDefaultLineType();
initDefaultBorder();
borderType.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20));
// 边框线型
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderComponent));
}
protected void initDefaultLineType() {
protected void initDefaultBorder() {
borderType.setSelectedLineStyle(Constants.LINE_THIN);
borderColorSelectBox.setSelectObject(ColorUtils.hexToColor(WidgetThemeDesignerUtils.isCurrentTemplateThemeDark() ? WidgetThemeDisplayConstants.COLOR_26FFFFFF_HEX : WidgetThemeDisplayConstants.COLOR_26000000_HEX));
}
protected void createBorderRadiusPane() {
@ -294,9 +299,14 @@ public class DisplayEnhanceMobileStyleDefinePane extends BasicBeanPane<MobileSty
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());

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;
import com.fr.base.background.ColorBackground;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.mobile.style.FileEditorStyle;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
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.invoke.Reflect;
import java.awt.Color;
/**
* 文件属性定义面板
*
@ -28,10 +31,13 @@ public class FileEditorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDe
FileEditorStyle style = (FileEditorStyle) extraStyle;
customCombo.setSelectedIndex(style.isCustom() ? 1 : 0);
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());
borderRadius.setValue(style.getBorderRadius());
borderColorSelectBox.setSelectObject(style.getBorderColor());
}
this.customBeanPane.populateBean(ob);
}
@ -41,9 +47,10 @@ public class FileEditorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDe
mobileStyle = Reflect.on(mobileStyleClazz).create().get();
FileEditorStyle extraStyle = new FileEditorStyle();
extraStyle.setCustom(customCombo.getSelectedIndex() == 1);
extraStyle.setWidgetBackground(ColorBackground.getInstance(widgetBackgroundSelectBox.getSelectObject()));
extraStyle.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBackgroundSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
extraStyle.setBorderType(borderType.getSelectedLineStyle());
extraStyle.setBorderRadius(borderRadius.getValue());
extraStyle.setBorderColor(borderColorSelectBox.getSelectObject());
mobileStyle.setMobileCommonExtraStyle(extraStyle);
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();

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

@ -1,8 +1,10 @@
package com.fr.widgettheme.widget.mobile.pane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
/**
@ -23,16 +25,23 @@ public class FreeButtonMobileStyleDefinePane extends DisplayEnhanceMobileStyleDe
createBackgroundPane();
createBorderLinePane();
createBorderRadiusPane();
createFontPane(WidgetThemeDisplayConstants.DEFAULT_WHITE_COLOR);
createFontPane();
}
@Override
protected void initDefaultLineType() {
protected void initDefaultBorder() {
borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE);
}
@Override
protected void initBackgroundColor() {
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));
}
}

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

@ -31,6 +31,6 @@ public class IconColorMobileStyleDefinePane extends DisplayEnhanceMobileStyleDef
//图标颜色
createIconColorSelectBox();
// 字体
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK);
createFontPane();
}
}

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

@ -23,11 +23,11 @@ public class LabelMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefineP
createBackgroundPane();
createBorderLinePane();
createBorderRadiusPane();
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK);
createFontPane();
}
@Override
protected void initDefaultLineType() {
protected void initDefaultBorder() {
borderType.setSelectedLineStyle(com.fr.stable.Constants.LINE_NONE);
}
}

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

@ -28,6 +28,6 @@ public class TextAreaMobileStyleDefinePane extends DisplayEnhanceMobileStyleDefi
// 圆角边框
createBorderRadiusPane();
// 字体
createFontPane(WidgetThemeDisplayConstants.DEFAULT_FONT_COLOR_BLACK);
createFontPane();
}
}

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

@ -7,6 +7,7 @@ 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;
@ -59,6 +60,7 @@ public class WidgetThemeMobileStyleDefinePaneCreator {
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);
}
/**

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.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.js.JsObject;
import javax.swing.JButton;
import javax.swing.JFrame;
@ -10,6 +11,7 @@ import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.util.Optional;
public class JxUIPaneTest {
@ -30,16 +32,49 @@ public class JxUIPaneTest {
JPanel panel = new JPanel(new FlowLayout());
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的弹框,输出填写的信息");
panel.add(button);
button.addActionListener(e -> {
Model returnValue = pane.update();
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);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
container.add(button);
}
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

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.ChartHyperRelateFloatLink;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane;
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.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
@ -149,7 +149,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
}
private void refreshNameableCreator() {
if (ChartEditContext.duchampMode()) {
if (DesignModeContext.isDuchampMode()) {
return;
}
HashMap paneMap = getHyperlinkMap();

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

@ -7,6 +7,7 @@ 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.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;
@ -136,6 +137,7 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
buttonStyleDefinedPane = new ButtonStyleDefinedPane();
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();
fontColorButton = new UIColorButton();
bold = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
@ -145,7 +147,7 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox);
paneMap.put(StyleSetting.LINE_TYPE, lineComboBox);
paneMap.put(StyleSetting.LINE_COLOR, borderColorSelectBox);
paneMap.put(StyleSetting.TEXT_STYLE, WidgetStyleComponentCombiner.combineTextStyleComponent(fontNameSelectBox, fontSizePane, fontColorButton, bold, italic));
paneMap.put(StyleSetting.TEXT_STYLE, WidgetStyleComponentCombiner.combineTextStyleComponent(fontNameSelectBox, fontSizePane, fontColorButton, italic, bold));
paneMap.put(StyleSetting.BORDER_RADIUS, borderRadiusSpinner);
paneMap.put(StyleSetting.FONT, frFontPane);
paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane);
@ -268,6 +270,15 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
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(FRFont font) {

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

@ -3,9 +3,11 @@ package com.fr.design.widgettheme.common;
import com.fr.design.widgettheme.StyleSetting;
import com.fr.design.widgettheme.BaseStyleSettingPane;
import com.fr.form.ui.Widget;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme;
import org.jetbrains.annotations.Nullable;
import java.awt.Color;
import java.util.Arrays;
import java.util.List;
@ -64,6 +66,9 @@ public class ButtonSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
} else {
styleSettingHead.setSelectedIndex(1);
colorSelectBox.setSelectObject(buttonTheme.getThemeColor());
Color widgetBgColor = buttonTheme.getWidgetBackground().getColor();
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(widgetBgColor));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(widgetBgColor));
assignFontSizePane(buttonTheme);
}
switchCard();
@ -83,6 +88,7 @@ public class ButtonSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
protected void updateButtonStyleBean(ButtonTheme buttonTheme) {
buttonTheme.setThemeColor(colorSelectBox.getSelectObject());
buttonTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
assignFontSizeStyle(buttonTheme);
switchCard();
}

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

@ -78,6 +78,7 @@ public class EditorSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
colorSelectBox.setSelectObject(editorTheme.getThemeColor());
lineComboBox.setSelectedLineStyle(editorTheme.getBorderStyle().getLineType());
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());
@ -110,6 +111,7 @@ public class EditorSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
editorTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject());
editorTheme.setBorderStyle(new BorderStyle((int) borderRadiusSpinner.getValue(), lineComboBox.getSelectedLineStyle(), borderColorSelectBox.getSelectObject()));
editorTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
editorTheme.setIconColor(iconColorSelectBox.getSelectObject());
assignFontSizeStyle(editorTheme);
switchCard();
}

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

@ -61,8 +61,10 @@ public class NormalButtonSettingPane<T extends Widget> extends BaseStyleSettingP
styleSettingHead.setSelectedIndex(0);
} else {
styleSettingHead.setSelectedIndex(1);
lineComboBox.setSelectedLineStyle(widgetTheme.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(widgetTheme.getBorderStyle().getRadius());
BorderStyle borderStyle = widgetTheme.getBorderStyle();
lineComboBox.setSelectedLineStyle(borderStyle.getLineType());
borderRadiusSpinner.setValue(borderStyle.getRadius());
borderColorSelectBox.setSelectObject(borderStyle.getBorderColor());
assignFontPane(widgetTheme);
buttonStyleDefinedPane.populate(ButtonBackground.create(widgetTheme.getButtonBackgroundStyle()));
}

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

@ -3,9 +3,11 @@ package com.fr.design.widgettheme.common;
import com.fr.design.widgettheme.StyleSetting;
import com.fr.design.widgettheme.BaseStyleSettingPane;
import com.fr.form.ui.TreeEditor;
import com.fr.util.ColorUtils;
import com.fr.widgettheme.theme.widget.theme.cell.TreeTheme;
import org.jetbrains.annotations.Nullable;
import java.awt.Color;
import java.util.Arrays;
import java.util.List;
@ -56,6 +58,9 @@ public class TreeEditorSettingPane<T extends TreeEditor> extends BaseStyleSettin
} else {
styleSettingHead.setSelectedIndex(1);
colorSelectBox.setSelectObject(treeTheme.getThemeColor());
Color widgetBgColor = treeTheme.getWidgetBackground().getColor();
widgetBgColorSelectBox.setSelectObject(ColorUtils.ignoreColorAlpha(widgetBgColor));
widgetBgAlphaDragPane.populateBean(ColorUtils.roundColorAlphaDouble(widgetBgColor));
assignFontSizePane(treeTheme);
}
switchCard();
@ -83,6 +88,7 @@ public class TreeEditorSettingPane<T extends TreeEditor> extends BaseStyleSettin
protected void updateTreeStyleBean(TreeTheme treeTheme) {
treeTheme.setThemeColor(colorSelectBox.getSelectObject());
treeTheme.setWidgetBackground(ColorUtils.createColorBackgroundWithAlpha(widgetBgColorSelectBox.getSelectObject(), widgetBgAlphaDragPane.updateBean()));
assignFontSizeStyle(treeTheme);
switchCard();
}

Loading…
Cancel
Save