|
|
|
@ -14,10 +14,13 @@ import javax.swing.JPanel;
|
|
|
|
|
import javax.swing.SpinnerNumberModel; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import javax.swing.text.DefaultFormatter; |
|
|
|
|
|
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.ispinner.UIBasicSpinner; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.form.ui.NumberEditor; |
|
|
|
|
import com.fr.general.Inter; |
|
|
|
@ -39,6 +42,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
private com.fr.design.editor.editor.IntegerEditor decimalLength; |
|
|
|
|
private JPanel limitNumberPane; |
|
|
|
|
private WaterMarkDictPane waterMarkDictPane; |
|
|
|
|
private UITextField regErrorMsgTextField; |
|
|
|
|
|
|
|
|
|
private ActionListener actionListener1 = new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@ -153,26 +157,34 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
@Override |
|
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
|
JPanel content = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
content.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
|
|
|
|
content.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
|
|
|
|
content.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
// richer:数字的允许直接编辑没有意义
|
|
|
|
|
|
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); |
|
|
|
|
content.add(northPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
|
northPane.add(waterMarkDictPane); |
|
|
|
|
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); |
|
|
|
|
JPanel validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
validatePane.setPreferredSize(new Dimension(400,200)); |
|
|
|
|
centerPane.add(validatePane); |
|
|
|
|
content.add(northPane, BorderLayout.NORTH); |
|
|
|
|
content.add(centerPane, BorderLayout.CENTER); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); |
|
|
|
|
|
|
|
|
|
this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); |
|
|
|
|
this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); |
|
|
|
|
this.decimalLength.setColumns(4); |
|
|
|
|
limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, |
|
|
|
|
FlowLayout.LEFT, 4); |
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); |
|
|
|
|
this.allowDecimalsCheckBox.addActionListener(actionListener1); |
|
|
|
|
|
|
|
|
|
this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); |
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); |
|
|
|
|
this.allowNegativeCheckBox.addActionListener(actionListener2); |
|
|
|
|
|
|
|
|
|
this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); |
|
|
|
@ -180,7 +192,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
|
|
|
|
maxValueSpinner.setPreferredSize(new Dimension(120, 20)); |
|
|
|
|
setNotAllowsInvalid(this.maxValueSpinner); |
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); |
|
|
|
|
this.maxValueSpinner.setVisible(false); |
|
|
|
|
this.setMaxValueCheckBox.addActionListener(actionListener3); |
|
|
|
|
this.maxValueSpinner.addChangeListener(changeListener1); |
|
|
|
@ -189,10 +201,29 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); |
|
|
|
|
minValueSpinner.setPreferredSize(new Dimension(120, 20)); |
|
|
|
|
setNotAllowsInvalid(this.minValueSpinner); |
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); |
|
|
|
|
this.minValueSpinner.setVisible(false); |
|
|
|
|
this.setMinValueCheckBox.addActionListener(actionListener4); |
|
|
|
|
this.minValueSpinner.addChangeListener(changeListener2); |
|
|
|
|
|
|
|
|
|
regErrorMsgTextField = new UITextField(16); |
|
|
|
|
validatePane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); |
|
|
|
|
|
|
|
|
|
regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
|
|
|
|
|
|
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -227,7 +258,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
minValueSpinner.setVisible(true); |
|
|
|
|
minValueSpinner.setValue(new Double(e.getMinValue())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.regErrorMsgTextField.setText(e.getRegErrorMessage()); |
|
|
|
|
this.waterMarkDictPane.populate(e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -255,6 +286,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
|
|
|
|
|
|
|
|
|
|
this.waterMarkDictPane.update(ob); |
|
|
|
|
|
|
|
|
|
ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); |
|
|
|
|
|
|
|
|
|
return ob; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|