From 643e06a71ac3bc347470bdf77c726c16e0a27f0a Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 15 Dec 2023 10:59:37 +0800 Subject: [PATCH 1/2] REPORT-99485 RadioButtonStoryBoard --- .../fr/design/gui/storybook/Storybook.java | 8 ++- .../{ => components}/ButtonTabStoryBoard.java | 0 .../{ => components}/CheckBoxStoryBoard.java | 0 .../{ => components}/ComboBoxStoryBoard.java | 0 .../components/RadioButtonStoryBoard.java | 50 +++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) rename designer-base/src/test/java/com/fr/design/gui/storybook/{ => components}/ButtonTabStoryBoard.java (100%) rename designer-base/src/test/java/com/fr/design/gui/storybook/{ => components}/CheckBoxStoryBoard.java (100%) rename designer-base/src/test/java/com/fr/design/gui/storybook/{ => components}/ComboBoxStoryBoard.java (100%) create mode 100644 designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java index b1a6c81762..6517967adc 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java @@ -9,9 +9,13 @@ import com.formdev.flatlaf.extras.FlatAnimatedLafChange; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.storybook.components.ButtonStoryBoard; +import com.fr.design.gui.storybook.components.ButtonTabStoryBoard; +import com.fr.design.gui.storybook.components.CheckBoxStoryBoard; +import com.fr.design.gui.storybook.components.ComboBoxStoryBoard; import com.fr.design.gui.storybook.components.EastRegionContainer; import com.fr.design.gui.storybook.components.ExpandablePaneStoryBoard; import com.fr.design.gui.storybook.components.InputStoryBoard; +import com.fr.design.gui.storybook.components.RadioButtonStoryBoard; import com.fr.design.gui.storybook.components.SliderStoryBoard; import com.fr.design.gui.storybook.components.ToggleButtonStoryBoard; import com.fr.design.gui.storybook.components.ToolTipStoryBoard; @@ -36,7 +40,8 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; -import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineUIScale.scale; /** @@ -98,6 +103,7 @@ public class Storybook { components.add(new StoryBookComponent("ButtonTabGroup", new ButtonTabStoryBoard())); components.add(new StoryBookComponent("CheckBox", new CheckBoxStoryBoard())); components.add(new StoryBookComponent("ComboBox", new ComboBoxStoryBoard())); + components.add(new StoryBookComponent("RadioButton", new RadioButtonStoryBoard())); components.add(new StoryBookComponent("Input", new InputStoryBoard())); components.add(new StoryBookComponent("Slider", new SliderStoryBoard())); components.add(new StoryBookComponent("ToolTip", new ToolTipStoryBoard())); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/ButtonTabStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/ButtonTabStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/CheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/CheckBoxStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/ComboBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/ComboBoxStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java new file mode 100644 index 0000000000..a3db59e1b3 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java @@ -0,0 +1,50 @@ +package com.fr.design.gui.storybook.components; + +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; + +import javax.swing.ButtonGroup; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + +/** + * RadioButton + * + * @author vito + * @since 11.0 + * Created on 2023/12/14 + */ +public class RadioButtonStoryBoard extends StoryBoard { + + ButtonGroup buttonGroup = new ButtonGroup(); + ButtonGroup buttonGroup1 = new ButtonGroup(); + + public RadioButtonStoryBoard() { + super("单选按钮"); + add( + cell(new UILabel("普通")).with(it -> it.setFont(labelFont.deriveFont(14f))), + row(10, + cell(new UIRadioButton("选项一")).with(it -> { + buttonGroup.add(it); + buttonGroup.setSelected(it.getModel(), true); + }), + cell(new UIRadioButton("选项二")).with(it -> buttonGroup.add(it)), + cell(new UIRadioButton("选项三")).with(it -> buttonGroup.add(it)) + ), + cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + row(10, + cell(new UIRadioButton("选项一")).with(it -> { + buttonGroup1.add(it); + buttonGroup1.setSelected(it.getModel(), true); + }), + cell(new UIRadioButton("选项二")).with(it -> buttonGroup1.add(it)), + cell(new UIRadioButton("选项三")).with(it -> { + buttonGroup1.add(it); + it.setEnabled(false); + }) + ) + ); + } +} From 127fe12d5ba9eb7ec508b0143f2d0db34df12bf4 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 15 Dec 2023 11:02:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E6=BC=8F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/storybook/components/ButtonTabStoryBoard.java | 10 +++++----- .../gui/storybook/components/CheckBoxStoryBoard.java | 3 ++- .../gui/storybook/components/ComboBoxStoryBoard.java | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java index 3b36adba28..abfb4d7659 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java @@ -1,16 +1,16 @@ -package com.fr.design.gui.storybook; +package com.fr.design.gui.storybook.components; import com.fine.theme.icon.LazyIcon; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UITabGroup; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.theme.edit.ui.TabbedPane; +import com.fr.design.gui.storybook.StoryBoard; import com.fr.stable.ArrayUtils; +import javax.swing.Icon; -import javax.swing.*; - -import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; /** * Tab按钮组 diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java index e40c60af68..0e86de2e65 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java @@ -1,8 +1,9 @@ -package com.fr.design.gui.storybook; +package com.fr.design.gui.storybook.components; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; import java.awt.*; diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java index 9aa93f107f..34c3554950 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java @@ -1,7 +1,8 @@ -package com.fr.design.gui.storybook; +package com.fr.design.gui.storybook.components; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; import com.fr.stable.ArrayUtils; import java.awt.*;