本文整理汇总了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");
}
}
示例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");
}
}