Browse Source

REPORT-136650 fix:控件自适应按钮交互异常修复

fbp/merge
Levy.Xie-解安森 3 months ago
parent
commit
51bfec255c
  1. 58
      designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java

58
designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java

@ -1,8 +1,9 @@
package com.fr.design.widget.ui; 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.data.Dictionary;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; 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.design.widget.FRWidgetFactory;
import com.fr.form.ui.ButtonGroup; import com.fr.form.ui.ButtonGroup;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel; 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.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
@ -29,7 +27,7 @@ public class ButtonGroupDictPane extends JPanel {
private UICheckBox adaptiveCheckbox; private UICheckBox adaptiveCheckbox;
private UILabel columnLabel; private UILabel columnLabel;
private AccessibleDictionaryEditor dictPane; private AccessibleDictionaryEditor dictPane;
private ReactiveCardPane reactiveCardPane; private Row showColumn;
public ButtonGroupDictPane() { public ButtonGroupDictPane() {
@ -41,51 +39,29 @@ public class ButtonGroupDictPane extends JPanel {
*/ */
public void initComponents() { public void initComponents() {
dictPane = new AccessibleDictionaryEditor(); 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")); 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); 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)); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
showColumn = row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)).getComponent();
reactiveCardPane = ReactiveCardPane.create() this.setLayout(FRGUIPaneFactory.createBorderLayout());
.addSupplier("adaptive", () -> column( adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
10, adaptiveCheckbox.setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), adaptiveCheckbox.addActionListener(e -> {
row(cell(adaptiveCheckbox)), boolean selected = adaptiveCheckbox.isSelected();
row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)) showColumn.setVisible(!selected);
).getComponent() });
).addSupplier("inadaptive", () -> column( this.add(column(10,
10, row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)), row(cell(adaptiveCheckbox)),
row(cell(adaptiveCheckbox)) cell(showColumn)
).getComponent()); ).getComponent());
reactiveCardPane.select("inadaptive").populate();
this.add(reactiveCardPane);
} }
public void populate(ButtonGroup buttonGroup) { public void populate(ButtonGroup buttonGroup) {
dictPane.setValue(buttonGroup.getDictionary()); dictPane.setValue(buttonGroup.getDictionary());
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
boolean selected = adaptiveCheckbox.isSelected(); boolean selected = adaptiveCheckbox.isSelected();
if (selected) { showColumn.setVisible(!selected);
reactiveCardPane.select("adaptive").populate();
} else {
reactiveCardPane.select("inadaptive").populate();
}
columnSpinner.setValue(buttonGroup.getColumnsInRow()); columnSpinner.setValue(buttonGroup.getColumnsInRow());
} }

Loading…
Cancel
Save