From 74b1c75fc8176210a7ab30c779a720ac15cce5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 28 Mar 2024 17:37:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-116247=20=E3=80=90NewUI=E3=80=91?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E=E6=80=A7-=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=A0=B7=E5=BC=8F=E9=9D=A2=E6=9D=BF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/style/TextFormatPane.java | 74 ++++++++----------- 1 file changed, 30 insertions(+), 44 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index 790208bb6..c2fc1fddd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -1,8 +1,5 @@ package com.fr.design.gui.style; -import com.fine.swing.ui.layout.Column; -import com.fine.swing.ui.layout.Layouts; -import com.fine.swing.ui.layout.Row; import com.fine.theme.utils.FineUIUtils; import com.fr.base.CoreDecimalFormat; import com.fr.base.GraphHelper; @@ -16,7 +13,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.TextFontComboBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -43,9 +39,11 @@ import java.math.RoundingMode; import java.text.Format; import java.text.SimpleDateFormat; -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.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * @author Starryi @@ -79,7 +77,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private boolean isRightFormat; private boolean isDate = false; private GlobalNameListener globalNameListener = null; - protected ReactiveCardPane cardPane; public TextFormatPane() { @@ -89,6 +86,10 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName initPreviewLabel4GeneralFormat(); initLayout(); + + setTextFieldVisible(false); + setRoundingBoxVisible(false); + setPreviewLabelVisible(false); } private void initFormatTypesComboBox() { @@ -136,43 +137,33 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName protected void initLayout() { this.setLayout(new BorderLayout()); - cardPane = ReactiveCardPane.create() - .addSupplier("normal", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - createTypeRow() - ).getComponent()) - .addSupplier("preview", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - createTypeRow(), - createPreviewRow() - ).getComponent()) - .addSupplier("previewAndCheck", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - createTypeRow(), - createPreviewRow(), - createRoundBoxRow() - ).getComponent()); - cardPane.select("normal").populate(); - this.add(cardPane); + this.add(column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"))).weight(LEFT_WEIGHT), + cell(typeComboBox).weight(RIGHT_WEIGHT) + ), + cell(textField), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(LEFT_WEIGHT), + cell(roundingBox).weight(RIGHT_WEIGHT) + ), + cell(previewLabel) + ).getComponent()); } - private Cell createTypeRow() { - return row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"))).weight(1.2), - cell(typeComboBox).weight(3) - ); + protected void setTextFieldVisible(boolean visible) { + textField.setVisible(visible); } - private Cell createRoundBoxRow() { - return row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(1.2), - cell(roundingBox).with(it -> it.setBorder(null)).weight(3) - ); + protected void setRoundingBoxVisible(boolean visible) { + roundingBox.getParent().setVisible(visible); } - private Cell createPreviewRow() { - return row( - cell(previewLabel).weight(1) - ); + protected void setPreviewLabelVisible(boolean visible) { + previewLabel.setVisible(visible); } + protected UIComboBoxRenderer createComBoxRender() { return new UIComboBoxRenderer() { @Override @@ -314,11 +305,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName return contents == FormatContents.TEXT || contents == FormatContents.NULL; } - private boolean isRoundFormat() { - int contents = getFormatContents(); - return contents == FormatContents.PERCENT || contents == FormatContents.THOUSANDTHS; - } - /** * Radio selection listener. */ @@ -328,16 +314,16 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int contents = getFormatContents(); - Column contentContainer; + if (!isTextOrNull()) { textField.removeAllItems(); String[] items = FormatField.getInstance().getFormatArray(contents, false); textField.setItemArray(items); textField.setSelectedIndex(0); - cardPane.select(isRoundFormat() ? "previewAndCheck" : "preview").populate(); - } else { - cardPane.select("normal").populate(); } + setTextFieldVisible(!isTextOrNull()); + setPreviewLabelVisible(!isTextOrNull()); + setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT || getFormatContents() == FormatContents.THOUSANDTHS); } }