Browse Source

Pull request #8995: REPORT-70955 许多场景不支持千分比样式

Merge in DESIGN/design from ~PENGDA/design:feature/x to feature/x

* commit 'bb28d112b9ebaa70e474d6f6af235b3e724776b7':
  REPORT-70955 许多场景不支持千分比样式
feature/x
pengda 2 years ago
parent
commit
a6ac6c54bf
  1. 17
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  3. 15
      designer-base/src/main/java/com/fr/design/style/FormatPane.java

17
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};

7
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);
}
}

15
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)) {

Loading…
Cancel
Save