Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7582584 建立时间:2006年5月29日 |

| |
[eXtremeComponents]ExtremeTable 软件技术, 电脑与网络
lhwork 发表于 2006/6/28 11:28:34 |
Author: 江南白衣
Home Page:http://www.extremecomponents.org
Extreme Table是最功能强大而又容易配置,扩展,自定义的Table 控件。
基础读物:
1. ExtremeTable自带的文档.
2.Luck翻译的ExtremeTable官方文档中文版
0.概述
Extreme Table最紧要的功能是排序, 分页, 导出Excel, pdf和汇总。
快速浏览自带文档及springside的best 示例代码: listBook.jsp和listOrder.jsp.
0.1 安装原始版本
1. 从http://www.extremecomponents.org 下载最新版
2.把extremecomponents.jar 放入web-inf/lib
3.根据minum, 导出excel 或 导出pdf的需要,把/lib下的jiarcopy到web-inf/lib
4.把images里的图片放入web的任意目录
5.把css文件放到web的任意目录
6.在/source/org/extremecomponents/table/core目录找到extremetable.properties文件,把它复制到WEB-INF/classes里面.
7.修改web.xml , 修改全局属性(见2)。
0.2 安装SpringSide的优化版本
1.将springside中的web-inf/lib/extremecomponents-springside.jar 放入web-inf/lib目录
2.将Extreme带的minum和excel jar放入
3.复制 springside中images/table下面的图片到对应目录。(还有一幅属于springside的Table Head的图,查)
4.将springside中的修改版extremecomponents.css文件放入任意目录
5.把src/extremetable.properties 复制到对应目录
6.修改web.xml , 修改全局属性。
0.3 使用Compact View
默认的式样不符合大家的审美,幸亏还有Compact View和css设置,让我们可以敬谢不敏它号称非常方便的HtmlView子类扩展。
1. 在全局设置里 table.view.html=org.extremecomponents.table.view.CompactView
2.把images里/table/compact/*.gif copy 到 /table
1.自定义及扩展
ExtremeTable比Display Tag的i一个就是良好的自定义和扩展能力,不用千人一面。 不过,人总是懒的,虽然扩展子类很容易,但能不扩展就还是不可扩展了。幸亏用Compact View再改改CSS一般就能达到要求。
1.1. 良好的CSS定义
ExtremeTable 的CSS定义非常严谨, 并且提供很多个层次的修改方式:
1.直接修改css文件, 可以把table view改成任意样式
2.修改全局属性, 改变某种元素对应的css class名table.styleClass=tableRegion
3.在某个页面的row,column tag中定义class <ec:row style="" or styleClass=""/>
SpringSide采用层次1, 直接修改extremecomponents.css为合适的样式
1.2.方便的<tr><td>属性扩展
row与column已提供了丰富的普通属性与 javascript属性如onClick(), 如果属性仍然未够,可自行扩展<row>与<column>tag ,并通过全局属性指定新的子类名。
为了方便大家在子类扩展属性, extreme Table提供了专门的回调函数与Util函数如(详细请看手册)public void addExtendedAttributes(Row row){ table.addAttribute(TableConstants.IDENTIFIER, TagUtils.evaluateExpressionAsString("identifier",identifier, this, pageContext)); }
如果不是Extremetable的特别支持, 普通taglib class要扩展属性的话: 1.定义真正的Java属性,setter,getter 2. tld文件中声明新的属性 3.重载输出函数将新属性打印出来
1.3 扩展HTMLView,cell 等显示组件
Extreme Table在这些类的扩展上放便很多,但这个版本里我还没有进行尝试,就不写了。
2.全局属性配置
ExtremeTable支持在properties文件里方便的统一配置丰富的全局属性
在/source/org/extremecomponents/table/core目录找到extremetable.properties文件,把它复制到WEB-INF/classes里面.
在web.xml里面增加 <context-param> <param-name>extremecomponentsPreferencesLocation</param-name> <param-value>/extremetable.properties</param-value> </context-param>
我修改过的属性有:table.autoIncludeParameters=falsetable.filterable=falsetable.view.html=org.extremecomponents.table.view.CompactViewtable.locale=zh_CNcolumn.format.date=yyyy-MM-ddcolumn.format.currency=¥###,###,#00.00row.highlightRow=true
3.导出
ExtremeTable导出的一项重要特性是可以根据不同的View导出不同的列.
比如html管理界面可能只列出订单几个最重要的列,而导出excel时则需要导出所有的列。<ec:column property="orderdate" title="订单日期" cell="date" format="yyyy-MM-dd" viewsDenied= "html"/>
以上订单日期列在html view看不到,而excel,pdf view可以见到.
而"编辑图标","选择Checkbox"这些管理界面上的列,也可以设置不export到pdf,excel view
3.1.中文问题
中文问题一共有3处 1.文件名中文问题,重载AbstractExportFilter.java 的setResponseHeaders()函数
import org.springside.framework.utils.StrUtil; response.setHeader("Content-Disposition", "attachment;filename=\"" + StrUtil.toUtf8(exportName) + "\"");
2.导出xls 重载XlsView.java,在body()和createHeader()处加hssfCell.setEncoding(HSSFCell.ENCODING_UTF_16);
3.导出pdf 较长,看http://forum.javaeye.com/viewtopic.php?p=108909#108909 ,不过我更希望等它ExtremeTable自己升级
springside的做法是放弃导出前pdf, 直接修改前两个函数并压回jar内.(放弃导出pdf还可以省3M jar,hehe)
4.其他要点
4.1. 使用排序功能时,如果property为嵌套属性时,需要设置alias
因为javascript的关系.<ec:column property="customer.name" title="客户名称" alias="customer"/>
4.2. Date Cell与NumberCell
在全局属性定义:
column.format.date= yyyy-MM-ddcolumn.format.currency= ¥###,###,#00.00
<ec:column property="totalprice" title="总金额" cell="currency" width="80" /><ec:column property="shipdate" title="发货日期" cell="date" width= "80"/>
4.3. 汇总
在column中加入两个cac属性,就会自动在table的底端显示汇总
<ec:column property="totalprice" title="总金额" cell="number" format="###,###,##0.00" calc="total" calcTitle= "汇总:"/>
4.4 i18N
4.4.1 column Title的i18N
在Web.xml里面增加<context-param> <param-name>extremecomponentsMessagesLocation</param-name> <param-value>messages</param-value></context-param><ec:column property="name" title="book.name"/>
4.4.2 按钮的i18n
extreme table的默认zh_CN已支持中文了,但有些信息不支持,所以自己再实现了一个properties文件,日后如果他跟上了可以去掉.
全局定义里
table.locale=zh_CN
为 source/org/extremecomponents/table/resource/extremetableResourceBundle_zh_CN.properties 补齐以下几项
toolbar.firstPageText=\u7b2c\u4e00\u9875toolbar.lastPageText=\u6700\u540e\u9875toolbar.nextPageText=\u4e0b\u4e00\u9875toolbar.prevPageText=\u4e0a\u4e00\u9875
springside把他直接压回jar.
也可以copy 到src下面
web.xml增加
<context-param> <param-name>extremecomponentsMessagesLocation</param-name> <param-value>extremetableResourceBundle</param-value> </context-param>
4.5 不显示导出excel及分页
最快的方式是设置table的showStatusBar= false<ec:table items= "order.orderItems"var="item" action="" showStatusBar= "false"> |
|
回复:ExtremeTable 软件技术, 电脑与网络
dd(游客)发表评论于2011/6/21 16:38:20 |
<script>alert('cccccc');</script> |
|
Comfortable Shoe Brands 软件技术, 电脑与网络
tiffany watches(游客)发表评论于2010/4/1 17:09:27 |
DanskoWhat started as a Danish clog or the “perfect barn shoe” has since become a complete line of much-beloved footwear, with a legion of devoted fans. Offering boots, shoes, sandals, and clogs for men, women and kids, Dansko footwear is a marriage of comfort and down-to-earth styling.EccoEcco shoes offer something that many of the other comfort brands don’t - extremely trendy styling. In fact, there are several styles of Ecco shoes that you’d fall in love with even if they weren’t a comfort brand. With footwear in the casual, business and outdoor categories, Ecco offers shoes for men, women & kids, and is also an extremely popular manufacturer of golf shoes.BirkenstockWith features such as arch support, raised toe bars and deep heel cups, Birkenstock shoes and sandals offer plenty of comfort enhancements, as well as being probably the most legendary shoe brand on this list. Having been a favorite among hippies in the late 1960s, in the 1970s their popularity soared, making Birkenstock a household name. Though you may think only of brown two-strap sandals when you think of Birkenstocks, their lines now include contemporary colors and styles, and are truly “feel-good” shoes.New BalanceNew balance With an emphasis on walking shoes, the engineers at New Balance know the importance of a proper fit and offer a wide range of widths and sizes. Often recommended by podiatrists, New Balance sho... |
|
» 1 »
|