From c26bf215ea83d5a105ea628e10fc55dd8fcdcb68 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 1 Aug 2016 09:09:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=A1=E9=AA=8C=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FieldEditorDefinePane.java | 20 ++++++++++--------- .../widget/ui/NumberEditorDefinePane.java | 16 ++++++++------- .../widget/ui/TextFieldEditorDefinePane.java | 19 +++++++++++------- .../design/designer/creator/XTextEditor.java | 9 +++++---- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index f454657e2d..f5172fd7c3 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -47,15 +47,7 @@ public abstract class FieldEditorDefinePane extends Abstr // 错误信息 JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); //目前只整改了文本、密码、文本域和数字四个控件 - if(!(this instanceof TextFieldEditorDefinePane)&&!(this instanceof NumberEditorDefinePane)){ - JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - this.add(northPane, BorderLayout.NORTH); - JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); - firstPanel.add(allowBlankCheckBox); - firstPanel.add(errorMsgPane); - northPane.add(firstPanel); - } + this.addAllowBlankPane(allowBlankCheckBox,errorMsgPane); errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); errorMsgTextField = new UITextField(16); errorMsgPane.add(errorMsgTextField); @@ -113,6 +105,16 @@ public abstract class FieldEditorDefinePane extends Abstr public void checkValid() throws Exception { } + + public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){ + JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + this.add(northPane, BorderLayout.NORTH); + JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); + firstPanel.add(allowBlankCheckBox); + firstPanel.add(errorMsgPane); + northPane.add(firstPanel); + } public UICheckBox getAllowBlankCheckBox(){ return allowBlankCheckBox; } diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index d322c5d39d..e4261061b2 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -125,9 +125,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMaxValueCheckBox.isSelected()) { - if (setMinValueCheckBox.isSelected()) { - minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); - } + if (setMinValueCheckBox.isSelected()) { + minValueModel.setMaximum(Double.parseDouble("" + maxValueSpinner.getValue())); + } } } }; @@ -137,9 +137,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane @Override public void stateChanged(ChangeEvent e) { if (setMinValueCheckBox.isSelected()) { - if (setMaxValueCheckBox.isSelected()) { - maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); - } + if (setMaxValueCheckBox.isSelected()) { + maxValueModel.setMinimum(Double.parseDouble("" + minValueSpinner.getValue())); + } } } }; @@ -315,5 +315,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane df.setAllowsInvalid(false); } } + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){} -} \ No newline at end of file + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 12003ec2b1..ecee0612b0 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -73,15 +74,15 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }; regPane.addPhoneRegListener(pl); - JPanel spp1 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); + JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); getAllowBlankCheckBox().setPreferredSize(new Dimension(444,40)); validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); - spp1.add(validateContent); - JPanel spp2 = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); + basicPane.add(validateContent); + JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane.addInputKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { @@ -102,9 +103,9 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }); - spp2.add(waterMarkDictPane); - contenter.add(spp2, BorderLayout.NORTH); - contenter.add(spp1, BorderLayout.CENTER); + advancedPane.add(waterMarkDictPane); + contenter.add(advancedPane, BorderLayout.NORTH); + contenter.add(basicPane, BorderLayout.CENTER); return attrPane; } @@ -138,4 +139,8 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane return new TextEditor(); } -} \ No newline at end of file + @Override + public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane){} + + + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java index 52ce652954..5586728e2d 100644 --- a/designer_form/src/com/fr/design/designer/creator/XTextEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XTextEditor.java @@ -19,10 +19,12 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import jdk.nashorn.internal.runtime.regexp.joni.Regex; /** * @author richer @@ -53,11 +55,10 @@ public class XTextEditor extends XWrapperedFieldEditor { Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {widgetValue},super.supportedDescriptor()); - Boolean displayRegField = false; - if((((TextEditor) toData()).getRegex() instanceof NoneReg) || ((TextEditor) toData()).getRegex()==null){ + Boolean displayRegField = true; + RegExp reg = ((TextEditor) toData()).getRegex(); + if(reg == null || reg.toRegText().equals("")){ displayRegField = false; - }else{ - displayRegField = true; } return displayRegField? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[] {regex, regErrorMessage, waterMark} ):