From 51bfec255c83f56de09ae10ccdbc81ecaf581dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 10 Oct 2024 19:25:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-136650=20fix=EF=BC=9A=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E6=8C=89=E9=92=AE=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/ButtonGroupDictPane.java | 58 ++++++------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java index 752b6e44c8..14d9be0450 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java @@ -1,8 +1,9 @@ package com.fr.design.widget.ui; +import com.fine.swing.ui.layout.Row; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.Dictionary; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; @@ -11,11 +12,8 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.widget.FRWidgetFactory; import com.fr.form.ui.ButtonGroup; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; @@ -29,7 +27,7 @@ public class ButtonGroupDictPane extends JPanel { private UICheckBox adaptiveCheckbox; private UILabel columnLabel; private AccessibleDictionaryEditor dictPane; - private ReactiveCardPane reactiveCardPane; + private Row showColumn; public ButtonGroupDictPane() { @@ -41,51 +39,29 @@ public class ButtonGroupDictPane extends JPanel { */ public void initComponents() { dictPane = new AccessibleDictionaryEditor(); - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true); - adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - adaptiveCheckbox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean selected = adaptiveCheckbox.isSelected(); - if (selected) { - reactiveCardPane.select("adaptive").populate(); - } else { - reactiveCardPane.select("inadaptive").populate(); - } - } - }); UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")); this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); - - reactiveCardPane = ReactiveCardPane.create() - .addSupplier("adaptive", () -> column( - 10, - row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), - row(cell(adaptiveCheckbox)), - row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)) - ).getComponent() - ).addSupplier("inadaptive", () -> column( - 10, - row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), - row(cell(adaptiveCheckbox)) - ).getComponent()); - - reactiveCardPane.select("inadaptive").populate(); - this.add(reactiveCardPane); - + showColumn = row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)).getComponent(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true); + adaptiveCheckbox.setBorder(new ScaledEmptyBorder(0, 0, 0, 0)); + adaptiveCheckbox.addActionListener(e -> { + boolean selected = adaptiveCheckbox.isSelected(); + showColumn.setVisible(!selected); + }); + this.add(column(10, + row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), + row(cell(adaptiveCheckbox)), + cell(showColumn) + ).getComponent()); } public void populate(ButtonGroup buttonGroup) { dictPane.setValue(buttonGroup.getDictionary()); adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); boolean selected = adaptiveCheckbox.isSelected(); - if (selected) { - reactiveCardPane.select("adaptive").populate(); - } else { - reactiveCardPane.select("inadaptive").populate(); - } + showColumn.setVisible(!selected); columnSpinner.setValue(buttonGroup.getColumnsInRow()); }