diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 38aa9fd0c0..d54e531ace 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -111,6 +111,10 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("checkbox_part_checked", "com/fine/theme/icon/checkbox/part_checked.svg", true), new SvgIconSource("checkbox_hovered", "com/fine/theme/icon/checkbox/hovered.svg", true), + // radioButton相关icon + new SvgIconSource("radio_selected", "com/fine/theme/icon/radio/radio_selected.svg", true), + new SvgIconSource("radio_unselected", "com/fine/theme/icon/radio/radio_unselected.svg", true), + // 菜单栏Icon new SvgIconSource("bold", "com/fine/theme/icon/font/bold.svg"), new SvgIconSource("italic", "com/fine/theme/icon/font/italic.svg"), diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/ReportScrollBarUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/ReportScrollBarUI.java new file mode 100644 index 0000000000..650dccfbd6 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/ReportScrollBarUI.java @@ -0,0 +1,92 @@ +package com.fine.theme.light.ui; + +import com.formdev.flatlaf.ui.FlatScrollBarUI; +import com.formdev.flatlaf.ui.FlatUIUtils; + +import javax.swing.JComponent; +import javax.swing.JButton; +import javax.swing.UIManager; +import javax.swing.plaf.ComponentUI; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; + +/** + * 应用于主面板报表工作区的滚动条UI,提供给 {@link com.fr.design.cell.bar.DynamicScrollBar} 的UI类 + * + * @author Levy.Xie + * @since 11.0` + * Created on 2023/12/08 + */ +public class ReportScrollBarUI extends FlatScrollBarUI { + + /** + * 创建UI类 + * + * @param c 组件 + * @return ReportScrollBarUI + */ + public static ComponentUI createUI(JComponent c) { + return new ReportScrollBarUI(); + } + + @Override + public void installUI(JComponent c) { + super.installUI(c); + scrollBarWidth = UIManager.getInt("ScrollBar.largeBar.width"); + thumbInsets = UIManager.getInsets("ScrollBar.largeBar.thumbInsets"); + showButtons = UIManager.getBoolean("ScrollBar.largeBar.showButtons"); + trackColor = UIManager.getColor("ScrollBar.largeBar.track"); + } + + @Override + public void uninstallUI(JComponent c) { + super.uninstallUI(c); + } + + @Override + protected JButton createDecreaseButton(int orientation) { + return new ReportScrollBarButton(orientation); + } + + @Override + protected JButton createIncreaseButton(int orientation) { + return new ReportScrollBarButton(orientation); + } + + protected class ReportScrollBarButton extends FlatScrollBarButton { + + protected final Color defaultButtonBackground = UIManager.getColor("ScrollBar.largeBar.buttonBackground"); + + protected ReportScrollBarButton(int direction) { + super(direction); + } + + @Override + public void paint(Graphics g) { + Object[] oldRenderingHints = FlatUIUtils.setRenderingHints(g); + + // paint hover or pressed background + if (isEnabled()) { + Color background = (pressedBackground != null && isPressed()) + ? pressedBackground + : (hoverBackground != null && isHover() + ? hoverBackground + : null); + + if (background == null) { + background = defaultButtonBackground; + } + g.setColor(deriveBackground(background)); + paintBackground((Graphics2D) g); + } + + // paint arrow + g.setColor(deriveForeground(getArrowColor())); + paintArrow((Graphics2D) g); + + FlatUIUtils.resetRenderingHints(g, oldRenderingHints); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java index 7112e5d657..4f6114028b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java @@ -1,5 +1,6 @@ package com.fr.design.gui.ibutton; +import com.fine.theme.icon.LazyIcon; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; @@ -18,6 +19,11 @@ import java.awt.event.ItemListener; * Time: 下午5:04 */ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNameObserver { + + private static final Icon RADIO_SELECTED = new LazyIcon("radio_selected"); + private static final Icon RADIO_UNSELECTED = new LazyIcon("radio_unselected"); + private static final int RADIO_V_GAP = UIManager.getInt("RadioButton.vGap"); + private UIObserverListener uiObserverListener; private GlobalNameListener globalNameListener = null; private String radioButtonName = StringUtils.EMPTY; @@ -106,6 +112,9 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam private void initComponent() { this.setFocusPainted(false); + this.setIcon(RADIO_UNSELECTED); + this.setSelectedIcon(RADIO_SELECTED); + this.setBorder(BorderFactory.createEmptyBorder(RADIO_V_GAP, 0, RADIO_V_GAP, 0)); } /** @@ -137,6 +146,7 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam /** * 注册观察者监听事件 + * * @param listener 观察者监听事件 */ public void registerNameListener(GlobalNameListener listener) { @@ -144,7 +154,8 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam } /** - * 组件是否需要响应观察者事件 + * 组件是否需要响应观察者事件 + * * @return 如果需要响应观察者事件则返回true,否则返回false */ public boolean shouldResponseNameListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java index d7ec3db936..f91670eef0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java @@ -1,7 +1,6 @@ package com.fr.design.gui.iscrollbar; import javax.swing.*; -import java.awt.*; /** * UIScrollBar是没有下上的按钮的,宽为8像素 @@ -11,44 +10,13 @@ import java.awt.*; */ public class UIScrollBar extends JScrollBar { - /** - * - */ - private static final long serialVersionUID = 1L; - private int temp = 10; + private static final long serialVersionUID = 1L; - public UIScrollBar(){ + public UIScrollBar() { } - public UIScrollBar(int orientation) { - super(orientation); - } - - @Override - public Dimension getPreferredSize() { - return getOrientation() == UIScrollBar.VERTICAL ? - new Dimension(10, super.getPreferredSize().height) - : new Dimension(super.getPreferredSize().width, 10); - } - - @Override - public void setBackground(Color bg) { - super.setBackground(bg); - } - - @Override - /** - * 取得宽度 - */ - public int getWidth() { - return getOrientation() == UIScrollBar.VERTICAL ? temp : super.getWidth(); - } + public UIScrollBar(int orientation) { + super(orientation); + } - @Override - /** - * 取得高度 - */ - public int getHeight() { - return getOrientation() == UIScrollBar.HORIZONTAL ? temp : super.getHeight(); - } } \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_selected.svg b/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_selected.svg new file mode 100644 index 0000000000..c80d9475ec --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_selected.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_unselected.svg b/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_unselected.svg new file mode 100644 index 0000000000..f5d61b7597 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/radio/radio_unselected.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index f85fd82a16..dfbb032015 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -137,7 +137,7 @@ Component.defaultHeight=24 @accentButtonDefaultBorderColor = if(@accentColor, @accentColor, tint(@accentBase2Color,20%)) # for buttons within components (e.g. combobox or spinner) -@buttonArrowColor = tint(@foreground,40%) +@buttonArrowColor = #0A1C38 @buttonDisabledArrowColor = lighten(@buttonArrowColor,25%) @buttonHoverArrowColor = lighten(@buttonArrowColor,20%,derived noAutoInverse) @buttonPressedArrowColor = lighten(@buttonArrowColor,30%,derived noAutoInverse) @@ -298,7 +298,7 @@ ComboBox.buttonBackground = $ComboBox.background ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) ComboBox.buttonSeparatorColor = $ComboBox.background ComboBox.buttonDisabledSeparatorColor = $Component.disabledBorderColor -ComboBox.buttonArrowColor = #0A1C38 +ComboBox.buttonArrowColor = @buttonArrowColor ComboBox.buttonDisabledArrowColor = @buttonDisabledArrowColor ComboBox.buttonHoverArrowColor = #0A1C38 ComboBox.buttonPressedArrowColor = #0A1C38 @@ -601,13 +601,14 @@ ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @foreground, #---- RadioButton ---- -RadioButton.border = com.formdev.flatlaf.ui.FlatMarginBorder -RadioButton.icon = com.formdev.flatlaf.icons.FlatRadioButtonIcon -RadioButton.icon.centerDiameter = 8 -RadioButton.icon[filled].centerDiameter = 5 -RadioButton.margin = 2,2,2,2 +#RadioButton.border = com.formdev.flatlaf.ui.FlatMarginBorder +#RadioButton.icon = com.formdev.flatlaf.icons.FlatRadioButtonIcon +#RadioButton.icon.centerDiameter = 8 +#RadioButton.icon[filled].centerDiameter = 5 +#RadioButton.margin = 2,2,2,2 RadioButton.iconTextGap = 4 -RadioButton.rollover = true +RadioButton.vGap = 4 +#RadioButton.rollover = true #---- RadioButtonMenuItem ---- @@ -634,39 +635,44 @@ RootPane.inactiveBorderColor = darken(@background,30%,derived) #---- ScrollBar ---- -ScrollBar.width = 16 +ScrollBar.width = 10 ScrollBar.minimumButtonSize = 12,12 -ScrollBar.minimumThumbSize = 10,10 +ScrollBar.minimumThumbSize = 100,100 ScrollBar.maximumThumbSize = 100000,100000 ScrollBar.trackInsets = 0,0,0,0 -ScrollBar.thumbInsets = 0,0,0,0 +ScrollBar.thumbInsets = 0,2,0,2 ScrollBar.trackArc = 0 -ScrollBar.thumbArc = 0 +ScrollBar.thumbArc = 999 ScrollBar.hoverThumbWithTrack = false ScrollBar.pressedThumbWithTrack = false -ScrollBar.showButtons = true +ScrollBar.showButtons = false ScrollBar.squareButtons = false ScrollBar.buttonArrowColor = @buttonArrowColor ScrollBar.buttonDisabledArrowColor = @buttonDisabledArrowColor ScrollBar.allowsAbsolutePositioning = true -[mac]ScrollBar.minimumThumbSize = 18,18 -[mac]ScrollBar.thumbInsets = 2,2,2,2 +[mac]ScrollBar.minimumThumbSize = 6,12 +[mac]ScrollBar.thumbInsets = 0,2,0,2 [mac]ScrollBar.thumbArc = 999 [mac]ScrollBar.hoverThumbWithTrack = true -[linux]ScrollBar.minimumThumbSize = 18,18 -[linux]ScrollBar.thumbInsets = 2,2,2,2 +[linux]ScrollBar.minimumThumbSize = 6,12 +[linux]ScrollBar.thumbInsets = 2,0,2,0 [linux]ScrollBar.thumbArc = 999 -ScrollBar.track = lighten(@background,1%,derived noAutoInverse) -ScrollBar.thumb = darken($ScrollBar.track,10%,derived noAutoInverse) +ScrollBar.track = #00000000 +ScrollBar.thumb = #0a1c3833 ScrollBar.hoverTrackColor = darken($ScrollBar.track,3%,derived noAutoInverse) ScrollBar.hoverThumbColor = darken($ScrollBar.thumb,10%,derived noAutoInverse) -ScrollBar.pressedThumbColor = darken($ScrollBar.thumb,20%,derived noAutoInverse) +ScrollBar.pressedThumbColor = #0a1c3849 ScrollBar.hoverButtonBackground = darken(@background,5%,derived noAutoInverse) ScrollBar.pressedButtonBackground = darken(@background,10%,derived noAutoInverse) +ScrollBar.largeBar.width = 16 +ScrollBar.largeBar.track = #FFF +ScrollBar.largeBar.showButtons = true +ScrollBar.largeBar.thumbInsets = 0,4,0,4 +ScrollBar.largeBar.buttonBackground = $ScrollBar.track #---- ScrollPane ---- diff --git a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java index 3476b08740..9829b4e0d9 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java @@ -3,6 +3,7 @@ */ package com.fr.design.cell.bar; +import com.fine.theme.light.ui.ReportScrollBarUI; import com.fr.base.DynamicUnitList; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.GridUtils; @@ -35,6 +36,7 @@ public class DynamicScrollBar extends JScrollBar { this.setMinimum(0); this.setUnitIncrement(1); this.setBlockIncrement(3); + this.setUI(new ReportScrollBarUI()); this.addComponentListener(new ComponentListener() { public void componentResized(ComponentEvent e) { @@ -98,11 +100,6 @@ public class DynamicScrollBar extends JScrollBar { } } - -// public void updateUI() { -// setUI(new DynamicScrollBarUI()); -// } - @Override public void setValue(int value) { if (reportPane == null) {