From bb28d112b9ebaa70e474d6f6af235b3e724776b7 Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 20 May 2022 11:12:36 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-70955=20=E8=AE=B8=E5=A4=9A=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E4=B8=8D=E6=94=AF=E6=8C=81=E5=8D=83=E5=88=86=E6=AF=94?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 17 ++++++++++++++--- .../com/fr/design/gui/style/TextFormatPane.java | 7 +++++-- .../java/com/fr/design/style/FormatPane.java | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index ba68ab36f..aeac730c9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -24,12 +24,22 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import java.math.BigDecimal; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; import java.math.RoundingMode; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.TitledBorder; -import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.text.Format; @@ -54,6 +64,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse private static final Integer[] TYPES = new Integer[]{ FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, + FormatContents.THOUSANDTHS, FormatContents.SCIENTIFIC, FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; 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 a477cb16c..0b8e8287a 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 @@ -58,7 +58,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName private static final Integer[] TYPES = new Integer[]{ FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, - FormatContents.SCIENTIFIC, + FormatContents.THOUSANDTHS, FormatContents.SCIENTIFIC, FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; @@ -228,6 +228,9 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName this.roundingBox.setSelected(((CoreDecimalFormat) format).getRoundingMode().equals(RoundingMode.HALF_UP)); } else if (pattern.indexOf("E") > 0) { setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern); + } else if (pattern.indexOf("‰") > 0) { + setPatternComboBoxAndList(FormatContents.THOUSANDTHS, pattern); + this.roundingBox.setSelected(((CoreDecimalFormat) format).getRoundingMode().equals(RoundingMode.HALF_UP)); } else { setPatternComboBoxAndList(FormatContents.NUMBER, pattern); } @@ -345,7 +348,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName } setTextFieldVisible(!isTextOrNull()); setPreviewLabelVisible(!isTextOrNull()); - setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT); + setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT || getFormatContents() == FormatContents.THOUSANDTHS); } } diff --git a/designer-base/src/main/java/com/fr/design/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/style/FormatPane.java index d1679561d..3f5d8fa0f 100644 --- a/designer-base/src/main/java/com/fr/design/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/style/FormatPane.java @@ -52,6 +52,7 @@ public class FormatPane extends BasicPane { private UIRadioButton numberRadioButton; private UIRadioButton currencyRadioButton; private UIRadioButton percentRadioButton; + private UIRadioButton thousandthsRadioButton; private UIRadioButton scientificRadioButton; private UIRadioButton dateRadioButton; private UIRadioButton timeRadioButton; @@ -99,6 +100,7 @@ public class FormatPane extends BasicPane { categoryButtonGroup.add(numberRadioButton); categoryButtonGroup.add(currencyRadioButton); categoryButtonGroup.add(percentRadioButton); + categoryButtonGroup.add(thousandthsRadioButton); categoryButtonGroup.add(scientificRadioButton); categoryButtonGroup.add(dateRadioButton); categoryButtonGroup.add(timeRadioButton); @@ -108,6 +110,7 @@ public class FormatPane extends BasicPane { leftControlPane.add(this.createRadioCenterPane(numberRadioButton)); leftControlPane.add(this.createRadioCenterPane(currencyRadioButton)); leftControlPane.add(this.createRadioCenterPane(percentRadioButton)); + leftControlPane.add(this.createRadioCenterPane(thousandthsRadioButton)); leftControlPane.add(this.createRadioCenterPane(scientificRadioButton)); leftControlPane.add(this.createRadioCenterPane(dateRadioButton)); leftControlPane.add(this.createRadioCenterPane(timeRadioButton)); @@ -136,6 +139,8 @@ public class FormatPane extends BasicPane { currencyRadioButton.setMnemonic('C'); percentRadioButton = new UIRadioButton(FormatField.getInstance().getName(FormatContents.PERCENT)); percentRadioButton.setMnemonic('P'); + thousandthsRadioButton = new UIRadioButton(FormatField.getInstance().getName(FormatContents.THOUSANDTHS)); + thousandthsRadioButton.setMnemonic('Q'); scientificRadioButton = new UIRadioButton(FormatField.getInstance().getName(FormatContents.SCIENTIFIC)); scientificRadioButton.setMnemonic('S'); dateRadioButton = new UIRadioButton(FormatField.getInstance().getName(FormatContents.DATE)); @@ -149,6 +154,7 @@ public class FormatPane extends BasicPane { numberRadioButton.addActionListener(radioActionListener); currencyRadioButton.addActionListener(radioActionListener); percentRadioButton.addActionListener(radioActionListener); + thousandthsRadioButton.addActionListener(radioActionListener); scientificRadioButton.addActionListener(radioActionListener); dateRadioButton.addActionListener(radioActionListener); timeRadioButton.addActionListener(radioActionListener); @@ -234,6 +240,9 @@ public class FormatPane extends BasicPane { } else if (pattern.endsWith("%")) { this.percentRadioButton.setSelected(true); this.applyRadioActionListener(this.percentRadioButton); + } else if (pattern.equals("‰")){ + this.thousandthsRadioButton.setSelected(true); + this.applyRadioActionListener(this.thousandthsRadioButton); } else if (pattern.indexOf("E") > 0) { this.scientificRadioButton.setSelected(true); this.applyRadioActionListener(this.scientificRadioButton); @@ -259,6 +268,7 @@ public class FormatPane extends BasicPane { scientificRadioButton.setEnabled(false); textRadioButton.setEnabled(false); percentRadioButton.setEnabled(false); + thousandthsRadioButton.setEnabled(false); nullRadioButton.setEnabled(false); dateRadioButton.setEnabled(false); timeRadioButton.setEnabled(false); @@ -285,6 +295,7 @@ public class FormatPane extends BasicPane { numberRadioButton.setEnabled(false); currencyRadioButton.setEnabled(false); percentRadioButton.addActionListener(radioActionListener); + thousandthsRadioButton.setEnabled(false); scientificRadioButton.setEnabled(false); dateRadioButton.setEnabled(false); timeRadioButton.setEnabled(false); @@ -333,6 +344,8 @@ public class FormatPane extends BasicPane { return FormatContents.CURRENCY; else if (percentRadioButton.isSelected()) return FormatContents.PERCENT; + else if (thousandthsRadioButton.isSelected()) + return FormatContents.THOUSANDTHS; else if (scientificRadioButton.isSelected()) return FormatContents.SCIENTIFIC; else if (dateRadioButton.isSelected()) @@ -453,6 +466,8 @@ public class FormatPane extends BasicPane { contents = FormatContents.CURRENCY; } else if (ComparatorUtils.equals(source,percentRadioButton)) { contents = FormatContents.PERCENT; + }else if (ComparatorUtils.equals(source,thousandthsRadioButton)){ + contents = FormatContents.THOUSANDTHS; } else if (ComparatorUtils.equals(source,scientificRadioButton)) { contents = FormatContents.SCIENTIFIC; } else if (ComparatorUtils.equals(source,dateRadioButton)) {