obo
11 months ago
22 changed files with 372 additions and 90 deletions
@ -0,0 +1,70 @@
|
||||
package com.fr.widgettheme.theme.panel; |
||||
|
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.frpane.FontSizeComboPane; |
||||
import com.fr.widgettheme.theme.widget.style.TextStyle; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* 控件文本样式配置面板 |
||||
* 包含文本字体大小和字体颜色 |
||||
* |
||||
* @author oBo |
||||
* @since 11.0 |
||||
* Created on 2023/12/13 |
||||
*/ |
||||
public class WidgetTextStylePane extends JPanel { |
||||
|
||||
private final FontSizeComboPane fontSizePane; |
||||
|
||||
private final UIColorButton fontColorButton; |
||||
|
||||
public WidgetTextStylePane(int preferredWidth) { |
||||
this(null, preferredWidth); |
||||
} |
||||
|
||||
public WidgetTextStylePane(Vector<Integer> fontSizes, int preferredWidth) { |
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||
this.setBorder(BorderFactory.createEmptyBorder()); |
||||
fontSizePane = new FontSizeComboPane(fontSizes); |
||||
fontColorButton = new UIColorButton(); |
||||
fontSizePane.setPreferredSize(new Dimension(preferredWidth, fontSizePane.getPreferredSize().height)); |
||||
this.add(fontSizePane); |
||||
this.add(fontColorButton); |
||||
} |
||||
|
||||
public void setTextStyle(TextStyle textStyle) { |
||||
this.fontSizePane.setValue(textStyle.getFontSize()); |
||||
this.fontColorButton.setColor(textStyle.getFontColor()); |
||||
} |
||||
|
||||
public TextStyle getTextStyle() { |
||||
TextStyle textStyle = new TextStyle(); |
||||
textStyle.setFontSize(this.fontSizePane.getValue()); |
||||
textStyle.setFontColor(this.fontColorButton.getColor()); |
||||
return textStyle; |
||||
} |
||||
|
||||
public void setFontSizeValue(int fontSize) { |
||||
this.fontSizePane.setValue(fontSize); |
||||
} |
||||
|
||||
public void setFontColorValue(Color fontColor) { |
||||
this.fontColorButton.setColor(fontColor); |
||||
} |
||||
|
||||
public int getFontSizeValue() { |
||||
return this.fontSizePane.getValue(); |
||||
} |
||||
|
||||
public Color getFontColorValue() { |
||||
return this.fontColorButton.getColor(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.design.widgettheme; |
||||
|
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme; |
||||
import com.fr.widgettheme.theme.widget.theme.ParaSelectEditorTheme; |
||||
import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* 参数面板下拉框编辑控件配置面板 |
||||
* 继承自编辑控件配置面板,添加一个下拉框背景色 |
||||
* |
||||
* @author obo |
||||
* @since 11.0 |
||||
* Created on 2023/12/13 |
||||
*/ |
||||
public class ParaSelectEditorSettingPane<T extends Widget> extends ParaEditorSettingPane<T> { |
||||
public ParaSelectEditorSettingPane() { |
||||
super(Arrays.asList( |
||||
StyleSetting.THEME_COLOR, |
||||
StyleSetting.SELECT_COLOR, |
||||
StyleSetting.STYLE_TYPE, |
||||
StyleSetting.LINE_TYPE, |
||||
StyleSetting.BORDER_RADIUS, |
||||
StyleSetting.TEXT_STYLE |
||||
)); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateEditorBean(EditorTheme editorTheme) { |
||||
ParaSelectEditorTheme paraSelectEditorTheme= new ParaSelectEditorTheme(editorTheme); |
||||
if (!editorTheme.isFollowTheme()) { |
||||
selectBgColorBox.setSelectObject(paraSelectEditorTheme.getSelectBoxBgColor()); |
||||
} |
||||
super.populateEditorBean(editorTheme); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateEditorStyleBean(EditorTheme editorTheme) { |
||||
ParaSelectEditorTheme paraSelectEditorTheme= new ParaSelectEditorTheme(editorTheme); |
||||
paraSelectEditorTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject()); |
||||
super.updateEditorStyleBean(editorTheme); |
||||
} |
||||
|
||||
@Override |
||||
protected EditorTheme getEditorTheme() { |
||||
return new ParaSelectEditorTheme(); |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.widgettheme.common; |
||||
|
||||
import com.fr.design.widgettheme.StyleSetting; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; |
||||
import com.fr.widgettheme.theme.widget.theme.cell.SelectEditTheme; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 单元格下拉框编辑控件配置面板 |
||||
* 继承自编辑控件配置面板,添加一个下拉框背景色 |
||||
* |
||||
* @author obo |
||||
* @since 11.0 |
||||
* Created on 2023/12/13 |
||||
*/ |
||||
public class SelectEditorSettingPane <T extends Widget> extends EditorSettingPane<T> { |
||||
|
||||
public SelectEditorSettingPane() { |
||||
super(Arrays.asList( |
||||
StyleSetting.THEME_COLOR, |
||||
StyleSetting.SELECT_COLOR, |
||||
StyleSetting.STYLE_TYPE, |
||||
StyleSetting.LINE_TYPE, |
||||
StyleSetting.BORDER_RADIUS |
||||
)); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "selectEditorSetting"; |
||||
} |
||||
|
||||
@Override |
||||
protected EditorTheme getEditorTheme() { |
||||
return new SelectEditTheme(); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateEditorBean(EditorTheme editorTheme) { |
||||
SelectEditTheme selectEditTheme = new SelectEditTheme(editorTheme); |
||||
if (!selectEditTheme.isFollowTheme()) { |
||||
selectBgColorBox.setSelectObject(selectEditTheme.getSelectBoxBgColor()); |
||||
} |
||||
super.populateEditorBean(selectEditTheme); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateEditorStyleBean(EditorTheme editorTheme) { |
||||
SelectEditTheme selectEditTheme = new SelectEditTheme(editorTheme); |
||||
selectEditTheme.setSelectBoxBgColor(selectBgColorBox.getSelectObject()); |
||||
super.updateEditorStyleBean(selectEditTheme); |
||||
} |
||||
} |
Loading…
Reference in new issue