|
|
@ -1,7 +1,8 @@ |
|
|
|
package com.fr.design.widgettheme; |
|
|
|
package com.fr.design.widgettheme; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.widgettheme.theme.panel.WidgetTextStylePane; |
|
|
|
import com.fr.design.gui.frpane.FontSizeComboPane; |
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIColorButton; |
|
|
|
import com.fr.widgettheme.theme.widget.style.BorderStyle; |
|
|
|
import com.fr.widgettheme.theme.widget.style.BorderStyle; |
|
|
|
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; |
|
|
@ -25,11 +26,13 @@ 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 javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
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.Component; |
|
|
|
import java.awt.Component; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -63,12 +66,18 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa |
|
|
|
protected FRFontPane frFontPane; |
|
|
|
protected FRFontPane frFontPane; |
|
|
|
// 按钮背景设置
|
|
|
|
// 按钮背景设置
|
|
|
|
protected ButtonStyleDefinedPane buttonStyleDefinedPane; |
|
|
|
protected ButtonStyleDefinedPane buttonStyleDefinedPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected NewColorSelectBox selectBgColorBox; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 文本样式 |
|
|
|
* 主题文本样式的字体大小 |
|
|
|
* 包含字体大小、字体颜色 |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected WidgetTextStylePane textStylePane; |
|
|
|
protected FontSizeComboPane fontSizePane; |
|
|
|
protected NewColorSelectBox selectBgColorBox; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 主题文本样式的字体颜色 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected UIColorButton fontColorButton; |
|
|
|
|
|
|
|
|
|
|
|
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<>(); |
|
|
@ -94,12 +103,13 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa |
|
|
|
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); |
|
|
|
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); |
|
|
|
frFontPane = new FRFontPane(); |
|
|
|
frFontPane = new FRFontPane(); |
|
|
|
buttonStyleDefinedPane = new ButtonStyleDefinedPane(); |
|
|
|
buttonStyleDefinedPane = new ButtonStyleDefinedPane(); |
|
|
|
textStylePane = new WidgetTextStylePane(100); |
|
|
|
|
|
|
|
selectBgColorBox = new NewColorSelectBox(160, true); |
|
|
|
selectBgColorBox = new NewColorSelectBox(160, true); |
|
|
|
|
|
|
|
fontSizePane = new FontSizeComboPane(); |
|
|
|
|
|
|
|
fontColorButton = new UIColorButton(); |
|
|
|
paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); |
|
|
|
paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); |
|
|
|
paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); |
|
|
|
paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); |
|
|
|
paneMap.put(StyleSetting.LINE_TYPE, lineComboBox); |
|
|
|
paneMap.put(StyleSetting.LINE_TYPE, lineComboBox); |
|
|
|
paneMap.put(StyleSetting.TEXT_STYLE, textStylePane); |
|
|
|
paneMap.put(StyleSetting.TEXT_STYLE, ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)); |
|
|
|
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); |
|
|
@ -207,7 +217,7 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa |
|
|
|
setLineComboBox(widgetStyle); |
|
|
|
setLineComboBox(widgetStyle); |
|
|
|
setBorderRadiusSpinner(widgetStyle); |
|
|
|
setBorderRadiusSpinner(widgetStyle); |
|
|
|
setTextStylePane(widgetStyle); |
|
|
|
setTextStylePane(widgetStyle); |
|
|
|
setFrFontPane(); |
|
|
|
setFrFontPane(widgetStyle); |
|
|
|
setButtonStyleDefinedPane(widgetStyle); |
|
|
|
setButtonStyleDefinedPane(widgetStyle); |
|
|
|
setSelectBgColor(widgetStyle); |
|
|
|
setSelectBgColor(widgetStyle); |
|
|
|
} |
|
|
|
} |
|
|
@ -242,12 +252,14 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setTextStylePane(ThemedWidgetStyle widgetStyle) { |
|
|
|
private void setTextStylePane(ThemedWidgetStyle widgetStyle) { |
|
|
|
this.textStylePane.setTextStyle(widgetStyle.getTextStyle()); |
|
|
|
ThemeTextStyle textStyle = widgetStyle.getTextStyle(); |
|
|
|
|
|
|
|
this.fontSizePane.setValue(textStyle.getFontSize()); |
|
|
|
|
|
|
|
this.fontColorButton.setColor(textStyle.getFontColor()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setFrFontPane() { |
|
|
|
private void setFrFontPane(ThemedWidgetStyle widgetStyle) { |
|
|
|
if (frFontPane != null) { |
|
|
|
if (frFontPane != null) { |
|
|
|
frFontPane.populateBean(FRFont.getInstance()); |
|
|
|
frFontPane.populateBean(widgetStyle.getFontStyle().getFont()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -269,8 +281,11 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa |
|
|
|
if (borderRadiusSpinner != null) { |
|
|
|
if (borderRadiusSpinner != null) { |
|
|
|
borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS); |
|
|
|
borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS); |
|
|
|
} |
|
|
|
} |
|
|
|
if (textStylePane != null) { |
|
|
|
if (fontSizePane != null) { |
|
|
|
textStylePane.setTextStyle(new ThemeTextStyle()); |
|
|
|
fontSizePane.setValue(ThemeTextStyle.DEFAULT_FONT_SIZE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontColorButton != null) { |
|
|
|
|
|
|
|
fontColorButton.setColor(Color.BLACK); |
|
|
|
} |
|
|
|
} |
|
|
|
if (frFontPane != null) { |
|
|
|
if (frFontPane != null) { |
|
|
|
frFontPane.populateBean(FRFont.getInstance()); |
|
|
|
frFontPane.populateBean(FRFont.getInstance()); |
|
|
|