Package easyJ.common.validate

Examples of easyJ.common.validate.ValidateErrors


        }
        super.process(request, response, application);
    }

    public boolean encapsulateObject() throws EasyJException {
        errors = new ValidateErrors();
        // 从客户端传来的处理数据
        object = BeanUtil.getObject(className, properties, errors);

        // 只有是在用户进行更新操作的时候才进行校验,在进行查询操作的时候,可以不进行校验
        if (errors.getSize() != 0) {
View Full Code Here


        }
        super.process(request, response, application);
    }

    public boolean encapsulateObject() throws EasyJException {
        errors = new ValidateErrors();
        // 从客户端传来的处理数据
        object = BeanUtil.getObject(className, properties, errors);

        // 只有是在用户进行更新操作的时候才进行校验,在进行查询操作的时候,可以不进行校验
        if (errors.getSize() != 0) {
View Full Code Here

                        .getDisplayProperties(subClassName);
                if (displayProperties == null) {
                    return null;
                }
                //用户提交数据校验之后的结果需要显示给用户
                ValidateErrors errors = (ValidateErrors) request
                        .getAttribute(Globals.VALIDATE_ERRORS);
                int propertySize = displayProperties.size();
                buffer.append("<table width=\"100%\" id=\"details\">\n");
                buffer.append("<tr>\n");
                /* 下面是输出题头栏的checkbox */
 
View Full Code Here

            String hintType) throws EasyJException {
        Class clazz = object.getClass();
        String primaryKey = (String) BeanUtil.getPubStaticFieldValue(clazz,
                Const.PRIMARY_KEY);

        ValidateErrors errors = (ValidateErrors) request
                .getAttribute(Globals.VALIDATE_ERRORS);
       
        if (object == null || editProperties == null) {
            return null;
        }

        StringBuffer buffer = new StringBuffer();

        buffer.append("<input type=\"hidden\"  id=\"id\" name=\"" + primaryKey
                + "\" value=\""
                + Format.format(BeanUtil.getFieldValue(object, primaryKey))
                + "\"/>");
        buffer.append("<table width=\"100%\" class=\"query\" >\n");
        ArrayList textareaProperties = new ArrayList();
        ArrayList checkboxsProperties = new ArrayList();
        int size = propertySize;
        if (size == -1) {
            size = editProperties.size();
            /* sizePerLin指每一行有多少个字段 */
        }
        int sizePerLine = Integer.parseInt(columnsPerLine);
        int j = 0;
        int tdWidth = 100;
        if ("Y".equals(hint))
            tdWidth = 70 / sizePerLine;
        else
            tdWidth = 90 / sizePerLine;

        for (int i = start; i < size; i++) {
            UserPropertyRight property = (UserPropertyRight) editProperties
                    .get(i);
            if (j % sizePerLine == 0) {
                buffer.append("<tr>\n");
            }
            String propertyName = property.getPropertyName();
            /* 因为如果是textarea的话,就会放到下面显示,所以这些只有当不是textarea的时候才显示 */
            String displayChineseName = "<td width=\"15%\" align=\"left\" style="
                        +"'text-align:justify;text-justify:distribute-all-lines'>"
                    + property.getPropertyChiName()
                    + ": </td> <td align=\"left\" width=\"" + tdWidth + "%\">";
            if ("checkboxs".equals(property.getType())) {
                checkboxsProperties.add(property);
                continue;
            }
            if ("textarea".equals(property.getType())) {
                textareaProperties.add(property);
                continue;
            }

            if (GenericValidator
                    .isBlankOrNull(property.getPropertyValueTable())) {
                /* 如果不是从数据字典表或者其他表中选取,则显示输入框 */

                // 如果是隐藏字段,则输入hidden
                if (GenericValidator.isBlankOrNull(property.getHidden())) {
                    buffer.append(displayChineseName + "\n");
                    buffer.append("<input type=\"text\" name=\""
                            + property.getPropertyName()
                            + "\" value=\""
                            + Format.format(BeanUtil.getFieldValue(object,
                                    propertyName))
                            + "\" onblur=\""
                            + Format.format(Validate.getClientValidate(object
                                    .getClass().getName()
                                    + propertyName))
                            + "\" style=\"width:97%;\"  />\n");
                    if (errors != null
                            && errors.getErrorMsg(propertyName) != null) {
                        buffer.append(errors.getErrorMsg(propertyName));
                    }
                } else {
                    buffer.append("<input type=\"hidden\" name=\""
                            + property.getPropertyName()
                            + "\" value=\""
View Full Code Here

              ArrayList displayProperties = (ArrayList) userCache.getDisplayProperties(subClassName);

                if (displayProperties == null) {
                    return null;
                }
                ValidateErrors errors = (ValidateErrors) request
                        .getAttribute(Globals.VALIDATE_ERRORS);
                int propertySize = displayProperties.size();
                buffer.append("<table width=\"100%\" id=\"details\">\n");
                buffer.append("<tr>\n");
                /* 下面是输出题头栏的checkbox */

                // buffer.append("<td class=\"trTitle\">操作</td>\n");
                /*
                 * properties用来保存明细显示字段,classes用来保存某字段需要从哪个class对应的表中选择数据,
                 * 并把properties, classes送到客户端,放到hidden当中,在选择给明细选择数据的时候用到
                 */
                StringBuffer properties = new StringBuffer();
                StringBuffer classes = new StringBuffer();
                StringBuffer propertyTypes = new StringBuffer();
                /* 下面输入用来浏览的数据字段 */
                for (int i = 0; i < propertySize; i++) {
                    UserPropertyRight property = (UserPropertyRight) displayProperties
                            .get(i);
                    Integer width = property.getShowWidth();
                    if (width != null)
                        buffer.append("<td nowrap class=\"trTitle\" width='"
                                + width +"%'align=\"center\">\n");
                    else
                        buffer.append("<td nowrap class=\"trTitle\" align=\"center\">\n");
                    buffer.append(property.getPropertyChiName() + "\n");
                    buffer.append("</td>\n");
                    properties.append(property.getPropertyName()).append(",");
                    propertyTypes.append(property.getType()).append(",");
                    if (GenericValidator.isBlankOrNull(property
                            .getPropertyValueTable()))
                        classes.append(",");
                    else {
                        classes.append(property.getPropertyValueTable())
                                .append(",");
                        /* 将需要显示的字段放到id字段的后面 */
                        properties.append(property.getShowProperty()).append(
                                ",");
                        propertyTypes.append(property.getType()).append(",");
                    }
                }
                buffer.append("</tr>\n");

                ArrayList dataList = (ArrayList) BeanUtil.getFieldValue(obj,
                        subClassProperty);
                int dataSize = 0;
                String subPrimaryKeyName = "";
                if (dataList != null)
                    dataSize = dataList.size();
                subPrimaryKeyName = (String) BeanUtil
                        .getPrimaryKeyName(BeanUtil.getClass(subClassName));
//                buffer
//                        .append("<tr><td class=\"trContent\" colspan=\""
//                                + propertySize
//                                + "\" ><image src=\"image\\delete.gif\" id=\"check"
//                                + "\" onclick=\"UseCase.hiddenDetail(this)\" /><image  src=\"image\\up.gif\" id=\"insertBefore"
//                                + "\" onclick=\"UseCase.insert('up','user')\" /><image  src=\"image\\up.gif\" id=\"insertBeforeSys"
//                                + "\" onclick=\"UseCase.insert('up','sys')\" /><image src=\"image\\down.gif\" id=\"insertAfter"
//                                + "\" onclick=\"UseCase.insert('down','user')\" /><image src=\"image\\down.gif\" id=\"insertAfterSys"
//                                + "\" onclick=\"UseCase.insert('down','sys')\" /></td></tr>\n");

                buffer
                .append("<tr><td class=\"trContent\" colspan=\""
                        + propertySize
                        + "\" ><image src=\"image/delete.gif\" id=\"check"
                        + "\" onclick=\"UseCase.hiddenDetail(this)\" /><image  src=\"image/up.gif\" id=\"insertBefore"
                        + "\" onclick=\"UseCase.insert('up','user')\" /><image  src=\"image/up.gif\" id=\"insertBeforeSys"
                        + "\" onclick=\"UseCase.insert('up','sys')\" /><image src=\"image/down.gif\" id=\"insertAfter"
                        + "\" onclick=\"UseCase.insert('down','user')\" /><image src=\"image/down.gif\" id=\"insertAfterSys"
                        + "\" onclick=\"UseCase.insert('down','sys')\" /></td></tr>\n");
               
                String propertyValueTable = "";
                for (int i = 0; i < dataSize; i++) {
                    buffer.append("<div><tr id=\"tr" + i
                            + "\" class=\"trContent\">\n");
                    Object object = dataList.get(i);
                    UseCaseInteraction interaction = (UseCaseInteraction)object;
                   
//                     buffer.append( "<td class=\"trContent\" onMouseOver=\"showImg(this)\" onMouseLeave=\"hideImg(this)\"><image"+
//                     "style=\"display:none\" src=\"image\\delete.gif\""+
//                     "id=\"check" + i + "\" onclick=\"Data.hiddenDetail(this)\" /><image"+
//                     "style=\"display:none\" src=\"image\\up.gif\""+
//                     "id=\"insertBefore" + i + "\""+
//                     "onclick=\"UseCase.insert(this,'up','user')\" /><image"+
//                     "style=\"display:none\" src=\"image\\up.gif\""+
//                     "id=\"insertBeforeSys" + i + "\""+
//                     "onclick=\"UseCase.insert(this,'up','sys')\" /><br>"+
//                     "<image style=\"display:none\" src=\"image\\down.gif\""+
//                     "id=\"insertAfter" + i + "\""+
//                     "onclick=\"UseCase.insert(this,'down','user')\" /><image"+
//                     "style=\"display:none\" src=\"image\\down.gif\""+
//                     "id=\"insertAfterSys" + i + "\""+
//                     "onclick=\"UseCase.insert(this,'down','sys')\" /><input"+
//                     "type=\"hidden\" name=\""+subPrimaryKeyName+ "\""+
//                     "value=\""+BeanUtil.getFieldValue(object,subPrimaryKeyName)+"\"/></td>\n");

                    buffer.append("<input type=\"hidden\" name=\""
                            + subPrimaryKeyName + "\" value=\""
                            + BeanUtil.getFieldValue(object, subPrimaryKeyName)
                            + "\"/>");
                    for (int k = 0; k < propertySize; k++) {
                        UserPropertyRight property = (UserPropertyRight) displayProperties
                                .get(k);
                       
                        //特殊处理columns字段
                        if ("columns".equals(property.getPropertyName())) {
                            Long classId = interaction.getClassId();
                            if (classId != null) {
                                String columnsValue = interaction.getColumns();
                                StringBuffer columnBuffer =
                                    getProperty(classId.toString(), new Integer(i).toString(), columnsValue);
                                buffer.append("<td>");
                                buffer.append(columnBuffer);
                                buffer.append("</td>");
                            }
                            continue;
                        }
                       
                        String propertyName = property.getPropertyName();
                        /* 如果不是从数据字典表或者其他表中选取,则显示输入框 */
                        if (GenericValidator.isBlankOrNull(property
                                .getPropertyValueTable())) {
                            if ("textarea".equals(property.getType())) {
                                Object value = Format.format(BeanUtil
                                        .getFieldValue(object, propertyName));
                                if (k == 0 && "^^sys$$".equals(value)) {
                                    Integer width = property.getShowWidth();
                                    if (width != null)
                                        buffer.append("<td nowrap width='"
                                                + width +"%'\n");
                                    else
                                        buffer.append("<td nowrap>\n");
                                    buffer
                                            .append("<textarea  style=\"display:none\" name=\""
                                                    + property
                                                            .getPropertyName()
                                                    + "\" id=\""
                                                    + property
                                                            .getPropertyName()
                                                    + i
                                                    + "\" onblur=\""
                                                    + Format
                                                            .format(Validate
                                                                    .getClientValidate(object
                                                                            .getClass()
                                                                            .getName()
                                                                            + propertyName))
                                                    + "\"  onpropertychange=\"setHeight()\" onpaste=\"setHeight()\">"
                                                    + value + "</textarea>\n");
                                } else {
                                    Integer width = property.getShowWidth();
                                    if (width != null)
                                        buffer.append("<td nowrap class=\"trContent\" width='"
                                                + width +"%'>\n");
                                    else
                                        buffer
                                            .append("<td class=\"trContent\" nowrap>\n");
                                    buffer
                                            .append("<textarea  style=\"overflow:auto;width:100%;height:100%\" name=\""
                                                    + property
                                                            .getPropertyName()
                                                    + "\" id=\""
                                                    + property
                                                            .getPropertyName()
                                                    + i
                                                    + "\" onblur=\""
                                                    + Format
                                                            .format(Validate
                                                                    .getClientValidate(object
                                                                            .getClass()
                                                                            .getName()
                                                                            + propertyName))
                                                    + "\" onpropertychange=\"setHeight()\" onpaste=\"setHeight()\" onfocus=\"UseCase.rememberFocus(this)\">"
                                                    + value + "</textarea>\n");
                                }
                            } else {
                                Integer width = property.getShowWidth();
                                if (width != null)
                                    buffer.append("<td width='"
                                            + width +"%'>\n");
                                else
                                    buffer.append("<td>");
                                buffer
                                        .append("<input type=\"text\" name=\""
                                                + property.getPropertyName()
                                                + "\" id=\""
                                                + property.getPropertyName()
                                                + i
                                                + "\" onfocus=\"rememberFocus(this)\" value=\""
                                                + Format.format(BeanUtil
                                                        .getFieldValue(object,
                                                                propertyName))
                                                + "\" onblur=\""
                                                + Format
                                                        .format(Validate
                                                                .getClientValidate(object
                                                                        .getClass()
                                                                        .getName()
                                                                        + propertyName))
                                                + "\"/>\n");
                            }
                            if (errors != null
                                    && errors.getErrorMsg(propertyName) != null) {
                                buffer.append(errors.getErrorMsg(propertyName));
                            }
                        } else {
                            buffer.append("<td>");
                            /* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
                            propertyValueTable = property
View Full Code Here

        if (GenericValidator.isBlankOrNull(returnPath))
            returnPath = Globals.COMPOSITE_DATA_SAVE_RETURN_PARTH;
    }

    public boolean encapsulateObject() throws EasyJException {
        errors = new ValidateErrors();
        // 从客户端传来的处理数据
        object = BeanUtil.getCompositObject(className, properties, errors);

        if (errors.getSize() != 0)
            if (Globals.UPDATE_ACTION.equals(action)
View Full Code Here

            .getDisplayProperties(subClassName);
        if (displayProperties == null) {
          return null;
        }
        // 用户提交数据校验之后的结果需要显示给用户
        ValidateErrors errors = (ValidateErrors) request
            .getAttribute(Globals.VALIDATE_ERRORS);
        int propertySize = displayProperties.size();
        buffer.append("<table width=\"100%\" id=\"details\">\n");
        buffer.append("<tr>\n");
        /* 下面是输出题头栏的checkbox */
 
View Full Code Here

      throws EasyJException {
    Class clazz = object.getClass();
    String primaryKey = (String) BeanUtil.getPubStaticFieldValue(clazz,
        Const.PRIMARY_KEY);

    ValidateErrors errors = (ValidateErrors) request
        .getAttribute(Globals.VALIDATE_ERRORS);

    if (object == null || editProperties == null) {
      return null;
    }

    StringBuffer buffer = new StringBuffer();

    buffer.append("<input type=\"hidden\"  id=\"id\" name=\"" + primaryKey
        + "\" value=\""
        + Format.format(BeanUtil.getFieldValue(object, primaryKey))
        + "\"/>");
    buffer.append("<table width=\"100%\" class=\"query\" >\n");
    ArrayList textareaProperties = new ArrayList();
    ArrayList checkboxsProperties = new ArrayList();
    int size = propertySize;
    if (size == -1) {
      size = editProperties.size();
      /* sizePerLin指每一行有多少个字段 */
    }
    int sizePerLine = Integer.parseInt(columnsPerLine);
    int j = 0;
    int tdWidth = 100;
    if ("Y".equals(hint))
      tdWidth = 70 / sizePerLine;
    else
      tdWidth = 90 / sizePerLine;

    for (int i = start; i < size; i++) {
      UserPropertyRight property = (UserPropertyRight) editProperties
          .get(i);
      if (j % sizePerLine == 0) {
        buffer.append("<tr>\n");
      }
      String propertyName = property.getPropertyName();
      /* 因为如果是textarea的话,就会放到下面显示,所以这些只有当不是textarea的时候才显示 */
      String displayChineseName = "<td width=\"15%\" align=\"left\" style="
          + "'text-align:justify;text-justify:distribute-all-lines'>"
          + property.getPropertyChiName()
          + ": </td> <td align=\"left\" width=\"" + tdWidth + "%\">";
      if ("checkboxs".equals(property.getType())) {
        checkboxsProperties.add(property);
        continue;
      }
      if ("textarea".equals(property.getType())) {
        textareaProperties.add(property);
        continue;
      }

      if (GenericValidator
          .isBlankOrNull(property.getPropertyValueTable())) {
        /* 如果不是从数据字典表或者其他表中选取,则显示输入框 */

        // 如果是隐藏字段,则输入hidden
        if (GenericValidator.isBlankOrNull(property.getHidden())) {
          buffer.append(displayChineseName + "\n");
          buffer.append("<input type=\"text\" name=\""
              + property.getPropertyName()
              + "\" value=\""
              + Format.format(BeanUtil.getFieldValue(object,
                  propertyName))
              + "\" onblur=\""
              + Format.format(Validate.getClientValidate(object
                  .getClass().getName()
                  + propertyName))
              + "\" style=\"width:97%;\"  />\n");
          if (errors != null
              && errors.getErrorMsg(propertyName) != null) {
            buffer.append(errors.getErrorMsg(propertyName));
          }
        } else {
          buffer.append("<input type=\"hidden\" name=\""
              + property.getPropertyName()
              + "\" value=\""
View Full Code Here

TOP

Related Classes of easyJ.common.validate.ValidateErrors

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.