From de13436dbb41715a419592bc3544e56a2de606f8 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 31 Oct 2017 12:48:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/tabledatapane/FileTableDataPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index c27373d59d..db98a6928b 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -90,6 +90,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private Parameter[] params; private JPanel filePath; private XMLNodeTreePane nodeTreePane; + private JPanel textSetPanel; private UICheckBox needColumnNameCheckBox;// 第一行是否作为标题 private UIRadioButton tableDismemberRadioButton;// 制表符 @@ -150,8 +151,8 @@ public class FileTableDataPane extends AbstractTableDataPane { southPanel.add(setPanel, BorderLayout.CENTER); setPanel.setPreferredSize(new Dimension(setPanelWidth, 460)); setPanel.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("FR-Designer_Set"))); - JPanel controlPane = textSetPanel(width,height); - setPanel.add(controlPane, BorderLayout.NORTH); + textSetPanel = textSetPanel(width,height); + setPanel.add(textSetPanel, BorderLayout.NORTH); fileTypeComboBox.addActionListener(getFileTypeListener(setPanel,width,height)); this.add(northPanel, BorderLayout.NORTH); @@ -464,7 +465,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } else if (fileTypeComboBox.getSelectedIndex() == EXCEL) { setPanel.add(excelSetPanel(width,height), BorderLayout.NORTH); } else { - setPanel.add(textSetPanel(width,height), BorderLayout.NORTH); + setPanel.add(textSetPanel, BorderLayout.NORTH); } String tipContent = Inter.getLocText("FR-Designer-Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "
" + "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp
" + "  "; From c9cc266f07f2b6d816c45d10512596b705d4d14d Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 31 Oct 2017 16:33:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-5277=20[9.0=E4=B8=89=E8=BD=AE?= =?UTF-8?q?=E5=9B=9E=E5=BD=92]=E6=95=B0=E5=AD=97=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=9C=80=E5=A4=A7=E5=80=BC=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E7=A7=BB=E5=87=BA=E7=84=A6=E7=82=B9=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itextfield/UINumberField.java | 2 +- .../component/NumberEditorValidatePane.java | 64 +++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/itextfield/UINumberField.java b/designer_base/src/com/fr/design/gui/itextfield/UINumberField.java index 54c8820363..9b88911ade 100644 --- a/designer_base/src/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer_base/src/com/fr/design/gui/itextfield/UINumberField.java @@ -185,8 +185,8 @@ public class UINumberField extends UITextField { // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. private boolean notChange(String strNew) { boolean noChange = false; - strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数 boolean isMinus = strNew.startsWith("-"); + strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数 String strIntPart; String strDecPart = StringUtils.EMPTY; int decPos = strNew.indexOf(CoreConstants.DOT); diff --git a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java index bc2612aa67..feaaf67dc1 100644 --- a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -29,10 +29,8 @@ public class NumberEditorValidatePane extends JPanel { private UICheckBox allowNegativeCheckBox; private UICheckBox setMaxValueCheckBox; private UICheckBox setMinValueCheckBox; - private UIBasicSpinner maxValueSpinner; - private SpinnerNumberModel maxValueModel; - private UIBasicSpinner minValueSpinner; - private SpinnerNumberModel minValueModel; + private UISpinner maxValueSpinner; + private UISpinner minValueSpinner; private UISpinner decimalLength; private JPanel limitNumberPane; private UITextField errorMsgTextField; @@ -66,13 +64,11 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); setMaxValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); - setNotAllowsInvalid(this.maxValueSpinner); + this.maxValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); this.setMaxValueCheckBox.addActionListener(setMaxListener); this.maxValueSpinner.addChangeListener(maxValueChangeListener); this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false); - this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); - setNotAllowsInvalid(this.minValueSpinner); + this.minValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); minValueSpinner.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.setMinValueCheckBox.addActionListener(setMinListener); this.minValueSpinner.addChangeListener(minValueChangeListener); @@ -126,14 +122,14 @@ public class NumberEditorValidatePane extends JPanel { @Override public void actionPerformed(ActionEvent e) { if (allowNegativeCheckBox.isSelected()) { - minValueModel.setMinimum(-Double.MAX_VALUE); + minValueSpinner.getTextField().setMinValue(-Double.MAX_VALUE); if (!setMinValueCheckBox.isSelected()) { - maxValueModel.setMinimum(-Double.MAX_VALUE); + maxValueSpinner.getTextField().setMinValue(-Double.MAX_VALUE); } } else { - minValueModel.setMinimum(0.0); + minValueSpinner.getTextField().setMinValue(0.0); if (!setMinValueCheckBox.isSelected()) { - maxValueModel.setMinimum(0.0); + maxValueSpinner.getTextField().setMinValue(0.0); } Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); @@ -162,7 +158,7 @@ public class NumberEditorValidatePane extends JPanel { maxValueSpinner.setValue(value); } else { maxValueSpinner.setEnabled(false); - minValueModel.setMaximum(Double.MAX_VALUE); + minValueSpinner.getTextField().setMaxValue(Double.MAX_VALUE); } } }; @@ -180,9 +176,10 @@ public class NumberEditorValidatePane extends JPanel { } } minValueSpinner.setValue(value); + maxValueSpinner.getTextField().setMinValue(value); } else { minValueSpinner.setEnabled(false); - maxValueModel.setMinimum(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); + maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); } } }; @@ -192,8 +189,10 @@ public class NumberEditorValidatePane extends JPanel { @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + if (maxValueSpinner.getValue() >= minValueSpinner.getValue()) { + minValueSpinner.getTextField().setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue())); + } else { + maxValueSpinner.setValue(minValueSpinner.getValue()); } } } @@ -204,26 +203,16 @@ public class NumberEditorValidatePane extends JPanel { @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + if (minValueSpinner.getValue() <= maxValueSpinner.getValue()) { + maxValueSpinner.getTextField().setMinValue(Double.parseDouble("" + minValueSpinner.getValue())); + } else { + minValueSpinner.setValue(maxValueSpinner.getValue()); } } } }; } - private void setNotAllowsInvalid(UIBasicSpinner jspinner) { - JComponent editor = jspinner.getEditor(); - if (editor instanceof UIBasicSpinner.DefaultEditor) { - JFormattedTextField ftf = ((UIBasicSpinner.DefaultEditor) editor).getTextField(); - ftf.setColumns(10); - JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter(); - DefaultFormatter df = (DefaultFormatter) formatter; - df.setAllowsInvalid(false); - } - } - - public void populate(NumberEditor e) { allowDecimalsCheckBox.setSelected(e.isAllowDecimals()); if (e.isAllowDecimals()) { @@ -235,7 +224,6 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setSelected(e.isAllowNegative()); if (e.getMaxValue() == Double.MAX_VALUE) { setMaxValueCheckBox.setSelected(false); -// maxValueFieldPane.setVisible(false); maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); maxValueSpinner.setEnabled(false); } else { @@ -271,13 +259,23 @@ public class NumberEditorValidatePane extends JPanel { ob.setAllowNegative(allowNegativeCheckBox.isSelected()); if (setMaxValueCheckBox.isSelected()) { - ob.setMaxValue(Double.parseDouble(StringUtils.EMPTY + maxValueSpinner.getValue())); + 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()) { - ob.setMinValue(Double.parseDouble(StringUtils.EMPTY + minValueSpinner.getValue())); + 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); }