Package easyJ.system.data

Examples of easyJ.system.data.UserPropertyRight


public class Validate {
    public Validate() {}

    public static String getClientValidate(String classPropertyName)
            throws EasyJException {
        UserPropertyRight property = (UserPropertyRight) SystemDataCache
                .getPropertyHT(false).get(classPropertyName);
        if (property == null)
            return null;
        /*
         * 校验规则的格式是:不同的校验规则用分号(;)隔开。一个校验规则所用到的参数用逗号(,)隔开。比如一个字段需要进行float校验,
         * 而且不能大于100,不能小于0(学生的成绩)。表示规则应该是:isFloat;maxValue,100;minValue,0 。
         */
        String propertyChiName = property.getPropertyChiName();
        String validateRules = property.getValidateRule();
        if (GenericValidator.isBlankOrNull(validateRules))
            return null;
        // 得到校验的规则
        StringTokenizer ruleToken = new StringTokenizer(validateRules, ";");
        StringBuffer buffer = new StringBuffer();
View Full Code Here


            throws EasyJException {
        /*
         * 校验规则的格式是:不同的校验规则用分号(;)隔开。一个校验规则所用到的参数用逗号(,)隔开。比如一个字段需要进行float校验,
         * 而且不能大于100,不能小于0(学生的成绩)。表示规则应该是:isFloat;maxValue,100;minValue,0 。
         */
        UserPropertyRight property = (UserPropertyRight) SystemDataCache
                .getPropertyHT(false).get(classPropertyName);
        if (property == null)
            return null;
        String propertyChiName = property.getPropertyChiName();
        String validateRules = property.getValidateRule();
        if (GenericValidator.isBlankOrNull(validateRules))
            return null;

        // 得到校验的规则
        StringTokenizer ruleToken = new StringTokenizer(validateRules, ";");
View Full Code Here

        .getClass(), Const.PRIMARY_KEY);
    Object primaryKeyValue = BeanUtil.getFieldValue(object, primaryKey);

    int propertySize = displayProperties.size();
    for (int j = 0; j < propertySize; j++) {
      UserPropertyRight property = (UserPropertyRight) displayProperties
          .get(j);
      buffer.append("<td abbr=\"asdf\" onclick=\"Data.edit('"
          + primaryKey + "'" + ",'" + primaryKeyValue + "')\">\n");
      String propertyName = property.getPropertyName();
      if (GenericValidator.isBlankOrNull(property.getShowProperty())) {
        buffer.append(Format.formatDisplay(BeanUtil.getFieldValue(
            object, propertyName)));
        /* 下面在属性propertyName要加上Value是从数据字典中取出数据时显示用的。在创建试图的时候的规定 */
      } else {
        buffer.append(Format.formatDisplay(BeanUtil.getFieldValue(
            object, property.getShowProperty())));
      }
      buffer.append("</td>\n");
    }

    return buffer;
View Full Code Here

      ArrayList displayProperties, ValidateErrors errors, int i,
      boolean isComposite) throws EasyJException {
    StringBuffer buffer = new StringBuffer();
    int propertySize = displayProperties.size();
    for (int k = 0; k < propertySize; k++) {
      UserPropertyRight property = (UserPropertyRight) displayProperties
          .get(k);
      Integer width = property.getShowWidth();
      if (width != null)
        buffer.append("<td class=\"trContent\" width='" + width
            + "%'nowrap>\n");
      else
        buffer.append("<td class=\"trContent\" nowrap>\n");
      String propertyName = property.getPropertyName();
      /* 如果不是从数据字典表或者其他表中选取,则显示输入框 */
      if (GenericValidator
          .isBlankOrNull(property.getPropertyValueTable())) {
        if ("textarea".equals(property.getType())) {
          buffer.append("<textarea width=\"100%\" name=\""
              + property.getPropertyName());
          // 如果不是主子表,则对名称加上主键号,否则在查询的时候会有问题。
          if (!isComposite)
            buffer.append(i);
          buffer.append("\" id=\""
              + property.getPropertyName()
              + i
              + "\" onblur=\""
              + Format.format(Validate.getClientValidate(object
                  .getClass().getName()
                  + propertyName))
              + "\">"
              + Format.format(BeanUtil.getFieldValue(object,
                  propertyName)) + "</textarea>\n");
        } else {
          if ("webAddress".equals(property.getShowType())) {
            Object fieldValue = Format.format(BeanUtil
                .getFieldValue(object, propertyName));
            buffer.append("<a href = \"http://" + fieldValue
                + "\" target=\"_blank\"\">" + fieldValue
                + "</a>");
          } else {

            buffer.append("<input type=\"text\" name=\""
                + property.getPropertyName());
            if (!isComposite)
              buffer.append(i);
            buffer.append("\" id=\""
                + property.getPropertyName()
                + i
                + "\" value=\""
                + Format.format(BeanUtil.getFieldValue(object,
                    propertyName))
                + "\" onblur=\""
                + Format.format(Validate
                    .getClientValidate(object.getClass()
                        .getName()
                        + propertyName))
                + "\" style=\"width:95%\"/>\n");
          }
        }
        if (errors != null && errors.getErrorMsg(propertyName) != null) {
          buffer.append(errors.getErrorMsg(propertyName));
        }
      } else {
        /* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
        String propertyValueTable = property.getPropertyValueTable();
        if (property.getFromDictionary() != null) {
          if ("checkboxs".equals(property.getType())) {
            StringBuffer cheboxBuffer = null;
            if (!property.getFromDictionary()) {
              cheboxBuffer = getCheckboxs(property
                  .getPropertyValueTable(), property
                  .getPropertyName(), BeanUtil.getFieldValue(
                  object, property.getPropertyName()), i);
            } else {
              cheboxBuffer = getCheckBoxsFromDic(property
                  .getPropertyValueTable(), property
                  .getPropertyName(), BeanUtil.getFieldValue(
                  object, property.getPropertyName()), i);
            }
            buffer.append(cheboxBuffer);
          } else if ("radio".equals(property.getType())) {
            StringBuffer radioBuffer = null;
            if (!property.getFromDictionary()) {
              radioBuffer = getRadios(property
                  .getPropertyValueTable(), property
                  .getPropertyName(), BeanUtil.getFieldValue(
                  object, property.getPropertyName()), i);
            } else {
              radioBuffer = getRadiosFromDic(property
                  .getPropertyValueTable(), property
                  .getPropertyName(), BeanUtil.getFieldValue(
                  object, property.getPropertyName()), i);
            }
            buffer.append(radioBuffer);
          } else {
            if (property.getFromDictionary().booleanValue()) {

              String selectName = propertyName;
              if (!isComposite)
                selectName += i;
              StringBuffer selectBuffer = DictionaryProxy
                  .getHtmlSelect(selectName,
                      propertyValueTable, BeanUtil
                          .getFieldValue(object,
                              propertyName),
                      BeanUtil.getFieldValue(object,
                          property.getShowProperty()));
              buffer.append(selectBuffer.toString());
            } else {
              Object propertyValue = BeanUtil.getFieldValue(
                  object, propertyName);
              String diplayName = property.getShowProperty();
              Object displayValue = BeanUtil.getFieldValue(
                  object, diplayName);
              StringBuffer selectBuffer = HtmlClientComponentService
                  .getDataSelect(propertyValueTable,
                      propertyName, propertyValue,
View Full Code Here

        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,
View Full Code Here

      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=\""
              + Format.format(BeanUtil.getFieldValue(object,
                  propertyName)) + "\"/>\n");
        }
      } else {
        buffer.append(displayChineseName + "\n");
        // buffer.append(displayChineseName);
        /* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
        /**
         * Bug here .
         *
         */
        String propertyValueTable = property.getPropertyValueTable();
        if (property.getFromDictionary() != null) {
          if (property.getFromDictionary().booleanValue()) {
           
//            StringBuffer selectBuffer =
//        DictionaryProxy.getHtmlSelect(propertyName,
//                      propertyValueTable,
//                      BeanUtil.getFieldValue(object,propertyName),
//                      BeanUtil.getFieldValue(object,propertyName));
            StringBuffer selectBuffer = HtmlClientComponentService
            .getSelect(propertyValueTable, BeanUtil
                .getFieldValue(object, propertyName));
            buffer.append(selectBuffer.toString());
          } else {
            StringBuffer selectBuffer = HtmlClientComponentService
                .getSelect(propertyValueTable, BeanUtil
                    .getFieldValue(object, propertyName));
            buffer.append(selectBuffer.toString());
          }
        }

      }
      buffer.append("</td>\n");
      if ("Y".equals(hint)) {
        if ("cursor".equals(hintType))
          buffer.append("<td><img src=\"/image/ask.gif\" alt=\""
              + Format.format(property.getDescription())
              + "\"></img></td>");
        else
          buffer.append("<td>"
              + Format.format(property.getDescription())
              + "</td>");
      }

      if (!"textarea".equals(property.getType())
          || "checkboxs".equals(property.getType())) {
        j++;
      }
      if (j % sizePerLine == 0) {
        buffer.append("</tr>");
      }
    }
    /* 如果最后一行没有够每行要求的td数,那么就需要在下面补齐 */
    while ((j % sizePerLine) != 0) {
      j++;
      buffer.append("<td></td>");
    }
    buffer.append("</tr>\n");
    buffer.append("</table>\n");
    for (int i = 0; i < textareaProperties.size(); i++) {
      UserPropertyRight property = (UserPropertyRight) textareaProperties
          .get(i);
      buffer.append("<table><tr ><td width=\"15%\" align=\"left\">"
          + property.getPropertyChiName()
          + "</td><td align=\"left\">\n");
      /* 大小应该有屏幕大小决定的,将来需要改 */
      buffer.append("<textarea style=\"width:97%\" rows=\"5\" name=\""
          + property.getPropertyName()
          + "\">"
          + Format.format(BeanUtil.getFieldValue(object, property
              .getPropertyName())) + "</textarea>");
      buffer.append("</td></tr></table>\n");
    }
    for (int i = 0; i < checkboxsProperties.size(); i++) {
      UserPropertyRight property = (UserPropertyRight) checkboxsProperties
          .get(i);
      buffer.append("<table><tr><td width=\"15%\">"
          + property.getPropertyChiName()
          + "</td><td align=\"left\">\n");
      /* 大小应该有屏幕大小决定的,将来需要改 */
      StringBuffer cheboxBuffer = getCheckboxs(property
          .getPropertyValueTable(), property.getPropertyName(),
          BeanUtil.getFieldValue(object, property.getPropertyName()),
          -1);
      buffer.append(cheboxBuffer.toString() + "\n");
      buffer.append("</td></tr></table>\n");
    }
    return buffer;
View Full Code Here

    buffer
        .append("<td align=\"center\" class=\"trTitle\" width=\"5%\"><input type=\"checkbox\" name=\"checkAll\" onclick=\"Data.checkAll()\"/>\n");
    buffer.append("</td>\n");
    /* 下面输入用来浏览的数据字段 */
    for (int i = 0; i < propertySize; i++) {
      UserPropertyRight property = (UserPropertyRight) displayProperties
          .get(i);
      propertyBuffer.append(property.getPropertyName());
      if (i != propertySize - 1) {
        propertyBuffer.append(",");
      }
      buffer.append("<td nowrap class=\"trTitle\" align=\"center\">\n");
      buffer
          .append("<a style=\"text-decoration:none\" href=\"javascript:Data.orderBy('"
              + property.getPropertyName()
              + "')\">"
              + property.getPropertyChiName() + "</a>\n");
      buffer.append("</td>\n");
    }
    buffer.append("</tr>\n");
    buffer.append("<input type=\"hidden\"  name=\"properties\" value=\""
        + propertyBuffer.toString() + "\"/>");
    if (request.getAttribute(Globals.PAGE) != null) {
      Page page = (Page) request.getAttribute(Globals.PAGE);
      ArrayList dataList = page.getPageData();
      int dataSize = dataList.size();
      for (int i = 0; i < dataSize; i++) {
        Object object = dataList.get(i);
        String primaryKey = (String) BeanUtil.getPubStaticFieldValue(
            object.getClass(), Const.PRIMARY_KEY);
        Object primaryKeyValue = BeanUtil.getFieldValue(object,
            primaryKey);
        buffer.append("<tr id=\"tr" + primaryKeyValue + "\">\n");
        buffer
            .append("<td class=\"trContent\"  align=\"center\" width=\"5%\"><input type=\"checkbox\" name=\"check\" value=\""
                + primaryKeyValue + "\"/> </td>\n");
        for (int j = 0; j < propertySize; j++) {
          UserPropertyRight property = (UserPropertyRight) displayProperties
              .get(j);
          buffer
              .append("<td class=\"trContent\"abbr=\"asdf\" align=\"center\" onclick=\"Discuss.expandContent('"
                  + primaryKey
                  + "'"
                  + ",'"
                  + primaryKeyValue
                  + "','"
                  + queryByTopic
                  + "','"
                  + primaryKeyValue + "')\" nowrap>\n");
          String propertyName = property.getPropertyName();
          if (GenericValidator.isBlankOrNull(property
              .getShowProperty())) {
            buffer.append(Format.formatDisplay(BeanUtil
                .getFieldValue(object, propertyName)));
            /* 下面在属性propertyName要加上Value是从数据字典中取出数据时显示用的。在创建试图的时候的规定 */
          } else {
            buffer.append(Format.formatDisplay(BeanUtil
                .getFieldValue(object, property
                    .getShowProperty())));
          }
          buffer.append("</td>\n");
        }
        buffer.append("</tr>\n");
View Full Code Here

    buffer
        .append("<th align=\"center\" class=\"trTitle\" width=\"5%\"><input type=\"checkbox\" name=\"checkAll\" onclick=\"Data.checkAll()\"/>\n");
    buffer.append("</th>\n");
    /* 下面输入用来浏览的数据字段 */
    for (int i = 0; i < propertySize; i++) {
      UserPropertyRight property = (UserPropertyRight) displayProperties
          .get(i);
      buffer.append("<th class=\"order\" onclick=\"Data.orderBy('"
          + property.getPropertyName() + "', " + editable + ")\">"
          + property.getPropertyChiName() + "</a>\n");
      buffer.append("</th>\n");
    }

    // 判断是否需要显示操作栏

View Full Code Here

        ArrayList displayProperties = (ArrayList) UserColumnService
                .getDisplayProperties(userId, className);
        StringBuffer buffer = new StringBuffer();
        int propertySize = displayProperties.size();
        for (int i = 0; i < propertySize; i++) {
            UserPropertyRight property = (UserPropertyRight) displayProperties
                    .get(i);
            buffer.append(property.getPropertyName());
            buffer.append("=");
            Object value = null;
            if (property.getShowProperty() != null) {
                value = BeanUtil.getFieldValue(discuss, property
                        .getShowProperty());
            } else {
                value = BeanUtil.getFieldValue(discuss, property
                        .getPropertyName());
            }
            if (value == null) {
                buffer.append("asdf");
            } else {
View Full Code Here

    int size = queryProperties.size();
    /* sizePerLin指每一行有多少个字段 */
    int sizePerLine = Integer.parseInt(columnsPerLine);
    int j = 0;
    for (int i = 0; i < size; i++) {
      UserPropertyRight property = (UserPropertyRight) queryProperties
          .get(i);
      if (j % sizePerLine == 0) {
        buffer.append("<tr>\n");
      }
      String propertyName = property.getPropertyName();
      if ("Y".equals(property.getScopeQuery())) {
        /* 如果范围查询 */
        buffer.append("<td nowrap>" + property.getPropertyChiName()
            + "</td>\n");
        buffer.append("<td>\n");
        buffer.append("<input type=\"text\" name=\"lower"
            + property.getPropertyName()
            + "\" value=\""
            + Format.format(BeanUtil.getFieldValue(lower,
                propertyName)) + "\"/>--\n");
        buffer.append("<input type=\"text\" name=\"upper"
            + property.getPropertyName()
            + "\" value=\""
            + Format.format(BeanUtil.getFieldValue(upper,
                propertyName)) + "\"/>\n");
        buffer.append("</td>\n");
      } else {
        /* 如果不是hidden字段 */
        if (GenericValidator.isBlankOrNull(property.getHidden())) {
          buffer.append("<td>" + property.getPropertyChiName()
              + "</td>\n");
        }
        propertyName = property.getPropertyName();
        buffer.append("<td>\n");
        /* 如果不是范围查询 */
        if (GenericValidator.isBlankOrNull(property
            .getPropertyValueTable())) {
          /* 如果不是从数据字典表或者其他表中选取,则显示输入框 */
          if (GenericValidator.isBlankOrNull(property.getHidden())) {
            buffer.append("<input type=\"text\" name=\""
                + property.getPropertyName()
                + "\" value=\""
                + Format.format(BeanUtil.getFieldValue(lower,
                    propertyName)) + "\"/>\n");
          } else {
            buffer.append("<input type=\"hidden\" name=\""
                + property.getPropertyName()
                + "\" value=\""
                + Format.format(BeanUtil.getFieldValue(lower,
                    propertyName)) + "\"/>\n");

          }
        } else {
          /* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
          String propertyValueTable = property
              .getPropertyValueTable();
          if (property.getFromDictionary() != null) {
//            if (property.getFromDictionary().booleanValue()) {
//              StringBuffer selectBuffer = DictionaryProxy
//                  .getHtmlSelect(propertyName,
//                      propertyValueTable, BeanUtil
//                          .getFieldValue(lower,
//                              propertyName),
//                      BeanUtil.getFieldValue(lower,
//                          property.getShowProperty()));
//              buffer.append(selectBuffer);
//            } else {
              if ("select".equalsIgnoreCase(property
                  .getShowType())) {
                StringBuffer selectBuffer = HtmlClientComponentService
                    .getSelect(propertyValueTable, BeanUtil
                        .getFieldValue(lower,
                            propertyName));
                buffer.append(selectBuffer);
              } else {
                buffer.append("<input type=\"text\" name=\""
                    + property.getShowProperty()
                    + "\" value=\""
                    + Format.format(BeanUtil.getFieldValue(
                        lower, property
                            .getShowProperty()))
                    + "\"/>");
              }
            //}
          }
View Full Code Here

TOP

Related Classes of easyJ.system.data.UserPropertyRight

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.