Browse Source

REPORT-9267 REPORT-9391

master
Mata.Li 6 years ago
parent
commit
733f7c538b
  1. 3
      designer-base/src/com/fr/design/gui/itextfield/UINumberField.java
  2. 28
      designer-base/src/com/fr/design/widget/component/NumberEditorValidatePane.java
  3. 24
      designer-realize/src/com/fr/design/present/PresentPane.java

3
designer-base/src/com/fr/design/gui/itextfield/UINumberField.java

@ -106,7 +106,8 @@ public class UINumberField extends UITextField {
*/ */
public double getValue() throws NumberFormatException { public double getValue() throws NumberFormatException {
try { try {
if (this.getText().length() == 0) { //如果只输入了负号应该解释为0,而不是Double最大值
if (this.getText().length() == 0 || "-".equals(this.getText())) {
return 0; return 0;
} }

28
designer-base/src/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -188,11 +188,11 @@ public class NumberEditorValidatePane extends JPanel {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (setMaxValueCheckBox.isSelected()) { if (setMinValueCheckBox.isSelected()) {
if (maxValueSpinner.getValue() >= minValueSpinner.getValue()) { if (maxValueSpinner.getValue() >= minValueSpinner.getValue()) {
minValueSpinner.getTextField().setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue())); minValueSpinner.getTextField().setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue()));
} else { } else {
maxValueSpinner.setValue(minValueSpinner.getValue()); minValueSpinner.setValue(maxValueSpinner.getValue());
} }
} }
} }
@ -202,11 +202,11 @@ public class NumberEditorValidatePane extends JPanel {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (setMinValueCheckBox.isSelected()) { if (setMaxValueCheckBox.isSelected()) {
if (minValueSpinner.getValue() <= maxValueSpinner.getValue()) { if (minValueSpinner.getValue() <= maxValueSpinner.getValue()) {
maxValueSpinner.getTextField().setMinValue(Double.parseDouble("" + minValueSpinner.getValue())); maxValueSpinner.getTextField().setMinValue(Double.parseDouble("" + minValueSpinner.getValue()));
} else { } else {
minValueSpinner.setValue(maxValueSpinner.getValue()); maxValueSpinner.setValue(minValueSpinner.getValue());
} }
} }
} }
@ -258,27 +258,7 @@ public class NumberEditorValidatePane extends JPanel {
} }
ob.setAllowNegative(allowNegativeCheckBox.isSelected()); ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMaxValueCheckBox.isSelected()) {
if (maxValueSpinner.getValue() < maxValueSpinner.getTextField().getMinValue()) {
ob.setMaxValue(Double.parseDouble(StringUtils.EMPTY + maxValueSpinner.getTextField().getMinValue()));
maxValueSpinner.getTextField().setValue(maxValueSpinner.getTextField().getMaxValue());
} else {
ob.setMaxValue(Double.parseDouble(StringUtils.EMPTY + maxValueSpinner.getValue()));
}
} else {
ob.setMaxValue(Double.MAX_VALUE);
}
if (setMinValueCheckBox.isSelected()) {
if (minValueSpinner.getValue() > minValueSpinner.getTextField().getMaxValue()) {
ob.setMinValue(Double.parseDouble(StringUtils.EMPTY + minValueSpinner.getTextField().getMaxValue()));
minValueSpinner.getTextField().setValue(minValueSpinner.getTextField().getMaxValue());
} else {
ob.setMinValue(Double.parseDouble(StringUtils.EMPTY + minValueSpinner.getValue()));
}
} else {
ob.setMinValue(-Double.MAX_VALUE);
}
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){
errorMsgTextFieldPane.setVisible(true); errorMsgTextFieldPane.setVisible(true);
}else{ }else{

24
designer-realize/src/com/fr/design/present/PresentPane.java

@ -25,6 +25,9 @@ import java.util.Set;
*/ */
public class PresentPane extends UIComboBoxPane<Present> { public class PresentPane extends UIComboBoxPane<Present> {
private DictPresentPane dictPresentPane; private DictPresentPane dictPresentPane;
private FormulaPresentPane formulaPresentPane;
private BarCodePane barCodePane;
private CurrencyLinePane currencyLinePane;
private List<String> keys; private List<String> keys;
private List<String> displays; private List<String> displays;
@ -51,6 +54,9 @@ public class PresentPane extends UIComboBoxPane<Present> {
public void populateBean(Present ob) { public void populateBean(Present ob) {
if(ob == null) { if(ob == null) {
dictPresentPane.reset(); dictPresentPane.reset();
formulaPresentPane.reset();
barCodePane.reset();
currencyLinePane.reset();
} }
super.populateBean(ob); super.populateBean(ob);
} }
@ -74,20 +80,20 @@ public class PresentPane extends UIComboBoxPane<Present> {
keys.add(DictPresent.class.getName()); keys.add(DictPresent.class.getName());
displays.add(dictPresentPane.title4PopupWindow()); displays.add(dictPresentPane.title4PopupWindow());
FurtherBasicBeanPane<BarcodePresent> bar = new BarCodePane(); barCodePane = new BarCodePane();
paneList.add(bar); paneList.add(barCodePane);
keys.add(BarcodePresent.class.getName()); keys.add(BarcodePresent.class.getName());
displays.add(bar.title4PopupWindow()); displays.add(barCodePane.title4PopupWindow());
FurtherBasicBeanPane<FormulaPresent> formula = new FormulaPresentPane(); formulaPresentPane = new FormulaPresentPane();
paneList.add(formula); paneList.add(formulaPresentPane);
keys.add(FormulaPresent.class.getName()); keys.add(FormulaPresent.class.getName());
displays.add(formula.title4PopupWindow()); displays.add(formulaPresentPane.title4PopupWindow());
FurtherBasicBeanPane<CurrencyLinePresent> currency = new CurrencyLinePane(); currencyLinePane = new CurrencyLinePane();
paneList.add(currency); paneList.add(currencyLinePane);
keys.add(CurrencyLinePresent.class.getName()); keys.add(CurrencyLinePresent.class.getName());
displays.add(currency.title4PopupWindow()); displays.add(currencyLinePane.title4PopupWindow());
Set<PresentKindProvider> providers = ExtraDesignClassManager.getInstance().getArray(PresentKindProvider.MARK_STRING); Set<PresentKindProvider> providers = ExtraDesignClassManager.getInstance().getArray(PresentKindProvider.MARK_STRING);
for (PresentKindProvider provider : providers) { for (PresentKindProvider provider : providers) {

Loading…
Cancel
Save