Browse Source

控件校验完善

master
kerry 9 years ago
parent
commit
c26bf215ea
  1. 20
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  2. 16
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  3. 19
      designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  4. 9
      designer_form/src/com/fr/design/designer/creator/XTextEditor.java

20
designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -47,15 +47,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> 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<T extends FieldEditor> 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;
}

16
designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -125,9 +125,9 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
@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<NumberEditor>
@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<NumberEditor>
df.setAllowsInvalid(false);
}
}
@Override
public void addAllowBlankPane(UICheckBox allowBlankCheckBox,JPanel errorMsgPane){}
}
}

19
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<TextEditor>
}
};
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<TextEditor>
}
});
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<TextEditor>
return new TextEditor();
}
}
@Override
public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane){}
}

9
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} ):

Loading…
Cancel
Save