首先我们实现一个jsp输入框与birt的异步刷新。
新建一个报表,取名TopNPercent.rptdesign,空白模板,sql查询结果集。
新建数据源MyDataSource,采用BIRT设计器自带的例子数据库:
驱动程序类:org.eclipse.birt.report.data.oda.sampledb.Driver (Classic Models Inc. SampleDB Driver)
Database URL:jdbc:classicmodels:sampled
用户名:ClassicModels
新建数据集Customer Sales
select CUSTOMERS.CUSTOMERNAME,
CUSTOMERS.CUSTOMERNUMBER,
sum(ORDERDETAILS.QUANTITYORDERED *
ORDERDETAILS.PRICEEACH) as CUSTOMERTOTAL
from CUSTOMERS, ORDERS, ORDERDETAILS
where CUSTOMERS.CUSTOMERNUMBER = ORDERS.CUSTOMERNUMBER
and ORDERS.ORDERNUMBER = ORDERDETAILS.ORDERNUMBER
group by CUSTOMERS.CUSTOMERNAME, CUSTOMERS.CUSTOMERNUMBER
order by CUSTOMERTOTAL
新建两个参数:
参数:Top Count
提示文本:Number of Customers for Top "N" Chart
数据类型:十进制
显示类型:文本框
帮助文本:Enter the number of customers you wish included in the top "N" graph of the report
默认值:5
参数:Top Percentage
提示文本:Percentage of Customers for Top N% Listing
数据类型:十进制
显示类型:文本框
帮助文本:Enter the percentage of customers you wish included in the top N% listing of the report
默认值:25
在报表编辑器中插入三个网格,分别为1行2列,2行1列,2行1列。
最上面的网格,左边一列插入一个图片,格式为嵌入,地址为:C:\Documents and Settings\pclenahan\My Documents\ClassicModels\logos\Classic-Models-Full-M.jpg
右边一列插入三个文本,分别为:
文本:Classic Models, Inc. 字体格式:蓝色字体,加粗,大小20点
HTML格式动态文本:701 Gateway Boulevard, San Francisco, CA 94107
HTML格式动态文本:Top <VALUE-OF>params["Top Count"]</VALUE-OF> / Top <VALUE-OF>params["Top Percentage"]</VALUE-OF>% Customers by Revenue 字体格式:黑色字体,加粗,大小16点
中间插入图表:
第一行插入文本:
HTML格式动态文本:Top <VALUE-OF>params["Top Count"]</VALUE-OF> Customers
第二行插入图表:
使用以下来源的数据- Customer Sales,类别(X)系列选择可用列绑定-图表- row["CUSTOMERNAME"],值(Y)系列选择可用列绑定-图表- row["CUSTOMERTOTAL"].
筛选器:row["CUSTOMERTOTAL"],Top N, params["Top Count"]
在第二行图表上建立书签:"TopSalesChart"
最下面的网格:
第一行插入文本:
HTML格式动态文本:Top <VALUE-OF>params["Top Percentage"]</VALUE-OF>% Customers (sorted by name)
第二行插入一个1行3列的表:分别绑定dataSetRow["CUSTOMERNAME"],dataSetRow["CUSTOMERNUMBER"],dataSetRow["CUSTOMERTOTAL"],
新建过滤器:row["CUSTOMERTOTAL"],上百分比,params["Top Percentage"]
在最下面的网格上新建书签:"TopPercent"
最终预览的效果:
新建JSP,名称为mashup.jsp,内容如下:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/birt.tld" prefix="birt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<title>BIRT JSP Tag Lib Mashup</title>
<style>
.pageHeader {
position: absolute;
width: 1020px;
text-align: center;
color: #224499;
font-size: xx-large;
font-weight: bold;
}
.mashupContainer {
position: absolute;
font-family: Verdana, Tahoma, Arial;
font-size: 11px;
border: 1px solid #87AFDA;
margin: 3px;
}
.mashupTitle {
position: absolute;
background: #D4E6FC;
font-size: 14px;
font-weight: bold;
color: #224499;
padding: 3px;
border-bottom: 1px solid #87AFDA;
}
.mashupContent {
position: absolute;
padding: 3px;
}
</style>
<script type="text/javascript">
function populateDefaults(elem){
txtBox = document.getElementById(elem);
if(txtBox.value == ""){
if(elem == "TopN"){
txtBox.value = 5;
}else if(elem == "TopP"){
txtBox.value = 25;
}
}
}
function refreshTag(iframeName, elem, paramName) {
var c = document.getElementById(elem).value;
origUrl = window.frames[iframeName].location.toString();
var pos = origUrl.indexOf('&__overwrite=true&Top');
if (pos > 0) {
window.frames[iframeName].location = origUrl.substr(0, pos) + '&__overwrite=true&' + paramName + '=' + c;
} else {
window.frames[iframeName].location = origUrl
+ '&__overwrite=true&' + paramName + '=' + c;
}
}
</script>
</head>
<body>
<div class="mashupContainer" id="salesDataContainer" style="z-index: 1000; top: 50px; left: 50px; height: 400px; width: 320px;">
<div class="mashupTitle" style="z-index: -1; width: 98%; height: 20px;">Report Parameters</div>
<div class="mashupContent" id="SalesData" style="padding-top: 20px; z-index: -1; top: 24px; left: 0px; width; 320px%; height: 300px;">
TOP COUNT PARAMETER
<input type="Text" id="TopN" name="TopN" onblur="populateDefaults('TopN')">
<br><br>
<INPUT TYPE="button" NAME="button" Value="Refresh Chart" onClick="refreshTag('birtViewer', 'TopN', 'Top%20Count')" >
<br><br>
<br><br>
TOP PERCENT PARAMETER
<input type="Text" id="TopP" name=&
构造的时候先调用基类的构造函数,再调用派生类的构造函数
析构的时候先调用派生类的析构函数,再调用基类的析构函数
看一个例子:
#include "stdafx.h"
class Base
{
public:
Base()
{
printf("Base construct!\n");
}
virtual ~Base()
{
printf("Base release!\n");
}
};
class Sub : public Base
{
public:
Sub()
{
printf("Sub construct!\n");
}
~Sub()
{
printf("Sub release!\n");
}
};
class Factory
{
public:
Base *CreateSub()
{
return new Sub();
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Factory fy;
Base *pBase = fy.CreateSub();
delete pBase;
pBase = NULL;
return 0;
}输出结果:
Base construct!
Sub construct!
Sub release!
Base release!
请按任意键继续. . .
注意,本例中如果基类析构函数不加virutal,本例中的情况就不会调用派生类的析构函数。
除非把pBase再转为Sub*类型。
Selenium测试直接运行在浏览器中,就像真正的用户在操作一样,这对项目经理,QA,tester 来说 无疑是一个宝贝。
更易于项目测试人员和开发人员的沟通和提高效率。
目前支持的浏览器包括IE、Mozilla Firefox、Mozilla Suite等。
这个工具的主要功能包括:测试与浏览器的兼容性—测试你的应用程序看是否能够很好得工作在不同浏览器和操作系统之上。
测试系统功能—创建衰退测试检验软件功能和用户需求。
支持自动录制动作和自动生成。
Net、Java、Perl等不同语言的测试脚本。
Selenium 是ThoughtWorks专门为Web应用程序编写的一个验收测试工具。
Selenium IDE:一个Firefox插件,可以录制用户的基本操作,生成测试用例。随后可以运行这些测试用例在浏览器里回放,可将测试用例转换为其他语言的自动化脚本。
官方文档解析
http://seleniumhq.org/docs/02_selenium_ide.jsp
已有 0 人发表留言,猛击->>这里<<-参与讨论
ITeye推荐
- —软件人才免语言低担保 赴美带薪读研!—