Examples of PageFunction


Examples of easyJ.system.data.PageFunction

      role = context.getProjectRole();
    }

    /* 获得功能列表 */
    StringBuffer buffer = new StringBuffer();
    PageFunction function = new PageFunction();
    // function.setFunctionClass(className);
    function.setFunctionPage(pageName);
    // function.setFunctionPosition(new Long(position));
    function.setFunctionPositionRelatedValue(new Long(position));
    /* 现在为了调试方便,将来function要从cache当中取 */
    SingleDataProxy sdp = SingleDataProxy.getInstance();
    ArrayList functionList = (ArrayList) sdp.query(function);

    buffer.append("<table  width=\"100%\" class=\"function\"><tr><td>\n");

    /* 对数据进行环境过滤 */
    DataContextFilter filter = DataContextFilter.getInstance();
    filter.setContext(context);
    functionList = filter.filter(functionList);
    int size = functionList.size();

    for (int i = 0; i < size; i++) {
      function = (PageFunction) functionList.get(i);
      String functionName = function.getFunctionName(); // 功能的javascript
      // 名称
      String functionDisplayValue = function.getFunctionDisplayValue();
      buffer.append("<input type=\"button\" class=\"button\" value=\""
          + functionDisplayValue + "\" onclick=\"" + functionName
          + "\"/>\n");
    }
    buffer.append("</td></tr></table>\n");
View Full Code Here

Examples of easyJ.system.data.PageFunction

  public static StringBuffer getFunctionScript(HttpServletRequest request,
      String pageName) throws EasyJException {
    StringBuffer buffer = new StringBuffer();
    /* 获得功能列表 */
    PageFunction function = new PageFunction();
    function.setFunctionPage(pageName);
    SingleDataProxy sdp = SingleDataProxy.getInstance();
    ArrayList functionList = (ArrayList) sdp.query(function);
    buffer.append("<script language=\"javascript\">\n");
    int size = functionList.size();
    for (int i = 0; i < size; i++) {
      function = (PageFunction) functionList.get(i);
      if (!GenericValidator.isBlankOrNull(function.getFunctionContent())) {
        buffer.append(function.getFunctionContent());
      }
    }
    buffer.append("</script>\n");
    return buffer;
  }
View Full Code Here

Examples of easyJ.system.data.PageFunction

            buffer.append("</th>\n");
        }

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

        PageFunction pf = new PageFunction();
        if (editable)
          pf.setFunctionPositionRelatedValue(
              new Long(Globals.FUNCTION_LIST_EDIT));
        else
          pf.setFunctionPositionRelatedValue(new Long(Globals.FUNCTION_LIST));

        // 得到所有在list显示的功能
        ArrayList pfList = sdp.query(pf);

        // 过滤掉不符合的,符合的包括function_class为空的,或者function_class和 class_name 一致的。
        // 不能加上function_class为查询条件,因为可能会过滤掉function_class为空的。
        ArrayList effectList = new ArrayList();

        for (int i = 0; i < pfList.size(); i++) {
            pf = (PageFunction) pfList.get(i);
            if (pf.getFunctionClass() == null
                    || className.equals(pf.getFunctionClass()))
                effectList.add(pf);
        }

        if (effectList.size() != 0)
            buffer.append("<th>操作</th>");

        buffer.append("</tr>\n");
        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><input type=\"checkbox\" name=\"check\" id=\"check"
                        + i + "\"  value=\"" + primaryKeyValue
                        + "\"/> </td>\n");
               
                //根据用户是需要什么样的显示页面来确定是否需要编辑
                if (editable) {
                  buffer.append(getDisplayEdit(object, displayProperties,
                      null, i, false));
                } else {
                  buffer.append(getDisplayList(object, displayProperties, i));
                }
               
                // 输出每列的功能按钮
                if (effectList.size() != 0) {
                    buffer.append("<td>");
                    // 下面将主键值加入到functionName当中(见表Page_Function),需要functionName带有括号,例如Data.apply('cn.edu.pku.dr.requirement.elicitation.action.ProjectAction'),
                    // 这里是要在括号内加入主键名以及主键值作为参数,例如加入后可能变为apply('cn.edu.pku.dr.requirement.elicitation.action.ProjectAction','projectId',1);
                    for (int k = 0; k < effectList.size(); k++) {
                        pf = (PageFunction) effectList.get(k);
                        // 如果功能的出现需要条件,则要进行判断
                        Integer result = null;
                        // 这里0,1,-1的含义见FunctionCondition
                        if (pf.getFunctionCondition() != null) {
                            result = (Integer) BeanUtil.invokeStaticMethod(
                                    FunctionCondition.class, pf.getFunctionCondition(),
                                    new Object[] {object, userId });
                            // 如果值不为真,则继续。
                            if (result.intValue() == -1)
                                continue;
                        }
                        String functionName = pf.getFunctionName();
                       
                        //这里i代表行号,可能会被用到,也可能没有用到。看具体的方法
                        functionName = functionName.trim().substring(0,
                                functionName.length() - 1)
                                + ",'" + primaryKey + "',"
                                + primaryKeyValue + "," + i +")";
                        if (result == null || result.intValue() == 1)
                            buffer.append("<input type=\"button\" value=\""
                                    + pf.getFunctionDisplayValue()
                                    + "\" onclick=\"" + functionName + "\"/>");
                        else
                            buffer
                                    .append("<input type=\"button\" disabled value=\""
                                            + pf.getFunctionDisplayValue()
                                            + "\" onclick=\""
                                            + functionName
                                            + "\"/>");
                    }
View Full Code Here

Examples of easyJ.system.data.PageFunction

            role = context.getProjectRole();
        }

        /* 获得功能列表 */
        StringBuffer buffer = new StringBuffer();
        PageFunction function = new PageFunction();
        // function.setFunctionClass(className);
        function.setFunctionPage(pageName);
        // function.setFunctionPosition(new Long(position));
        function.setFunctionPositionRelatedValue(new Long(position));
        /* 现在为了调试方便,将来function要从cache当中取 */
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        ArrayList functionList = (ArrayList) sdp.query(function);

        buffer.append("<table  width=\"100%\" class=\"function\"><tr><td>\n");

        /* 对数据进行环境过滤 */
        DataContextFilter filter = DataContextFilter.getInstance();
        filter.setContext(context);
        functionList = filter.filter(functionList);
        int size = functionList.size();

        for (int i = 0; i < size; i++) {
            function = (PageFunction) functionList.get(i);
            String functionName = function.getFunctionName(); // 功能的javascript
            // 名称
            String functionDisplayValue = function.getFunctionDisplayValue();
            buffer.append("<input type=\"button\" class=\"button\" value=\""
                    + functionDisplayValue + "\" onclick=\"" + functionName
                    + "\"/>\n");
        }
        buffer.append("</td></tr></table>\n");
View Full Code Here

Examples of easyJ.system.data.PageFunction

    public static StringBuffer getFunctionScript(HttpServletRequest request,
            String pageName) throws EasyJException {
        StringBuffer buffer = new StringBuffer();
        /* 获得功能列表 */
        PageFunction function = new PageFunction();
        function.setFunctionPage(pageName);
        SingleDataProxy sdp = SingleDataProxy.getInstance();
        ArrayList functionList = (ArrayList) sdp.query(function);
        buffer.append("<script language=\"javascript\">\n");
        int size = functionList.size();
        for (int i = 0; i < size; i++) {
            function = (PageFunction) functionList.get(i);
            if (!GenericValidator.isBlankOrNull(function.getFunctionContent())) {
                buffer.append(function.getFunctionContent());
            }
        }
        buffer.append("</script>\n");
        return buffer;
    }
View Full Code Here

Examples of easyJ.system.data.PageFunction

      buffer.append("</th>\n");
    }

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

    PageFunction pf = new PageFunction();
    if (editable)
      pf.setFunctionPositionRelatedValue(new Long(
          Globals.FUNCTION_LIST_EDIT));
    else
      pf.setFunctionPositionRelatedValue(new Long(Globals.FUNCTION_LIST));

    // 得到所有在list显示的功能
    ArrayList pfList = sdp.query(pf);

    // 过滤掉不符合的,符合的包括function_class为空的,或者function_class和 class_name 一致的。
    // 不能加上function_class为查询条件,因为可能会过滤掉function_class为空的。
    ArrayList effectList = new ArrayList();

    for (int i = 0; i < pfList.size(); i++) {
      pf = (PageFunction) pfList.get(i);
      if (pf.getFunctionClass() == null
          || className.equals(pf.getFunctionClass()))
        effectList.add(pf);
    }

    if (effectList.size() != 0)
      buffer.append("<th>操作</th>");

    buffer.append("</tr>\n");
    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><input type=\"checkbox\" name=\"check\" id=\"check"
                + i
                + "\"  value=\""
                + primaryKeyValue
                + "\"/> </td>\n");

        // 根据用户是需要什么样的显示页面来确定是否需要编辑
        if (editable) {
          buffer.append(getDisplayEdit(object, displayProperties,
              null, i, false));
        } else {
          buffer.append(getDisplayList(object, displayProperties, i));
        }

        // 输出每列的功能按钮
        if (effectList.size() != 0) {
          buffer.append("<td>");
          // 下面将主键值加入到functionName当中(见表Page_Function),需要functionName带有括号,例如Data.apply('cn.edu.pku.dr.requirement.elicitation.action.ProjectAction'),
          // 这里是要在括号内加入主键名以及主键值作为参数,例如加入后可能变为apply('cn.edu.pku.dr.requirement.elicitation.action.ProjectAction','projectId',1);
          for (int k = 0; k < effectList.size(); k++) {
            pf = (PageFunction) effectList.get(k);
            // 如果功能的出现需要条件,则要进行判断
            Integer result = null;
            // 这里0,1,-1的含义见FunctionCondition
            if (pf.getFunctionCondition() != null) {
              result = (Integer) BeanUtil.invokeStaticMethod(
                  FunctionCondition.class, pf
                      .getFunctionCondition(),
                  new Object[] { object, userId });
              // 如果值不为真,则继续。
              if (result.intValue() == -1)
                continue;
            }
            String functionName = pf.getFunctionName();

            // 这里i代表行号,可能会被用到,也可能没有用到。看具体的方法
            functionName = functionName.trim().substring(0,
                functionName.length() - 1)
                + ",'"
                + primaryKey
                + "',"
                + primaryKeyValue
                + "," + i + ")";
            if (result == null || result.intValue() == 1)
              buffer.append("<input type=\"button\" value=\""
                  + pf.getFunctionDisplayValue()
                  + "\" onclick=\"" + functionName + "\"/>");
            else
              buffer
                  .append("<input type=\"button\" disabled value=\""
                      + pf.getFunctionDisplayValue()
                      + "\" onclick=\""
                      + functionName
                      + "\"/>");
          }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.function.PageFunction

   * Creates an unnamed function. Make sure the name of the function is set using {@link #setName} before the function
   * is added to the report's function collection.
   */
  public IndexDataGeneratorFunction()
  {
    this.pageFunction = new PageFunction();
    this.indexSeparator = ".";
    this.model = new TypedTableModel();
    this.dataFormula = new FormulaExpression();
    this.dataStorage = new TreeMap();
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.function.PageFunction

  public void testPageCount() throws Exception
  {
    GroupsDemo demo = new GroupsDemo();
    MasterReport report = demo.createReport();
    final PageFunction pf = new PageFunction("JUnit-Page");
    pf.setDependencyLevel(2);
    report.addExpression(pf);
//    report.addExpression(new PageVerifyFunction("pf-verify"));

    assertTrue(FunctionalityTestLib.execGraphics2D(report));
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.function.PageFunction

   * is added to the report's function collection.
   */
  public TocDataGeneratorFunction()
  {
    this.groups = new ArrayList();
    this.pageFunction = new PageFunction();
    this.indexSeparator = ".";
    this.model = new TypedTableModel();
    this.titleFormula = new FormulaExpression();
    this.dependencyLevel = LayoutProcess.LEVEL_COLLECT;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.function.PageFunction

  {

    final MasterReport result = new MasterReport();

    // set up the functions...
    final PageFunction f1 = new PageFunction("page_number");
    result.addExpression(f1);

    // set up the item band...
    final ItemBand itemBand = result.getItemBand();
    configureItemBand(itemBand);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.