Browse Source

REPORT-99485 change: 主题继承关系变更

newui
vito 12 months ago
parent
commit
2b37cfa22c
  1. 20
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java
  2. 33
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java
  3. 18
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java
  4. 5
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java
  6. 10
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  7. 351
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineDarkLaf.properties
  8. 47
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties
  9. 49
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  10. 34
      designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java

20
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java

@ -3,28 +3,29 @@ package com.fine.theme.light.ui.laf;
import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.IconManager; import com.fine.theme.icon.IconManager;
import com.fine.theme.light.ui.FineLightIconSet; import com.fine.theme.light.ui.FineLightIconSet;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
* FineReport designer new look and feel * Fine 暗色主题
* *
* @author vito * @author vito
* @since 11.0 * @since 11.0
* Created on 2023/9/12 * Created on 2023/9/12
*/ */
public class FineDarkLaf extends FlatDarkLaf { public class FineDarkLaf extends FineLaf {
private static final String USER_SCALE_FACTOR = "userScaleFactor"; private static final String USER_SCALE_FACTOR = "userScaleFactor";
private static final String NAME = "FineLaf Dark";
/** /**
* 安装外观 * 安装外观
* *
* @return 是否安装成功 * @return 是否安装成功
*/ */
public static boolean setup() { public static boolean setup() {
IconManager.addSet(new FineLightIconSet("fine-light")); IconManager.addSet(new FineLightIconSet("fine-dark"));
Layouts.setScaleFactor(UIScale.getUserScaleFactor()); Layouts.setScaleFactor(UIScale.getUserScaleFactor());
UIScale.addPropertyChangeListener(evt -> { UIScale.addPropertyChangeListener(evt -> {
if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) {
@ -36,7 +37,16 @@ public class FineDarkLaf extends FlatDarkLaf {
@Override @Override
public String getName() { public String getName() {
return "FineDarkLaf"; return NAME;
}
@Override
public String getDescription() {
return "Fine New Dark Look and Feel";
} }
@Override
public boolean isDark() {
return true;
}
} }

33
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLaf.java

@ -0,0 +1,33 @@
package com.fine.theme.light.ui.laf;
import com.formdev.flatlaf.FlatLaf;
/**
* Fine designer new look and feel
* FineLaf.properties 定义公共属性如UI等
* 其他主题继承该主题进行自定义防止出现UI不存在等问题
*
* @author vito
* @since 11.0
* Created on 2023/12/18
*/
public abstract class FineLaf extends FlatLaf {
private static final String NAME = "FineLaf";
@Override
public String getName() {
return NAME;
}
public static boolean setup() {
return setup(new FineLightLaf());
}
@Override
public String getDescription() {
return "Fine New Look and Feel";
}
}

18
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java

@ -3,21 +3,22 @@ package com.fine.theme.light.ui.laf;
import com.fine.swing.ui.layout.Layouts; import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.IconManager; import com.fine.theme.icon.IconManager;
import com.fine.theme.light.ui.FineLightIconSet; import com.fine.theme.light.ui.FineLightIconSet;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
* FineReport designer new look and feel * Fine 亮色主题
* *
* @author vito * @author vito
* @since 11.0 * @since 11.0
* Created on 2023/9/12 * Created on 2023/9/12
*/ */
public class FineLightLaf extends FlatLightLaf { public class FineLightLaf extends FineLaf {
public static final String USER_SCALE_FACTOR = "userScaleFactor"; public static final String USER_SCALE_FACTOR = "userScaleFactor";
private static final String NAME = "FineLaf Light";
/** /**
* 安装外观 * 安装外观
* *
@ -36,7 +37,16 @@ public class FineLightLaf extends FlatLightLaf {
@Override @Override
public String getName() { public String getName() {
return "FineLightLaf"; return NAME;
}
@Override
public String getDescription() {
return "Fine New Light Look and Feel";
} }
@Override
public boolean isDark() {
return false;
}
} }

5
designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java

@ -226,5 +226,8 @@ public class UILookAndFeel extends MetalLookAndFeel {
return new ImageIcon(url); return new ImageIcon(url);
} }
@Override
public String getName() {
return "FR UI 10";
}
} }

4
designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java

@ -18,8 +18,8 @@ public class LookAndFeelAction extends UpdateAction {
private final LookAndFeel lookAndFeel; private final LookAndFeel lookAndFeel;
public LookAndFeelAction(String name, LookAndFeel lookAndFeel) { public LookAndFeelAction(LookAndFeel lookAndFeel) {
this.setName(name); this.setName(lookAndFeel.getName());
this.lookAndFeel = lookAndFeel; this.lookAndFeel = lookAndFeel;
} }

10
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -3,9 +3,8 @@
*/ */
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf; import com.fine.theme.light.ui.laf.FineLightLaf;
import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.FlatLightLaf;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -679,10 +678,9 @@ public abstract class ToolBarMenuDock {
public MenuDef createLookAndFeel() { public MenuDef createLookAndFeel() {
MenuDef menuDef = new MenuDef("外观", 'H'); MenuDef menuDef = new MenuDef("外观", 'H');
menuDef.addShortCut( menuDef.addShortCut(
new LookAndFeelAction("FR11", new UILookAndFeel()), new LookAndFeelAction(new FineLightLaf()),
new LookAndFeelAction("fine new ui", new FineLightLaf()), new LookAndFeelAction(new FineDarkLaf()),
new LookAndFeelAction("flat dark", new FlatDarculaLaf()), new LookAndFeelAction(new UILookAndFeel())
new LookAndFeelAction("flat light", new FlatLightLaf())
); );
insertMenu(menuDef, "laf"); insertMenu(menuDef, "laf");
return menuDef; return menuDef;

351
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineDarkLaf.properties

@ -0,0 +1,351 @@
#---- variables ----
# general background and foreground (text color)
@background = #3c3f41
@foreground = #bbb
@disabledBackground = @background
@disabledForeground = shade(@foreground,25%)
# component background
@buttonBackground = tint(@background,9%)
@componentBackground = tint(@background,5%)
@menuBackground = darken(@background,5%)
# selection
@selectionBackground = @accentSelectionBackground
@selectionForeground = contrast(@selectionBackground, @background, @foreground, 25%)
@selectionInactiveBackground = spin(saturate(shade(@selectionBackground,70%),20%),-15)
@selectionInactiveForeground = @foreground
# menu
@menuSelectionBackground = @selectionBackground
@menuHoverBackground = lighten(@menuBackground,10%,derived)
@menuCheckBackground = darken(@menuSelectionBackground,10%,derived noAutoInverse)
@menuAcceleratorForeground = darken(@foreground,15%)
@menuAcceleratorSelectionForeground = @selectionForeground
# misc
@cellFocusColor = lighten(@selectionBackground,10%)
@icon = shade(@foreground,7%)
# accent colors (blueish)
# set @accentColor to use single accent color or
# modify @accentBaseColor to use variations of accent base color
@accentColor = systemColor(accent,null)
@accentBaseColor = #4B6EAF
@accentBase2Color = lighten(saturate(spin(@accentBaseColor,-8),13%),5%)
# accent color variations
@accentFocusColor = if(@accentColor, @accentColor, shade(spin(@accentBaseColor,-8),20%))
@accentLinkColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-5),50%),16%))
@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor)
@accentSliderColor = if(@accentColor, @accentColor, @accentBase2Color)
@accentUnderlineColor = if(@accentColor, @accentColor, @accentBase2Color)
@accentButtonDefaultBackground = if(@accentColor, @accentColor, darken(spin(@accentBaseColor,-8),13%))
# for buttons within components (e.g. combobox or spinner)
@buttonArrowColor = shade(@foreground,17%)
@buttonDisabledArrowColor = darken(@buttonArrowColor,25%)
@buttonHoverArrowColor = lighten(@buttonArrowColor,10%,derived noAutoInverse)
@buttonPressedArrowColor = lighten(@buttonArrowColor,20%,derived noAutoInverse)
# Drop (use lazy colors for IntelliJ platform themes, which usually do not specify these colors)
@dropCellBackground = darken(List.selectionBackground,10%,lazy)
@dropCellForeground = lazy(List.selectionForeground)
@dropLineColor = lighten(List.selectionBackground,10%,lazy)
@dropLineShortColor = lighten(List.selectionBackground,30%,lazy)
#---- system colors ----
activeCaption = #434E60
inactiveCaption = #393C3D
controlHighlight = darken($controlShadow,20%)
controlLtHighlight = darken($controlShadow,25%)
controlDkShadow = lighten($controlShadow,10%)
#---- Button ----
Button.background = @buttonBackground
Button.hoverBackground = lighten($Button.background,3%,derived)
Button.pressedBackground = lighten($Button.background,6%,derived)
Button.selectedBackground = lighten($Button.background,10%,derived)
Button.selectedForeground = $Button.foreground
Button.disabledSelectedBackground = lighten($Button.background,3%,derived)
Button.borderColor = tint($Button.background,10%)
Button.disabledBorderColor = $Button.borderColor
Button.focusedBorderColor = $Component.focusedBorderColor
Button.hoverBorderColor = $Button.focusedBorderColor
Button.innerFocusWidth = 1
Button.default.background = @accentButtonDefaultBackground
Button.default.foreground = contrast($Button.default.background, @background, $Button.foreground, 25%)
Button.default.hoverBackground = lighten($Button.default.background,3%,derived)
Button.default.pressedBackground = lighten($Button.default.background,6%,derived)
Button.default.borderColor = tint($Button.default.background,15%)
Button.default.hoverBorderColor = tint($Button.default.background,18%)
Button.default.focusedBorderColor = $Button.default.hoverBorderColor
Button.default.focusColor = lighten($Component.focusColor,3%)
Button.default.boldText = true
Button.toolbar.hoverBackground = lighten($Button.background,1%,derived)
Button.toolbar.pressedBackground = lighten($Button.background,4%,derived)
Button.toolbar.selectedBackground = lighten($Button.background,7%,derived)
#---- CheckBox ----
CheckBox.icon.focusWidth = 1
# enabled
CheckBox.icon.borderColor = tint($Component.borderColor,5%)
CheckBox.icon.background = tint(@background,5%)
CheckBox.icon.selectedBorderColor = tint($CheckBox.icon.borderColor,20%)
CheckBox.icon.selectedBackground = $CheckBox.icon.background
CheckBox.icon.checkmarkColor = shade(@foreground,10%)
# disabled
CheckBox.icon.disabledBorderColor = shade($CheckBox.icon.borderColor,20%)
CheckBox.icon.disabledBackground = @disabledBackground
CheckBox.icon.disabledCheckmarkColor = darken($CheckBox.icon.checkmarkColor,25%)
# focused
CheckBox.icon.focusedBorderColor = $Component.focusedBorderColor
CheckBox.icon.focusedBackground = fade($CheckBox.icon.focusedBorderColor,30%)
# hover
CheckBox.icon.hoverBorderColor = $CheckBox.icon.focusedBorderColor
CheckBox.icon.hoverBackground = lighten($CheckBox.icon.background,3%,derived)
# pressed
CheckBox.icon.pressedBorderColor = $CheckBox.icon.focusedBorderColor
CheckBox.icon.pressedBackground = lighten($CheckBox.icon.background,6%,derived)
# used if CheckBox.icon.style or RadioButton.icon.style = filled
# enabled
CheckBox.icon[filled].selectedBorderColor = $CheckBox.icon.checkmarkColor
CheckBox.icon[filled].selectedBackground = $CheckBox.icon.checkmarkColor
CheckBox.icon[filled].checkmarkColor = $CheckBox.icon.background
# hover
CheckBox.icon[filled].hoverSelectedBackground = darken($CheckBox.icon[filled].selectedBackground,3%,derived)
# pressed
CheckBox.icon[filled].pressedSelectedBackground = darken($CheckBox.icon[filled].selectedBackground,6%,derived)
#---- CheckBoxMenuItem ----
CheckBoxMenuItem.icon.checkmarkColor = @buttonArrowColor
CheckBoxMenuItem.icon.disabledCheckmarkColor = @buttonDisabledArrowColor
#---- Component ----
Component.borderColor = tint(@background,19%)
Component.disabledBorderColor = $Component.borderColor
Component.focusedBorderColor = lighten($Component.focusColor,5%)
Component.focusColor = @accentFocusColor
Component.linkColor = @accentLinkColor
Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor)
Component.grayFilter = -20,-70,100
Component.error.borderColor = desaturate($Component.error.focusedBorderColor,25%)
Component.error.focusedBorderColor = #8b3c3c
Component.warning.borderColor = darken(desaturate($Component.warning.focusedBorderColor,20%),10%)
Component.warning.focusedBorderColor = #ac7920
Component.custom.borderColor = desaturate(#f00,50%,relative derived noAutoInverse)
#---- Desktop ----
Desktop.background = #3E434C
#---- DesktopIcon ----
DesktopIcon.background = lighten($Desktop.background,10%,derived)
#---- HelpButton ----
HelpButton.questionMarkColor = shade(@foreground,10%)
HelpButton.disabledQuestionMarkColor = tint(@background,30%)
#---- InternalFrame ----
InternalFrame.activeTitleBackground = darken(@background,10%)
InternalFrame.activeTitleForeground = @foreground
InternalFrame.inactiveTitleBackground = lighten($InternalFrame.activeTitleBackground,5%)
InternalFrame.inactiveTitleForeground = @disabledForeground
InternalFrame.activeBorderColor = darken(@background,7%)
InternalFrame.inactiveBorderColor = darken(@background,3%)
InternalFrame.buttonHoverBackground = lighten($InternalFrame.activeTitleBackground,10%,derived)
InternalFrame.buttonPressedBackground = lighten($InternalFrame.activeTitleBackground,20%,derived)
InternalFrame.closeHoverBackground = lazy(Actions.Red)
InternalFrame.closePressedBackground = darken(Actions.Red,10%,lazy)
InternalFrame.closeHoverForeground = #fff
InternalFrame.closePressedForeground = #fff
InternalFrame.activeDropShadowOpacity = 0.5
InternalFrame.inactiveDropShadowOpacity = 0.75
#---- Menu ----
Menu.icon.arrowColor = @buttonArrowColor
Menu.icon.disabledArrowColor = @buttonDisabledArrowColor
#---- MenuBar ----
MenuBar.borderColor = $Separator.foreground
#---- PasswordField ----
PasswordField.capsLockIconColor = #ffffff64
PasswordField.revealIconColor = @foreground
#---- Popup ----
Popup.dropShadowColor = #000
Popup.dropShadowOpacity = 0.25
#---- PopupMenu ----
PopupMenu.borderColor = tint(@background,17%)
PopupMenu.hoverScrollArrowBackground = lighten(@background,5%)
#---- ProgressBar ----
ProgressBar.background = lighten(@background,8%)
ProgressBar.foreground = @accentSliderColor
ProgressBar.selectionBackground = @foreground
ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @background, @foreground, 25%)
#---- RootPane ----
RootPane.activeBorderColor = lighten(@background,7%,derived)
RootPane.inactiveBorderColor = lighten(@background,5%,derived)
#---- ScrollBar ----
ScrollBar.track = lighten(@background,1%,derived noAutoInverse)
ScrollBar.thumb = lighten($ScrollBar.track,10%,derived noAutoInverse)
ScrollBar.hoverTrackColor = lighten($ScrollBar.track,4%,derived noAutoInverse)
ScrollBar.hoverThumbColor = lighten($ScrollBar.thumb,10%,derived noAutoInverse)
ScrollBar.pressedThumbColor = lighten($ScrollBar.thumb,15%,derived noAutoInverse)
ScrollBar.hoverButtonBackground = lighten(@background,5%,derived noAutoInverse)
ScrollBar.pressedButtonBackground = lighten(@background,10%,derived noAutoInverse)
#---- Separator ----
Separator.foreground = tint(@background,10%)
#---- Slider ----
Slider.trackValueColor = @accentSliderColor
Slider.trackColor = lighten(@background,15%)
Slider.thumbColor = $Slider.trackValueColor
Slider.tickColor = @disabledForeground
Slider.focusedColor = fade(changeLightness($Component.focusColor,60%,derived),30%,derived)
Slider.hoverThumbColor = lighten($Slider.thumbColor,5%,derived)
Slider.pressedThumbColor = lighten($Slider.thumbColor,8%,derived)
Slider.disabledTrackColor = lighten(@background,10%)
Slider.disabledThumbColor = $Slider.disabledTrackColor
#---- SplitPane ----
SplitPaneDivider.draggingColor = $Component.borderColor
#---- TabbedPane ----
TabbedPane.underlineColor = @accentUnderlineColor
TabbedPane.inactiveUnderlineColor = mix(@accentUnderlineColor,$TabbedPane.background,60%)
TabbedPane.disabledUnderlineColor = lighten(@background,23%)
TabbedPane.hoverColor = darken($TabbedPane.background,5%,derived noAutoInverse)
TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,25%)
TabbedPane.contentAreaColor = $Component.borderColor
TabbedPane.buttonHoverBackground = darken($TabbedPane.background,5%,derived noAutoInverse)
TabbedPane.buttonPressedBackground = darken($TabbedPane.background,8%,derived noAutoInverse)
TabbedPane.closeBackground = null
TabbedPane.closeForeground = @disabledForeground
TabbedPane.closeHoverBackground = lighten($TabbedPane.background,5%,derived)
TabbedPane.closeHoverForeground = @foreground
TabbedPane.closePressedBackground = lighten($TabbedPane.background,10%,derived)
TabbedPane.closePressedForeground = $TabbedPane.closeHoverForeground
#---- Table ----
Table.gridColor = lighten($Table.background,8%)
#---- TableHeader ----
TableHeader.hoverBackground = lighten($TableHeader.background,5%,derived)
TableHeader.pressedBackground = lighten($TableHeader.background,10%,derived)
TableHeader.separatorColor = lighten($TableHeader.background,10%)
TableHeader.bottomSeparatorColor = $TableHeader.separatorColor
#---- TitlePane ----
TitlePane.embeddedForeground = darken($TitlePane.foreground,15%)
TitlePane.buttonHoverBackground = lighten($TitlePane.background,15%,derived)
TitlePane.buttonPressedBackground = lighten($TitlePane.background,10%,derived)
#---- ToggleButton ----
ToggleButton.selectedBackground = lighten($ToggleButton.background,10%,derived)
ToggleButton.disabledSelectedBackground = lighten($ToggleButton.background,3%,derived)
ToggleButton.toolbar.selectedBackground = lighten($ToggleButton.background,7%,derived)
#---- ToolBar ----
ToolBar.hoverButtonGroupBackground = lighten($ToolBar.background,3%,derived)
#---- ToolTip ----
ToolTip.border = 4,6,4,6
ToolTip.background = shade(@background,50%)
#---- Tree ----
Tree.hash = lighten($Tree.background,5%)
#---- Styles ------------------------------------------------------------------
#---- inTextField ----
# for leading/trailing components in text fields
[style]Button.inTextField = \
focusable: false; \
toolbar.margin: 1,1,1,1; \
toolbar.spacingInsets: 1,1,1,1; \
toolbar.hoverBackground: lighten($TextField.background,5%); \
toolbar.pressedBackground: lighten($TextField.background,10%); \
toolbar.selectedBackground: lighten($TextField.background,15%)

47
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -0,0 +1,47 @@
# \u516C\u5171\u5C5E\u6027\uFF0C\u5982UI\u7B49\uFF0C\u5176\u4ED6\u4E3B\u9898\u7EE7\u627F\u8BE5\u4E3B\u9898\uFF0C\u9632\u6B62\u51FA\u73B0UI\u4E0D\u5B58\u5728\u7B49\u95EE\u9898
#---- UI delegates ----
ButtonUI=com.formdev.flatlaf.ui.FlatButtonUI
CheckBoxUI=com.fine.theme.light.ui.FineCheckBoxUI
CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI
ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI
DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI
EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI
FileChooserUI=com.formdev.flatlaf.ui.FlatFileChooserUI
FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI
InternalFrameUI=com.formdev.flatlaf.ui.FlatInternalFrameUI
LabelUI=com.formdev.flatlaf.ui.FlatLabelUI
ListUI=com.formdev.flatlaf.ui.FlatListUI
MenuUI=com.formdev.flatlaf.ui.FlatMenuUI
MenuBarUI=com.formdev.flatlaf.ui.FlatMenuBarUI
MenuItemUI=com.formdev.flatlaf.ui.FlatMenuItemUI
OptionPaneUI=com.formdev.flatlaf.ui.FlatOptionPaneUI
PanelUI=com.formdev.flatlaf.ui.FlatPanelUI
PasswordFieldUI=com.formdev.flatlaf.ui.FlatPasswordFieldUI
PopupMenuUI=com.formdev.flatlaf.ui.FlatPopupMenuUI
PopupMenuSeparatorUI=com.formdev.flatlaf.ui.FlatPopupMenuSeparatorUI
ProgressBarUI=com.formdev.flatlaf.ui.FlatProgressBarUI
RadioButtonUI=com.formdev.flatlaf.ui.FlatRadioButtonUI
RadioButtonMenuItemUI=com.formdev.flatlaf.ui.FlatRadioButtonMenuItemUI
RootPaneUI=com.formdev.flatlaf.ui.FlatRootPaneUI
ScrollBarUI=com.formdev.flatlaf.ui.FlatScrollBarUI
ScrollPaneUI=com.formdev.flatlaf.ui.FlatScrollPaneUI
SeparatorUI=com.formdev.flatlaf.ui.FlatSeparatorUI
SliderUI=com.formdev.flatlaf.ui.FlatSliderUI
SpinnerUI=com.formdev.flatlaf.ui.FlatSpinnerUI
SplitPaneUI=com.formdev.flatlaf.ui.FlatSplitPaneUI
TabbedPaneUI=com.formdev.flatlaf.ui.FlatTabbedPaneUI
TableUI=com.formdev.flatlaf.ui.FlatTableUI
TableHeaderUI=com.formdev.flatlaf.ui.FlatTableHeaderUI
TextAreaUI=com.formdev.flatlaf.ui.FlatTextAreaUI
TextFieldUI=com.formdev.flatlaf.ui.FlatTextFieldUI
TextPaneUI=com.formdev.flatlaf.ui.FlatTextPaneUI
ToggleButtonUI=com.fine.theme.light.ui.FineToggleButtonUI
ToolBarUI=com.formdev.flatlaf.ui.FlatToolBarUI
ToolBarSeparatorUI=com.formdev.flatlaf.ui.FlatToolBarSeparatorUI
ToolTipUI=com.fine.theme.light.ui.FineTooltipUI
TreeUI=com.fine.theme.light.ui.UIFlatTreeUI
ViewportUI=com.formdev.flatlaf.ui.FlatViewportUI
HeadGroupUI=com.fine.theme.light.ui.FineHeadGroupUI

49
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -41,53 +41,6 @@
[linux]light.font = "Noto SansCJK", "SimHei", "Arial", "Ubuntu" [linux]light.font = "Noto SansCJK", "SimHei", "Arial", "Ubuntu"
[linux]semibold.font = "Noto SansCJK", "SimHei", "Arial", "Ubuntu" [linux]semibold.font = "Noto SansCJK", "SimHei", "Arial", "Ubuntu"
#---- UI delegates ----
ButtonUI = com.formdev.flatlaf.ui.FlatButtonUI
CheckBoxUI = com.fine.theme.light.ui.FineCheckBoxUI
CheckBoxMenuItemUI = com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI
ColorChooserUI = com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI = com.fine.theme.light.ui.FineComboBoxUI
DesktopIconUI = com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI = com.formdev.flatlaf.ui.FlatDesktopPaneUI
EditorPaneUI = com.formdev.flatlaf.ui.FlatEditorPaneUI
FileChooserUI = com.formdev.flatlaf.ui.FlatFileChooserUI
FormattedTextFieldUI = com.formdev.flatlaf.ui.FlatFormattedTextFieldUI
InternalFrameUI = com.formdev.flatlaf.ui.FlatInternalFrameUI
LabelUI = com.formdev.flatlaf.ui.FlatLabelUI
ListUI = com.formdev.flatlaf.ui.FlatListUI
MenuUI = com.formdev.flatlaf.ui.FlatMenuUI
MenuBarUI = com.formdev.flatlaf.ui.FlatMenuBarUI
MenuItemUI = com.formdev.flatlaf.ui.FlatMenuItemUI
OptionPaneUI = com.formdev.flatlaf.ui.FlatOptionPaneUI
PanelUI = com.formdev.flatlaf.ui.FlatPanelUI
PasswordFieldUI = com.formdev.flatlaf.ui.FlatPasswordFieldUI
PopupMenuUI = com.formdev.flatlaf.ui.FlatPopupMenuUI
PopupMenuSeparatorUI = com.formdev.flatlaf.ui.FlatPopupMenuSeparatorUI
ProgressBarUI = com.formdev.flatlaf.ui.FlatProgressBarUI
RadioButtonUI = com.formdev.flatlaf.ui.FlatRadioButtonUI
RadioButtonMenuItemUI = com.formdev.flatlaf.ui.FlatRadioButtonMenuItemUI
RootPaneUI = com.formdev.flatlaf.ui.FlatRootPaneUI
ScrollBarUI = com.formdev.flatlaf.ui.FlatScrollBarUI
ScrollPaneUI = com.formdev.flatlaf.ui.FlatScrollPaneUI
SeparatorUI = com.formdev.flatlaf.ui.FlatSeparatorUI
SliderUI = com.formdev.flatlaf.ui.FlatSliderUI
SpinnerUI = com.formdev.flatlaf.ui.FlatSpinnerUI
SplitPaneUI = com.formdev.flatlaf.ui.FlatSplitPaneUI
TabbedPaneUI = com.formdev.flatlaf.ui.FlatTabbedPaneUI
TableUI = com.formdev.flatlaf.ui.FlatTableUI
TableHeaderUI = com.formdev.flatlaf.ui.FlatTableHeaderUI
TextAreaUI = com.formdev.flatlaf.ui.FlatTextAreaUI
TextFieldUI = com.formdev.flatlaf.ui.FlatTextFieldUI
TextPaneUI = com.formdev.flatlaf.ui.FlatTextPaneUI
ToggleButtonUI = com.fine.theme.light.ui.FineToggleButtonUI
ToolBarUI = com.formdev.flatlaf.ui.FlatToolBarUI
ToolBarSeparatorUI = com.formdev.flatlaf.ui.FlatToolBarSeparatorUI
ToolTipUI=com.fine.theme.light.ui.FineTooltipUI
TreeUI = com.fine.theme.light.ui.UIFlatTreeUI
ViewportUI = com.formdev.flatlaf.ui.FlatViewportUI
HeadGroupUI=com.fine.theme.light.ui.FineHeadGroupUI
#---- variables ---- #---- variables ----
Component.defaultHeight=24 Component.defaultHeight=24
@ -187,7 +140,7 @@ tooltip.disabled=#A3ADBD
#---- Button ---- #---- Button ----
Button.border = com.formdev.flatlaf.ui.FlatButtonBorder Button.border = com.formdev.flatlaf.ui.FlatButtonBorder
Button.arc = 6 Button.arc = 3
Button.minimumWidth = 72 Button.minimumWidth = 72
Button.margin = 2,12,2,12 Button.margin = 2,12,2,12
Button.iconTextGap = 4 Button.iconTextGap = 4

34
designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java

@ -1,11 +1,10 @@
package com.fr.design.gui.storybook; package com.fr.design.gui.storybook;
import com.fanruan.gui.UiInspector; import com.fanruan.gui.UiInspector;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf; import com.fine.theme.light.ui.laf.FineLightLaf;
import com.finebi.cbb.utils.StringUtils; import com.finebi.cbb.utils.StringUtils;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.extras.FlatAnimatedLafChange; import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
@ -170,7 +169,18 @@ public class Storybook {
private void applyDPI(float dpi) { private void applyDPI(float dpi) {
System.setProperty("flatlaf.uiScale", String.valueOf(dpi)); System.setProperty("flatlaf.uiScale", String.valueOf(dpi));
FlatAnimatedLafChange.showSnapshot(); FlatAnimatedLafChange.showSnapshot();
FineLightLaf.setup(); LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
if (lookAndFeel instanceof FineLightLaf) {
FineLightLaf.setup();
} else if (lookAndFeel instanceof FineDarkLaf) {
FineDarkLaf.setup();
} else {
try {
UIManager.setLookAndFeel(lookAndFeel);
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
}
}
FlatLaf.updateUI(); FlatLaf.updateUI();
FlatAnimatedLafChange.hideSnapshotWithAnimation(); FlatAnimatedLafChange.hideSnapshotWithAnimation();
jf.setSize(scale(600), scale(400)); jf.setSize(scale(600), scale(400));
@ -188,30 +198,26 @@ public class Storybook {
menu.setMnemonic(KeyEvent.VK_A); menu.setMnemonic(KeyEvent.VK_A);
menuBar.add(menu); menuBar.add(menu);
JMenuItem menuItem = new JMenuItem("Fine New UI", FineLightLaf fineLightLaf = new FineLightLaf();
JMenuItem menuItem = new JMenuItem(fineLightLaf.getName(),
KeyEvent.VK_T); KeyEvent.VK_T);
menuItem.setAccelerator(KeyStroke.getKeyStroke( menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_1, ActionEvent.ALT_MASK)); KeyEvent.VK_1, ActionEvent.ALT_MASK));
menuItem.addActionListener(e -> applyLookAndFeel(new FineLightLaf())); menuItem.addActionListener(e -> applyLookAndFeel(fineLightLaf));
menu.add(menuItem); menu.add(menuItem);
menuItem = new JMenuItem("Flat Dark", FineDarkLaf darkLaf = new FineDarkLaf();
menuItem = new JMenuItem(darkLaf.getName(),
KeyEvent.VK_T); KeyEvent.VK_T);
menuItem.setAccelerator(KeyStroke.getKeyStroke( menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_2, ActionEvent.ALT_MASK)); KeyEvent.VK_2, ActionEvent.ALT_MASK));
menuItem.addActionListener(e -> applyLookAndFeel(new FlatDarkLaf())); menuItem.addActionListener(e -> applyLookAndFeel(darkLaf));
menu.add(menuItem); menu.add(menuItem);
menuItem = new JMenuItem("Flat Light", KeyEvent.VK_T);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK));
menuItem.addActionListener(e -> applyLookAndFeel(new FlatLightLaf()));
menu.add(menuItem);
menuItem = new JMenuItem("FR11", menuItem = new JMenuItem("FR11",
KeyEvent.VK_T); KeyEvent.VK_T);
menuItem.setAccelerator(KeyStroke.getKeyStroke( menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_4, ActionEvent.ALT_MASK)); KeyEvent.VK_3, ActionEvent.ALT_MASK));
menuItem.addActionListener(e -> applyLookAndFeel(new UILookAndFeel())); menuItem.addActionListener(e -> applyLookAndFeel(new UILookAndFeel()));
menu.add(menuItem); menu.add(menuItem);

Loading…
Cancel
Save