eXtremeComponents参考文档(二)

本文介绍 eXtremeTable 的最新更新,包括 RowTag 和 ColumnTag 的新功能、AutoGenerateColumns 的改进、TableTag 的 collection 属性变更等。此外还介绍了 BaseModel 重命名为 TableModel、Limit 和 LimitFactory 的接口化、以及多种 Tag 属性的详细说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

15.1.3. RowTagRowTag<ec:row> 现在被需要,它被用来替代columns。 现在看来它一直被需要。它不知道表中到底有多少列,最近重构的时候我通过 Table -> Row -> Column使结构固定来合并得到更好的灵活性。将来我可能提供更多的 特性,因为我知道eXtremeTable有着清晰的架构。

典型的eXtremeTable如下:

<ec:table items="presidents" var="pres" action="${pageContext.request.contextPath}/presidents.run" > <ec:row> <ec:column property="name"/> <ec:column property="term"/> </ec:row></ec:table>
15.1.4. AutoGenerateColumnsAutoGenerateColumns得到了很大的提高,现在你只需要设置你需要的属性。 当你添加列到ColumnHandler使,defaults将别自动调用。

AutoGenerateColumns为singleton并且不是线程安全的,因此不要定义任何类变量。

现在它的实现可能如下:

public class AutoGenerateColumnsImpl implements AutoGenerateColumns { public void addColumns(TableModel model) { Iterator iterator = columnsToAdd().iterator(); while (iterator.hasNext()) { Map columnToAdd = (Map) iterator.next(); Column column = new Column(model); column.setProperty((String) columnToAdd.get(PROPERTY)); column.setCell((String) columnToAdd.get(CELL)); model.getColumnHandler().addAutoGenerateColumn(column); } }}
15.1.5. Extended AttributesaddExtendedAttributes方法重命名使得如何使用这个特性更清晰。 因此RowTag的addExtendedAttributes现在变为addRowAttributes,ColumnTag变 为addColumnAttributes,TableTag变为addTableAttributes,ExportTag变 为addExportAttributes。另外你参考正确的model bean(它的实现更清晰), 将知道如何添加属性到你的cell、view.....

使用ExportCsvTag的示例如下:

public void addExportAttributes(Export export) { String view = export.getView(); if (StringUtils.isBlank(view)) { export.setView(TableConstants.CSV); export.setImageName(TableConstants.CSV); } export.addAttribute(CsvView.DELIMITER, getDelimiter());}
为了得到delimiter属性值你只需要从Export bean中get它:

Export export = model.getExportHandler().getCurrentExport();String delimiter = export.getAttributeAsString(DELIMITER);
现在你需要在ExportTag中覆盖它,你只需要调用setter方法。如果是新的属性,那么使用 可以和前一版一样使用addAttribute()方法。为了得到值,首先从ExportHandler得到Export, 然后调用需要的getter方法。这和使用其它tags一样。

在RowTag和ColumnTag中增加了两个新的callback方法:modifyRowAttributes和 modifyColumnAttributes,因此你可以在rows/columns被处理时改变属性值。

15.1.6. TableTag的collection属性TableTag的collection属性被删除,现在变为三个新属性:tableId、items和var。 因为我按照标准的JSTL命名,你应该能够根据这些名称知道他们的作用。tableId属性 被用来作为表的唯一标识,items属性用来表示从各种servlet的scopes里取得的集合, var属性表示你将使用EL编写脚本的名称。

依赖你的需要来决定如何使用新的属性,tableId用来唯一标识表。如果你的页面上只使用了 一个eXtremeTable并且不使用Limit特性,那么你根本不需要定义它。默认的表示名为'ec';如果使用 Limit特性你也可以使用'ec'这个名称。然而,如果的一个JSP页面上同时使用两个eXtremeTables你就 需要使用tableId来唯一标识他们。var属性被用来你将使用EL编写脚本的名称。items属性用来表示从 各种servlet的scopes里取得的集合,而且现在非常健壮。你现在能nest集合到另外的对象,或者nest你想的 深度。

取得集合的语法如下:

<ec:table items="command.myObject.myCol" />
本示例将从命令对象(command object)取得myCol集合。

<ec:table items="myCol" />
本示例中将根据名称自动取得集合,就像以前版本的collection属性一样。

15.1.7. BaseModelBaseModel被重命名为TableModel,这是因为已经不需要一个基础包(base package)了,这也 意味着不再需要BaseModel了。

15.1.8. Properties和ResourceBundleweb.xml文件中使用extremecomponentsPreferencesLocation属性取代extremecomponentsPropertiesLocation属性, properties现在被Preferences接口控制。在以后的版本,我将提供可选的xml文件配置。

eXtremeTable不再默认在顶层类路径(top level classpath)寻找 extremecomponents.properties文件。你应该在web.xml中使用设置context-param属性的 值为extremecomponentsPreferencesLocation,这将更为通用。

web.xml文件中使用extremecomponentsMessagesLocation属性取代extremecomponentsResourceBundleLocation属性, internationalization现在被Messages接口控制。

Properties和ResourceBundle属性根据table、row、column、export和filterare区分开。 在以前版本中每个属性都以'table'开头,现在每个属性关联到被使用的标签。另外poperty不再需要使用奇怪的下划线语法, 而是使用dot来强调。

下面为properties文件的示例:

table.imagePath=/extremesite/images/*.giftable.rowsDisplayed=12column.parse.date=yyyy-MM-ddcolumn.format.date=MM/dd/yyyycolumn.format.currency=$###,###,##0.00
[英文的属性文件示例如下:]

statusbar.resultsFound={0} results found, displaying {1} to {2}statusbar.noResultsFound=There were no results found.toolbar.firstPageTooltip=First Pagetoolbar.lastPageTooltip=Last Pagetoolbar.prevPageTooltip=Previous Pagetoolbar.nextPageTooltip=Next Pagetoolbar.filterTooltip=Filtertoolbar.clearTooltip=Cleartoolbar.clearText=Cleartoolbar.firstPageText=Firsttoolbar.lastPageText=Lasttoolbar.nextPageText=Nexttoolbar.prevPageText=Prevtoolbar.filterText=Filtercolumn.headercell.sortTooltip=Sort Bycolumn.calc.total=Totalcolumn.calc.average=Average
15.1.9. pageContextTableModel (以前的BaseModel)不再直接访问pageContext,取而代之的是使用Context接口, 默认的被pageContext支持。直接访问pageContext是一个不好的实现,Context提供你需要从不同servlet scopes中 取得需要属性值的所有方法。然而,如果你需要直接访问背后的对象,可以使用getContextObject()方法。

15.1.10. Limit和LimitFactoryLimit和LimitFactory现在都是接口,以前版本的实现不如我想象的简单。然而, Limit对象的方法命名和以前版本的一样,因此你以前的代码也能很好的工作。

我两个Limit实现重构为一个,但是仍有两个LimitFactory实现, 从coding的观点用户只要使用一个 实现,但是它必须兼容以前的版本。现在只有一个Limit实现我重命名为TableLimit。同时,因为Limit特性 依赖Context而不是request,我重命名工厂类(TableLimitFactory)来reflect它。

Limit在导出时正确地显示行信息,Limit具有一个isExported()方法。

使用Limit和LimitFactory的示例如下:

Context context = new HttpServletRequestContext(request);LimitFactory limitFactory = new TableLimitFactory(context, tableId);Limit limit = new TableLimit(limitFactory);
设置row属性,仅设置totalRows和默认的行显示:

limit.setRowAttributes(totalRows, DEFAULT_ROWS_DISPLAYED);
RequestLimitFactory具有另一个如果没有指定tableId将设置为ec的构造函数:

Context context = new HttpServletRequestContext(request);LimitFactory limitFactory = new TableLimitFactory(context);
15.1.11. TableTag的saveFilterSort属性saveFilterSort属性被state属性取代,state属性参照State接口并能插接不通的关于 如何保存表状态的实现。

State接口如下:

public interface State { public void saveParameters(TableModel model, Map parameters); public Map getParameters(TableModel model);}
表新增了两个属性:state和stateAttr。state属性使用预设的四种 状态(default、notifyToDefault、persist和notifyToPersist)之一, 你也可以插接自己的实现。default状态不维持任何状态;persist状态没有任何参数传入,将一直维持表的状态; notifyToDefault状态将一直维持表的状态直到你传入参数告诉它回到default状态;notifyToPersist状态 将一直维持当前状态直到你传入参数告诉它维持persisted状态。stateAttr为指定参数提供了一条途径,你 也可以使用属性文件在全局范围内指定它。为了向后兼容,默认参数一直为useSessionFilterSort。

如果你想state按照不同方式工作你只要实现State接口,然后使用TableTag的state属性来指定实现类的 全路径。

15.1.12. ColumnTag的showTotal属性列新增了两个属性:calc和calcTitle:

<ec:column property="data" calc="total" calcTitle="Total:" />
calc属性实现具有唯一方法的Calc接口:

public interface Calc { public Number getCalcResult(TableModel model, Column column);}
它传入model和column,并返回一个Number型的值。默认的实现为总计和平均值。

为了使用定制的Calc,只需要使用ColumnTag的calc属性来指定实现Calc接口的实现类的 全路径。

Calc为singleton并且不是线程安全的,因此不要定义任何类变量。

showTotal因为不再适用在新版中被删除,我也删除了表中的totalTitle。

15.1.13. Image名search图片名从search变为filter。

15.1.14. FormTag / InputTag DeprecatedFormTag和InputTag现在为deprecated。他们在新的html视图(view)中不再被使用。

15.1.15. RetrieveRowsCallbacks、FilterRowsCallback、SortRowsCallbackCallbacks为singleton并且不是线程安全的,因此不要定义任何类变量。

Chapter 16. Tag Attributes
16.1. TableTag
Table 16.1.

Name Description
action The URI that will be called when the filter, sort and pagination is used.
autoIncludeParameters Specify whether or not to automatically include the parameters, as hidden inputs, passed into the JSP.
border The table border attribute. The default is 0.
cellpadding The table cellpadding attribute. The default is 0.
cellspacing The table cellspacing attribute. The default is 0.
filterable Specify whether or not the table is filterable. Boolean value with the default being true.
filterRowsCallback A fully qualified class name to a custom FilterRowsCallback implementation. Could also be a named type in the preferences. Used to filter the Collection of Beans or Collection of Maps.
form The reference to a surrounding form element.
imagePath The path to find the images. For example imagePath=/extremesite/images/*.png is saying look in the image directory for the .png images.
intercept A fully qualified class name to a custom InterceptTable implementation. Could also be a named type in the preferences. Used to add table attributes.
items Reference the collection that will be retrieved.
locale The locale for this table. For example fr_FR is used for the French translation.
method Used to invoke the table action using a POST or GET.
onsubmit The javascript onsubmit action for the table.
retrieveRowsCallback A fully qualified class name to a custom RetrieveRowsCallback implementation. Could also be a named type in the preferences. Used to retrieve the Collection of Beans or Collection of Maps.
rowsDisplayed The number of rows to display in the table.
scope The scope (page, request, session, or application) to find the Collection of beans or Collection of Maps defined by the collection attribute.
showPagination Specify whether or not the table should use pagination. Boolean value with the default being true.
showExports Specify whether or not the table should use the exports. Boolean value with the default being true.
showStatusBar Specify whether or not the table should use the status bar. Boolean value with the default being true.
showTooltips Specify whether or not to show the tooltips. Boolean value with the default being true.
sortRowsCallback A fully qualified class name to a custom SortRowsCallback implementation. Could also be a named type in the preferences. Used to sort the Collection of Beans or Collection of Maps.
sortable Specify whether or not the table is sortable. Boolean value with the default being true.
state The table state to use when returning to a table. Acceptable values are default, notifyToDefault, persist, notifyToPersist.
stateAttr The table attribute used to invoke the state change of the table.
style The css inline style sheet.
styleClass The css class style sheet.
tableId The unique identifier for the table.
theme The theme to style the table. The default is eXtremeTable.
title The title of the table. The title will display above the table.
var The name of the variable to hold the current row bean.
view Generates the output. The default is the HtmlView to generate the HTML. Also used by the exports to generate XLS-FO, POI, and CSV.
width Width of the table.

16.2. RowTag
Table 16.2.

Name Description
highlightClass The css class style sheet when highlighting rows.
highlightRow Used to turn the highlight feature on and off. Acceptable values are true or false. The default is false.
intercept A fully qualified class name to a custom InterceptRow implementation. Could also be a named type in the preferences. Used to add or modify row attributes.
onclick The javascript onclick action
onmouseout The javascript onmouseout action
onmouseover The javascript onmouseover action
style The css inline style sheet.
styleClass The css class style sheet.

16.3. ColumnTag
Table 16.3.

Name Description
alias Used to uniquely identify the column when the same property is used for more than one column.
calc A fully qualified class name to a custom Calc implementation. Could also be a named type in the preferences. Used to do math on a column.
calcTitle The title of the calc.
cell Display for the column. The valid values are display, currency, rowCount, and date. The default value is display. The cell can also be a fully qualified class name to a custom Cell. Be sure to implement the Cell interface or extend AbstractCell if making a custom cell.
escapeAutoFormat Specify whether auto format of value will be skipped. False by default, and is only effective if autoformatting is implement in the view.
filterable Specify whether or not the column should be filterable. Acceptable values are true or false. The default is to use the value for the table filterable attribute.
filterCell Displays the filter column. The valid values are filter and droplist. The default is filter. The cell can also be a fully qualified class name to a custom cell.
filterClass The css class style sheet used to define what the table filter column looks like.
filterStyle The css class style sheet to use for the filter column.
format The format to use for the cell. For instance if used with a date cell then the format can be MM/dd/yyyy.
headerCell Display for the header column. The default is header. The cell can also be a fully qualified class name to a custom cell.
headerClass The css class style sheet used to define what the table header column looks like.
headerStyle The css class style sheet to use for the header column.
intercept A fully qualified class name to a custom InterceptColumn implementation. Could also be a named type in the preferences. Used to add or modify column attributes.
parse Used if the format needs to be interpreted. For instance, a date needs to be parsed in the specific format, such as MM-dd-yyyy.
property The bean attribute to use for the column.
sortable Specify whether or not the column should be sortable. The acceptable values are true or false. The default is to use the value for the table sortable attribute.
style The css inline style sheet.
styleClass The css class style sheet.
title The display for the table column header. If the title is not specified then it will default to the name of the property, changing the camelcase syntax to separate words.
value The value for the column. If the value attribute is not specifed then it will be retrieved automatically using the property attribute. The value can also be defined within the column body.
viewsAllowed The comma separated list of views that this column will be used in.
viewsDenied The comma separated list of views that this column will not be used in.
width Specify the column width.

16.4. ExportTag
Table 16.4.

Name Description
fileName The name of the export file.
imageName The image name.
intercept A fully qualified class name to a custom InterceptExport implementation. Could also be a named type in the preferences. Used to add or modify export attributes.
view A fully qualified class name to a custom View implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
viewResolver A fully qualified class name to a custom ViewResolver implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
text The text for the export view.
tooltip The tooltip that shows up when you mouseover the export image.

16.5. ExportXlsTag
Table 16.5.

Name Description
fileName The name of the export file.
imageName The image name.
intercept A fully qualified class name to a custom InterceptExport implementation. Could also be a named type in the preferences. Used to add or modify export attributes.
view A fully qualified class name to a custom View implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
viewResolver A fully qualified class name to a custom ViewResolver implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
text The text for the export view.
tooltip The tooltip that shows up when you mouseover the export image.

16.6. ExportCsvTag
Table 16.6.

Name Description
delimiter What to use as the file delimiter. The default is a comma.
fileName The name of the export file.
imageName The image name.
intercept A fully qualified class name to a custom InterceptExport implementation. Could also be a named type in the preferences. Used to add or modify export attributes.
view A fully qualified class name to a custom View implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
viewResolver A fully qualified class name to a custom ViewResolver implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
text The text for the export view.
tooltip The tooltip that shows up when you mouseover the export image.

16.7. ExportPdfTag
Table 16.7.

Name Description
headerBackgroundColor The background color on the header column.
headerColor The font color for the header column.
headerTitle The title displayed at the top of the page.
fileName The name of the export file.
imageName The image name.
intercept A fully qualified class name to a custom InterceptExport implementation. Could also be a named type in the preferences. Used to add or modify export attributes.
view A fully qualified class name to a custom View implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
viewResolver A fully qualified class name to a custom ViewResolver implementation. Could also be a named type in the preferences. Default types are pdf, xls, or csv.
text The text for the export view.
tooltip The tooltip that shows up when you mouseover the export image.

16.8. ColumnsTag
Table 16.8.

Name Description
autoGenerateColumns A fully qualified class name to a custom AutoGenerateColumns implementation. Could also be a named type in the preferences. Used to generate columns on the fly.

16.9. ParameterTag
Table 16.9.

Name Description
name The name of the parameter.
value The value of the parameter.
基于数据挖掘的音乐推荐系统设计与实现 需要一个代码说明,不需要论文 采用python语言,django框架,mysql数据库开发 编程环境:pycharm,mysql8.0 系统分为前台+后台模式开发 网站前台: 用户注册, 登录 搜索音乐,音乐欣赏(可以在线进行播放) 用户登陆时选择相关感兴趣的音乐风格 音乐收藏 音乐推荐算法:(重点) 本课题需要大量用户行为(如播放记录、收藏列表)、音乐特征(如音频特征、歌曲元数据)等数据 (1)根据用户之间相似性或关联性,给一个用户推荐与其相似或有关联的其他用户所感兴趣的音乐; (2)根据音乐之间的相似性或关联性,给一个用户推荐与其感兴趣的音乐相似或有关联的其他音乐。 基于用户的推荐和基于物品的推荐 其中基于用户的推荐是基于用户的相似度找出相似相似用户,然后向目标用户推荐其相似用户喜欢的东西(和你类似的人也喜欢**东西); 而基于物品的推荐是基于物品的相似度找出相似的物品做推荐(喜欢该音乐的人还喜欢了**音乐); 管理员 管理员信息管理 注册用户管理,审核 音乐爬虫(爬虫方式爬取网站音乐数据) 音乐信息管理(上传歌曲MP3,以便前台播放) 音乐收藏管理 用户 用户资料修改 我的音乐收藏 完整前后端源码,部署后可正常运行! 环境说明 开发语言:python后端 python版本:3.7 数据库:mysql 5.7+ 数据库工具:Navicat11+ 开发软件:pycharm
MPU6050是一款广泛应用在无人机、机器人和运动设备中的六轴姿态传感器,它集成了三轴陀螺仪和三轴加速度计。这款传感器能够实时监测并提供设备的角速度和线性加速度数据,对于理解物体的动态运动状态至关重要。在Arduino平台上,通过特定的库文件可以方便地与MPU6050进行通信,获取并解析传感器数据。 `MPU6050.cpp`和`MPU6050.h`是Arduino库的关键组成部分。`MPU6050.h`是头文件,包含了定义传感器接口和函数声明。它定义了类`MPU6050`,该类包含了初始化传感器、读取数据等方法。例如,`begin()`函数用于设置传感器的工作模式和I2C地址,`getAcceleration()`和`getGyroscope()`则分别用于获取加速度和角速度数据。 在Arduino项目中,首先需要包含`MPU6050.h`头文件,然后创建`MPU6050`对象,并调用`begin()`函数初始化传感器。之后,可以通过循环调用`getAcceleration()`和`getGyroscope()`来不断更新传感器读数。为了处理这些原始数据,通常还需要进行校准和滤波,以消除噪声和漂移。 I2C通信协议是MPU6050与Arduino交互的基础,它是一种低引脚数的串行通信协议,允许多个设备共享一对数据线。Arduino板上的Wire库提供了I2C通信的底层支持,使得用户无需深入了解通信细节,就能方便地与MPU6050交互。 MPU6050传感器的数据包括加速度(X、Y、Z轴)和角速度(同样为X、Y、Z轴)。加速度数据可以用来计算物体的静态位置和动态运动,而角速度数据则能反映物体转动的速度。结合这两个数据,可以进一步计算出物体的姿态(如角度和角速度变化)。 在嵌入式开发领域,特别是使用STM32微控制器时,也可以找到类似的库来驱动MPU6050。STM32通常具有更强大的处理能力和更多的GPIO口,可以实现更复杂的控制算法。然而,基本的传感器操作流程和数据处理原理与Arduino平台相似。 在实际应用中,除了基本的传感器读取,还可能涉及到温度补偿、低功耗模式设置、DMP(数字运动处理器)功能的利用等高级特性。DMP可以帮助处理传感器数据,实现更高级的运动估计,减轻主控制器的计算负担。 MPU6050是一个强大的六轴传感器,广泛应用于各种需要实时运动追踪的项目中。通过 Arduino 或 STM32 的库文件,开发者可以轻松地与传感器交互,获取并处理数据,实现各种创新应用。博客和其他开源资源是学习和解决问题的重要途径,通过这些资源,开发者可以获得关于MPU6050的详细信息和实践指南
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值