Browse Source

控件校验完善

master
kerry 8 years ago
parent
commit
c7fad3e336
  1. 21
      designer_form/src/com/fr/design/designer/creator/XTextEditor.java

21
designer_form/src/com/fr/design/designer/creator/XTextEditor.java

@ -24,6 +24,7 @@ import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
/**
@ -38,31 +39,33 @@ public class XTextEditor extends XWrapperedFieldEditor {
/**
* 控件的属性列表
*
* @return 此控件所用的属性列表
* @throws IntrospectionException 异常
*/
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor widgetValue=new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
CRPropertyDescriptor widgetValue = new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(
WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
CRPropertyDescriptor regex= new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName(
CRPropertyDescriptor regex = new CRPropertyDescriptor("regex", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Input_Rule")).setEditorClass(RegexEditor.class).putKeyValue(
"renderer", RegexCellRencerer.class).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
CRPropertyDescriptor regErrorMessage=new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName(
CRPropertyDescriptor regErrorMessage = new CRPropertyDescriptor("regErrorMessage", this.data.getClass()).setI18NName(
Inter.getLocText("Verify-Message")).putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate");
CRPropertyDescriptor waterMark= new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName(
CRPropertyDescriptor waterMark = new CRPropertyDescriptor("waterMark", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_WaterMark")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced");
CRPropertyDescriptor[] sup=(CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[] {widgetValue},super.supportedDescriptor());
CRPropertyDescriptor[] sup = (CRPropertyDescriptor[]) ArrayUtils.addAll(new CRPropertyDescriptor[]{widgetValue}, super.supportedDescriptor());
Boolean displayRegField = true;
RegExp reg = ((TextEditor) toData()).getRegex();
if(reg == null || reg.toRegText().equals("")){
if (reg == null || !StringUtils.isNotEmpty(reg.toRegText())) {
displayRegField = false;
}
return displayRegField? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,
new CRPropertyDescriptor[] {regex, regErrorMessage, waterMark} ):
(CRPropertyDescriptor[]) ArrayUtils.addAll(sup,new CRPropertyDescriptor[] {regex, waterMark});
return displayRegField ? (CRPropertyDescriptor[]) ArrayUtils.addAll(sup,
new CRPropertyDescriptor[]{regex, regErrorMessage, waterMark}) :
(CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark});
}
@Override

Loading…
Cancel
Save