dorado7问答 defaultvalue怎么定义当天

Dorado Presentation Middleware(即Dorado展现中间件,以下简称Dorado)致力于辅助Web应用中表现层的开发过程。Dorado主要可以为您带来如下两方面的使用价值:
更加美观、更加人性化的Web操作界面。
更加高效的表现层开发效率。
Dorado Presentation Middleware产品包含3个主要的功能部分:Web客户端、服务端引擎、IDE集成开发工具。
Web客户端- 主要利用Javascript搭建的纯浏览器前端展现系统,可支持目前较为常见的所有主流浏览器。
服务端引擎- 用于辅助Dorado Web客户端的自动生成,客户端与服务端的数据通信、状态同步,以及Dorado展现层与后台系统的集成等。
IDE集成开发工具- Eclipse插件形式的集成开发工具。用于辅助开发人员对Dorado界面及其他相关配置进行快速的定制。
主要功能特点
全新的Web客户端
Dorado7提供了全新打造的Web客户端,这包括全新的基础运行框架和全新的控件库。较之Dorado的前作,新的Web客户端将带来如下的增强:
支持所有主流浏览器 - Dorado7将兼容所有主流的浏览器,包括IE、Chrome、Firefox、Safari、Opera以及以这5种浏览器为内核的其他浏览器。 结合目前各浏览器在性能、稳定性、功能等各方面的因素,我们推荐用户使用Chrome作为首选的浏览器。
更加丰富的控件库
- 初始包含超过60个的界面控件,并且此数量还会不断的提高。
- 由于在设计之初给予了周全的考虑,因此Dorado7可以在几乎所有的交互过程中以异步请求替代同步请求,这将使界面的操作体验获得极大的提升。 同时,Dorado7中还提供了独特的Ajax请求自动合并技术,以尽可能减少与服务端之间的实际交互次数,进一步提高界面运行效率。
管理库文件,实现按需装载
- Dorado7提供了以资源包的形式对Javascript和CSS文件进行管理的功能,不但系统内部的库文件以此种方式进行管理,用户也可以将自己的库文件纳入这一管理机制。 通过这一功能,用户可以定义各资源包之间的依赖关系、实现库文件的运行时自动合并、以及库文件的按需装载。 这可以在性能优化、项目维护等方面带来诸多好处。
强大的客户端调试器
- 新的客户端调试器可以提供分级日志、API测试、页面结构剖析等调试功能。 借助新的调试器您甚至还可以随时查看/修改任意Dorado对象的属性值、分析DataSet中的实时数据。配合Dorado7中全新的异常处理机制,相比前作开发人员将拥有更加丰富的调试手段。
完整的拖拽功能支持
- Dorado7中所有的控件都将支持拖拽操作的属性、事件和API接口。
立体数据模型
&立体数据模型&因其相对于平面数据模型(二维数据模型)而得名。即指Dorado7推翻了Dorado前作中以DataSet为媒介、以二维表形式对于展现数据进行封装和管理的设计思路。 Dorado7不再局限数据必须以二维表结构与DataSet对接,而是可以支持非常自由的数据形式。并且也不再提供专用的数据封装对象。 这些变化使得展现层中的数据更加纯粹、更加贴切真实的业务含义。自然,也使开发变得更加便利、更加生动。
&立体数据模型&是Dorado7相对于前作最重要的概念变化,也是Dorado7最为核心的设计思想。 以上的寥寥数语并不足以阐明这一抽象概念,请参考 Dorado7方法论 中关于&立体数据模型&的更多论述。
没有JSP的Web
秉承了Dorado产品的一贯风格,Dorado7仍以XML形式的视图配置文件作为定义Web界面的主要手段。 不过,在Dorado7中这里的视图配置文件被赋予了更多的内涵,视图配置文件已经可以完整的描述Web界面的所有特性,JSP不再是Dorado7的必选项。 在大多数情况下,直接访问一个视图配置文件就可以得到一个功能完整的Web界面。
可能很多开发人员对于此特性会感到一丝不安,出于某些技术人员习惯以及页面需求等原因,开发人员可能仍然需要以HTML形式来实现页面的布局。 Dorado7同样对此种使用方式提供了完善的支持。开发者可以很方便的使用JSP、Velocity或者其他类似的技术来为视图配置文件定义布局方式。 并且,新的开发方式让美工人员与开发人员的合作变得更为可行和便利。以JSP为例,Dorado7不再引入繁多的Taglib标签库,而是以纯HTML方式的占位符来辅助Web页面的布局。
智能方法适配
&智能方法适配&是指允许开发人员尽可能按照自己的意愿、业务的需要来定义他们的业务方法,然后由Dorado引擎自动根据场景、参数名、参数类型等因素来判断应当怎样调用该业务方法。 &智能方法适配&是Dorado7提供的一个非常有特色的功能,提供此功能的主要目的是尽量减少开发人员所需要掌握的Dorado API,让业务方法的代码更加&业务化&,更加易于阅读。
通过&智能方法适配&也可以很好的体验出Dorado7所提倡的&基于约定而非配置&进行开发的理念。在实际的应用场景中大部分实现了Dorado前端的功能中可能并不需要引入任何Dorado的API。
扩展和重用
为提高Dorado7产品的扩展性和可重用性我们在Dorado7中提供了很多新的特性,这些特性主要包括:
叠加式配置
- 当用于需要设置或改变Dorado中的某运行参数时,通常不需要直接修改Dorado提供的缺省配置文件,而是增加一个新的、只包含最小参数集合的配置文件。 由Dorado引擎对这些配置文件进行叠加是的读取和处理,此特性可以有效的降低升级Dorado引擎可能带来的额外成本、提供项目的可维护性。
利用Spring搭建的Dorado引擎
- Dorado7自身的服务就是利用Spring搭建起来,不过Dorado7并不因此要求用户的项目一定要使用Spring。
这个特性使得开发人员有能力利用Spring的特性来替换几乎所有Dorado自身的内部服务。
数据模型对象
- Dorado7中的数据模型对象既支持全局、私有、匿名等可见性,又支持类似面向对象的继承和复写。这些特性可以为配置信息的重用和维护提供很多的便利。
视图配置文件模板
- Dorado7中的视图配置文件支持多级模板功能,这非常有利于降低项目的管理和维护成本。
视图配置的Import和Export
- Dorado7的视图配置文件允许开发人员利用Import和Export这两个标记。引入来自于其他视图配置文件中的一段配置信息。
用户自定义控件
- Dorado7允许用户将一段已有的、具有一个通用性视图配置信息注册为一个新的自定义控件,并且Dorado的IDE也可以非常方便的支持这一新添加的控件。
Client Edition
Dorado7提供Dorado7 Client Edition这样一个特性的产品打包方式,Dorado7 Client Edition中只包含了Dorado7 Presentation Middleware中的Web客户端部分(即Javascript和CSS的部分)。
发布此版本的目的是为了满足各种Web项目中前端界面增强的需求。这里提到的Web项目包括基于J2EE的Web项目和其他非J2EE的Web项目,如.Net、PHP等,其定位类似于Ext。 Dorado7 Client Edition从一个侧面体现出了Dorado7产品在设计上的封装度和灵活性。
不仅仅是展现中间件
虽然Dorado7的主要功能都是围绕展现层这一主题展开的,可是我们认为Dorado7连同配套的SampleCenter提供给用户的并不仅仅是对Web应用展现层的简单补充。 通过Dorado7即相关的示例所承载的是一种非常实用的Web开发最佳实践、一种新的开发模式。
因此可以说,使用Dorado您得到的可能并不是仅仅是对展现层的改良,也是对整体应用开发模式的一次度量和重铸。
created by
created by
created by
created by
created by
created by
created byCheckbox inputs can only have two states: checked or unchecked. They can have any value, but they either submit that value (checked) or don't (unchecked) with a form submission. The default is unchecked. You can control that in HTML like this:
&!-- Default to unchecked --&
&input type="checkbox"&
&!-- Default to checked, XHTML --&
&input type="checkbox" checked="checked" /&
&!-- Default to checked, HTML5 --&
&input type="checkbox" checked&
Visually, there are actually three states a checkbox can be in: checked, unchecked, or indeterminate. They look like this:
Here are some things to know about indeterminate checkboxes:
You can't make a checkbox indeterminate through HTML. There is no indeterminate attribute. It is a property of checkboxes though, which you can change via JavaScript.
var checkbox = document.getElementById("some-checkbox");
checkbox.indeterminate =
or jQuery style:
$("#some-checkbox").prop("indeterminate", true); // prop is jQuery 1.6+
The indeterminate state is visual only. The checkbox is still either checked or unchecked as a state. That means the visual indeterminate state masks the real value of the checkbox, so that better make sense in your UI!
Like the checkboxes themselves, indeterminate state looks different in different browsers. Here's Opera 11.50 on Mac:
The reason I'm writing this at all is because I just had a use case come up for this state: nested checkboxes. Each checkbox may have child checkboxes. If all those children are checked, it may be checked. If none are checked, it is unchecked. If some of them are checked, then it's in an indeterminate state (in this case symbolically meaning "partially" checked).
This demo isn't perfect. It only checked one level "up" for determining indeterminate state. Ideally it would check up recursively until the top. If you wanna fix it to do that, I'll update the code and credit you.
Rotating amongst the states
was messing around with the idea of rotating the state between unchecked, indeterminate, and checked with a click. Here's some jQuery to do that:
var $check = $("input[type=checkbox]"),
.data('checked',0)
.click(function(e) {
el = $(this);
switch(el.data('checked')) {
// unchecked, going indeterminate
el.data('checked',1);
el.prop('indeterminate',true);
// indeterminate, going checked
el.data('checked',2);
el.prop('indeterminate',false);
el.prop('checked',true);
// checked, going unchecked
el.data('checked',0);
el.prop('indeterminate',false);
el.prop('checked',false);
Reader Casual Trash sent me in a library-free and far more succinct version of rotating through all three visual states which utilizes the readonly attribute that checkbox inputs can have.
&!-- Ghetto click handler --&
&input type="checkbox" id="cb1" onclick="ts(this)"&
function ts(cb) {
if (cb.readOnly) cb.checked=cb.readOnly=
else if (!cb.checked) cb.readOnly=cb.indeterminate=
is where you go to learn HTML, CSS, and how to build iOS apps. It's a complete education in modern web and app technology, designed to get you ready for a hot new job or to kickstart your own business.
only area with access to video training on how to build websites from scratch using the best modern tools.
is the most powerful online form builder out there. Easily build multi-page forms, add logic and branching, customize the design, take payments, and much more.
You get an email from someone you've never met (poor communication skills, but a decent idea) and they want to cut you in and give you control over a new web company they want to start. Do you:
Delete the email.
Respond and say "Thanks but no thanks."
Email back to discuss, but skeptically.
Email back to discuss, all business.
Email back to discuss, flattered and positive.
Jump right in, startupville here I come.Dorado7&JavaScript&记录
//用于判断客户端环境中是否已经安装过ChromeFrame的js代码
function isChromeFrameAvailable() {
&&& var ua =
navigator.userAgent.toLowerCase();
(ua.indexOf("chromeframe") &= 0) {
&&& return
&&& if (typeof
window['ActiveXObject'] != 'undefined') {
&&& var obj =
new ActiveXObject('ChromeTab.ChromeFrame');
&&& if (obj)
obj.registerBhoIfNeeded();
&&& return
&&& } catch(e)
&&& return
// 定制右下角提示框的标题信息
dorado.util.Resource.append("dorado.baseWidget",
{MessageBoxDefaultTitle : "提示",
&NotifyTipDefaultCaption : "提示"});
1.javaScript开发基础
-----------------------------------------------------------------------------------------------
this指View对象,View对象的onCreate事件中的this是指向其自身
(因为控件总是先被创建然后才被添加到控件树上,因此在onCreate事件被触发时控件并不知道其隶属的View对象)
-----------------------------------------------------------------------------------------------
arg.processDefault =
false;通知系统是否要执行该事件所代表的后续操作,(在循环中相当于continue)
throw new dorado.Exception("xxx");终止操作,(在循环中相当于break)
-----------------------------------------------------------------------------------------------
$type 构建对象
-----------------------------------------------------------------------------------------------
this.get("#btnOk")与this.id("btnOk"),this.id()不支持迭代属性(如:this.get("#btnOk.caption"))
-----------------------------------------------------------------------------------------------
this.get("title")&&&&&
//读取View自身的虚拟属性
this.get("#buttonOK")& //获取View中的某一个对象
this.get("^foo")&&&&&&
//根据tags机制获取View中的一批对象
-----------------------------------------------------------------------------------------------
定义一个URL的时候,如果我们定义一个字符串,其开头以"/"开始则表示从端口号开始计算,而不是以webapp的名字开头
只要以"&"开头就可以,对于这种URL,Dorado会自动的版主你转换为webapp开头的URL
如:&images/icon.gif 转换为 sample/images/icon.gif
另外Dorado中还支持带有skin&前缀的写法,如:"skin&widget.css"将转换为Dorado当前当前皮肤路径下的widget.css的URL。因为skin是预设的URL前缀代表当前皮肤的跟路径。
-----------------------------------------------------------------------------------------------
$DomUtils.xCreate()方法以json形式定义的组件的模板信息快速的创建DOM元素
如:$DomUtils.xCreate({
&tagName: "button",
&content: "Click Me",// 定义按钮的标题
&style: {// 定义按钮的style
&border: "1px black solid",
&backgroundColor: "white"
&onclick: function() {// 定义onclick事件
&alert("Button clicked.");
tagName是告诉xCreate方法要创建的对象类型为button
-----------------------------------------------------------------------------------------------
调式可以用$log替换alert(),$log()是记录调试日志的一个工具。日志结果可在页面上按F2后,切换到script标签,
并在编辑框中输入$log("AAAAAAAAA");并单击Run按钮执行,切换到Console标签页就可以看到输出的日志。
$log功能还支持多种级别的日志,例如error,info,warn等,如我们输出一个error的信息
$log("错误信息","error")
-----------------------------------------------------------------------------------------------
js循环.each()
Dorado7扩展了标准的Array使之可支持each迭代,除Array之外Dorado7提供的EntityList、KeyedList等集合特性的对象也支持each迭代
var s = '';
['A', 'B', 'C'].each(function(item) {
each方法进行循环,右侧是一个回调函数,另外each也支持循环的终止(如同for循环中的break功能),
只要在方法的内部写为true则继续循环
-----------------------------------------------------------------------------------------------
使用偏移量来定义图标,如:url(skin&common/icons.gif) -140px
-----------------------------------------------------------------------------------------------
EntiyUtils工具类和虚拟实体属性
设置虚拟实体属性
Category category = new Category();
category = EntityUtils.toEntity(category);
//注意Category.java中没有prop1,prop2,prop3等属性
EntityUtils.setValue(category, "prop1", "value1");
EntityUtils.setValue(category, "prop2", 3);
EntityUtils.setValue(category, "prop3", true);
String prop1 = EntityUtils.getString(category, "prop1");
int prop2 = EntityUtils.getInt(category, "prop2");
boolean prop3 = EntityUtils.getBoolean(category, "prop3");
获取数据实体状态
Category category = new Category();
category = EntityUtils.toEntity(category);
EntityUtils.setState(category, EntityState.MODIFIED);
if (EntityState.NEW==EntityUtils.getState(category)){
数据实体状态
EntityState.NONE //原始状态
EntityState.NEW //新增数据实体
EntityState.MOVED //被移动过的数据实体,专指树控件节点移动引起
EntityState.MODIFIED //被编辑过的数据实体
EntityState.DELETED //做过删除标记的数据实体
问题3.如何批量的获取所有被删除,或被修改的记录
public void
saveAll(Collection&Category&
categories) {
(Category category : categories) {
EntityState state = categoryDao.persistEntity(category);
if (EntityState.isVisible(state)) {
&&&&&&&&&&&
Collection&Product& products =
category.getProducts();
&&&&&&&&&&&
for (Product product:EntityUtils.getIterable(products,
FilterType.MODIFIED, Product.class)){
&&&&&&&&&&&&&
&&&&&&&&&&&
&&&&&&&&&&&
for (Product product:EntityUtils.getIterable(products,
FilterType.DELETED, Product.class)){
&&&&&&&&&&&&&&
&&&&&&&&&&&
}&&&&&&&&&&&&&
&&&&&&&&&&&
for (Product product:EntityUtils.getIterable(products,
FilterType.NEW, Product.class)){
&&&&&&&&&&&&&&
&&&&&&&&&&&
}&&&&&&&&&&&&&
问题4. 某个数据实体在客户端被编辑过,如何获取原始值
例如产品中的productName属性从"Aniseed Syrup"改为"Chef Anton's Gumbo
Mix",unitPrice从3600.00调整为3200.00,而提交到服务器端后,
我们获得的是Product的实体对象,通过它的getProductName()方法只能拿到"Chef Anton's Gumbo
Mix",如果我们还希望取得该属性的原始值,
public void
saveAll(Collection&Category&
categories) {
(Category category : categories) {
EntityState state = categoryDao.persistEntity(category);
if (EntityState.isVisible(state)) {
&&&&&&&&&&&
Collection&Product& products =
category.getProducts();
&&&&&&&&&&&
if (products != null) {
&&&&&&&&&&&&&&&
for (Product product : products) {
&&&&&&&&&&&&&&&&&&&
if (EntityState.MODIFIED.equals(EntityUtils
&&&&&&&&&&&&&&&&&&&&&&&&&&&
.getState(product))) {
&&&&&&&&&&&&&&&&&&&&&&&
String oldString = EntityUtils.getOldString(product,
"productName");//获取原始的productName值
&&&&&&&&&&&&&&&&&&&&&&&
float unitPrice = EntityUtils.getOldFloat(product,
"unitPrice");//获取原始的unitPrice值
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&
}&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&
productService.saveAll(products);
&&&&&&&&&&&
---------------------------------------------------------------------------------------------------------------------
组装控制注册
需要在dorado-home文件夹的控件配置文件components-context.xml中做如下声明:
&bean id="dorado.assembledComponent.ButtonPanel"
parent="dorado.assembledComponentTypeRegister"&
&property name="name" value="ButtonPanel"
&property name="src"
value="com.bstek.ponent.AssembledComponents#ButtonPanel"
&d:virtual-property name="buttonCaption"
/&&!--虚拟属性buttonCaption的声明--&
&Panel id="ButtonPanel"
layout="regionPadding:8"&
&&&&&&&&&&&
&Container layout="Anchor" layoutConstraint="bottom
height:28"&
&&&&&&&&&&&&&&&
&Button caption="${virtualProperty.buttonCaption}"
layoutConstraint="left:50%"&
&&&&&&&&&&&&&&&&&&&
&ClientEvent
name="onClick"&&![CDATA[
&dorado.MessageBox.alert("您点击了" +
self.get("caption") + "按钮.");
&&&&&&&&&&&&&&&&&&&
]]&&/ClientEvent&
&&&&&&&&&&&&&&&
&&&&&&&&&&&
&/Container&
注:${virtualProperty.buttonCaption}是一个引用虚拟属性的动态表达式,表示引用虚拟属性buttonCaption
注意执行更新Dorado配置规则,便于IDE的ToolBox中可以看到自定义的控件对象
---------------------------------------------------------------------------------------------------------------------
getMessages(),setMessages()返回或设置当前数据实体关联的额外信息的数组,
一般情况下这里的信息都对应了数据校验的验证结果。返回的对象是一个JSON数组,JSON结构说明:
state {String} 信息级别。取值范围包括:info、ok、warn、error。默认值为error。
text {String} 信息内容。
entity.setMessages("desc",{state:"info",
text:"这是备注信息的提示信息"});
entity.setMessages("salary",{state:"warn",
text:"薪水必须大于上海市最低薪资"});
entity.setMessages("sex",{state:"error", text:"性别字段非空"});
entity.setMessages("A") 或 entity.setMessages("A", undefined)
表示清空掉验证状态
---------------------------------------------------------------------------------------------------------------------
EntityList
向集合中插入一个数据实体
insert(dorado.Entity|Object entity , String[insertMode] ,
dorado.Entity[refEntity] )
entityList.insert({id:"0123",name:"do"},"begin");
begin& //在集合的起始位置插入
before //在refEntity参数指定的数据实体之前插入
after& //在refEntity参数指定的数据实体之后插入
//在集合的末尾插入,(系统默认:end)
删除一个数据实体
remove(dorado.Entity[entity] , boolean[detach])
entitylist.remove();&&
&//对当前的实体对象添加删除标记
entitylist.remove(null, true);&
//彻底删除当前的实体对象
each (Function fn , Object [scope])用于遍历当前集合的所有实体对象
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
entityList.each(function(entity){
names += data.get("name");
已经打上删除标记的实体对象使用each遍历的时候也能访问到
如果EntityList是一个支持分页的集合,则会遍历所有已经加载过的分页中的实体对象,注意这儿说的是已经加载过的,
未加载过的分页不会去遍历。如果想遍历未加载数据的分页建议采用iterator()方法
iterator (Object|boolean [options])
each是EntityList提供的一个简单易用的遍历函数,如果希望对遍历规则做更多的控制,我们就需要通过iterator方法,举例:
问题一:不希望对已经做过删除标记的数据进行遍历
解决的办法代码如:
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
var entityList = ...
var iterator = entityList.iterator(false);
iterator.first();
while(iterator.hasNext()){
&&& names +=
iterator.next().get("name");
问题二:采用了分页技术,但是希望对未加载的页也进行数据遍历
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
var entityList = ...
var iterator = entityList.iterator({includeUnloadPage:true});
iterator.first();
while(iterator.hasNext()){
&&& names +=
iterator.next().get("name");
includeUnloadPage会触发DataProvider处理机制引起AJAX数据请求,使用时要注意性能问题
问题三:希望从指定位置开始进行遍历
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
var entityList = ...
var iterator = entityList.iterator({nextIndex:20});
iterator.first();
while(iterator.hasNext()){
&&& names +=
iterator.next().get("name");
问题四:希望从指定页开始遍历
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
var entityList = ...
var iterator = entityList.iterator({pageNo:5});
iterator.first();
while(iterator.hasNext()){
&&& names +=
iterator.next().get("name");
问题五:只遍历当前页
// 将每一个集合元素的name属性连接成为一个字符串
var names = "";
var entityList = ...
var iterator = entityList.iterator({currentPage:true});
iterator.first();
while(iterator.hasNext()){
&&& names +=
iterator.next().get("name");
---------------------------------------------------------------------------------------------------------------------
DataSet.getData和DataSet.queryData
getData(),默认只返回DataPath命中的第一笔数据,可能是Entity,也可能是EntityList。
queryData(),返回DataPath完整的执行结果,且默认只返回Entity
(只在使用#等确定只可能有最多一个命中数据实体的DataPath时)或Entity的数组。
public getData ( String [path] , String|Object [options] ) :
dorado.Entity|dorado.EntityList|any
loadMode: 数据装载模式。
包含下列三种取值:
always && &-
如果有需要总是装载尚未装载的延时数据。
auto && &-
如果有需要则自动启动异步的数据装载过程,但对于本次方法调用将返回数据的当前值。
never && &-
不会激活数据装载过程,直接返回数据的当前值。
.flush : boolean
是否要清除DataSet中原有的数据并重新提取数据
范例1:获取产品分类为2的所有产品
var entityList = ds.getData("[@.get('categoryId')==2]");
范例2:清除DataSet中原有的数据并重新提取数据后,再查询产品分类为2的所有产品
var entityList =
ds.getData("[@.get('categoryId')==2]",{flush:true});
范例3:在已经加载到客户端的数据中查询产品分类为2的所有产品
var entityList =
ds.queryData("[@.get('categoryId')==2]",{loadMode:"never"});
---------------------------------------------------------------------------------------------------------------------
下拉选择,DataSetDropDown
&DataSetDropDown id="ddCustomers"
dataSet="dsCustomers" dynaFilter="true" /&
下拉框的绑定:trigger指定dropDown的id
&AutoFormElement property="customer"
trigger="ddCustomers" /&
显示指定的列:设置DataType的defaultDisplayProperty
&DataType name="BaseCustomer" parent="CommonEntity"
creationType="com.bstek.dorado.sample.entity.Customer"
&defaultDisplayProperty="companyName"&
&PropertyDef name="companyName" label="公司名"
&/DataType&
下拉框过滤查询:
设置DataSetDropDown属性,dynaFilter = true
---------------------------------------------------------------------------------------------------------------------
获取AutoForm的属性值
var entity1 = this.get("#form1.entity");
dorado.MessageBox.alert(entity1.prop);
this.set("#form1.entity",{prop:"设置属性值"});
---------------------------------------------------------------------------------------------------------------------
DataSet对实体对象的维护时,专门提供了state属性,用这个属性标识Entity对象的状态
STATE_NONE &&&
& - 无状态。
STATE_NEW&& & -
新增状态。
STATE_MODIFIED &&
& - 已修改状态。
STATE_DELETED &&
& - 已删除状态。
STATE_MOVED && &
- 被移动状态。
每个实体当前的状态我们在浏览器中可以通过state属性访问:
if (STATE_NEW == entity.state){
dorado.MessageBox.alert("实体数据的状态为新增");
Dorado7提供的两个重要工具类 EntityState 和 EntityUtils 完成对实体数据状态的识别:
for(Product product :& products){
&&&&&&&&&&&
if(EntityState.DELETED.equals(EntityUtils.getState(product))){
&&&&&&&&&&&&&&&
System.out.println("删除产品 : " +
product.getProductName());//执行产品删除操作
&&&&&&&&&&&
&&&&&&&&&&&
if(EntityState.MODIFIED.equals(EntityUtils.getState(product))){
&&&&&&&&&&&&&&&
System.out.println("修改产品 : " +
product.getProductName());//执行产品修改操作
&&&&&&&&&&&
&&&&&&&&&&&
else if(EntityState.NEW
.equals(EntityUtils.getState(product))){
&&&&&&&&&&&&&&&
System.out.println("新增产品 : " +
product.getProductName());//执行产品新增操作
&&&&&&&&&&&
---------------------------------------------------------------------------------------------------------------------
如何获取修改前的数据:
通过EntityUtils.getOldxxx方法获取,该方法有两个参数:第一个是数据实体对象,第二个是指定的属性名。
如后台获取旧的数据:float oldValue = EntityUtils.getOldFloat(product,
"unitPrice");
后台获取旧的数据,还需要设置UpdateAction控件下的UpdateItem属性submitOldData
为了性能考虑,默认情况下UpdataAction控件不会将数据实体的原始数据提交到服务器,如需要则设置submitOldData=true
通过EntkityUtils可以方便的获取原始数据的值,另根据不同的数据类型EntityUtils类定提供了不同的方法获取原始值:
EntityUtils.getOldString& 获取String类型的值
EntityUtils.getOldInt &&
&& 获取Int类型的值
EntityUtils.getOldLong&&&
获取String类型的值
EntityUtils.getOldFloat&&
获取Float类型的值
EntityUtils.getOldDouble& 获取Double类型的值
EntityUtils.getOldBoolean 获取Boolean类型的值
EntityUtils.getOldValue&&
获取一个指定类型的值
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 dorado7下载 的文章

 

随机推荐