当前位置: 首页>>代码示例>>Java>>正文


Java ParamUtils.getIntParameter方法代码示例

本文整理汇总了Java中org.jivesoftware.util.ParamUtils.getIntParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ParamUtils.getIntParameter方法的具体用法?Java ParamUtils.getIntParameter怎么用?Java ParamUtils.getIntParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.util.ParamUtils的用法示例。


在下文中一共展示了ParamUtils.getIntParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: service

import org.jivesoftware.util.ParamUtils; //导入方法依赖的package包/类
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // retrieve parameters
    String statisticKey = request.getParameter("stat");
    String timePeriod = request.getParameter("timeperiod");
    String graphcolor = request.getParameter("color");
    boolean sparkLines = request.getParameter("sparkline") != null;
    boolean pdfFormat = request.getParameter("pdf") != null;
    long[] dateRange = GraphEngine.parseTimePeriod(timePeriod);
    int width;
    int height;

    if (pdfFormat) {
        // PDF A4 page = 595 wide - (50px * 2 margins) = 495
        width = ParamUtils.getIntParameter(request, "width", 495);
        height = ParamUtils.getIntParameter(request, "height", 252);
        JFreeChart[] charts;
        Statistic[] stats;
        if (request.getParameter("pdf").equalsIgnoreCase("all")) {
            String[] statKeys = statsViewer.getAllHighLevelStatKeys();
            List<String> statList = Arrays.asList(statKeys);
            Collections.sort(statList, new Comparator<String>() {
                public int compare(String stat1, String stat2) {
                    String statName1 = statsViewer.getStatistic(stat1)[0].getName();
                    String statName2 = statsViewer.getStatistic(stat2)[0].getName();
                    return statName1.toLowerCase().compareTo(statName2.toLowerCase());
                }
            });
            charts = new JFreeChart[statList.size()];
            stats = new Statistic[statList.size()];
            int index = 0;
            for (String statName : statList) {
                stats[index] = statsViewer.getStatistic(statName)[0];
                charts[index] = graphEngine.generateChart(statName, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
                index++;
            }
        } else {
            charts = new JFreeChart[] {graphEngine.generateChart(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2])};
            stats = new Statistic[] {statsViewer.getStatistic(statisticKey)[0]};
        }
        writePDFContent(request, response, charts, stats, dateRange[0], dateRange[1], width, height);
    } else {
        byte[] chart;
        if (sparkLines) {
            width = ParamUtils.getIntParameter(request, "width", 200);
            height = ParamUtils.getIntParameter(request, "height", 50);
            chart = graphEngine.generateSparklinesGraph(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
        }
        else {
            width = ParamUtils.getIntParameter(request, "width", 590);
            height = ParamUtils.getIntParameter(request, "height", 300);
            chart = graphEngine.generateGraph(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
        }

        writeImageContent(response, chart, "image/png");
    }


}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:60,代码来源:GraphServlet.java

示例2: service

import org.jivesoftware.util.ParamUtils; //导入方法依赖的package包/类
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       // retrieve parameters
       String statisticKey = request.getParameter("stat");
       String timePeriod = request.getParameter("timeperiod");
       String graphcolor = request.getParameter("color");
       boolean sparkLines = request.getParameter("sparkline") != null;
       boolean pdfFormat = request.getParameter("pdf") != null;
       long[] dateRange = GraphEngine.parseTimePeriod(timePeriod);
       int width;
       int height;

       if (pdfFormat) {
           // PDF A4 page = 595 wide - (50px * 2 margins) = 495
           width = ParamUtils.getIntParameter(request, "width", 495);
           height = ParamUtils.getIntParameter(request, "height", 252);
           JFreeChart[] charts;
           Statistic[] stats;
           if (request.getParameter("pdf").equalsIgnoreCase("all")) {
               String[] statKeys = statsViewer.getAllHighLevelStatKeys();
               List<String> statList = Arrays.asList(statKeys);
               Collections.sort(statList, new Comparator<String>() {
                   public int compare(String stat1, String stat2) {
                       String statName1 = statsViewer.getStatistic(stat1)[0].getName();
                       String statName2 = statsViewer.getStatistic(stat2)[0].getName();
                       return statName1.toLowerCase().compareTo(statName2.toLowerCase());
                   }
               });
               charts = new JFreeChart[statList.size()];
               stats = new Statistic[statList.size()];
               int index = 0;
               for (String statName : statList) {
                   stats[index] = statsViewer.getStatistic(statName)[0];
                   charts[index] = graphEngine.generateChart(statName, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
                   index++;
               }
           } else {
               charts = new JFreeChart[] {graphEngine.generateChart(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2])};
               stats = new Statistic[] {statsViewer.getStatistic(statisticKey)[0]};
           }
           writePDFContent(request, response, charts, stats, dateRange[0], dateRange[1], width, height);
       } else {
           byte[] chart;
           if (sparkLines) {
               width = ParamUtils.getIntParameter(request, "width", 200);
               height = ParamUtils.getIntParameter(request, "height", 50);
               chart = graphEngine.generateSparklinesGraph(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
           }
           else {
               width = ParamUtils.getIntParameter(request, "width", 590);
               height = ParamUtils.getIntParameter(request, "height", 300);
               chart = graphEngine.generateGraph(statisticKey, width, height, graphcolor, dateRange[0], dateRange[1], (int)dateRange[2]);
           }

           writeImageContent(response, chart, "image/png");
       }


   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:60,代码来源:GraphServlet.java


注:本文中的org.jivesoftware.util.ParamUtils.getIntParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。