﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Nic Sense Zone Space-文章分类-Dorado on the road</title><link>http://www.blogjava.net/nicholas-sjy/category/18877.html</link><description>老了没有回忆不要紧，要是只有一大堆后悔就惨了</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 04:17:35 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 04:17:35 GMT</pubDate><ttl>60</ttl><item><title>Dorado on the road - final</title><link>http://www.blogjava.net/nicholas-sjy/articles/97034.html</link><dc:creator>Nic Sense Zone</dc:creator><author>Nic Sense Zone</author><pubDate>Wed, 31 Jan 2007 09:52:00 GMT</pubDate><guid>http://www.blogjava.net/nicholas-sjy/articles/97034.html</guid><wfw:comment>http://www.blogjava.net/nicholas-sjy/comments/97034.html</wfw:comment><comments>http://www.blogjava.net/nicholas-sjy/articles/97034.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nicholas-sjy/comments/commentRss/97034.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nicholas-sjy/services/trackbacks/97034.html</trackback:ping><description><![CDATA[
		<p align="center">
				<strong>
						<u>
								<font size="6">Dorado on the way － final<br /><br /></font>
						</u>
				</strong>
		</p>      本来想继续前面陆陆续续的两篇关于Dorado的文章，但想想为了大家查阅方便，干脆来一个final版，一次性写出来。<br /><br /><br /><br />  
<p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2006</font>年<font face="Times New Roman, serif">12</font>月<font face="Times New Roman, serif">25</font>日</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>今天是圣诞节，进入公司已经四个月了，可是对公司的产品<font face="Times New Roman, serif">Dorado</font>还几乎是一个门外汉，<font face="Times New Roman, serif">(</font>我要说明一下，不是我太笨，刚刚进入公司就接受了一个传统项目的开发，再加之学校的事情，在此我想我应该声明一点，我还是一个大四的学生，快结束大学四年的学习了，到最后，乱七八糟的事情实在是太多了，这个报告那个报告的。<font face="Times New Roman, serif">)</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Thomas(</font>我们公司的产品经理<font face="Times New Roman, serif">)</font>，还有范经理，实在是不好意思，还有公司的同事，虽然我比他们中的好多人进入公司都早，可惜我不是最厉害的，至少现在不是。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>到上个星期为止，学校的事情基本上已经完了，毕业设计的课题也选了，选的课题是《基于智能<font face="Times New Roman, serif">Agent</font>的分布式移动计算处理》，本来一开始自作聪明，以为题目为“移动计算”嘛，就是移动设备的计算处理，智能<font face="Times New Roman, serif">Agent</font>嘛～估计就是一种形式而已，我自从从大学二年级自学<font face="Times New Roman, serif">Java</font>开始，接触了<font face="Times New Roman, serif">Java</font>中的<font face="Times New Roman, serif">JavaSE</font>和<font face="Times New Roman, serif">JavaEE</font>两个体系，正好可以借此课题，让我对<font face="Times New Roman, serif">JavaME</font>有所了解，也实现了完成毕业设计的作用。结果后来导师选好了以后，看着导师给的材料，我才知道，我陷入泥潭了～<font face="Times New Roman, serif">(</font>导师，原谅我这么说，呵呵<font face="Times New Roman, serif">·)</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>今天是我真正学习<font face="Times New Roman, serif">Dorado</font>的第一天，公司给了我一些资料，所以我信心十足，我要赶上公司的其他同事，呵呵～争取超过他们哦～已经习惯了要做到最好，我是不是太自大了？？</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>还是跟我学习<font face="Times New Roman, serif">Java</font>一样，首先在公司的官方网站<font face="Times New Roman, serif">(<a href="http://www.bstek.com/">http://www.bstek.com/</a>)</font>下载了<font face="Times New Roman, serif">Dorado</font>的最近版本，我下载的版本是<font face="Times New Roman, serif">Dorado-5.0 061129.1132</font>，一并还下载了<font face="Times New Roman, serif">Dorado 5 </font>快速入门，组件使用技巧，当然还有<font face="Times New Roman, serif">Dorado</font>的<font face="Times New Roman, serif">API</font>－－我的最爱。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>首先看了<font face="Times New Roman, serif">Benny(</font>我们公司的<font face="Times New Roman, serif">CTO)</font>录制的两段视频说明，依照<font face="Times New Roman, serif">Dorado</font>安装自带的<font face="Times New Roman, serif">doradosample</font>，把<font face="Times New Roman, serif">dorado</font>的大致功能作了一个讲解说明，个人感觉<font face="Times New Roman, serif">dorado</font>还是挺有市场前景的，只是需要更大的宣传。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>好了，闲话不多说了，开始我的<font face="Times New Roman, serif">Dorado</font>之旅吧～</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>首先，需要了解的是：<span style="BACKGROUND: #ffff00"><font color="#800000">视图模型</font></span><font face="Times New Roman, serif">Dorado</font>开发当中非常重要的对象，它封装了<font face="Times New Roman, serif">Dorado</font>的界面逻辑和操作逻辑，即主要包含什么数据<font face="Times New Roman, serif">dataset </font>，以及这些数据通过什么形式来展现。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>下面是我今天学习中，觉得需要注意的一些地方和术语。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ul><li><p style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><b><span style="BACKGROUND: #ffff00">Dataset</span></b></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. getDataset(“datasetName”) ; </font>获取对<font face="Times New Roman, serif">dataset</font>的引用</p></li></ul><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. RecordIterator ri = dataset.recordIterator() ; </font>获取对<font face="Times New Roman, serif">dataset</font>的迭代器引用。</p></ol><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>对<font face="Times New Roman, serif">dataset</font>的遍历</p><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">while(ri.hasNext()){</font></p></ol></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Record record = ri.nextRecord() ;</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">// </font>对每条记录的操作</p><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">}</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">4. </font>可是通过<font face="Times New Roman, serif">getControl(“controlName”) ; </font>获取组件的引用</p><ol><p style="MARGIN-BOTTOM: 0cm"><font color="#800000">注意，这里得到的是<font face="Times New Roman, serif">Control</font>对象，需要进行类型的强制转换。</font></p></ol></ol><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">5. ”Module</font>数据坞”的说明。</p><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1). </font>数据坞里面的<font face="Times New Roman, serif">dataset</font>对象可以被不同的视频模型索引用，以达到数据共享的作<font face="Times New Roman, serif"></font>用。</p></ol></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2). Module</font>不应该包含任何的业务逻辑，这是一种良好的设计模式。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3). Module</font>的创建和销毁由<font face="Times New Roman, serif">Dorado</font>提供的容器来管理，可以当做一个<font face="Times New Roman, serif">Singleton</font>来<font face="Times New Roman, serif"></font>使用。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>所以在绝大部分情况下，在<font face="Times New Roman, serif">Module</font>里面添加非静态的属性都不是正确<font face="Times New Roman, serif"> (</font>或者是不太明智<font face="Times New Roman, serif">)</font>的做法。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">4). Module</font>中的<font face="Times New Roman, serif">dataset</font>的创建和销毁使用<font face="Times New Roman, serif">dorado</font>提供的容器来管理的，但开发人<font face="Times New Roman, serif"></font>员可以强制通过<font face="Times New Roman, serif">scope</font>和<font face="Times New Roman, serif">timeout</font>来定制<font face="Times New Roman, serif">dataset</font>的生命周期。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">5). scope</font>有三种取值，分别是<font face="Times New Roman, serif">request (</font>默认<font face="Times New Roman, serif">)</font>，<font face="Times New Roman, serif">session </font>， <font face="Times New Roman, serif">application</font>。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>需要特别注意的是，在同一个<font face="Times New Roman, serif">request</font>中<font color="#800000">连续以不同</font>的<font face="Times New Roman, serif">pageIndex </font>，<font face="Times New Roman, serif">pageSize </font>，<font face="Times New Roman, serif"> parameters</font>的不同组合来获取<font face="Times New Roman, serif">Module</font>中的<font face="Times New Roman, serif">dataset</font>，但将获得<font color="#800000">多个不同的</font><font face="Times New Roman, serif">dataset </font>实例。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">6). </font>如果为了提高效率而将<font face="Times New Roman, serif">scope</font>设置为<font face="Times New Roman, serif">application </font>，则应该注意让此<font face="Times New Roman, serif">dataset</font>中的<font face="Times New Roman, serif"></font>数据量不要过大。常用在大型系统中的代码表。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">6. </font>通过<font face="Times New Roman, serif">dataSet.getCurrent() ; </font>方法，可以从<font face="Times New Roman, serif">dataSet</font>获取当前记录。由于<font face="Times New Roman, serif">dataSet</font>具有</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">“</font>当前记录”这个，所以大多数操作都是对“当前数据”来说的。</p><ul><ul><ul><ul><p style="MARGIN-BOTTOM: 0cm"></p></ul></ul></ul><li><p style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">Mapping</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>所有的<font face="Times New Roman, serif">Mapping</font>单元都是通过名为<font face="Times New Roman, serif">global</font>的管理单元来进行管理的。</p></li></ul><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. </font>在请求映射的过程中，<font face="Times New Roman, serif">dorado</font>有着自己独特的，不同于<font face="Times New Roman, serif">Struts</font>的映射机制，</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>例如：对于请求：<font face="Times New Roman, serif">action=”access.login.d”</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">access </font>与对应的<font face="Times New Roman, serif">controller</font>的名称一致，</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>而<font face="Times New Roman, serif">login</font>与对应的<font face="Times New Roman, serif">action</font>的名称一致。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. controller</font><span lang="zh-CN">的</span><font face="Times New Roman, serif">clazz</font><span lang="zh-CN">属性所表示的是用于处理这个请求的</span><font face="Times New Roman, serif">class </font><span lang="zh-CN">，类似于</span><font face="Times New Roman, serif">Struts</font><span lang="zh-CN">中的</span><font face="Times New Roman, serif"> Action </font><span lang="zh-CN">，而提交的数据，就从</span><font face="Times New Roman, serif">Struts </font><span lang="zh-CN">中的</span><font face="Times New Roman, serif">ActionFrom</font><span lang="zh-CN">转换成了</span><font face="Times New Roman, serif">Dorado</font><span lang="zh-CN">的</span><font face="Times New Roman, serif">dataset.</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">4. </font>对于页面的访问安全控制<font face="Times New Roman, serif">(</font>即只能通过<font face="Times New Roman, serif">dorado</font>式的请求，而不容许以文件结构路径<font face="Times New Roman, serif"></font>来访问，即<font face="Times New Roman, serif">../demo/XX.jsp)</font>，可以将<font face="Times New Roman, serif">view</font>中的<font face="Times New Roman, serif">safe</font>属性设置为<font face="Times New Roman, serif">true</font>来控制。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>或者通过<font face="Times New Roman, serif">dorado</font>默认的<font face="Times New Roman, serif">setting</font>中的<font face="Times New Roman, serif">security.accessChecher</font>来控制。不过我可以自主<font face="Times New Roman, serif"></font>创建一个<font face="Times New Roman, serif">AccessChecker</font>类型的<font face="Times New Roman, serif">java</font>类来进行控制。但需要将<font face="Times New Roman, serif">setting.xml</font>里面的<font face="Times New Roman, serif"> “security.accessChecker”</font>属性修改为自己创建的类路径。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">5. </font>可以通过<font face="Times New Roman, serif">DoradoContext</font>来访问<font face="Times New Roman, serif">dorado</font>的上下文信息，并通过标记量来告诉<font face="Times New Roman, serif">dorado </font>的上下文从哪里获取需要的变量。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>例如，</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Object obj = doradoContext.getAttribute(DoradoContext.SESSION,”username”) ;</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><ul><li value="1"><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">i18n</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>你需要在<font face="Times New Roman, serif">i18n</font>目录下新建一些<font face="Times New Roman, serif">I18N</font>的<font face="Times New Roman, serif">properties</font>类型文件。此类文件与<font face="Times New Roman, serif">java</font>中的</p><p style="MARGIN-BOTTOM: 0cm">一致，都是以键－值对的形式存在。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. </font>在<font face="Times New Roman, serif">dataset</font>中的<font face="Times New Roman, serif">Fields</font>里面设置为<font face="Times New Roman, serif">${Resource.fileName.key}</font>的形式进行设置。这个就 </p><p style="MARGIN-BOTTOM: 0cm">有点类似于<font face="Times New Roman, serif">JSP2.0</font>中的<font face="Times New Roman, serif">EL</font>，其中，<font face="Times New Roman, serif">fileName</font>是资源文件的文件头，不包括<font face="Times New Roman, serif">_cn_ZH</font></p><p style="MARGIN-BOTTOM: 0cm">等类似的字样。而<font face="Times New Roman, serif">key</font>是在文件中的键。这些都是在系统的<font face="Times New Roman, serif">setting.xml</font>中的 </p><p style="MARGIN-BOTTOM: 0cm">“<font face="Times New Roman, serif">common.locale.language”</font>和“<font face="Times New Roman, serif">common.locale.country ”</font>来进行的配置。同样，你可</p><p style="MARGIN-BOTTOM: 0cm">以通过修改这两个属性来启用不同的<font face="Times New Roman, serif">I18N</font>文件。</p></li></ul><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>对于动态更改用户的国际化资源的情况，可以使用<font face="Times New Roman, serif"></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">LocalHelper.getLocale(“language”,”country”),</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">ResourceManager.getInstance().setDefaultLocale(context, </font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">DoradoContext.SESSION,</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">locale) ; </font>来设置。 </p><ul><p style="MARGIN-BOTTOM: 0cm"></p><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">EL</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">JSP2.0</font>方面的书籍中有大量的经典介绍，这里就不再记录。</p><p style="MARGIN-BOTTOM: 0cm">开发时，只需记住<font face="Times New Roman, serif">Dorado</font>内置的隐式变量，即可。</p><p style="MARGIN-BOTTOM: 0cm"></p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">Skin</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>皮肤文件夹存放的位置是在<font face="Times New Roman, serif">skins</font>文件夹下面的。</p><p style="MARGIN-BOTTOM: 0cm">在使用新皮肤时，只需要修改<font face="Times New Roman, serif">setting.xml</font>中的<font face="Times New Roman, serif">view.smartweb2.skin</font>对应的值即可。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. </font>同时可以通过修改<font face="Times New Roman, serif">skin.css</font>文件来修改<font face="Times New Roman, serif">dorado</font>中的标签库的所有展示风格。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>同时也支持传统的<font face="Times New Roman, serif">JSP</font>开发，即在<font face="Times New Roman, serif">&lt;head&gt;</font>标签中设置相信的各种属性，以完成让</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">dorado</font>以用户自定义的形式进行展现。</p></li></ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2007</font>年<font face="Times New Roman, serif">1</font>月<font face="Times New Roman, serif">1</font>日</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm" align="center"><font style="FONT-SIZE: 22pt" size="6"><b>关于</b></font><font face="Times New Roman, serif"><font style="FONT-SIZE: 22pt" size="6"><b>Dataset</b></font></font></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol><li><p style="MARGIN-BOTTOM: 0cm">可以通过<font face="Times New Roman, serif">RecordIterator </font>对<font face="Times New Roman, serif">dataset</font>中的数据进行遍历<font face="Times New Roman, serif">(</font>包括已经在客户端“删除”的记录<font face="Times New Roman, serif">)</font>。</p><p style="MARGIN-BOTTOM: 0cm"></p><p style="MARGIN-BOTTOM: 0cm"><span style="BACKGROUND: #ffff99"><font style="FONT-SIZE: 13pt" size="3"><b>为什么在客户端已经“删除”的记录，</b></font><font face="Times New Roman, serif"><font style="FONT-SIZE: 13pt" size="3"><b>dataset</b></font></font></span><span style="BACKGROUND: #ffff99"><font style="FONT-SIZE: 13pt" size="3"><b>仍然可以遍历到？ </b></font></span></p><p style="MARGIN-BOTTOM: 0cm"><span style="BACKGROUND: #ffff99">原因就在于<font face="Times New Roman, serif">Dorado</font></span><span style="BACKGROUND: #ffff99">出于对性能的考虑，在客户端做的删除并没有立刻更新服务器段的记录，而仅仅是在客户端的<font face="Times New Roman, serif">dataset</font></span><span style="BACKGROUND: #ffff99">中做了删除的标记。在用户提交了以后，才会对服务器端的记录做修改。所以用户在客户端做的删除操作后，如果刷新页面，删除的记录将会重新出现。</span></p><p style="MARGIN-BOTTOM: 0cm"></p><p style="MARGIN-BOTTOM: 0cm">可以通过如下代码对<font face="Times New Roman, serif">dataset</font>中已经标记为“删除”的记录进行遍历：</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">RecordIterator rit </font>＝ <font face="Times New Roman, serif">dataset.recordIterator() ; // </font>获取<font face="Times New Roman, serif">dataset</font>的遍历器</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">rit.setVisibility(Dataset.FILTER_DELETED) ; // </font>设置遍历器的可见属性</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">while(rit.hasNext()){</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Record record = rit.nextRecord() ; // </font>取得当前的<font face="Times New Roman, serif">Record</font>对象</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">// </font>对记录进行操作</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">}</font></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="2"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst </font>以及 <font face="Times New Roman, serif">isLast</font>的理解</p><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dataset</font>中容易犯下的错误就是对<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>的误解。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>并不像大家想象当中的那样，代表着<font face="Times New Roman, serif">Dataset</font>的当前记录<font color="#ff3333">（注意，所有对<font face="Times New Roman, serif">Dataset</font></font><font color="#ff3333">的操作，都是对“当前记录”而言）</font>是否是第一条记录或者是最后一条记录。他们真正的含义如下：</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst</font>：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>官方解释：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst</font>表示<font face="Times New Roman, serif">Dataset</font>已经在试图继续向前移动当前记录的过程失败，亦即<font face="Times New Roman, serif"></font>当<font face="Times New Roman, serif">dataset</font>的当前记录从第二条记录转到第一条记录时<font face="Times New Roman, serif">isFirst</font>仍然是<font face="Times New Roman, serif"> false</font>，只有当<font face="Times New Roman, serif">Dataset</font>试图继续向前移动当前记录后，<font face="Times New Roman, serif">isFirst</font>才会变成<font face="Times New Roman, serif"> true</font>，此时<font face="Times New Roman, serif">dataset</font>的当前记录仍然是第一条记录。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>我的理解：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>对于<font face="Times New Roman, serif">isFirst</font>，你可以于<font face="Times New Roman, serif">Java</font>当中的<font face="Times New Roman, serif">Iterator</font>作对比。我们假设<font face="Times New Roman, serif">Java</font>中的<font face="Times New Roman, serif"> Iterator</font>具有<font face="Times New Roman, serif">previous()</font>，就是<font face="Times New Roman, serif">next()</font>倒着遍历<font face="Times New Roman, serif">()</font>，那么当当前记录从第二<font face="Times New Roman, serif"></font>条作<font face="Times New Roman, serif">previous()</font>成功到达第一条记录的时候，<font face="Times New Roman, serif">isFirst</font>仍然返回<font face="Times New Roman, serif">false</font>，为什<font face="Times New Roman, serif"></font>么？因为在移动过程中没有受阻，它成功的前移了。下面要注意了，现<font face="Times New Roman, serif"></font>在当前记录已经在第一条了，现在如果当前记录再试图向前移动时，此<font face="Times New Roman, serif"></font>时受阻了，因为在当前记录前面已经没有记录可以移动了，此时<font face="Times New Roman, serif"> isFirst()</font>返回<font face="Times New Roman, serif">true</font>。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>如下图：</p><p style="MARGIN-BOTTOM: 0cm"><img style="WIDTH: 687px; HEIGHT: 403px" height="300" alt="图1" hspace="20" src="D:\Personal\Nicholas\余光掠影\Dorado on the way\图1.bmp" width="300" vspace="20" temp_src="D:\Personal\Nicholas\余光掠影\Dorado on the way\图1.bmp" /><br />在<font face="Times New Roman, serif">dorado</font>的设计过程中，数据导航条的数据前移和后移过程中，并不会<font face="Times New Roman, serif"></font>查看当前记录是否是第一条或者是最后一条数据，而是默认前或者后还<font face="Times New Roman, serif"></font>有数据，从而继续作向前或向后的操作，只有在移动受阻后，才修改是<font face="Times New Roman, serif"></font>否到边界的标记，这样或许在移动操作中可能会对移动的性能有一定的<font face="Times New Roman, serif"></font>帮助。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>个人认为，这里把<font face="Times New Roman, serif">isFisrt()</font>看作是对当前记录的操作时候“越界”的标<font face="Times New Roman, serif"></font>志更为合适。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">IsLast</font>：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>官方的解释：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isLast</font>表示<font face="Times New Roman, serif">Dataset</font>已经在试图继续向后移动当前记录的工程失败，亦即<font face="Times New Roman, serif"></font>当<font face="Times New Roman, serif">dataset</font>试图继续向前移动当前记录后，<font face="Times New Roman, serif">isFirst</font>才会变为<font face="Times New Roman, serif">true</font>，此时<font face="Times New Roman, serif"> Dataset</font>的当前记录仍然是倒数第一条记录。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>我的理解：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>可以对比<font face="Times New Roman, serif">isFirst</font>来理解，我觉得我已经解释的比较清楚了。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="3"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">moveFirst </font>和 <font face="Times New Roman, serif">moveLast</font>方法</p><p style="MARGIN-BOTTOM: 0cm">当用户调用了<font face="Times New Roman, serif">Dataset</font>的<font face="Times New Roman, serif">moveFirst</font>或<font face="Times New Roman, serif">moveLast</font>之后，<font face="Times New Roman, serif">Dataset</font>的<font face="Times New Roman, serif">isFirst</font>或<font face="Times New Roman, serif">isLast</font>立刻被置为<font face="Times New Roman, serif">true</font>。</p><p style="MARGIN-BOTTOM: 0cm">当<font face="Times New Roman, serif">dataset</font>没有任何<span style="BACKGROUND: #ffff00"><font color="#800000">可见记录</font></span>的时候，<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>将同时为<font face="Times New Roman, serif">true</font>，并且当前记录为<font face="Times New Roman, serif">null</font>。</p><p style="MARGIN-BOTTOM: 0cm">想必在前面理解了我对<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>的讲解之后，对这两个方法的理解应该不会出现什么偏差了。</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>不过我想提醒大家一下，注意我这里的用词，是<span style="BACKGROUND: #ffff00"><font color="#800000">“可见记录”</font></span>，即是说，如果在客户<font face="Times New Roman, serif"></font>端删除了所有的记录，虽然没有向服务器提交，但此时<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>都会同时返回<font face="Times New Roman, serif"><span style="BACKGROUND: #ffff00"><font color="#800000">true</font></span></font>。这里就很好的统一了对用户的“体验一致性”，即用户认为已经没有数据了。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="4"><li><p style="MARGIN-BOTTOM: 0cm">不知道大家有没有在浏览器中查看过<font face="Times New Roman, serif">Dorado</font>生成的<font face="Times New Roman, serif">jsp</font>文件的源代码，其实这些源代码都是通过<font face="Times New Roman, serif">html</font>和<font face="Times New Roman, serif">xml</font>界面模板信息共同展现的。</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="5"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Dorado</font>内部加载顺序：第一步： 客户端发出请求</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第二步：初始化 视图模型</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第三步：初始化 <font face="Times New Roman, serif">Dataset</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第四步：初始化 组件</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第五步：完成组件与<font face="Times New Roman, serif">Dataset</font>之间的绑定</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第六步： <font face="Times New Roman, serif">Dataset</font>向外部请求数据，完成数据加载</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第七步：向客户端返回<font face="Times New Roman, serif">HTML/XML</font>界面模板信息</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                                                         第八步：完成，显示页面</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2007</font>年<font face="Times New Roman, serif">1</font>月<font face="Times New Roman, serif">8</font>日</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="6"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Dataset</font>中最重要的方法： <font face="Times New Roman, serif">flushData() </font></p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>功能我想我不说大家也知道，就是通过不刷新页面来实现数据更新与交换。</p><ul><li><p style="BACKGROUND: none transparent scroll repeat 0% 0%; MARGIN-BOTTOM: 0cm">在设置对象的属性于视图模型中的字段的时候，可是使用在试图模型中的<font face="Times New Roman, serif">objectClazz</font>来帮助我们实现这个一一对应的关系。－<font face="Times New Roman, serif"><span style="BACKGROUND: #ffff00"><font color="#800000">fromDO</font></span></font><span style="BACKGROUND: #ffff00"><font color="#800000">方法</font></span></p><p style="MARGIN-BOTTOM: 0cm">注：因为这里是根据<font face="Times New Roman, serif">java class</font>中的属性名称一一映射的，所以如果出现属性名称于试图模型中所希望的字段名称不一致的时候，可以使用<font face="Times New Roman, serif">property</font>属性来辅助我们。</p><p style="MARGIN-BOTTOM: 0cm"></p></li><li><p style="MARGIN-BOTTOM: 0cm">异步交互：</p></li></ul><ol><ol><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dataset</font>中设置<font face="Times New Roman, serif">autoLoadData</font>为<font face="Times New Roman, serif">false</font>，并且设置<font face="Times New Roman, serif">async</font>为<font face="Times New Roman, serif">true</font>。</p><p style="MARGIN-BOTTOM: 0cm"></p></ol></ol><ul><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">MasterLink</font>：</p><p style="MARGIN-BOTTOM: 0cm">主从表的设置：</p><ul><li><p style="MARGIN-BOTTOM: 0cm">方法一： 修改主表的<font face="Times New Roman, serif">Dataset</font>中的<font face="Times New Roman, serif">afterScroll</font>事件。</p></li><li><p style="MARGIN-BOTTOM: 0cm">方法二： 在<font face="Times New Roman, serif">masterLink</font>中设置，便可以完成同样的功能。</p><ul><li><p style="MARGIN-BOTTOM: 0cm">特点：可以缓存已经下载的数据</p><p style="MARGIN-BOTTOM: 0cm"></p></li></ul></li></ul></li><li><p style="MARGIN-BOTTOM: 0cm">在中设置多个监听器，各个监听器之间用逗号分隔。</p><p style="MARGIN-BOTTOM: 0cm">在监听器中分别提供了<font face="Times New Roman, serif">beforeXX</font>和<font face="Times New Roman, serif">afterXX</font>方法，其中<font face="Times New Roman, serif">afterXX</font>的返回值为<font face="Times New Roman, serif">void</font>，<font face="Times New Roman, serif">beforeXX</font>的返回值为<font face="Times New Roman, serif">boolean</font>型，这样如果在<font face="Times New Roman, serif">beforeXX</font>方法中返回<font face="Times New Roman, serif">false</font>，就可以实现中止标准的<font face="Times New Roman, serif">dataset.XX()</font>以及监听器本身的<font face="Times New Roman, serif">afterXX()</font>方法的操作。</p><p style="MARGIN-BOTTOM: 0cm"></p></li><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">ViewProperties</font></p><ul><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">在传统的开发方式中，常常通过<font face="Times New Roman, serif">getParameter()</font>方法来获取页面的参数信息。但是需要注意以下的提示：</p><p style="BACKGROUND: #ffff99; MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dorado</font>中，可以通过两种方式来发送<font face="Times New Roman, serif">request</font>请求，一种是通过<font face="Times New Roman, serif">JSP</font>页面来发送<font face="Times New Roman, serif">request</font>请求，还有一种是通过客户端的<font face="Times New Roman, serif">dataset</font>的<font face="Times New Roman, serif">flushData()</font>方法来发送<font face="Times New Roman, serif">request</font>请求，但需要注意的是，通过这两种方式产生的<font face="Times New Roman, serif">request</font>请求是完全不通的<font face="Times New Roman, serif">request</font>对象。所以通过类似于<font face="Times New Roman, serif">DoradoContext.getContext().getParameter(“pageSize”)</font>这样的方法在第一种<font face="Times New Roman, serif">request</font>请求中是正确的，可以获得通过<font face="Times New Roman, serif">JSP</font>页面传送的<font face="Times New Roman, serif">pageSize</font>参数，但在第二种<font face="Times New Roman, serif">request</font>中，通过这样的方法所得到的就是<font face="Times New Roman, serif">null</font>，需要特别的注意。</p><p style="MARGIN-BOTTOM: 0cm">所以，在开发中常常遇到的问题就是你第一页显示的没有问题，但是当你点击下一页的时候，就会有问题。这是因为第一页是通过<font face="Times New Roman, serif">JSP</font>页面发送的请求，而当点击下一页的时候，就是通过客户端的<font face="Times New Roman, serif">Dataset</font>来发送的请求。</p><p style="MARGIN-BOTTOM: 0cm">如果通过<font face="Times New Roman, serif">ViewProperties</font><span lang="zh-CN">方式，就不存在这样的问题。</span></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">具体使用如下：</p><ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">DoradoContext.getContext().getAttribute(DoradoContext.VIEW,”pageSize”) ;</font></p></ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">这个方法返回的是<font face="Times New Roman, serif">Object</font>类型的返回值，你只需要做适当的强制转型即可。</p></li></ul></li></ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><ul><ul><li value="1"><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">我们可以从服务器端或者客户端来访问、存贮<font face="Times New Roman, serif">ViewProperties</font>，用“推”的形式来实现客户端于服务器端之间的数据传递</p><ul><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">服务器端：</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">DoradoContext.getContext().setAttribute(DoradoContext.VIEW, key, value) ;</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">DoradoContext.getContext().getAttribute(DoradoContext.VIEW, key) ;</font></p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">客户端：</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">getViewModel().properties().getValue(key) ;</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">getViewModel().properties().setValue(key, value) ;</font></p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">同时，我们也可以通过<font face="Times New Roman, serif">EL</font>表达式来方便的访问<font face="Times New Roman, serif">viewProperties</font>属性：</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">${ViewProperties.XXX},</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">${ViewProperties.getString(“XXX”)}</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"></p></li></ul></li></ul><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">数据校验</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dataset</font>中添加校验器来完成</p><ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dataset</font>的<font face="Times New Roman, serif">beforeChange()</font>方法中添加代码。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">例如可以使用如下方式：</p><ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">switch(field.getName()){</font></p></ul></ul></li></ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">case “key1” : {</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">// code here</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">}</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">...</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">}</font></p><ul><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm">记录状态</p><ul><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">none </font>－无状态： 当数据下载到客户端，此时记录是“无状态”的，这是<font face="Times New Roman, serif"> Dorado</font>的默认状态。</p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">new </font>－新增状态：表示该记录刚刚被添加到数据集，并且尚未得到验证和<font face="Times New Roman, serif"></font>确认。如果此时我们执行了对该记录的撤销，那么该记录<font face="Times New Roman, serif"></font>将被从数据集中移除。</p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">insert </font>－已添加状态：表示这是一条新增的并且已经经过验证和确认的记录。</p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">modify </font>－已修改状态：表示这是一条数据已经被修改的并且已经经过验证<font face="Times New Roman, serif"></font>和确认的记录。</p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">delete </font>－ 已删除状态：表示这是一条被标记为已删除的记录。默认形式下<font face="Times New Roman, serif"></font>此种记录是不可见的，我们对数据集的遍历操作也<font face="Times New Roman, serif"></font>不会得到该记录。但是我们前面还是接受了一种方<font face="Times New Roman, serif"></font>法，可以遍历到这类记录。</p></li></ul></li></ul><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>可以通过<font face="Times New Roman, serif">Rocord.getState()</font>方法获得记录的状态信息。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>并且可以通过<font face="Times New Roman, serif">dataset.getOldRecord(Record r)</font>来获取记录<font face="Times New Roman, serif">r</font>的原始值。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm" align="center"><font style="FONT-SIZE: 22pt" size="6"><b>组件开发</b></font></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm">一<font face="Times New Roman, serif">. DataTable</font></p><ol><li><p style="MARGIN-BOTTOM: 0cm">分配下载功能： 设置<font face="Times New Roman, serif">autoLoadPage</font>为<font face="Times New Roman, serif">true</font></p></li><li><p style="MARGIN-BOTTOM: 0cm">在表格中，列标题常常需要汉化成为中文，我们不建议您在<font face="Times New Roman, serif">DataTable</font>里直接修改，尽管这样做也可以达到目的，我们建议您在与<font face="Times New Roman, serif">DataTable</font>绑定的<font face="Times New Roman, serif">Dataset</font>中的<font face="Times New Roman, serif">Fields</font>中进行修改。</p></li><li><p style="MARGIN-BOTTOM: 0cm">设置<font face="Times New Roman, serif">fixedColumn</font>来设置锁定的列数。</p></li><li><p style="MARGIN-BOTTOM: 0cm">设置<font face="Times New Roman, serif">confirmCancel</font>和<font face="Times New Roman, serif">confirmDelete</font>属性可以设置对表格进行快捷键的操作时，是否弹出相应的提示信息。</p></li><li><p style="MARGIN-BOTTOM: 0cm">设置<font face="Times New Roman, serif">editable</font>来设置表格是否可编辑。</p></li><li><p style="MARGIN-BOTTOM: 0cm">通过<font face="Times New Roman, serif">headerHeight</font>可以设置表格头的高度。</p></li><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">ignored</font>属性是控制表格向客户端输出，一旦设置为<font face="Times New Roman, serif">true</font>，在客户端将不会有这个表格元素存在。 </p></li><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">top</font>和<font face="Times New Roman, serif">left</font>用来设置表格在屏幕的绝对位置。</p></li><li><p style="MARGIN-BOTTOM: 0cm">在修改事件的时候，返回值为<font face="Times New Roman, serif">false</font>，表明不需要再继续执行系统默认的执行方式，而只执行我们自定义的执行方式即可。</p></li><li><p style="MARGIN-BOTTOM: 0cm">我们可以通过<font face="Times New Roman, serif">dataset.getField(“fieldName”).setReadOnly(true) </font>来控制具体某一个单元格的只读属性。</p><p style="MARGIN-BOTTOM: 0cm">对表格可编辑状态控制的具体总结：</p><p style="MARGIN-BOTTOM: 0cm">行状态：利用<font face="Times New Roman, serif">dataset</font>的<font face="Times New Roman, serif">afterScroll</font>动态设定<font face="Times New Roman, serif">dataset</font>的<font face="Times New Roman, serif">readOnly</font>属性实现。</p><p style="MARGIN-BOTTOM: 0cm">列状态：利用<font face="Times New Roman, serif">column</font>的<font face="Times New Roman, serif">readOnly</font>属性实现。</p><p style="MARGIN-BOTTOM: 0cm">指定<font face="Times New Roman, serif">m</font>行<font face="Times New Roman, serif">n</font>列的所在单元格状态：在<font face="Times New Roman, serif">dataset</font>的<font face="Times New Roman, serif">afterScroll</font>动态设定<font face="Times New Roman, serif">field</font>的<font face="Times New Roman, serif">readOnly</font>属性实现。</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><br /></p><img src ="http://www.blogjava.net/nicholas-sjy/aggbug/97034.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nicholas-sjy/" target="_blank">Nic Sense Zone</a> 2007-01-31 17:52 <a href="http://www.blogjava.net/nicholas-sjy/articles/97034.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Dorado on the Road - 2</title><link>http://www.blogjava.net/nicholas-sjy/articles/Dorado-2.html</link><dc:creator>Nic Sense Zone</dc:creator><author>Nic Sense Zone</author><pubDate>Mon, 01 Jan 2007 00:08:00 GMT</pubDate><guid>http://www.blogjava.net/nicholas-sjy/articles/Dorado-2.html</guid><wfw:comment>http://www.blogjava.net/nicholas-sjy/comments/91262.html</wfw:comment><comments>http://www.blogjava.net/nicholas-sjy/articles/Dorado-2.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/nicholas-sjy/comments/commentRss/91262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nicholas-sjy/services/trackbacks/91262.html</trackback:ping><description><![CDATA[  
<p style="MARGIN-BOTTOM: 0cm" align="center"><font face="Times New Roman, serif"><font style="FONT-SIZE: 22pt" size="6"><u><b>Dorado on the way<br /><br /></b></u></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font color="#000000"><font size="5"><font face="Times New Roman, serif">2007</font>年<font face="Times New Roman, serif">1</font>月<font face="Times New Roman, serif">1</font>日</font></font></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm" align="center"><font style="FONT-SIZE: 22pt" size="6"><b>关于</b></font><font face="Times New Roman, serif"><font style="FONT-SIZE: 22pt" size="6"><b>Dataset</b></font></font></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol><li><p style="MARGIN-BOTTOM: 0cm">可以通过<font face="Times New Roman, serif">RecordIterator </font>对<font face="Times New Roman, serif">dataset</font>中的数据进行遍历<font face="Times New Roman, serif">(</font>包括已经在客户端“删除”的记录<font face="Times New Roman, serif">)</font>。</p><p style="MARGIN-BOTTOM: 0cm"></p><p style="MARGIN-BOTTOM: 0cm"><span style="BACKGROUND: #ffff99"><font style="FONT-SIZE: 13pt" size="3"><b>为什么在客户端已经“删除”的记录，</b></font><font face="Times New Roman, serif"><font style="FONT-SIZE: 13pt" size="3"><b>dataset</b></font></font></span><span style="BACKGROUND: #ffff99"><font style="FONT-SIZE: 13pt" size="3"><b>仍然可以遍历到？ </b></font></span></p><p style="MARGIN-BOTTOM: 0cm"><span style="BACKGROUND: #ffff99">原因就在于<font face="Times New Roman, serif">Dorado</font></span><span style="BACKGROUND: #ffff99">出于对性能的考虑，在客户端做的删除并没有立刻更新服务器段的记录，而仅仅是在客户端的<font face="Times New Roman, serif">dataset</font></span><span style="BACKGROUND: #ffff99">中做了删除的标记。在用户提交了以后，才会对服务器端的记录做修改。所以用户在客户端做的删除操作后，如果刷新页面，删除的记录将会重新出现。</span></p><p style="MARGIN-BOTTOM: 0cm"></p><p style="MARGIN-BOTTOM: 0cm">可以通过如下代码对<font face="Times New Roman, serif">dataset</font>中已经标记为“删除”的记录进行遍历：</p></li></ol><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">RecordIterator rit ＝ dataset.recordIterator() ; </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 获取dataset的遍历器</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            rit.setVisibility(Dataset.FILTER_DELETED) ; </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 设置遍历器的可见属性</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img id="Codehighlighter1_169_291_Open_Image" onclick="this.style.display='none'; Codehighlighter1_169_291_Open_Text.style.display='none'; Codehighlighter1_169_291_Closed_Image.style.display='inline'; Codehighlighter1_169_291_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_169_291_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_169_291_Closed_Text.style.display='none'; Codehighlighter1_169_291_Open_Image.style.display='inline'; Codehighlighter1_169_291_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(rit.hasNext())</span><span id="Codehighlighter1_169_291_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_169_291_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                     Record record </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> rit.nextRecord() ; </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 取得当前的Record对象<br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                     </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 对记录进行操作</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />            }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><p style="MARGIN-BOTTOM: 0cm"> </p><ol start="2"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst </font>以及 <font face="Times New Roman, serif">isLast</font>的理解</p><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dataset</font>中容易犯下的错误就是对<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>的误解。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>并不像大家想象当中的那样，代表着<font face="Times New Roman, serif">Dataset</font>的当前记录<font color="#ff3333">（注意，所有对<font face="Times New Roman, serif">Dataset</font></font><font color="#ff3333">的操作，都是对“当前记录”而言）</font>是否是第一条记录或者是最后一条记录。他们真正的含义如下：</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">          isFirst</font>：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>          官方解释：<br />                  <font face="Times New Roman, serif">isFirst</font>表示<font face="Times New Roman, serif">Dataset</font>已经在试图继续向前移动当前记录的过程失败，亦即<font face="Times New Roman, serif"></font>当<font face="Times New Roman, serif">dataset</font>的当前记录从第二条记录转到第一条记录时<font face="Times New Roman, serif">isFirst</font>仍然是<font face="Times New Roman, serif">false</font>，只有当<font face="Times New Roman, serif">Dataset</font>试图继续向前移动当前记录后，<font face="Times New Roman, serif">isFirst</font>才会变成<font face="Times New Roman, serif"> true</font>，此时<font face="Times New Roman, serif">dataset</font>的当前记录仍然是第一条记录。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>         我的理解：<br />                  对于<font face="Times New Roman, serif">isFirst</font>，你可以于<font face="Times New Roman, serif">Java</font>当中的<font face="Times New Roman, serif">Iterator</font>作对比。我们假设<font face="Times New Roman, serif">Java</font>中的<font face="Times New Roman, serif"> Iterator</font>具有<font face="Times New Roman, serif">previous()</font>，就是<font face="Times New Roman, serif">next()</font>倒着遍历<font face="Times New Roman, serif">()</font>，那么当当前记录从第二<font face="Times New Roman, serif"></font>条作<font face="Times New Roman, serif">previous()</font>成功到达第一条记录的时候，<font face="Times New Roman, serif">isFirst</font>仍然返回<font face="Times New Roman, serif">false</font>，为什<font face="Times New Roman, serif"></font>么？因为在移动过程中没有受阻，它成功的前移了。下面要注意了，现<font face="Times New Roman, serif"></font>在当前记录已经在第一条了，现在如果当前记录再试图向前移动时，此<font face="Times New Roman, serif"></font>时受阻了，因为在当前记录前面已经没有记录可以移动了，此时<font face="Times New Roman, serif"> isFirst()</font>返回<font face="Times New Roman, serif">true</font>。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>如下图：<br /></p><p style="MARGIN-BOTTOM: 0cm"><img src="D:\Personal\Nicholas\余光掠影\Dorado on the way\图1.bmp" /><br /></p><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">dorado</font>的设计过程中，数据导航条的数据前移和后移过程中，并不会<font face="Times New Roman, serif"></font>查看当前记录是否是第一条或者是最后一条数据，而是默认前或者后还<font face="Times New Roman, serif"></font>有数据，从而继续作向前或向后的操作，只有在移动受阻后，才修改是<font face="Times New Roman, serif"></font>否到边界的标记，这样或许在移动操作中可能会对移动的性能有一定的<font face="Times New Roman, serif"></font>帮助。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>个人认为，这里把<font face="Times New Roman, serif">isFisrt()</font>看作是对当前记录的操作时候“越界”的标<font face="Times New Roman, serif"></font>志更为合适。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">IsLast</font>：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>官方的解释：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">isLast</font>表示<font face="Times New Roman, serif">Dataset</font>已经在试图继续向后移动当前记录的工程失败，亦即<font face="Times New Roman, serif"></font>当<font face="Times New Roman, serif">dataset</font>试图继续向前移动当前记录后，<font face="Times New Roman, serif">isFirst</font>才会变为<font face="Times New Roman, serif">true</font>，此时<font face="Times New Roman, serif"> Dataset</font>的当前记录仍然是倒数第一条记录。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>我的理解：</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>可以对比<font face="Times New Roman, serif">isFirst</font>来理解，我觉得我已经解释的比较清楚了。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="3"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">moveFirst </font>和 <font face="Times New Roman, serif">moveLast</font>方法</p><p style="MARGIN-BOTTOM: 0cm">当用户调用了<font face="Times New Roman, serif">Dataset</font>的<font face="Times New Roman, serif">moveFirst</font>或<font face="Times New Roman, serif">moveLast</font>之后，<font face="Times New Roman, serif">Dataset</font>的<font face="Times New Roman, serif">isFirst</font>或<font face="Times New Roman, serif">isLast</font>立刻被置为<font face="Times New Roman, serif">true</font>。</p><p style="MARGIN-BOTTOM: 0cm">当<font face="Times New Roman, serif">dataset</font>没有任何<span style="BACKGROUND: #ffff00"><font color="#800000">可见记录</font></span>的时候，<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>将同时为<font face="Times New Roman, serif">true</font>，并且当前记录为<font face="Times New Roman, serif">null</font>。</p><p style="MARGIN-BOTTOM: 0cm">想必在前面理解了我对<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>的讲解之后，对这两个方法的理解应该不会出现什么偏差了。</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>         不过我想提醒大家一下，注意我这里的用词，是<span style="BACKGROUND: #ffff00"><font color="#800000">“可见记录”</font></span>，即是说，如果在客户<font face="Times New Roman, serif"></font>端删除了所有的记录，虽然没有向服务器提交，<br />         但此时<font face="Times New Roman, serif">isFirst</font>和<font face="Times New Roman, serif">isLast</font>都会同时返回<font face="Times New Roman, serif"><span style="BACKGROUND: #ffff00"><font color="#800000">true</font></span></font>。这里就很好的统一了对用户的“体验一致性”，即用户认为已经没有数据了。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="4"><li><p style="MARGIN-BOTTOM: 0cm">不知道大家有没有在浏览器中查看过<font face="Times New Roman, serif">Dorado</font>生成的<font face="Times New Roman, serif">jsp</font>文件的源代码，其实这些源代码都是通过<font face="Times New Roman, serif">html</font>和<font face="Times New Roman, serif">xml</font>界面模板信息共同展现的。</p></li></ol><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="5"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Dorado</font>内部加载顺序：</p><ol><ol><p style="MARGIN-BOTTOM: 0cm">第一步： 客户端发出请求</p></ol></ol></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第二步：初始化 视图模型</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第三步：初始化 <font face="Times New Roman, serif">Dataset</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第四步：初始化 组件</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第五步：完成组件与<font face="Times New Roman, serif">Dataset</font>之间的绑定</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第六步： <font face="Times New Roman, serif">Dataset</font>向外部请求数据，完成数据加载</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第七步：向客户端返回<font face="Times New Roman, serif">HTML/XML</font>界面模板信息</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                              第八步：完成，显示页面</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ol start="6"><li><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Dataset</font>中最重要的方法： <font face="Times New Roman, serif">flushData() </font></p></li></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>         功能我想我不说大家也知道，就是通过不刷新页面来实现数据更新与交换。<br /><br /><br />未完待续。。。<img height="19" src="http://www.blogjava.net/Emoticons/regular_smile.gif" width="19" border="0" /></p><img src ="http://www.blogjava.net/nicholas-sjy/aggbug/91262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nicholas-sjy/" target="_blank">Nic Sense Zone</a> 2007-01-01 08:08 <a href="http://www.blogjava.net/nicholas-sjy/articles/Dorado-2.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Dorado on the Road - 1</title><link>http://www.blogjava.net/nicholas-sjy/articles/Dorado.html</link><dc:creator>Nic Sense Zone</dc:creator><author>Nic Sense Zone</author><pubDate>Sun, 31 Dec 2006 19:29:00 GMT</pubDate><guid>http://www.blogjava.net/nicholas-sjy/articles/Dorado.html</guid><wfw:comment>http://www.blogjava.net/nicholas-sjy/comments/91260.html</wfw:comment><comments>http://www.blogjava.net/nicholas-sjy/articles/Dorado.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nicholas-sjy/comments/commentRss/91260.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nicholas-sjy/services/trackbacks/91260.html</trackback:ping><description><![CDATA[  
<p style="MARGIN-BOTTOM: 0cm" align="center"><font face="Times New Roman, serif"><font style="FONT-SIZE: 22pt" size="6"><u><b>Dorado on the way</b></u></font></font></p><p style="MARGIN-BOTTOM: 0cm" align="center"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2006</font>年<font face="Times New Roman, serif">12</font>月<font face="Times New Roman, serif">25</font>日</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>今天是圣诞节，进入公司已经四个月了，可是对公司的产品<font face="Times New Roman, serif">Dorado</font>还几乎是一个门外汉，<font face="Times New Roman, serif">(</font>我要说明一下，不是我太笨，刚刚进入公司就接受了一个传统项目的开发，再加之学校的事情，在此我想我应该声明一点，我还是一个大四的学生，快结束大学四年的学习了，到最后，乱七八糟的事情实在是太多了，这个报告那个报告的。<font face="Times New Roman, serif">)</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Thomas(</font>我们公司的产品经理<font face="Times New Roman, serif">)</font>，还有范经理，实在是不好意思，还有公司的同事，虽然我比他们中的好多人进入公司都早，可惜我不是最厉害的，至少现在不是。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>到上个星期为止，学校的事情基本上已经完了，毕业设计的课题也选了，选的课题是《基于智能<font face="Times New Roman, serif">Agent</font>的分布式移动计算处理》，本来一开始自作聪明，以为题目为“移动计算”嘛，就是移动设备的计算处理，智能<font face="Times New Roman, serif">Agent</font>嘛～估计就是一种形式而已，我自从从大学二年级自学<font face="Times New Roman, serif">Java</font>开始，接触了<font face="Times New Roman, serif">Java</font>中的<font face="Times New Roman, serif">JavaSE</font>和<font face="Times New Roman, serif">JavaEE</font>两个体系，正好可以借此课题，让我对<font face="Times New Roman, serif">JavaME</font>有所了解，也实现了完成毕业设计的作用。结果后来导师选好了以后，看着导师给的材料，我才知道，我陷入泥潭了～<font face="Times New Roman, serif">(</font>导师，原谅我这么说，呵呵<font face="Times New Roman, serif">·)</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>今天是我真正学习<font face="Times New Roman, serif">Dorado</font>的第一天，公司给了我一些资料，所以我信心十足，我要赶上公司的其他同事，呵呵～争取超过他们哦～已经习惯了要做到最好，我是不是太自大了？？</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>还是跟我学习<font face="Times New Roman, serif">Java</font>一样，首先在公司的官方网站<font face="Times New Roman, serif">(<a href="http://www.bstek.com/">http://www.bstek.com/</a>)</font>下载了<font face="Times New Roman, serif">Dorado</font>的最近版本，我下载的版本是<font face="Times New Roman, serif">Dorado-5.0 061129.1132</font>，一并还下载了<font face="Times New Roman, serif">Dorado 5 </font>快速入门，组件使用技巧，当然还有<font face="Times New Roman, serif">Dorado</font>的<font face="Times New Roman, serif">API</font>－－我的最爱。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>首先看了<font face="Times New Roman, serif">Benny(</font>我们公司的<font face="Times New Roman, serif">CTO)</font>录制的两段视频说明，依照<font face="Times New Roman, serif">Dorado</font>安装自带的<font face="Times New Roman, serif">doradosample</font>，把<font face="Times New Roman, serif">dorado</font>的大致功能作了一个讲解说明，个人感觉<font face="Times New Roman, serif">dorado</font>还是挺有市场前景的，只是需要更大的宣传。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>好了，闲话不多说了，开始我的<font face="Times New Roman, serif">Dorado</font>之旅吧～</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>首先，需要了解的是：<span style="BACKGROUND: #ffff00"><font color="#800000">视图模型</font></span><font face="Times New Roman, serif">Dorado</font>开发当中非常重要的对象，它封装了<font face="Times New Roman, serif">Dorado</font>的界面逻辑和操作逻辑，即主要包含什么数据<font face="Times New Roman, serif">dataset </font>，以及这些数据通过什么形式来展现。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>下面是我今天学习中，觉得需要注意的一些地方和术语。</p><p style="MARGIN-BOTTOM: 0cm"><br /></p><ul><li><p style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><b><span style="BACKGROUND: #ffff00">Dataset</span></b></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. getDataset(“datasetName”) ; </font>获取对<font face="Times New Roman, serif">dataset</font>的引用</p></li></ul><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. RecordIterator ri = dataset.recordIterator() ; </font>获取对<font face="Times New Roman, serif">dataset</font>的迭代器引用。</p></ol><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>对<font face="Times New Roman, serif">dataset</font>的遍历<br /></p><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"><br /></font></p><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span><img id="Codehighlighter1_19_67_Open_Image" onclick="this.style.display='none'; Codehighlighter1_19_67_Open_Text.style.display='none'; Codehighlighter1_19_67_Closed_Image.style.display='inline'; Codehighlighter1_19_67_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_19_67_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_19_67_Closed_Text.style.display='none'; Codehighlighter1_19_67_Open_Image.style.display='inline'; Codehighlighter1_19_67_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(ri.hasNext())</span><span id="Codehighlighter1_19_67_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_19_67_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">2</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />Record record </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ri.nextRecord() ;<br /></span><span style="COLOR: #008080">3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 对每条记录的操作</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">4</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">5</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">4. </font>可是通过<font face="Times New Roman, serif">getControl(“controlName”) ; </font>获取组件的引用</p></ol></ol><ol><ol><p style="MARGIN-BOTTOM: 0cm"><font color="#800000">注意，这里得到的是<font face="Times New Roman, serif">Control</font>对象，需要进行类型的强制转换。</font></p></ol></ol><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">5. ”Module</font>数据坞”的说明。</p><ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1). </font>数据坞里面的<font face="Times New Roman, serif">dataset</font>对象可以被不同的视频模型索引用，以达到数据共享的作用。</p></ol></ol><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">                    2). Module</font>不应该包含任何的业务逻辑，这是一种良好的设计模式。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">                    3). Module</font>的创建和销毁由<font face="Times New Roman, serif">Dorado</font>提供的容器来管理，可以当做一个<font face="Times New Roman, serif">Singleton</font>来使用。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                         所以在绝大部分情况下，在<font face="Times New Roman, serif">Module</font>里面添加非静态的属性都不是正确<font face="Times New Roman, serif"> (</font>或者是不太明智<font face="Times New Roman, serif">)</font>的做法。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">                     4). Module</font>中的<font face="Times New Roman, serif">dataset</font>的创建和销毁使用<font face="Times New Roman, serif">dorado</font>提供的容器来管理的，但开发人<font face="Times New Roman, serif"></font>员可以强制通过<font face="Times New Roman, serif">scope</font>和<font face="Times New Roman, serif">timeout</font>来定制<font face="Times New Roman, serif">dataset</font>的<br />                          生命周期。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">                     5). scope</font>有三种取值，分别是<font face="Times New Roman, serif">request (</font>默认<font face="Times New Roman, serif">)</font>，<font face="Times New Roman, serif">session </font>， <font face="Times New Roman, serif">application</font>。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                           需要特别注意的是，在同一个<font face="Times New Roman, serif">request</font>中<font color="#800000">连续以不同</font>的<font face="Times New Roman, serif">pageIndex </font>，<font face="Times New Roman, serif">pageSize </font>，<font face="Times New Roman, serif"> parameters</font>的不同组合来获取<font face="Times New Roman, serif">Module</font>中的<font face="Times New Roman, serif">dataset</font>，但将获得<font color="#800000">多个不同的</font><font face="Times New Roman, serif">dataset </font>实例。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">                     6). </font>如果为了提高效率而将<font face="Times New Roman, serif">scope</font>设置为<font face="Times New Roman, serif">application </font>，则应该注意让此<font face="Times New Roman, serif">dataset</font>中的<font face="Times New Roman, serif"></font>数据量不要过大。常用在大型系统中的代码表。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">6. </font>通过<font face="Times New Roman, serif">dataSet.getCurrent() ; </font>方法，可以从<font face="Times New Roman, serif">dataSet</font>获取当前记录。由于<font face="Times New Roman, serif">dataSet</font>具有</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">“</font>当前记录”这个，所以大多数操作都是对“当前数据”来说的。</p><ul><ul><ul><ul><p style="MARGIN-BOTTOM: 0cm"></p></ul></ul></ul><li><p style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">Mapping</span></font></font></font></p><blockquote dir="ltr" style="MARGIN-RIGHT: 0px"><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>所有的<font face="Times New Roman, serif">Mapping</font>单元都是通过名为<font face="Times New Roman, serif">global</font>的管理单元来进行管理的。</p></blockquote></li></ul><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">            2. </font>在请求映射的过程中，<font face="Times New Roman, serif">dorado</font>有着自己独特的，不同于<font face="Times New Roman, serif">Struts</font>的映射机制，</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>                  例如：对于请求：<font face="Times New Roman, serif">action=”access.login.d”</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">access </font>与对应的<font face="Times New Roman, serif">controller</font>的名称一致，</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>而<font face="Times New Roman, serif">login</font>与对应的<font face="Times New Roman, serif">action</font>的名称一致。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. controller</font><span lang="zh-CN">的</span><font face="Times New Roman, serif">clazz</font><span lang="zh-CN">属性所表示的是用于处理这个请求的</span><font face="Times New Roman, serif">class </font><span lang="zh-CN">，类似于</span><font face="Times New Roman, serif">Struts</font><span lang="zh-CN">中的</span><font face="Times New Roman, serif"> Action </font><span lang="zh-CN">，而提交的数据，就从</span><font face="Times New Roman, serif">Struts </font><span lang="zh-CN">中的</span><font face="Times New Roman, serif">ActionFrom</font><span lang="zh-CN">转换成了</span><font face="Times New Roman, serif">Dorado</font><span lang="zh-CN">的</span><font face="Times New Roman, serif">dataset.</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">4. </font>对于页面的访问安全控制<font face="Times New Roman, serif">(</font>即只能通过<font face="Times New Roman, serif">dorado</font>式的请求，而不容许以文件结构路径<font face="Times New Roman, serif"></font>来访问，即<font face="Times New Roman, serif">../demo/XX.jsp)</font>，可以将<font face="Times New Roman, serif">view</font>中的<font face="Times New Roman, serif">safe</font>属性设置为<font face="Times New Roman, serif">true</font>来控制。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>或者通过<font face="Times New Roman, serif">dorado</font>默认的<font face="Times New Roman, serif">setting</font>中的<font face="Times New Roman, serif">security.accessChecher</font>来控制。不过我可以自主<font face="Times New Roman, serif"></font>创建一个<font face="Times New Roman, serif">AccessChecker</font>类型的<font face="Times New Roman, serif">java</font>类来进行控制。但需要将<font face="Times New Roman, serif">setting.xml</font>里面的<font face="Times New Roman, serif"> “security.accessChecker”</font>属性修改为自己创建的类路径。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">5. </font>可以通过<font face="Times New Roman, serif">DoradoContext</font>来访问<font face="Times New Roman, serif">dorado</font>的上下文信息，并通过标记量来告诉<font face="Times New Roman, serif">dorado </font>的上下文从哪里获取需要的变量。</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif"></font>例如，</p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">Object obj = doradoContext.getAttribute(DoradoContext.SESSION,”username”) ;</font></p><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><br /></p><ul><li value="1"><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">i18n</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>你需要在<font face="Times New Roman, serif">i18n</font>目录下新建一些<font face="Times New Roman, serif">I18N</font>的<font face="Times New Roman, serif">properties</font>类型文件。此类文件与<font face="Times New Roman, serif">java</font>中的</p><p style="MARGIN-BOTTOM: 0cm">一致，都是以键－值对的形式存在。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. </font>在<font face="Times New Roman, serif">dataset</font>中的<font face="Times New Roman, serif">Fields</font>里面设置为<font face="Times New Roman, serif">${Resource.fileName.key}</font>的形式进行设置。这个就 </p><p style="MARGIN-BOTTOM: 0cm">有点类似于<font face="Times New Roman, serif">JSP2.0</font>中的<font face="Times New Roman, serif">EL</font>，其中，<font face="Times New Roman, serif">fileName</font>是资源文件的文件头，不包括<font face="Times New Roman, serif">_cn_ZH</font></p><p style="MARGIN-BOTTOM: 0cm">等类似的字样。而<font face="Times New Roman, serif">key</font>是在文件中的键。这些都是在系统的<font face="Times New Roman, serif">setting.xml</font>中的 </p><p style="MARGIN-BOTTOM: 0cm">“<font face="Times New Roman, serif">common.locale.language”</font>和“<font face="Times New Roman, serif">common.locale.country ”</font>来进行的配置。同样，你可</p><p style="MARGIN-BOTTOM: 0cm">以通过修改这两个属性来启用不同的<font face="Times New Roman, serif">I18N</font>文件。</p></li></ul><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>对于动态更改用户的国际化资源的情况，可以使用<font face="Times New Roman, serif"></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">LocalHelper.getLocale(“language”,”country”),</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">ResourceManager.getInstance().setDefaultLocale(context, </font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">DoradoContext.SESSION,</font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">locale) ; </font>来设置。 </p><ul><p style="MARGIN-BOTTOM: 0cm"></p><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">EL</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm">在<font face="Times New Roman, serif">JSP2.0</font>方面的书籍中有大量的经典介绍，这里就不再记录。</p><p style="MARGIN-BOTTOM: 0cm">开发时，只需记住<font face="Times New Roman, serif">Dorado</font>内置的隐式变量，即可。</p><p style="MARGIN-BOTTOM: 0cm"></p></li><li><p lang="zh-CN" style="MARGIN-BOTTOM: 0cm"><font color="#800000"><font face="Times New Roman, serif"><font size="4"><span style="BACKGROUND: #ffff00">Skin</span></font></font></font></p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">1. </font>皮肤文件夹存放的位置是在<font face="Times New Roman, serif">skins</font>文件夹下面的。</p><p style="MARGIN-BOTTOM: 0cm">在使用新皮肤时，只需要修改<font face="Times New Roman, serif">setting.xml</font>中的<font face="Times New Roman, serif">view.smartweb2.skin</font>对应的值即可。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">2. </font>同时可以通过修改<font face="Times New Roman, serif">skin.css</font>文件来修改<font face="Times New Roman, serif">dorado</font>中的标签库的所有展示风格。</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">3. </font>同时也支持传统的<font face="Times New Roman, serif">JSP</font>开发，即在<font face="Times New Roman, serif">&lt;head&gt;</font>标签中设置相信的各种属性，以完成让</p><p style="MARGIN-BOTTOM: 0cm"><font face="Times New Roman, serif">dorado</font>以用户自定义的形式进行展现。<br /></p></li></ul><img src ="http://www.blogjava.net/nicholas-sjy/aggbug/91260.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nicholas-sjy/" target="_blank">Nic Sense Zone</a> 2007-01-01 03:29 <a href="http://www.blogjava.net/nicholas-sjy/articles/Dorado.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>