Browse Source

Merge branch 'release/9.0' of http://cloud.finedevelop.com:2015/scm/~plough/design into release/9.0

master
plough 7 years ago
parent
commit
83d8cde03a
  1. 7
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  2. 2
      designer_base/src/com/fr/design/gui/itextfield/UINumberField.java
  3. 64
      designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java

7
designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -90,6 +90,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
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<FileTableData> {
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<FileTableData> {
} 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() + "<br>"
+ "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp<br>" + "&nbsp</body> </html> ";

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

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

Loading…
Cancel
Save