<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>SixSun的Blog</title>
<link>http://blogger.org.cn/blog/blog.asp?name=sixsun</link>
<description>SixSun的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[JBean WebFrame]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=51983</link>
<author>sixsun</author>
<pubDate>2011/9/11 16:18:36</pubDate>
<description><![CDATA[<a><span id="result_box" class="" lang="zh-CN"><span class="">JBeanWeb</span><span>框架</span><span></span><span>的基础上</span><span>JBean</span><span></span><span>。</span> <span class="hps">JBean</span><span></span><span>不仅是</span><span></span><span>一个建模</span><span class="">软件，</span><span class="">也是一个</span><span>敏捷</span><span>的</span><span>Web应用程序开发</span><span>工具</span><span>。</span><span>许多先进的功能</span><span>，</span><span>同时</span><span>完全支持</span><span class="">Java持久性API</span><span class="">（JPA）的</span><span>2.0</span><span>，</span><span>春，</span><span>H</span><span class="hps">ibernate</span><span>，</span><span>EasyUI</span><span>，</span><span>AJAX</span><span>...</span> <span class="hps">JBeanWeb</span><span>可以提高</span><span>您</span><span>的</span><span>开发</span><span class="">速度和质量</span><span class="">。</span><span class="">节省高达</span><span>75</span><span>％的时间</span><span>，</span><span>并</span><span>节省高达</span><span>75</span><span>％的钱</span><span>。</span>&nbsp;<span class="hps"></span><span class=""></span></span></a><p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/JBeanWeb.png"><img class="alignnone size-full wp-image-772" title="JBeanWeb" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/JBeanWeb.png" height="231" width="411"></a><strong></strong></p>
<div class="important_block"><span style="COLOR: #000000"><strong></strong></span><span id="result_box" class="" lang="zh-CN"><span class="">1.Business</span><span class="">模型</span><span class="">设计</span><br><span class="">2.自动构建</span><span class="">SQL</span><span class="">语句</span><br><span class="">3.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建</span></span><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="">数据库</span><span class="">设计文档</span><br><span class="">4.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建</span></span><span id="result_box" class="" lang="zh-CN"><span class="">Java</span><span class="">持久化对象</span><br><span class="">5.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建</span></span><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="hps">DAO的</span><span class="">代码</span><br><span class="">6.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建Spring</span></span><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="">控制器</span><span class="">代码</span><br><span class="">7.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建</span></span><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="hps">Spring的XML</span><span class="">配置文件</span><br><span class="">8.</span></span><span id="result_box" class="" lang="zh-CN"><span class="">自动构建</span></span><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="">软件界面，</span><span class="">基于</span><span class="">AJAX</span><span class="">，</span><span class="">sping</span><span class="">，hibernate, velocity</span><span class=""></span><br><span class="">9.你</span><span class="">可以</span><span class="">添加</span><span class="">自己</span><span class="">的</span><span class="">新</span><span class="">套件</span><span class="">模板</span><span class="">扩展</span><span class="">新的功能</span><span class=""></span></span> </div>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr style="BACKGROUND-COLOR: #00ff00">
<td valign="top" width="140">document</td>
<td valign="top" width="416"><strong>JBean-Developer-and-Spring&amp;Hibernate-For-Java.pdf<br></strong><strong></strong><strong></strong><strong></strong><strong></strong></td></tr>
<tr>
<td valign="top" width="140">Supported languages</td>
<td valign="top" width="416"><strong>If you are a java developers, please use this document</strong></td></tr>
<tr>
<td valign="top" width="140">document</td>
<td valign="top" width="416"><a class="downloadlink" title="Version1.0.0 downloaded 1038 times" href="http://www.suntodo.com/wordpress/wp-content/plugins/download-monitor/download.php?id=9">JBean Developer and Spring&amp;Hibernate-For Java (1038)</a></td></tr></tbody></table>
<p><a title="1Setup Maven" href="http://www.suntodo.com/archives/486" target="_blank"><strong><span style="COLOR: #000000">1&nbsp;&nbsp; &nbsp;Setup Maven&nbsp;&nbsp; &nbsp;1</span></strong></a><br><a title="2Install m2eclipse" href="http://www.suntodo.com/archives/492" target="_blank"><strong><span style="COLOR: #000000">2&nbsp;&nbsp; &nbsp;Install m2eclipse&nbsp;&nbsp; &nbsp;4</span></strong></a><br><a title="3Import JBean Web Application Framework" href="http://www.suntodo.com/archives/503" target="_blank"><strong><span style="COLOR: #000000">3&nbsp;&nbsp; &nbsp;Import JBean Web Application Framework&nbsp;&nbsp; &nbsp;8</span></strong></a><br><a title="4Deployment Database" href="http://www.suntodo.com/archives/505" target="_blank"><strong><span style="COLOR: #000000">4&nbsp;&nbsp; &nbsp;Deployment Database&nbsp;&nbsp; &nbsp;11</span></strong></a><br><a title="5Run the JBean Web Application" href="http://www.suntodo.com/archives/509" target="_blank"><strong><span style="COLOR: #000000">5&nbsp;&nbsp; &nbsp;Run the JBean Web Application&nbsp;&nbsp; &nbsp;13</span></strong></a><br><a title="6Create JBean Module Java Project" href="http://www.suntodo.com/archives/514" target="_blank"><strong><span style="COLOR: #000000">6&nbsp;&nbsp; &nbsp;Create JBean Module Java Project&nbsp;&nbsp; &nbsp;15</span></strong></a><br><a title="7Create a JBEAN Module Project" href="http://www.suntodo.com/archives/524" target="_blank"><strong><span style="COLOR: #000000">7&nbsp;&nbsp; &nbsp;Create a JBEAN Module Project&nbsp;&nbsp; &nbsp;18</span></strong></a><br><a title="8Configuring web applications" href="http://www.suntodo.com/archives/528" target="_blank"><strong><span style="COLOR: #000000">8&nbsp;&nbsp; &nbsp;Configuring web applications&nbsp;&nbsp; &nbsp;25</span></strong></a><br><a title="9How to Create Web UI" href="http://www.suntodo.com/archives/535" target="_blank"><strong><span style="COLOR: #000000">9&nbsp;&nbsp; &nbsp;How to Create Web UI &nbsp;&nbsp; 28</span></strong></a><br><a title="10The relationship between the model and Web UI" href="http://www.suntodo.com/archives/543" target="_blank"><strong><span style="COLOR: #000000">10&nbsp;&nbsp; &nbsp;The relationship between the model and Web UI&nbsp;&nbsp; &nbsp;35</span></strong></a></p>
<p><span style="COLOR: #000000"><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A&nbsp; JBean Module Example<br></strong></span></p>
<div><img alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/071411_1416_7CreateaJBE6.png" align="left">JPA Domain</div>
<ol>
<li>
<div>Spring Controller</div></li>
<li>
<div>Dao Api</div></li>
<li>
<div>Dao Hibernate impl</div></li>
<li>
<div>Service Api</div></li>
<li>
<div>Service Impl</div></li>
<li>
<div>Spring xml file(Dao and Controller)</div></li>
<li>
<div>Junit Test Code</div></li>
<li>
<div>Junit Test Spring xml</div></li></ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br></p>
<p><br></p>
<p><br></p>
<p><br></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal1.png"><img class="alignnone size-full wp-image-425" title="portal1" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal1.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal2.png"><img class="alignnone size-full wp-image-426" title="portal2" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal2.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal3.png"><img class="alignnone size-full wp-image-427" title="portal3" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal3.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal4.png"><img class="alignnone size-full wp-image-428" title="portal4" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal4.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal5.png"><img class="alignnone size-full wp-image-429" title="portal5" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal5.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal6.png"><img class="alignnone size-full wp-image-430" title="portal6" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal6.png" height="475" width="1366"></a></p>
<p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal7.png"><img class="alignnone size-full wp-image-431" title="portal7" alt="" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/portal7.png" height="475" width="1366"></a></p>]]></description>
</item><item>
<title><![CDATA[JBean Designer]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=51982</link>
<author>sixsun</author>
<pubDate>2011/9/11 16:12:11</pubDate>
<description><![CDATA[<a><span id="result_box" class="" lang="zh-CN"><span class="">JBean</span><span class="">是</span><span class="">一个强大的数据库</span><span class="">设计</span><span class="">器，</span></span></a><a><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="">JPA</span><span class="">/Hibernate</span><span class="">/</span> <span class="hps">ORM</span><span class="">设计器</span><span class="">，基于</span></span></a><a><span id="result_box" class="" lang="zh-CN"><span class=""></span><span class="">模型驱动架构</span><span class=""></span><span class="">，支持</span><span class=""></span><span class="">跨语言</span><span class="">和数据库</span><span class="">以及</span><span class="">许多先进的功能</span><span class="">，</span><span class="">同时完全支持</span><span class="">Java持久性API</span><span class="">（JPA）的</span><span class="">2.0</span><span class="">和Spring</span><span class="">，</span><span class="">Hibernate中，</span><span class="">EasyUI</span><span class="">，</span><span class="">Ajax</span><span class="">...</span></span></a><a></a><p><a href="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/Screen2.png"><img title="Screen" src="http://www.suntodo.com/wordpress/wp-content/uploads/2011/07/Screen2.png" alt="" height="726" width="894"></a></p>
<p><strong><strong></strong><span style="color: #000000;"><strong><a title="JBean Developer Guide3.4-For Java" href="http://www.suntodo.com/archives/388" target="_blank"><span style="color: #000000;">JBean Developer Guide3.4 For JAVA</span></a>.</strong></span></strong></p>
<p><a title="1New a JBEAN" href="http://www.suntodo.com/archives/14" target="_blank">1 New a JBEAN 1</a></p>
<p><a title="2Setup JBean file" href="http://www.suntodo.com/archives/17" target="_blank">2 Setup JBean file 5</a></p>
<p><a title="3Basic JBean Entity" href="http://www.suntodo.com/archives/198" target="_blank">3 Basic JBean Entity 7</a></p>
<p><a title="4Entity and Table" href="http://www.suntodo.com/archives/74" target="_blank">4 Entity and Table 23</a></p>
<p><a title="5The relationship between Entity" href="http://www.suntodo.com/archives/222" target="_blank">5 The relationship between Entity 25</a></p>
<p><a title="6Entity Inheritance" href="http://www.suntodo.com/archives/83" target="_blank">6 Entity Inheritance 35</a></p>
<p><a title="7Table Inheritance" href="http://www.suntodo.com/archives/98" target="_blank">7 Table Inheritance 37</a></p>
<p><a title="8Primary key generation strategy" href="http://www.suntodo.com/archives/111" target="_blank">8 Primary key generation strategy 45</a></p>
<p><a title="9Composite primary key" href="http://www.suntodo.com/archives/124" target="_blank">9 Composite primary key 53</a></p>
<p><a title="10Composite embedded objects" href="http://www.suntodo.com/archives/130" target="_blank">10 Composite embedded objects 57</a></p>
<p><a title="11JBean and Hibernate" href="http://www.suntodo.com/archives/135" target="_blank">11 JBean and Hibernate 59</a></p>
<p><a title="12Attribute Override" href="http://www.suntodo.com/archives/145" target="_blank">12 Attribute Override 63</a></p>
<p><a title="13Association Override" href="http://www.suntodo.com/archives/148" target="_blank">13 Association Override 73</a></p>
<p><a title="14Primary Key Join Column" href="http://www.suntodo.com/archives/152" target="_blank">14 Primary Key Join Column 77</a></p>
<p><a title="15Second table" href="http://www.suntodo.com/archives/156" target="_blank">15 Second table 81</a></p>
<p><a title="16Version field" href="http://www.suntodo.com/archives/162" target="_blank">16 Version field 85</a></p>
<p><a title="17Listeners" href="http://www.suntodo.com/archives/169" target="_blank">17 Listeners 87</a></p>]]></description>
</item><item>
<title><![CDATA[编程与旅行]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=51067</link>
<author>sixsun</author>
<pubDate>2011/3/3 16:10:31</pubDate>
<description><![CDATA[<A><IMG style="BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000; BORDER-LEFT-COLOR: #000000" border=0 src="uploadfile/20113316955934.JPG">　</A>
<P><FONT color=#000000 size=2></FONT></P>
<P><FONT color=#000000 size=2>在特殊情况下，还要带上如下物品：</FONT></P>
<UL>
<LI><FONT color=#000000 size=2>应急灯</FONT></LI>
<LI><FONT color=#000000 size=2>狗拉雪橇</FONT></LI>
<LI><FONT color=#000000 size=2>氧气设备</FONT></LI></UL>
<P><FONT color=#000000 size=2>编程与旅行何其相似！与上面的旅行者一样，开发人员在面对程序时也应抛弃不切实际的幻想，客观准确的判断各种潜在问题。</FONT></P>
<P><FONT color=#000000 size=2>有一年多没有一本Java技术方面的著作让我能静下心来仔细思索。我们希望编写健壮稳定，易于维护的软件，这与项目盈利似乎没有半毛钱关系，包括重构，优化设计，任何不增加功能的改变，往往不能给公司和各人来带任何好处，当一个项目的生命周期很快结束，代码复用就是一个神话。但这不是我们无需编写良好程序的理由，过去几年，阅读过很多Eclipse和apache下优秀项目的源码，继而熟悉各种设计模式和策略，而Robust+Java解决了以前很多在异常框架设计上的困惑，让我为之振奋。</FONT></P>]]></description>
</item><item>
<title><![CDATA[MINA设计与实践-前言]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=50865</link>
<author>sixsun</author>
<pubDate>2011/1/12 15:30:10</pubDate>
<description><![CDATA[<A> 
<P><FONT color=#000000 size=2>Apache MINA是一个网络应用程序框架，更容易帮助用户开发高性能，高可伸缩性的网络应用程序。它在多种传输方式上提供一个抽象的“事件驱动”异步API,例如，TCP/IP 和UDP通过NIO的方式。</FONT></P>
<P><FONT size=2><FONT color=#000000>本文将通过对Apache <ABBR title="Multipurpose Infrastructure for Network Applications">MINA项目源代码的设计，来学习高性能网络开发，多线程技术及设计模式。MINA项目没有想象中那么庞大，源码数量也不算多（约1122个），如果熟悉设计模式可以通过类名就判断出它们的作用和大致写法。大概可以分为如下几大块：</ABBR></FONT></FONT></P>
<UL>
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">核心接口</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">过滤器</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">代理器</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">处理器</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">传输器</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">工具类</ABBR></FONT></LI></UL>
<P><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">准备知识，如下即可：</ABBR></FONT></P>
<UL>
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">熟悉Java编程语言</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">熟悉GOF设计模式</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">熟悉多线程及多线程设计模式</ABBR></FONT> 
<LI><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications">熟悉Java网络编程</ABBR></FONT></LI></UL>
<P><FONT color=#000000 size=2><ABBR title="Multipurpose Infrastructure for Network Applications"></ABBR></FONT><FONT color=#000000 size=2>Apache MINA is often called:（<FONT size=2>Apache MINA常被以下方式调用：</FONT>）</FONT></P>
<UL>
<LI><FONT color=#000000><FONT size=2>NIO framework · library, （NIO 框架包）</FONT> </FONT>
<LI><FONT color=#000000 size=2>client · server framework · library, or （client · server 框架包）</FONT><FONT size=2> 
<LI><FONT color=#000000 size=2>a networking · socket library（网络Socket包）</FONT></FONT></LI></UL>
<P><FONT color=#000000 size=2>MINA is a simple yet full-featured network application framework which provides:</FONT></P>
<P><FONT color=#000000 size=2>MINA是一个简单且全功能的网络应用程序框架，提供如下支持：</FONT></P>
<UL>
<LI><FONT color=#000000 size=2>Unified API for various transport types（为多种数据传送类型提供统一的API）: </FONT>
<UL>
<LI><FONT color=#000000 size=2>TCP/IP &amp; UDP/IP via Java NIO </FONT>
<LI><FONT color=#000000 size=2>Serial communication (RS232) via RXTX </FONT>
<LI><FONT color=#000000 size=2>In-VM pipe communication </FONT>
<LI><FONT color=#000000 size=2>You can implement your own! </FONT></LI></UL>
<LI><FONT color=#000000><FONT size=2>Filter interface as an extension point; similar to Servlet filters （过滤器解开是一个扩展点，和Servlet过滤器很相似）</FONT> </FONT>
<LI><FONT color=#000000 size=2>Low-level and high-level API(低级别和高级别的API): </FONT>
<UL>
<LI><FONT color=#000000><FONT size=2>Low-level: uses ByteBuffers （低级别:使用字节缓存）</FONT> </FONT>
<LI><FONT color=#000000 size=2>High-level: uses user-defined message objects and codecs (高级别:使用用户自定义消息对象和编码)</FONT></LI></UL>
<LI><FONT color=#000000 size=2>Highly customizable thread model:（高可自定义线程模式） </FONT>
<UL>
<LI><FONT color=#000000><FONT size=2>Single thread （单线程）</FONT> </FONT>
<LI><FONT color=#000000><FONT size=2>One thread pool （线程池）</FONT> </FONT>
<LI><FONT color=#000000 size=2>More than one thread pools (i.e. </FONT></A><A class=external-link href="http://www.eecs.harvard.edu/~mdw/proj/seda/" rel=nofollow target=_blank><FONT color=#000000 size=2>SEDA</FONT></A><A><FONT color=#000000 size=2>) （超过一个线程池）</FONT></LI></UL>
<LI><FONT color=#000000 size=2>Out-of-the-box SSL · TLS · StartTLS support using Java 5 <TT><FONT face="Courier New">SSLEngine</FONT></TT> </FONT>
<LI><FONT color=#000000><FONT size=2>Overload shielding &amp; traffic throttling （负载保护和传输控制）</FONT> </FONT>
<LI><FONT color=#000000><FONT size=2>Unit testability using mock objects&nbsp;（使用Mock对象的单元测试）</FONT> </FONT>
<LI><FONT color=#000000><FONT size=2>JMX managability （可管理的JMX）</FONT> </FONT>
<LI><FONT color=#000000><FONT size=2>Stream-based I/O support via <TT><FONT face="Courier New">StreamIoHandler</FONT></TT> （基于流的I/O支持通过<FONT face="Courier New">StreamIoHandler</FONT> ）</FONT> </FONT>
<LI><FONT color=#000000><FONT size=2>Integration with well known containers such as PicoContainer and Spring （整合了一些众所周知的容器，比如PICO容器，Spring）</FONT> </FONT>
<LI><FONT color=#000000 size=2>Smooth migration from Netty, an ancestor of Apache MINA.（从Netty项目无缝移植，ApacheMINA项目的先驱）</FONT></LI></UL>
<P><FONT size=2>待续...陆续更新</FONT></P></A>]]></description>
</item><item>
<title><![CDATA[My ExtJS2.3]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=48002</link>
<author>sixsun</author>
<pubDate>2010/1/15 16:39:31</pubDate>
<description><![CDATA[
<P><A>My ExtJS2.3<IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0></A><A href="http://blogger.org.cn/blog/uploadfile/2010115163922629.RAR" target=_blank>myext-2.3.0.rar</A><A><BR>原来看过一个PHP论坛上的，ExtJs Grid 的CRUD封装，不过只有一个表格的例子。ExtJs的组件很多，开发起来也比较繁琐，很多时候也用不了那么多接口，我根本记不住那么多东西，本着一次解决就拉到，以后就不想费时间写那么多js。所以我将大多数的组件重新封装了一层。适用与不同的服务器端语言，只要继承并设置一些请求参数就行了,时间有限写的比较仓促。</A>使用方式和网上PHP论坛的ExtJs Grid 的CRUD使用差不多。教程以后再附上。（PS：仅支持ExtJs2.3）</P>
<P><A><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2010115163754449.JPG" border=0></A></P>
<P>图示效果：</P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2010115164838785.JPG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/201011516494666.JPG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2010115164941827.JPG" border=0></P>]]></description>
</item><item>
<title><![CDATA[设计模式及继承和接口]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=41657</link>
<author>sixsun</author>
<pubDate>2008/12/10 0:48:41</pubDate>
<description><![CDATA[<A><FONT color=#000000>　</FONT></A><A><FONT color=#000000>　<FONT size=2>周星驰在《武状元苏乞儿》中的苏灿亦是做上帮主之位，才得到降龙十八掌的秘芨，可惜只练成十七掌，一直未能参透如何施展最后一掌。待至最后危机时刻，苏灿才悟到第十八掌“亢龙有悔”即是前十七掌的融为一体(此招与金庸原著并不相同).结果此掌挥出登时将对手赵无极打得灰飞烟灭、不见尸骸……<WBR style="LINE-HEIGHT: 1.3em"></FONT> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设计模式常见有23招（不算上多线程模式中的8招），根据类型又可以分为3类，Creational 模式，Structural 模式，Behavioral 模式。此处大致等同于降龙十八掌的前十七招，。招数好学，稍加时日便可见招拆招。但是当你看到一些框架的设计很精妙的时候，想自己一试身手，却不是那么容易，哪怕心中已经对各种模式的使用也颇为了解，却仍然力不从心。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;从百度的知道上搜索到一条关于“java接口和继承的一些解释”：</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR></FONT><FONT color=#000000><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em"><FONT style="LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.java类可以一次继承多个接口，用implements 接口1，接口2 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.如果是接口继承接口的话也可以用extends，接口是多继承的，java类才是单继承 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.接口继承接口可以不实现父接口中的方法，可以声明自己的新方法， <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.类实现接口时，一定要实现接口中声明的方法，如果接口中没有定义抽象方法则不需要 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5.抽象方法只能定义在抽象类中，抽象类实现接口，可以不实现接口中的抽象方法</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR></FONT><WBR style="LINE-HEIGHT: 1.3em"><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 外行看不懂，内行不用看。但100%正确，任何一本不算太烂的书都会解释的很清楚，语法层面的解释。借助强大的IDE工具想在这些问题上出错都很困难。初学者认真看语法书就能掌握上述知识，对于稍具经验的开发者来说，意义不大。谈一点我的认识：</FONT><WBR style="LINE-HEIGHT: 1.3em">&nbsp;<BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 继承- 事物的自然属性和行为。比如：你从您的父亲或爷爷或更老的祖先那里获取的属性和行为。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一部分属性和行为被你毫无保留的继承了下来。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 人，一般科学上被归类在灵长类，和人类一起同属与灵长类的，还有树鼩，狐猴，眼睛猴，猴子及类人猿。解剖学家发现，人类和这些动物在骨骼，肌肉和器官构造上有不少基本相似，因为我们都来自与灵长类。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 但是除了共性，即便是同属灵长类的我们又有着非常多的不同之处。包括外在内在体貌特征，解决问题的行为和方式，有些被完全继承下来了（一个鼻子，两只眼睛，都用嘴巴吃饭......），有些被有所保留的继承下来(指甲，不在作为捕猎的辅助，用于女孩子打扮，但又保留了挖耳朵，鼻子的本质行为)，有些则被完全改变（胚胎在发育一个月的时候有半圆形的腮，发育两个月的时候有发育不完全的尾，但出生以后这些特征消失，小时候一直觉得自己是有尾巴的）。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 接口- 事物的社会属性和行为。比如：你从一个自然人长大以后，你要工作了，经济不景气，一连学了不少技能（驾驶，烹饪），换了好几份工作(打手，歌星)等等。驾驶，烹饪是一种行为能力，打手，歌星属于身份。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这些并不是你与生俱来的。驾驶是因为你想拥有开车这一技能，并实施了学车，驾照考试这样具体方式，因此你获得了驾驶的能力。打手是因为你想成为打手这一身份，为了获取这样一个身份，你必须遵守打手的帮规，并且一一遵守，但是你作恶的身体是来自你的父母亲的，你现在既是一个普通的自然人，又拥有了驾驶技能，私下还是打手身份。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 再往深入的说，无论你是拥有驾驶技能，还是打手身份。都会被管理，对于你驾驶能力有驾协，交管等部门会监管或关注你，为什么会这样，因为他们知道你是有驾驶能力的人，你也许先会到这些监管部门去登记注册，当然也可以不去，登记有登记的好处，可能会定期给你寄一些免费的杂志，或罚单，换句话说你额外的获取了一些好处，但又被管理了。打手也会被帮派，司法等监管，因为你属于打手这一身份，你可以主动去帮会报到，或被动被别人举报到警察那里。一旦你拥有了某种能力和身份，很大程度上你就不是孤立的。你会在知情或不知情的状况下被外界所操纵，在知情的情况下自己实施某些行为。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 综上隐含了一些基础语法和容器的概念。也许说的不是很清楚，但最后终结一下，继承：是为了说明你源自什么，你可以说我源自人，但不能又源自鸟，否则就是鸟人（java不允许多重继承，C++可以，我不是那个意思<IMG style="VERTICAL-ALIGN: baseline! important" src="http://imgcache.qq.com/qzone/em/e143.gif"><WBR>）。接口是为了说明你是什么，我是一个司机，我是一个医生，我会画画等等（java允许实现多个接口）。接口除了其多态性这一语法特征之外，很重要的一点就是能够表明自己是什么，一旦表明了身份就能够被容器所接管。</FONT><WBR style="LINE-HEIGHT: 1.3em">&nbsp;<BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 设计模式是一些招式，设计技巧的归类和终结，这些技巧又源自开发语言本身，我们转了一个圈又回来了。但为什么明白了这些道理还是无法作出优雅的设计，取决与我们对事物的认识是随着经验和时间的改变不断变化的，我们要解决问题的通用性的边界也在不断扩张，心智能力还无法达到比较高的抽象程度。</FONT><WBR style="LINE-HEIGHT: 1.3em"> <BR><BR><FONT style="FONT-SIZE: x-small; LINE-HEIGHT: 1.3em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PS：其实这件事情关周星星同学什么事~~~~~~~~~~~~~~~</FONT><WBR style="LINE-HEIGHT: 1.3em"><IMG id=paperPicArea1 style="DISPLAY: none; POSITION: relative" src="http://imgcache.qq.com/ac/b.gif"><FONT size=2>还是有关系的，我在标题上声明了周星星，设计模式，继承，接口等几个关键字，对周星星感兴趣的同学就会点击进来，因为他知道如何处理周星星这样一个关键字，以此类推。</FONT></FONT></A>]]></description>
</item><item>
<title><![CDATA[Rich Web UI]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=34362</link>
<author>sixsun</author>
<pubDate>2008/4/25 10:06:59</pubDate>
<description><![CDATA[
<P><IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/2008612233531595.RAR" target=_blank>org.sixsun.wrp.web.html.ui.rar</A>&nbsp;version0.1</P>
<P>ui&nbsp;&nbsp;&nbsp; - 多个示例代码(例如 -&nbsp; ui\web\html\ui\container\box\AllInOne.html)<BR>src&nbsp;&nbsp; - javascript代码，仅仅构建UI的结构和行为<BR>style - 决定UI的样式外观</P>
<P>PS:时间匆匆，问题多多，不善此道，做到后面就陷入一大堆问题之中，比如UI之间的通讯，父容器UI如何管理子UI的，如何监听UI的事件，UI资源释的释放，浏览器兼容性等等。</P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2008612233414468.PNG" border=0> 
<P>&lt;SCRIPT LANGUAGE="JavaScript"&gt;<BR>&lt;!--<BR>&nbsp;// 主窗口<BR>&nbsp;var main = new Box();<BR>&nbsp;main.setText("XXXX公司");<BR>&nbsp;main.displayButtonBar();<BR>&nbsp;main.max();<BR>&nbsp;&nbsp; <BR>&nbsp;// 分割主窗口(main)的Y分隔条<BR>&nbsp;var splitbary = new SplitBarY(150);<BR>&nbsp;main.addChild(splitbary);<BR>&nbsp;<BR>&nbsp;// Y分隔条的左边窗口<BR>&nbsp;var yLeft = new SimpleBox(); <BR>&nbsp;yLeft.getBox().setText( '用户窗口' );<BR>&nbsp;yLeft.getBox().setIcon( 'IOCN_CRUD_USER' );<BR>&nbsp;yLeft.setMinTarget( main.getStateBar() );<BR>&nbsp;splitbary.addToLeft(yLeft);<BR>&nbsp;<BR>&nbsp;// 分割Y分隔条(splitbary)的右边窗口的X分隔条<BR>&nbsp;var rightSplitbarx = new SplitBarX(200);<BR>&nbsp;splitbary.addToRight(rightSplitbarx);<BR>&nbsp;//splitbary.addToLeft(splitbarx); <BR>&nbsp;<BR>&nbsp;// X分隔条的上边窗口<BR>&nbsp;var righttop = new SimpleBox(); <BR>&nbsp;righttop.getBox().setText( '日期窗口' );<BR>&nbsp;righttop.getBox().setIcon( 'ICON_DATE' );<BR>&nbsp;righttop.setMinTarget( main.getStateBar());<BR>&nbsp;rightSplitbarx.addToTop( righttop );<BR>&nbsp;<BR>&nbsp;// X分隔条的下边窗口<BR>&nbsp;var rightbottom = new SimpleBox(); <BR>&nbsp;rightbottom.getBox().setText( '帮助窗口' );<BR>&nbsp;rightbottom.getBox().setIcon( 'ICON_HELP' );<BR>&nbsp;rightbottom.setMinTarget( main.getStateBar() );<BR>&nbsp;rightSplitbarx.addToBottom(rightbottom);<BR>&nbsp;<BR>//--&gt;<BR>&lt;/SCRIPT&gt; <BR>&nbsp; <BR>&lt;script type="text/javascript"&gt;<BR>&lt;!-- 下拉菜单 --&gt;<BR>&nbsp;<BR>&nbsp;// 创建横纵向菜单样例，'ICON_ACCEPT'等为图表常量<BR>&nbsp;var menuY = new Menu();<BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('1', '', '文件(File)', 'ICON_ACCEPT',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('2', '', '编辑(Edit)', 'ICON_ADD',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('3', '', '导航(Navigate)', 'ICON_CANCEL',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('4', '', '查询(Search)', 'ICON_DATE',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('5', '', '项目(Project)', 'ICON_DELETE',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('6', '', '运行(Run)', 'ICON_EMAIL',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('7', '', '窗口(WIndow)', 'ICON_ERROR',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuY.addMenuItem('8', '', '帮助(Help)', 'ICON_EXCLAMATION', '#' , '');<BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('1.1',&nbsp;&nbsp; '1',&nbsp;&nbsp; '新建(New)',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('1.1.1', '1.1', '项目(Project)',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('1.1.2', '1.1', '项目...(Project...)', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('1.2',&nbsp;&nbsp; '1',&nbsp;&nbsp; '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('1.3',&nbsp;&nbsp; '1',&nbsp;&nbsp; '退出(Edit)',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('2.1', '2', '撤销(Undo)',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.2', '2', '重做(Redo)',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.3', '2', '剪切(Cut)',&nbsp;&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.4', '2', '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.5', '2', '复制(Copy)',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.6', '2', '粘贴(Paste)', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.7', '2', '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.8', '2', '删除(Delete)',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('2.9', '2', '全选(Select All)', 'ICON_PRINTER', '#' , ''); <BR>&nbsp;menuY.addMenuItem('2.10', '2','查找/替换(F/R)', 'ICON_PRINTER', '#' , ''); <BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('4.1', '4', '查询...', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('7.1', '7',&nbsp; '新建窗口', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.2', '7',&nbsp; '新建编辑器', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.3', '7',&nbsp; '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.4', '7',&nbsp; '打开透视图', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.5', '7',&nbsp; '打开视图', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.6', '7',&nbsp; '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.7', '7',&nbsp; '自定义视图...', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.8', '7',&nbsp; '保存视图...', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.9', '7',&nbsp; '重设视图', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.10', '7', '关闭视图', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.11', '7', '关闭所有视图', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.12', '7',&nbsp; '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('7.6', '7',&nbsp; '参数选择', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuY.addMenuItem('8.1', '8', '欢迎', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('8.2', '8', '帮助内容', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('8.3', '8', '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('8.4', '8', '软件更新', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuY.addMenuItem('8.5', '8', '-', '-', '#' , '');<BR>&nbsp;menuY.addMenuItem('8.6', '8', '关于', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;// 主窗口添加菜单栏<BR>&nbsp;main.setMenuBar(menuY);<BR>//--&gt;<BR>&lt;/SCRIPT&gt; </P>
<P>&lt;script type="text/javascript"&gt;<BR>&lt;!-- 横向菜单 --&gt;</P>
<P>&nbsp;// 创建横向菜单样例，'ICON_PRINTER'为图标常量<BR>&nbsp;var menuX = new Menu();<BR>&nbsp;menuX.setX();</P>
<P>&nbsp;menuX.addMenuItem('1', '', '主菜单项1', 'ICON_ACCEPT',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('2', '', '主菜单项2', 'ICON_ADD',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('3', '', '主菜单项3', 'ICON_CANCEL',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('4', '', '主菜单项4', 'ICON_DATE',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('5', '', '主菜单项5', 'ICON_DELETE',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('6', '', '主菜单项6', 'ICON_EMAIL',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('7', '', '主菜单项7', 'ICON_ERROR',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '#' , '');<BR>&nbsp;menuX.addMenuItem('8', '', '主菜单项8', 'ICON_EXCLAMATION', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('1.1', '1', '菜单项1-1', 'ICON_PRINTER', 'http://www.163.com' , '');<BR>&nbsp;menuX.addMenuItem('1.2', '1', '菜单项1-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3', '1', '菜单项1-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.4', '1', '菜单项1-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.5', '1', '菜单项1-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.1', '1.3', '菜单项1-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2', '1.3', '菜单项1-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.3', '1.3', '菜单项1-3-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.4.1', '1.4', '菜单项1-4-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.4.2', '1.4', '菜单项1-4-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.5.1', '1.5', '菜单项1-5-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.5.2', '1.5', '菜单项1-5-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.1', '1.3.2', '菜单项1-3-2.1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2', '1.3.2', '菜单项1-3-2.2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.3', '1.3.2', '菜单项1-3-2.3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.1', '1.3.2.2',&nbsp; '菜单项1-3-2.2.1',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.2', '1.3.2.2',&nbsp; '菜单项1-3-2.2.2',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.3', '1.3.2.2',&nbsp; '菜单项1-3-2.2.3',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.4', '1.3.2.2',&nbsp; '菜单项1-3-2.2.4',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.5', '1.3.2.2',&nbsp; '菜单项1-3-2.2.5',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.6', '1.3.2.2',&nbsp; '菜单项1-3-2.2.6',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.7', '1.3.2.2',&nbsp; '菜单项1-3-2.2.7',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.8', '1.3.2.2',&nbsp; '菜单项1-3-2.2.8',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.9', '1.3.2.2',&nbsp; '菜单项1-3-2.2.9',&nbsp; 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.10', '1.3.2.2', '菜单项1-3-2.2.10', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.11', '1.3.2.2', '菜单项1-3-2.2.11', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('1.3.2.2.6.1', '1.3.2.2.6', '菜单项1-3-2.2.6.1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('2.1', '2', '菜单项2-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('2.2', '2', '菜单项2-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('2.3', '2', '菜单项2-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('2.4', '2', '菜单项2-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('2.5', '2', '菜单项2-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('3.1', '3', '菜单项3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.2', '3', '菜单项3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.3', '3', '菜单项3-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.4', '3', '菜单项3-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.5', '3', '菜单项3-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.3.1', '3.3', '菜单项3-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('3.3.2', '3.3', '菜单项3-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('5.1', '5', '菜单项5-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.2', '5', '菜单项5-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.3', '5', '菜单项5-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.4', '5', '菜单项5-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.5', '5', '菜单项5-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.3.1', '5.3', '菜单项5-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('5.3.2', '5.3', '菜单项5-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('6.1', '6', '菜单项6-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.2', '6', '菜单项6-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.3', '6', '菜单项6-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.4', '6', '菜单项6-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.5', '6', '菜单项6-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.3.1', '6.3', '菜单项6-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('6.3.2', '6.3', '菜单项6-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('7.1', '7', '菜单项7-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.2', '7', '菜单项7-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.3', '7', '菜单项7-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.4', '7', '菜单项7-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.5', '7', '菜单项7-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.3.1', '7.3', '菜单项7-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('7.3.2', '7.3', '菜单项7-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;menuX.addMenuItem('8.1', '8', '菜单项8-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.2', '8', '菜单项8-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.3', '8', '菜单项8-3', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.4', '8', '菜单项8-4', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.5', '8', '菜单项8-5', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.3.1', '8.3', '菜单项8-3-1', 'ICON_PRINTER', '#' , '');<BR>&nbsp;menuX.addMenuItem('8.3.2', '8.3', '菜单项8-3-2', 'ICON_PRINTER', '#' , '');<BR>&nbsp;<BR>&nbsp;yLeft.addChild(menuX);</P>
<P>&lt;/script&gt;</P>
<P>&lt;SCRIPT LANGUAGE="JavaScript"&gt;<BR>&lt;!--<BR>&nbsp;// 创建ToolBar样例</P>
<P>&nbsp;var label = "ICON_ACCEPT,ICON_CANCEL,ICON_STOP,ICON_ERROR,ICON_EXCLAMATION,ICON_INFO";<BR>&nbsp;var labels = label.split(",");<BR>&nbsp;for(var i=0; i&lt;labels.length; i++){<BR>&nbsp; var icon = labels[i];<BR>&nbsp;&nbsp; <BR>&nbsp; main.addToolBarButton(new Label(icon, "", icon));<BR>&nbsp;} <BR>&nbsp;<BR>//--&gt;<BR>&lt;/SCRIPT&gt;<BR>&nbsp; <BR>&lt;script type="text/javascript"&gt;<BR>&lt;!-- <BR>&nbsp;// 创建Group的样例<BR>&nbsp;<BR>&nbsp;// new Group Object.<BR>&nbsp;var group1 = new Group();<BR>&nbsp;group1.setTitle('title-1');<BR>&nbsp;group1.addToParent(rightbottom);<BR>&nbsp;<BR>&nbsp;// new Group Object.<BR>&nbsp;var group2 = new Group();<BR>&nbsp;group2.setTitle('title-2');<BR>&nbsp;group2.addToParent(rightbottom);</P>
<P>//--&gt;<BR>&lt;/script&gt;<BR>&nbsp;<BR>&lt;script type="text/javascript"&gt;<BR>&lt;!--</P>
<P>&nbsp;// 视图容器 <BR>&nbsp;var view = new View();<BR>&nbsp;view.create('标题栏-0');<BR>&nbsp;view.create('标题栏-1');<BR>&nbsp;view.create('标题栏-2');<BR>&nbsp;view.create('标题栏-3');<BR>&nbsp;view.create('标题栏-4');<BR>&nbsp;view.create('标题栏-5');<BR>&nbsp;view.create('标题栏-6');<BR>&nbsp;view.create('标题栏-7');<BR>&nbsp;view.create('标题栏-8');<BR>&nbsp;view.create('标题栏-9'); <BR>&nbsp;// 激活第一个页面<BR>&nbsp;view.activeByIdx(0);<BR>&nbsp;// 是否创建下拉视图选项菜单<BR>&nbsp;view.createPullDownViewItemMenu(); <BR>&nbsp;// righttop容器添加该视图容器<BR>&nbsp;righttop.addChild(view);<BR>//--&gt;<BR>&lt;/script&gt;<BR>&nbsp; <BR></P>]]></description>
</item><item>
<title><![CDATA[SOA Tools Platform Project]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=27793</link>
<author>sixsun</author>
<pubDate>2007/9/2 0:57:39</pubDate>
<description><![CDATA[
<TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD align=left>
<H1>SOA Tools Platform Project</H1></TD><!-- image/logo to go in here -->
<TD align=right></TD></TR></TBODY></TABLE>
<DIV class=homeitem3col>
<H3>Project Mission</H3>
<UL>
<LI>The mission of the SOA Tools Platform (STP) project is to build frameworks and exemplary extensible tools that enable the design, configuration, assembly, deployment, monitoring, and management of software designed around a Service Oriented Architecture (SOA). The project is guided by the values of transparency, extensibility, vendor neutrality, community collaboration, agile development, and standards-based innovation. STP leverages the Service Component Architecture specification (SCA) as its model. STP is a natural complement to other Eclipse projects, such as the Web Tools Platform and Data Tools Platform, and reuses, as appropriate, components from these projects. </LI></UL>
<HR class=clearer>
</DIV>
<DIV class=homeitem3col>
<H3>Subprojects</H3>
<UL>
<LI><B><A href="http://www.eclipse.org/stp/cf/">STP Core Frameworks (CF)</A></B><BR>The STP Core subproject will define EMF models that conform to the SCA specification for Service Assembly as well as Java language components for SCA syntax support. 
<LI><B><A href="http://www.eclipse.org/stp/soas/main.html">STP SOA System (SOAS)</A></B><BR>The SOA System subproject will provide tools and frameworks for assembling, building, packaging and deploying Services to runtime containers. In addition support will be provided for the definition and association of Policy to Services prior to deployment. 
<LI><B><A href="http://www.eclipse.org/stp/sc/">STP Service Creation (SC)</A></B><BR>While The STP "cf" and "soas" sub-project will provide the APIs and mechanisms required to support and expand the modelling of SOANs under the chosen assembly paradigm, the SC sub-project will handle the management of the relationship between the SOA model tooling provided by STP and the actual implementation tooling(s). The ultimate goal is to support the development of SOAN via tools fully integrated for top-down and bottom-up approaches as well as a mix of both in an agile way. 
<LI><B><A href="http://www.eclipse.org/stp/b2j/">STP BPEL 2 Java (B2J)</A></B><BR>The BPEL to Java (B2J) subproject will provide tools to translate BPEL into executable Java classes. It will also define a standard framework to which these executable Java classes can be deployed. 
<LI colspan="3" width="96%" valign="top"><B><A href="http://www.eclipse.org/stp/bpmn/index.php">STP BPMN (BPMN)</A></B><BR>The BPMN subproject will provide an editor and a set of tools to model business processes diagrams using the BPMN notation and allow validation and generation of BPEL artifacts from those diagrams. </LI></UL></DIV>]]></description>
</item><item>
<title><![CDATA[Eclipse Modeling Project]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=27792</link>
<author>sixsun</author>
<pubDate>2007/9/2 0:40:14</pubDate>
<description><![CDATA[<A>　
<H1>Eclipse Modeling Project</H1>
<TABLE>
<TBODY>
<TR>
<TD>
<P>The Eclipse Modeling Project focuses on the evolution and promotion of model-based development technologies within the Eclipse community by providing a unified set of modeling frameworks, tooling, and standards implementations.</P>
<P>The Modeling Project charter is posted <A href="http://www.eclipse.org/modeling/modeling-charter.php">here</A> and inherits from the <A href="http://www.eclipse.org/org/processes/Eclipse_Standard_TopLevel_Charter_v1.0.html">Eclipse Standard Top-Level Charter v1.0</A>.</P></TD>
<TD align=right><IMG src="http://www.eclipse.org/modeling/images/modeling_pos_logo_fc_med.jpg"> </TD></TR></TBODY></TABLE>
<DIV class=homeitem3col>
<H3>Abstract Syntax Development</H3>
<UL>
<LI></A><A href="http://www.eclipse.org/modeling/emf/">Eclipse Modeling Framework</A><A> (EMF) : a modeling framework and code generation facility for building tools and other applications based on a structured data model. 
<UL>
<LI></A><A href="http://www.eclipse.org/emft/projects/cdo/">CDO</A><A> : a technology for distributed shared EMF models and a fast server-based O/R mapping solution. With CDO you can easily enhance your existing models in such a way that saving a resource transparently commits the applied changes to a relational database. 
<LI></A><A href="http://www.eclipse.org/emft/projects/net4j/">Net4j</A><A> : an extensible client-server system based on the Eclipse Runtime and the Spring Framework. You can easily extend the protocol stack with Eclipse plugins that provide new transport or application protocols. 
<LI></A><A href="http://www.eclipse.org/emft/projects/teneo/">Teneo</A><A> : a database persistency solution for EMF using Hibernate or JPOX/JDO 2.0. It supports automatic creation of EMF to Relational Mappings and the related database schemas. 
<LI></A><A href="http://www.eclipse.org/emft/projects/query/">Model Query</A><A> (MQ) : facilitates the process of search and retrieval of model elements of interest in a flexible yet controlled and structured manner. 
<LI></A><A href="http://www.eclipse.org/emft/projects/transaction/">Model Transaction</A><A> (MT) : provides a model management layer built on top of EMF for managing EMF resources. 
<LI></A><A href="http://www.eclipse.org/emft/projects/validation/">Validation Framework</A><A> (VF) : provides model constraint definition, traversal, and evaluation for EMF model validation. </LI></UL></LI></UL></DIV>
<DIV class=homeitem3col>
<H3>Concrete Syntax Development</H3>
<UL>
<LI></A><A href="http://www.eclipse.org/gmf">Graphical Modeling Framework</A><A> (GMF) : provides a generative component and runtime infrastructure for developing graphical editors based on </A><A href="http://www.eclipse.org/modeling/emf/" target=_top><B>EMF</B></A><A> and </A><A href="http://www.eclipse.org/gef" target=_top><B>GEF</B></A><A>. 
<LI></A><A href="">Textual Modeling Framework</A><A> (TMF) : awaiting proposal. </LI></UL></DIV>
<DIV class=homeitem3col>
<H3></A><A style="COLOR: white" href="http://www.eclipse.org/modeling/mdt/">Model Development Tools</A><A></H3>
<UL>
<LI></A><A href="http://www.eclipse.org/modeling/mdt/?project=eodm">EMF Ontology Definition Metamodel</A><A> (EODM) : an implementation of RDF(S)/OWL metamodels of the </A><A href="http://www.omg.org/ontology">Ontology Definition Metamodel (ODM)</A><A> using EMF with additional parsing, inference, model transformation and editing functions. 
<LI></A><A href="http://www.eclipse.org/modeling/mdt/?project=ocl">Object Constraint Language</A><A> (OCL) : defines APIs for OCL expression syntax for implementing queries and contraints. 
<LI></A><A href="http://www.eclipse.org/modeling/mdt/?project=uml2">Unified Modeling Language 2.x</A><A> (UML2) : an EMF-based implementation of the UML 2.x metamodel for the Eclipse platform. 
<LI></A><A href="http://www.eclipse.org/modeling/mdt/?project=uml2tools">UML2 Tools</A><A> : a set of GMF-based editors for viewing and editing UML models. 
<LI></A><A href="http://www.eclipse.org/modeling/mdt/?project=xsd">XML Schema Infoset Model</A><A> (XSD) : a reference library that provides an </A><A href="http://www.eclipse.org/modeling/mdt/javadoc/?project=xsd&amp;page=org/eclipse/xsd/package-summary.html&amp;anchor=details">API</A><A> for use with any code that examines, creates or modifies </A><A href="http://www.w3.org/TR/XMLSchema-0">W3C XML Schema</A><A>. </LI></UL></DIV>
<DIV class=homeitem3col>
<H3>Model Transformation</H3>
<UL>
<LI></A><A href="http://www.eclipse.org/m2m/">Model to Model Transformation</A><A> (M2M) : will deliver an extensible framework for model-to-model transformation languages, with an exemplary implementation of the </A><A href="http://www.omg.org/technology/documents/modeling_spec_catalog.htm#MOF_QVT">QVT</A><A> Core language. 
<UL>
<LI></A><A href="http://www.eclipse.org/m2m/atl/">Atlas Transformation Language (ATL)</A><A> : a model transformation language and toolkit. </LI></UL>
<LI></A><A href="http://www.eclipse.org/m2t/">Model to Text Transformation</A><A> (M2T) : focuses on technologies for transforming models into text (typically language source code and the resources it consumes) 
<UL>
<LI></A><A href="http://www.eclipse.org/emft/projects/jet/">Java Emitter Templates</A><A> (JET) : provides code generation framework &amp; facilities that are used by EMF. 
<LI></A><A href="http://www.eclipse.org/emft/projects/jeteditor/">JET Editor</A><A> : leverages Eclipse text editor framework to provide this capability via features like syntax coloring, error highlighting and code completion. </LI></UL></LI></UL></DIV>
<DIV class=homeitem3col>
<H3>Model Integration</H3>
<UL>
<LI></A><A href="http://www.eclipse.org/mddi">Model Driven Development integration</A><A> (MDDi) : produces an extensible framework and exemplary tools dedicated to integration of modeling tools in Eclipse. </LI></UL></DIV>
<DIV class=homeitem3col>
<H3>Technology and Research</H3>
<UL>
<LI></A><A href="http://www.eclipse.org/gmt">Generative Modeling Technologies</A><A> (GMT) : research-oriented project focused on producing prototypes in the area of Model Driven Engineering (MDE). 
<UL>
<LI></A><A href="http://www.eclipse.org/gmt/am3/">Atlas MegaModel Management (AM3)</A><A> : the goal is to provide a practical support for modeling in the large. The objective is to deal with global resource management in a model-engineering environment. We base this activity on the concept of a "megamodel". 
<LI></A><A href="http://www.eclipse.org/gmt/amw/">Atlas Model Weaver (AMW)</A><A> : a tool for representing correspondences between models. The correspondences are stored in a model, called weaving model. It is created conforming to a weaving metamodel. 
<LI></A><A href="http://www.eclipse.org/gmt/mofscript/">MOFScript</A><A> : aims at developing tools and frameworks for supporting model to text transformations, e.g., to support generation of implementation code or documentation from models. 
<LI></A><A href="http://www.eclipse.org/gmt/oaw/">openArchitecture Ware (oAW)</A><A> : a suite of tools and components assisting with model driven software development built upon a modular MDA/MDD generator framework implemented in Java(TM) supporting arbitrary import (design) formats, meta models, and output (code) formats. 
<LI></A><A href="http://www.eclipse.org/gmt">UMLX</A><A> : concrete graphical syntax to complement the OMG QVT model transformation language. 
<LI></A><A href="http://www.eclipse.org/gmt">VIATRA2</A><A> : aims to provide a general-purpose support for the entire life-cycle of engineering model transformations including the specification, design, execution, validation and maintenance of transformations within and between various modeling languages and domains. 
<LI></A><A href="http://www.eclipse.org/gmt/epsilon/">Epsilon</A><A> : a metamodel-agnostic component for supporting model navigation, creation, and modification operations. 
<LI></A><A href="http://www.eclipse.org/gmt/gems">GEMS</A><A> : aims to bridge the gap between the communities experienced with visual metamodeling tools, such as the Generic Modeling Environment (GME), and those built around the Eclipse modeling technologies, such as the Eclipse Modeling Framework (EMF) and Graphical Modeling Framework (GMF). 
<LI></A><A href="http://www.eclipse.org/gmt/modisco">MoDisco</A><A> : an Eclipse GMT component for model-driven reverse engineering. The objective is to allow practical extractions of models from legacy systems. As a GMT component, MoDisco will make good use of other GMT components or solutions available in the Eclipse Modeling Project (EMF, M2M, GMF, TMF, etc), and more generally of any plugin available in the Eclipse environment. </LI></UL></LI></UL></DIV></A>]]></description>
</item><item>
<title><![CDATA[Eclipse Modeling Framework Project (EMF)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=27791</link>
<author>sixsun</author>
<pubDate>2007/9/2 0:23:47</pubDate>
<description><![CDATA[<A>　
<H1>Eclipse Modeling Framework Project (EMF)</H1><IMG style="FLOAT: right" alt="" src="http://www.eclipse.org/modeling/emf/images/emf_logo.png"> 
<P>The EMF project is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, along with a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.</P>
<P>EMF builds include </A><A href="http://www.eclipse.org/modeling/mdt/?project=xsd#xsd">XML Schema Infoset Model</A><A> (XSD), now a component of the </A><A href="http://www.eclipse.org/modeling/mdt/?project=xsd">Model Development Tools</A><A> (MDT) project, and an EMF-based implementation of </A><A href="http://www.eclipse.org/modeling/emf/?project=sdo">Service Data Objects</A><A> (SDO). Other subprojects are packaged separately. XSD provides a model and API for manipulating components of an XML Schema, with access to the underlying DOM representation of the schema document. </P>
<P>The next release of EMF is scheduled for the end of June 2008, along with the rest of the </A><A href="http://wiki.eclipse.org/index.php/Ganymede">Ganymede</A><A> projects. </P>
<DIV class=homeitem id=emf style="CLEAR: both">
<H3>EMF</H3>
<P>EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor. Models can be specified using annotated Java, XML documents, or modeling tools like Rational Rose, then imported into EMF. Most important of all, EMF provides the foundation for interoperability with other EMF-based tools and applications. For more detailed information see the </A><A href="http://www.eclipse.org/modeling/emf/docs/#overviews">EMF Overviews</A><A> and </A><A href="http://www.eclipse.org/modeling/emf/docs/#plandocs">Project Plan</A><A>.</P>
<UL class=extras>
<LI></A><A href="http://www.eclipse.org/modeling/emf/?project=emf#emf">More...</A><A> 
<LI></A><A href="http://www.eclipse.org/modeling/emf/downloads/?project=emf">Downloads</A><A> </LI></UL></DIV>
<DIV class=homeitem id=query>
<H3>Query</H3>
<P>The query component provides capabilities to specify and execute queries against EMF model elements and their contents.</P>
<UL class=extras>
<LI></A><A href="http://www.eclipse.org/modeling/emf/?project=query#query">More...</A><A> 
<LI></A><A href="http://www.eclipse.org/modeling/emf/downloads/?project=query">Downloads</A><A> </LI></UL></DIV>
<DIV class=homeitem id=transaction style="CLEAR: both">
<H3>Transaction</H3>
<P>The transaction component provides a model management layer built on top of EMF for managing EMF resources. It provides API that include extensions to the EditingDomain and related APIs of the EMF.Edit framework, and an internal model of transactions. It consists of two layers: a non-Eclipse core, providing primarily the "transaction model", and an Eclipse workspace integration layer.</P>
<UL class=extras>
<LI></A><A href="http://www.eclipse.org/modeling/emf/?project=transaction#transaction">More...</A><A> 
<LI></A><A href="http://www.eclipse.org/modeling/emf/downloads/?project=transaction">Downloads</A><A> </LI></UL></DIV>
<DIV class=homeitem id=validation>
<H3>Validation</H3>
<P>The validation component provides capabilities used to ensure model integrity.</P>
<UL class=extras>
<LI></A><A href="http://www.eclipse.org/modeling/emf/?project=validation#validation">More...</A><A> 
<LI></A><A href="http://www.eclipse.org/modeling/emf/downloads/?project=validation">Downloads</A><A> </LI></UL></DIV>
<DIV class=homeitem id=sdo style="CLEAR: both">
<H3>SDO</H3>
<P>Service Data Objects (SDO) is a framework that simplifies and unifies data application development in a service oriented architecture (SOA). It supports and integrates XML and incorporates J2EE patterns and best practices. EMF includes an EMF-based implementation of Service Data Objects.</P>
<UL class=extras>
<LI></A><A href="http://www.eclipse.org/modeling/emf/?project=sdo#sdo">More...</A><A> 
<LI></A><A href="http://www.eclipse.org/modeling/emf/downloads/?project=emf">Downloads</A><A> </LI></UL></DIV></A>]]></description>
</item><item>
<title><![CDATA[WWTJS]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=27267</link>
<author>sixsun</author>
<pubDate>2007/8/14 17:01:37</pubDate>
<description><![CDATA[新写的JS 客户端&nbsp;UI：采用包装模式的思想，富客户端UI就像外壳一样附加到普通的元素上。部分UI使用了两种实现，一种直接使用Html,CSS,JS结合的方式，一种直接使用JS（UI结尾的文件使用这种方式）。看过ExtJS做的，很漂亮，效果很绚，我做不到那种程度，但不喜欢那种编程方式，做ExtJS的的确是CSS,JS的高手，但没有提供良好的面对对象的设计和使用。精力有限，不想在js上花太大时间，只做了一些常用的。 
<P>下载:<A href="http://blogger.org.cn/blog/images/file/zip.gif" target=_blank><IMG onmousewheel="return bbimg(this)" title=点击在新窗口查看原始图片 src="http://blogger.org.cn/blog/images/file/zip.gif" onload="java_script_:if(this.width>500)this.width=500" border=0></A><A href="http://blogger.org.cn/blog/uploadfile/200781010583911.RAR" target=_blank>WWTJS.rar</A></P>
<P>服务期端还有WWT.jar 开发中</P>]]></description>
</item><item>
<title><![CDATA[RAP－Demo Application]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=23226</link>
<author>sixsun</author>
<pubDate>2007/3/14 16:49:08</pubDate>
<description><![CDATA[
<P>RAP自带的demo，如果熟悉RCP开发的话，很快就会上手RAP的开发。这种Web开发方式比较喜欢，不用再去管那些web ui(html,css,javascript)的东西,连jsp，velocity这些都不需要了，只要关注java的开发就可以了。不足的是大量复杂的js作出来的UI，点击的响应速度有些慢。并且要是能自带一个类似WindowBuilder可视化的开发工具，再提供更多的界面样式就好了.</P>
<P>PS:<BR>fl老大看了以后就是说界面太丑了，美工Hmm说太象桌面应用程序了。界面丑还好解决，只要以后RAP能提供定义界面样式的接口或提供更多可选择的界面就好；太象桌面应用程序，我认为有以下几点：</P>
<P>从有html开始，web的UI好像没有任何统一的设计标准，html像排版工具一样被随意的用作web的开发，界面都是根据个人喜好来设计的。<BR><BR>RAP将一个web页面像Eclipse那样划分出这么多的ViewPart区域，不同的视图之间存在着比以往更多的交互。在平常做web开发中虽然我们也在页面上划分出很多区域（是一种页面结构上的简单划分），仅仅局限于显示内容，而不存在复杂的操作，无非就是提交和链接，不同区域（视图）之间也很少存在通信，一个页面上的可操作的内容也很少，一个功能模块就是一个操作页面，不像桌面应用这样将很多模块功能都集中在一个界面中同时操作。适当的减少页面上的ViewPart就会觉得接近以往的web应用了。<BR><BR>由于用户已经习惯了以往web的界面，如何平衡RAP过于像桌面应用程序的，我觉得还是可以做到的，一方面RAP本身可以将界面的样式改进一下，使其平衡在传统web和桌面应用之间。另一方面给客户做培训让其慢慢接受这种操作方式，毕竟还是很方便的。</P>
<P><STRONG><FONT size=1>download:</FONT></STRONG><BR>RAP Project - Downloads<BR>RAP Update Site<BR>RAP 1.0M2 for Eclipse 3.2 / 3.3: <A href="http://download.eclipse.org/technology/rap/update-site/">http://download.eclipse.org/technology/rap/update-site/</A>&nbsp; [zipped update site] <BR>New and Noteworthy <BR>RAP 1.0M1 for Eclipse 3.2 / 3.3: <A href="http://download.eclipse.org/technology/rap/update-site/">http://download.eclipse.org/technology/rap/update-site/</A>&nbsp; [zipped update site] </P>
<P>看了RAP（<A href="http://www.eclipse.org/rap/index.php">http://www.eclipse.org/rap/index.php</A>）的demo中的例子<BR><BR><STRONG>运行demo 的方式参考：</STRONG></P>
<P><A href="http://www.eclipse.org/rap/gettingstarted.php">http://www.eclipse.org/rap/gettingstarted.php</A></P>
<P>(1)插件下的第一个demo 与RCP开发非常相似，比如布局的概念，如 Perspective，ViewPart，layout ，IFolderLayout editorArea ......</P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2007314172212411.PNG" border=0></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 5px; BACKGROUND: #f3f3f3; PADDING-BOTTOM: 5px; MARGIN: 5px 20px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #cccccc 1px solid">
<P>import org.eclipse.rap.ui.*;</P>
<P>public class Perspective implements IPerspectiveFactory {</P>
<P>&nbsp; public void createInitialLayout( final IPageLayout layout ) {<BR>&nbsp;&nbsp;&nbsp; String editorArea = layout.getEditorArea();<BR>&nbsp;&nbsp;&nbsp; layout.setEditorAreaVisible( false );<BR>&nbsp;&nbsp;&nbsp; IFolderLayout topLeft = layout.createFolder( "topLeft",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPageLayout.LEFT,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.25f,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; editorArea );<BR>&nbsp;&nbsp;&nbsp; topLeft.addView( "org.eclipse.rap.demo.DemoTreeViewPartI" );<BR>&nbsp;&nbsp;&nbsp; topLeft.addView( "org.eclipse.rap.demo.DemoTreeViewPartII" );<BR>&nbsp;&nbsp;&nbsp; IFolderLayout bottomLeft = layout.createFolder( "bottomLeft",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPageLayout.BOTTOM,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.50f,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "topLeft" );<BR>&nbsp;&nbsp;&nbsp;&nbsp;.......&nbsp;<BR>&nbsp; }<BR>}</P></DIV>
<P>(2)类似SWT，JFace的RWT</P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2007314172240200.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2007314172252558.PNG" border=0></P>]]></description>
</item><item>
<title><![CDATA[Rich Ajax Platform (RAP)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=23150</link>
<author>sixsun</author>
<pubDate>2007/3/11 16:59:50</pubDate>
<description><![CDATA[今天发现eclipse的<A>Rich Ajax Platform</A> Project已经更新，前段时间看页面都还是一个计划。以后可以像写RCP程序那样做Web开发了，很多UI开发的概念和RCP相似。 
<H1>Rich Ajax Platform (RAP) Project</H1>
<H2>What is RAP?</H2>
<P>The RAP project aims to enable developers to build rich, Ajax-enabled Web applications by using the Eclipse development model, plug-ins with the well known Eclipse workbench extenstion points and a widget toolkit with SWT API (plus JFace). The project is in the <A href="http://www.eclipse.org/projects/dev_process/validation-phase.php" target=_blank>validation phase</A>. </P>
<H2>M2 has been released</H2>
<P>Just in time for EclipseCon we have released our second milestone build of RAP (<A href="http://eclipse.org/rap/downloads.php">Download</A>, <A href="http://wiki.eclipse.org/index.php/Rap10M2_News" target=_blank>New and Noteworthy</A>). There is also a new demo application offering some useful functionality for EclipseCon: the EclpseCon program in a RAP Ajax app, plus functionality to find and connect to other people. </P>
<P><A href="http://rap.innoopract.com/rap" target=_blank>See the EclipseCon demo online</A>. </P>
<P>A core component of RAP is the RAP Widget Toolkit, which offers SWT API to the largest extend possible (for the web). See a demo <A href="http://rap.innoopract.com/rap?w4t_startup=controls" target=_blank>RWT widget demo</A>. </P>
<P><A href="http://rap.innoopract.com/rap" target=_blank><IMG alt="A demo webworkbench" src="http://www.eclipse.org/rap/resources/webworkbench.png"></A> </P>
<P><IMG alt="Webworkbench plugin.xml" src="http://www.eclipse.org/rap/resources/workbench_pde.png"> <BR>
<P><IMG alt="A ViewPart implementation" src="http://www.eclipse.org/rap/resources/viewpart.png"> 
<UL>
<LI><A href="http://eclipse.org/rap/downloads.php">Download the latest milestone build</A> </LI></UL>
<P></P>
<P></P>
<H2>Project Scope</H2>
<P>The objectives of the RAP project are:</P>
<P><B>Enable the development of Rich Internet Applications that are based on the Eclipse Plugin architecture.</B> The Eclipse OSGi framework (Equinox) can run inside of a Web application. This has been demonstrated by several parties, and a subproject of the Equinox project has already been established (see <A href="http://www.eclipse.org/equinox/incubator/server/" target=_blank>http://www.eclipse.org/equinox/incubator/server/</A>)</P>
<P><B>Enable Ajax UI development based on a Java component library with SWT api. </B>For enabling UI development based on a Java component library the project has received an initial code contribution from Innoopract (W4Toolkit). <B>NEW:</B> Based on the infrastructure provided by this code contributions we have implemented a first version of a new widget toolkit with SWT api, called RWT. More info on RWT can be found here: <A href="http://wiki.eclipse.org/index.php/RWTOverview" target=_blank>http://wiki.eclipse.org/index.php/RWTOverview</A>. RWT is using a sophisiticated JavaScript framework for client side rendering: <A href="http://qooxdoo.org/" target=_blank>qooxdoo</A>.</P>
<P><B>Provide a Web Workbench similar to the Eclipse platform workbench: </B>
<UL>
<LI>provides selection service (with session scope), 
<LI>provides extension points for action sets, workbench parts, perspectives, preference pages, etc., 
<LI>enables plug-ins to contribute to workbench parts provided by other plug-ins (e.g. action contributions) </LI></UL>
<P></P>
<P>The RAP API will be aligned with the Eclipse platform API as much as possible</P>]]></description>
</item><item>
<title><![CDATA[Aries-WebUI]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=22896</link>
<author>sixsun</author>
<pubDate>2007/2/27 1:19:09</pubDate>
<description><![CDATA[(PS:几天以后发现Eclipse推出的 RAP项目以后就感到自卑了，实在是鬼斧神工，自叹不如，但和很多人交流，都觉得Web效果做成那样太怪，很难接受并推广，有一定的道理，但我觉得是因为开发人员和美工以及用户的思考方式是不太一样的，程序员思考问题的方式是如何使事务标准化，并且这种标准化是可扩充及灵活的，我想RAP项目的开发人员以后应该也会考虑到如何让UI设计和布局更贴近现有的Web风格，但又不失这种Web开发模式的优势。) 
<P>自己在Web开发中画界面觉得很烦，一大堆html，css和js，美工做得的确很漂亮，但不是我想要的。一些开源的web ui很强大，但又感觉太复杂了，不想界面上有过多的js。我只想定义好某个元素的Class属性就自动拥有某些功能和样式，具体是怎么实现的最好隐藏起来，自己做了一些简单web ui，对CSS和js的了解一知半解的，做不到那么精致。满足一般的web ui 容器还是可以。如果可能的话倒想试一试WebLogic Portal 来开发，有现成的可以用，不用自己去关心这些细节。</P>
<P>基本UI 元素放在\org\sixsun\aries\widgets 下面</P>
<P>复合UI 放在\org\sixsun\aries\widgets\container下面</P>
<P>每个复合UI都对应一个CSS和javascript,UI的处理的基本思路是：页面上只有html代码，不直接含有js代码，js会根据定义好的Class 属性来初始化WebUI。只要导入相应的js就行。如：</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 5px; BACKGROUND: #f3f3f3; PADDING-BOTTOM: 5px; MARGIN: 5px 20px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #cccccc 1px solid">&lt;SCRIPT src="../style/classical.js" type=text/javascript charset=UTF-8&gt;&lt;/SCRIPT&gt;</DIV>
<P>如果你不喜欢由js赋予的相关效果和功能的话，不导入js就行了。原本想将所有的UI 都封装成js对象，但工作量太大，所以采用匹配Class属性的方式来赋予基本的html元素一些特殊的功能。</P>
<P>下载:<IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/200731521511772.RAR" target=_blank>Aries.rar</A>&nbsp;v0.1</P>
<P>下面这个是新写的：采用包装模式的思想，富客户端UI就像外壳一样附加到普通的元素上。部分UI使用了两种实现一种直接使用Html,CSS,JS结合的方式，一种直接使用JS（UI结尾的文件使用这种方式）。看过ExtJS做的，很漂亮，效果很玄，我做不到那种程度，但不喜欢那种编程方式，做ExtJS的的确是CSS,JS的高手，但没有提供良好的面对对象的设计和使用。</P>
<P>下载:<IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/200781010583911.RAR" target=_blank>WWTJS.rar</A></P>
<P>&nbsp;</P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173414418.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173425533.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173552442.PNG" border=0></P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/20073517363559.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/20073517369563.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173620508.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173636510.PNG" border=0></P>
<P>&nbsp;<A><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173643412.PNG" border=0></A></P>
<P><A><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173650379.PNG" border=0></A></P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173812975.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173821114.PNG" border=0></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/200735173830326.PNG" border=0></P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[IAdaptable和IAdaptableFactory(ZT)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=22459</link>
<author>sixsun</author>
<pubDate>2007/2/5 17:01:54</pubDate>
<description><![CDATA[
<P>原文:http://www.blogjava.net/reloadcn/archive/2006/10/09/74153.aspx</P>
<P>对Eclipse中<A id=viewpost1_TitleUrl href="http://www.blogjava.net/reloadcn/archive/2006/10/09/iadaptable.html">IAdaptable和IAdaptableFactory</A>&nbsp;模式解释的非常清晰，解决问题的方式也很符合平时的开发习惯，作者功力了得。 IAdaptableFactory 实际开发的时候可以通过手工注册或扩展点的方式进行注册。在<A href="http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=19194"><STRONG><FONT size=4>Contributing to Eclipse中文版</FONT></STRONG></A>&nbsp;一书中也有解释，但我认为这个是最好的一个。</P>
<DIV class=postText>
<P><STRONG><FONT face=Tahoma>1.&nbsp;简介和简单的实现</FONT> <BR></STRONG><BR><FONT face=Tahoma>IAdapteable实际上在Eclipse早期版本中不叫这个名字，它原来的名字叫做IExtensible，顾名思义就是可以扩展的意思，后来为了更能突出是由一个类配适到一个接口这么一种机制，所以改名为IAdaptable。<BR>这个接口有什么用呢，其实说白了，就是提供一个类型的转换机制。比如下面这段代码：<BR></FONT><BR></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: 107.91%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 282px; BACKGROUND-COLOR: #eeeeee">
<P><FONT face="Courier New"><SPAN style="COLOR: #000000">Class&nbsp;IAdaptable&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">interface</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable&nbsp;&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Class&nbsp;clazz);<BR>}<BR><BR>Class&nbsp;ListAdapter<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">&nbsp;ListAdapter&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">extends</SPAN> <SPAN style="COLOR: #000000">&nbsp;ArrayList&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">implements</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable&nbsp;</SPAN> </FONT></P>
<P><FONT face="Courier New"><SPAN style="COLOR: #000000">{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Class&nbsp;clazz)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(clazz&nbsp;</SPAN> <SPAN style="COLOR: #000000">==</SPAN> <SPAN style="COLOR: #000000">&nbsp;Vector.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">){<BR>&nbsp;&nbsp;&nbsp;Vector&nbsp;v&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;Vector(</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">.size());<BR>&nbsp;&nbsp;&nbsp;v.addAll(</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;v;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">;<BR>&nbsp;}<BR>}</FONT> </SPAN></P></DIV>
<P><BR><FONT face=Tahoma>ListAdapter类继承了ArrayList，并且实现了IAdaptable接口，我们想要将它转化成Vector类型对象，于是在getAdapter方法中我们判断传入参数类型，如果是Vector类那么就新生成一个Vector对象，将ArrayList中的值全部赋给它，并返回。<BR><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"><FONT face="Courier New"><SPAN style="COLOR: #000000">ListAdapter&nbsp;list&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;ListAdapter();<BR>&nbsp;&nbsp;Vector&nbsp;v&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;(Vector)&nbsp;list.getAdapter(Vector.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">);</SPAN> </FONT></DIV>
<P><BR><FONT face=Tahoma>ArrayList会返回Vector对象，这个对象是ArrayList的一个另外一种类型的副本。</FONT> <BR><BR><FONT face=Tahoma><STRONG>2.一个Swing程序</STRONG> <BR><BR>读者会问：这有什么用啊，不就简单转化一下麽。其实说实话，从上面的代码来看确实没什么用，但是如果我们换一个场景试试。<BR><BR>写这么一个Swing程序：有一个对话框，其中它有一个ComboBox和一个Table，ComboBox中存放的是一个名为Person类型的对象，当ComboBox的选项发生改变的时候，就在Table上显示它的属性，我们假设这个Swing程序已经在某个项目中开始实施，并且其界面布局不易更改。</FONT> </P>
<P><FONT face=Tahoma>看看代码：</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"><FONT face="Courier New"><SPAN style="COLOR: #000000">Class&nbsp;person<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Person&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> <SPAN style="COLOR: #000000">&nbsp;String&nbsp;name&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> <SPAN style="COLOR: #000000">&nbsp;String&nbsp;age&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">23</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> <SPAN style="COLOR: #000000">&nbsp;String&nbsp;sex&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">male</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Person(String&nbsp;name){<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">.setName(name);<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;String&nbsp;getName()&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;name;<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">void</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;setName(String&nbsp;name)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> <SPAN style="COLOR: #000000">.name&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;name;<BR>&nbsp;}<BR>&nbsp;……<BR>}<BR></FONT></SPAN></DIV>
<P><FONT face=Tahoma>UI类的部分代码：</FONT> <BR></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: 123.07%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 602px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #000000">{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;JTable();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">.getContentPane().add(table);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.setBounds(</SPAN> <SPAN style="COLOR: #000000">218</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">2</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">171</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">248</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ComboBoxModel&nbsp;jComboBox1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultComboBoxModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;Object[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;Person(</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">rEloaD</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">),&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;Person(</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">b</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">)&nbsp;});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comboBox&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;JComboBox();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">this</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">.getContentPane().add(comboBox);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comboBox.setModel(jComboBox1Model);&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comboBox.addActionListener(</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;ActionListener(){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">void</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;actionPerformed(ActionEvent&nbsp;e){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JComboBox&nbsp;comboBox&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">(JComboBox)e.getSource();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Person&nbsp;p&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;(Person)comboBox.getSelectedItem();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TableModel&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;p.getName()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Sex</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;p.getSex()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Age</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;p.getAge()&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.setModel(jTable1Model);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR></FONT></SPAN></DIV><BR>
<P align=center><A href="http://album.sina.com.cn/pic/5414465b02000439" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b02000439" border=0> </A></P>
<P><BR><BR>&nbsp;<FONT face=Tahoma>运行我们的代码，会发现效果还可以，每当我们选项改变的时候，Table就如同一个属性栏一样，改变着自己的内容：<BR></FONT></P>
<P align=center><A href="http://album.sina.com.cn/pic/5414465b0200043a" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b0200043a" border=0> </A></P>
<DIV></DIV>
<P><FONT face=Tahoma><BR><STRONG>3.需求变更</STRONG> <BR><BR>OK，问题来了。我写完这段代码后，组长告诉我，现在我们有一个新的需求，就是Combox中不仅仅有Person类型存在，而且还有一些货物(Product)类型，也就是说，我的table显示属性不能光针对Person这个类型了，还需要显示Product的属性。<BR><BR>我心里骂了句：早TMD干嘛了，都快交活儿了才告诉我。<BR><BR>无奈，我新增加了一个Product类型，然后更改了ActionListener中的部分代码：</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: 136.14%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 474px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #000000">JComboBox&nbsp;comboBox&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">(JComboBox)e.getSource();<BR>&nbsp;Object&nbsp;obj&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;comboBox.getSelectedItem();<BR>&nbsp;TableModel&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Person){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getName()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Sex</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getSex()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Age</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getAge()&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Product){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).name&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">price</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).price&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">quantity</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).quantity&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;});<BR><BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;table.setModel(jTable1Model);<BR><BR></FONT></SPAN></DIV><BR>
<P align=center><A href="http://album.sina.com.cn/pic/5414465b0200043b" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b0200043b" border=0> </A></P>
<P><BR><FONT face=Tahoma>结果还是让人满意的：<BR></FONT></P>
<P align=center><A href="http://album.sina.com.cn/pic/5414465b0200043c" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b0200043c" border=0> </A></P>
<P><BR></P>
<P><FONT face=Tahoma>后来我感觉ActionListener代码有一些凌乱，又封装了一个Builder类，让它创建TableModel：<BR><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: 114.81%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 332px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">static</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;TableModel&nbsp;modelBuilder(Object&nbsp;obj){<BR>TableModel&nbsp;jTable1Model&nbsp;<SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><FONT face="Courier New"><SPAN style="COLOR: #000000">;</SPAN></FONT><BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Person){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getName()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Sex</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getSex()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Age</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Person)obj).getAge()&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Product){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).name&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">price</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).price&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">quantity</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)obj).quantity&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR><BR>&nbsp;&nbsp;}<BR></SPAN><SPAN style="COLOR: #0000ff">return</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;jTable1Model;<BR><BR>}<BR><BR></FONT></SPAN></DIV>
<P><BR></P>
<P><FONT face=Tahoma>我对自己的代码还算满意，至少目前能用了。<BR><BR><STRONG>4.需求又变了</STRONG><BR><BR>第二天，组长告诉我，需求又变了，这会不但多增加一个“服装”类型，Product类型属性显示有错误，并且需要增加一个Tree，显示当前同种类型直接的层次结构，等等。<BR><BR>我听了领导唠叨半个小时后，打开了我刚写的Builder类，往里面增加着我的代码……<BR><BR>类图大致如下：<BR><BR></FONT><BR><A href="http://album.sina.com.cn/pic/5414465b0200043d" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b0200043d" border=0> </A><BR><BR>程序经过修改后，好不容易又符合要求了，情况又发生了变化，组长需要我继续修改。我无奈地看着组长，组长也无奈地看着我那用if-else堆成的代码……<BR><BR>“悲哀，真让我替你感到悲～哀！”组长操着本山的腔调这样对我说。<BR><BR>是啊，多悲哀啊，一个设计上的错误让我的代码无法适应需求的变化。</P>
<DIV></DIV>
<P><FONT face=Tahoma><BR><BR>好了，让我们回到IAdaptable上。<BR><BR>通过上面的例子，我看可以发现这么一个情况：同样一个对象，在程序里面往往有许多不同的显示方式（不仅仅是在UI显示，在其他一些代码里，需要转化成另外类型或者数据结构）。<BR><BR>如果我用IAdapteable的思想来实现刚才的Swing属性显示，会怎么样呢？<BR><BR>重新写一遍ActionListener中的代码：</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: 123.51%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 138px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #000000">JComboBox&nbsp;comboBox&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">(JComboBox)e.getSource();<BR>Object&nbsp;obj&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;comboBox.getSelectedItem();<BR>TableModel&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;(TableModel)&nbsp;((IAdaptable)obj).getAdapter(TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">);<BR>}<BR>table.setModel(jTable1Model);</FONT> </SPAN></DIV>
<P><FONT face=Tahoma>然后分别让Person和Product实现IAdaptable接口：<BR><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"><FONT face="Courier New"><SPAN style="COLOR: #000000">Class&nbsp;Person:<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">&nbsp;Person&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">implements</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable{<BR>&nbsp;&nbsp;&nbsp;…..<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Class&nbsp;clazz)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(clazz&nbsp;</SPAN> <SPAN style="COLOR: #000000">==</SPAN> <SPAN style="COLOR: #000000">&nbsp;TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">){<BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getName()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Sex</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getSex()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Age</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getAge()&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;}<BR>}<BR><BR>Class&nbsp;Product<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">&nbsp;Product&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">implements</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable{<BR>&nbsp;……<BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Class&nbsp;clazz)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(clazz&nbsp;</SPAN> <SPAN style="COLOR: #000000">==</SPAN> <SPAN style="COLOR: #000000">&nbsp;TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">){<BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getName()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Sex</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getSex()&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Age</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;getAge()&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">;<BR>&nbsp;}<BR>}<BR><BR></FONT></SPAN></DIV>
<P><FONT face=Tahoma>其实我们的代码量并没有任何的改变，前后都是一样的。<BR><BR>但是我们将Table需要显示的模型（TableModel），现在是作为扩展类接口抽取了出来，而那些需要在Table上显示自己属性的业务模型（Person,Product）实现了IAdaptable接口，将显示模型(TableModel)作为了自己的扩展接口类型给予实例返回，并且UI代码中，Table和业务模型之间形成一种契约：凡是实现了IAdaptable的接口才可以获得在该Table上显示的资格，并且Table从IAdaptable的getAdapter方法获得显示模型：<BR><BR></FONT></P>
<P align=center><A href="http://album.sina.com.cn/pic/5414465b0200043f" target=_blank><IMG src="http://album.sina.com.cn/pic/5414465b0200043f" border=0> </A></P>
<P><BR><BR>这样一来，我们的Swing程序不仅功能能够实现，而且UI部分代码和业务模型代码之间的耦合性减小了。<BR><BR>而且，如果需求发生变化，比如像刚才提到那样“需要增加一个Tree，显示当前同种类型直接的层次结构”，那我们就在getAdaper方法中返回一个TreeModel的副本，然后在UI中增加一个Tree，让它像Table一样，从IAdaptable接口中取出我们的TreeModel即可——UI扩展也变得容易起来。<BR><BR>现在我可以对组长说：让需求变化来得更猛烈些吧！<BR><BR></P>
<DIV></DIV>
<P><FONT face=Tahoma><BR><STRONG>5.模型代码无法修改</STRONG> <BR><BR>有这样一个问题：如果我们的模型已经存在，而且代码已经无法修改了怎么办？<BR><BR>IAdapterFactory就是为这种情况准备的。<BR><BR>先看看IAdapterFactory：</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"><FONT face="Courier New"><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">interface</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptableFactory&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;Object&nbsp;getAdapter(Object&nbsp;adapter,Class&nbsp;clazz);<BR>}</FONT> <BR></SPAN></DIV>
<P><BR><FONT face=Tahoma>这里面的方法和IAdaptable差不多，只是多了一个参数，这个参数就是需要我们返回Adapter接口的对象。<BR><BR>在Eclipse中IAdapterFactory并不是单独存在的，而是有一个IAdapterManager对它进行维护的：</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: 104.83%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 90px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">interface</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptableManager&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Object&nbsp;adapter,Class&nbsp;clazz);<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">boolean</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;registerAdapters&nbsp;(Class&nbsp;clazz,IAdaptableFactory&nbsp;factory);<BR>}</FONT> </SPAN></DIV>
<P><BR><FONT face=Tahoma>现在让我们这样来修改刚才的Swing程序：<BR><BR>假设Product类型是第三方提供的jar包，我们已经无法修改它的代码了，那我们就需要用到IAdapableFactory的扩展方法。请看下面的代码</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: 121.63%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 790px; BACKGROUND-COLOR: #eeeeee"><FONT face="Courier New"><SPAN style="COLOR: #000000">Class&nbsp;AdaptableFactoryImpl<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">&nbsp;AdaptableFactoryImpl&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">implements</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptableFactory&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Object&nbsp;adapter,&nbsp;Class&nbsp;clazz)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(adapter&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Product){<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(clazz&nbsp;</SPAN> <SPAN style="COLOR: #000000">==</SPAN> <SPAN style="COLOR: #000000">TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">){<BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;DefaultTableModel(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[][]&nbsp;{&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Name</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,((Product)adapter).name&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">price</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)adapter).price&nbsp;},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">quantity</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">,&nbsp;((Product)adapter).quantity&nbsp;}},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;String[]&nbsp;{&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;1</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">,&nbsp;</SPAN> <SPAN style="COLOR: #000000">"</SPAN> <SPAN style="COLOR: #000000">Column&nbsp;2</SPAN> <SPAN style="COLOR: #000000">"</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;});<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;}<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Class[]&nbsp;getAdapterList()&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> <SPAN style="COLOR: #000000">&nbsp;Class[]{TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">};<BR>&nbsp;}<BR>}<BR><BR>Class&nbsp;AdapterManagerImpl:<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> <SPAN style="COLOR: #000000">&nbsp;AdapterManagerImpl&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">implements</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptableManager&nbsp;{<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">static</SPAN> <SPAN style="COLOR: #000000">&nbsp;AdapterManagerImpl&nbsp;instance&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> <SPAN style="COLOR: #000000">&nbsp;Hashtable&nbsp;table&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Hashtable();<BR>&nbsp;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">private</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;AdapterManagerImpl(){}<BR>&nbsp;<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;Object&nbsp;getAdapter(Object&nbsp;adapter,&nbsp;Class&nbsp;clazz)&nbsp;{<BR>&nbsp;&nbsp;Object&nbsp;factory&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;table.get(adapter.getClass());<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(factory&nbsp;</SPAN> <SPAN style="COLOR: #000000">!=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">){<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;((IAdaptableFactory)factory).getAdapter(adapter,clazz);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;}<BR><BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">boolean</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;registerFacotry(Class&nbsp;clazz,&nbsp;IAdaptableFactory&nbsp;factory)&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">try</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">{<BR>&nbsp;&nbsp;&nbsp;table.put(clazz,factory);<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">true</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;}</SPAN> <SPAN style="COLOR: #0000ff">catch</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">(Exception&nbsp;e){<BR>&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">false</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">public</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">synchronized</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">static</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;AdapterManagerImpl&nbsp;getInstance()&nbsp;{<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">(instance&nbsp;</SPAN> <SPAN style="COLOR: #000000">==</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> <SPAN style="COLOR: #000000">)&nbsp;instance&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">new</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;AdapterManagerImpl();<BR>&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">return</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">&nbsp;instance;<BR>&nbsp;}<BR>}<BR></FONT></SPAN></DIV>
<P><BR><FONT face=Tahoma>有了这两个实现类后，我们再去修改一下ActionListener中的代码：</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"><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JComboBox&nbsp;comboBox&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;(JComboBox)&nbsp;e.getSource();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;obj&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;comboBox.getSelectedItem();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TableModel&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> <SPAN style="COLOR: #000000">&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">null</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">if</SPAN> <SPAN style="COLOR: #000000">&nbsp;(obj&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">instanceof</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;IAdaptable)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;(TableModel)&nbsp;((IAdaptable)&nbsp;obj)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getAdapter(TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</SPAN> <SPAN style="COLOR: #0000ff">else</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jTable1Model&nbsp;</SPAN> <SPAN style="COLOR: #000000">=</SPAN> </FONT><FONT face="Courier New"><SPAN style="COLOR: #000000">&nbsp;(TableModel)&nbsp;AdapterManagerImpl<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInstance().getAdapter(obj,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TableModel.</SPAN> <SPAN style="COLOR: #0000ff">class</SPAN> </FONT><SPAN style="COLOR: #000000"><FONT face="Courier New">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.setModel(jTable1Model);</FONT> </SPAN></DIV>
<P><BR><FONT face=Tahoma>好了，只要我们在适当]]></description>
</item><item>
<title><![CDATA[AspectJ重构23 个GoF 模式]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=20858</link>
<author>sixsun</author>
<pubDate>2006/12/18 16:16:54</pubDate>
<description><![CDATA[<A>　
<CENTER></A><A name=up></A><A><B><FONT size=-1>[</A><A href="http://www.cs.ubc.ca/~jan/AODPs/#introduction">Introduction</A><A>]&nbsp; [</A><A href="http://www.cs.ubc.ca/~jan/AODPs/#gof">GoF Patterns in Java and AspectJ</A><A>]&nbsp; [</A><A href="http://www.cs.ubc.ca/~jan/AODPs/#download">Downloads</A><A>]&nbsp; [</A><A href="http://www.cs.ubc.ca/~jan/AODPs/#papers">Publications</A><A>]&nbsp; [</A><A href="http://www.cs.ubc.ca/~jan/AODPs/#contact">Contact</A><A>]&nbsp; <BR>[</A><A href="http://www.cs.ubc.ca/~jan/" target=_parent>Jan Hannemann</A><A>]&nbsp; [</A><A href="http://www.cs.ubc.ca/labs/spl/" target=_parent>The SPL lab at UBC</A><A>] </FONT></B><BR>
<HR width="100%">
</CENTER>
<CENTER>
<P><I><FONT color=#ff0000>04/2004: update: minor changes to pattern code base</FONT></I> 
<H2>Aspect-Oriented Design Pattern Implementations</H2>
<H4>Language-dependence of Design Patterns</H4>
<P></CENTER>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=0>
<TBODY>
<TR>
<TD>
<H4>Introduction</H4></TD>
<TD vAlign=top>
<DIV align=right>[<A href="http://www.cs.ubc.ca/~jan/AODPs/#up">top</A>] </DIV></TD></TR>
<TR>
<TD bgColor=#e5e7ec colSpan=2>Software design patterns offer flexible solutions to common software development problems. Each pattern is comprised of a number of parts, including purpose/intent, applicability, structure, and sample implementations. A number of patterns involve crosscutting structures in the relationship between roles in the pattern and classes in each instance of the pattern. 
<P>When the software design patterns were first identified, the sample implementations were geared to the current state of the art in object-oriented languages. Since then, aspect-oriented programming has been proposed as a means of modularizing crosscutting concerns in software. Other work has shown that the implementation language affects pattern implementation, which makes it natural to explore the effect of aspect-oriented programming techniques on the implementation of the GoF patterns. </P></TD></TR></TBODY></TABLE></CENTER><BR>&nbsp; 
<P></A><A name=gof></A><A>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=0>
<TBODY>
<TR>
<TD>
<H4>GoF Design Patterns in Java and AspectJ</H4></TD>
<TD vAlign=top>
<DIV align=right>[<A href="http://www.cs.ubc.ca/~jan/AODPs/#up">top</A>] </DIV></TD></TR>
<TR>
<TD bgColor=#e5e7ec colSpan=2>As an initial experiment we chose to develop and compare Java and AspectJ implementations of the 23 GoF patterns. <A href="http://www.aspectj.org/">AspectJ</A> is a seamless aspect-oriented extension to Java, which means that programming in AspectJ is effectively programming in Java plus aspects. By focusing on the GoF patterns, we are keeping the purpose, intent, and applicability of 23 well-known patterns, and only allowing the solution structure and solution implementation to change. So we are not discovering new patterns, but simply working out how implementations of the GoF patterns can be handled using a new implementation tool. 
<P>For the 23 patterns, we managed to remove the code-level dependencies from the participants in 17 cases. For 12 of these, we developed reusable implementations that can be integrated into software systems as "library pattern aspects". The examples illustrate differences in Java and AspectJ implementations 
<P>Our results indicate that using AspectJ improves the implementation of many GoF patterns. In some cases this is reflected in a new solution structure with fewer or different participants; in other cases, the only the implementation of the classes in the originally proposed solution changes (for example by moving pattern code from the participants into an aspect) . </P></TD></TR></TBODY></TABLE></CENTER><BR>&nbsp; 
<P></A><A name=download></A><A>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=0>
<TBODY>
<TR>
<TD>
<H4>Downloads</H4></TD>
<TD vAlign=top>
<DIV align=right>[<A href="http://www.cs.ubc.ca/~jan/AODPs/#up">top</A>]</DIV></TD></TR>
<TR>
<TD bgColor=#e5e7ec colSpan=2>The following downloads are available. You will need to have <A href="http://www.java.sun.com/">Java</A> (version 1.2 or higher) and <A href="http://www.aspectj.org/">AspectJ</A> (version 1.1 or higher) installed to run the examples. Please refer to the readme files for details on running the examples:&nbsp; 
<UL>
<LI><FONT color=#ff0000>[new]</FONT> - <STRONG>A collection of Java and AspectJ implementations of the 23 GoF patterns, version 1.11</STRONG> - Each design pattern is represented by a sample system implemented in both Java and AspectJ. This includes the library of 12 reusable pattern aspects. The example code is intentionally kept simple. Note that while all classes are extensively commented using <CODE>ajdoc</CODE>, ajdoc does not work with latest AspectJ versions. The AspectJ team has an updated ajdoc in the works and we will provide HTML documentations of the implementations when it becomes available. 
<UL>
<LI>Code base from April 01, 2004 [<A href="http://www.cs.ubc.ca/~jan/AODPs/gof1.11.zip">ZIP</A>, 355K] - <I>please refer to the readme files in the /docs directory for details on setting up your system, and compiling and running the examples.</I> 
<LI>Release notes [<A href="http://www.cs.ubc.ca/~jan/AODPs/releaseNotes1.11.txt">TXT</A>, 3K] </LI></UL>
<P>&nbsp; </P>
<LI><STRONG>Old pattern implementations, version 1.1</STRONG> - basically the same as version 1.11 above, except for the Observer, FactoryMethod and Facade implementations. 
<UL>
<LI>Code base from February 25, 2004 [<A href="http://www.cs.ubc.ca/~jan/AODPs/gof1.1.zip">ZIP</A>, 347 K] </LI></UL>
<LI><STRONG>Old pattern implementations, version 1.0</STRONG> - based on an older version of AspectJ (1.0.6). We recommend you use the latest version instead (see above). 
<UL>
<LI>Code base from November 25, 2002 [<A href="http://www.cs.ubc.ca/~jan/AODPs/gof.zip">ZIP</A>, 321 K] 
<LI>Pre-generated ajdoc documentation for this code base [<A href="http://www.cs.ubc.ca/~jan/AODPs/gof_docs.zip">ZIP</A>, 697 K] </LI></UL></LI></UL></TD></TR></TBODY></TABLE></CENTER><BR>&nbsp; 
<P></A><A name=papers></A><A>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=0>
<TBODY>
<TR>
<TD>
<H4>Publications</H4></TD>
<TD vAlign=top>
<DIV align=right>[<A href="http://www.cs.ubc.ca/~jan/AODPs/#up">top</A>]</DIV></TD></TR>
<TR>
<TD bgColor=#e4e6eb colSpan=2>The following publications about Patterns in AOP are available so far: 
<UL>
<LI>Hannemann and Kiczales.<EM> <A href="http://www.cs.ubc.ca/~jan/papers/oopsla2002/oopsla2002.html">Design Pattern Implementation in Java and AspectJ</A>, </EM>Proceedings of the 17th Annual ACM conference on Object-Oriented Programming, Systems, Languages, and Applications</A> (<A href="http://oopsla.acm.org/oopsla2002/">OOPSLA</A>), pages 161-173, November 2002. </LI></UL></TD></TR></TBODY></TABLE></CENTER><BR>&nbsp; 
<P></A><A name=contact></A><A>
<CENTER>
<TABLE cellSpacing=0 cellPadding=5 width="95%" border=0>
<TBODY>
<TR>
<TD>
<H4>Contact</H4></TD>
<TD vAlign=top>
<DIV align=right>[<A href="http://www.cs.ubc.ca/~jan/AODPs/#up">top</A>]</DIV></TD></TR>
<TR>
<TD bgColor=#e4e6eb colSpan=2>This project is part of the Ph.D. research of <A href="http://www.cs.ubc.ca/~jan" target=_new>Jan Hannemann</A>, under the supervision of <A href="http://www.cs.ubc.ca/~gregor" target=_new>Gregor Kiczales</A> and <A href="http://www.cs.ubc.ca/~murphy" target=_new>Gail Murphy</A> at in the <A href="http://www.cs.ubc.ca/labs/spl" target=_new>Software Practices Lab</A>, <A href="http://www.cs.ubc.ca/" target=_new>Department of Computer Science</A>, <A href="http://www.ubc.ca/" target=_new>University of British Columbia</A>, Canada. 
<P>We are very interested to hear your feedback on this work. Please send all questions, comments and suggestions to: 
<UL><IMG height=20 src="http://www.cs.ubc.ca/~jan/pics/email_grey.gif" width=90> </UL></TD></TR></TBODY></TABLE></CENTER>
<P>
<HR width="100%">
<BR><I><FONT size=-1>Last updated: April 01, 2004 by Jan Hannemann</FONT></I> </A>]]></description>
</item><item>
<title><![CDATA[AOP@Work 系列]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=20833</link>
<author>sixsun</author>
<pubDate>2006/12/16 22:07:11</pubDate>
<description><![CDATA[<P>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=sort14 noWrap width="100%">
<P>　author: Adrian Colyer <BR>blog: <A href="http://www.aspectprogrammer.org/blogs/adrian">http://www.aspectprogrammer.org/blogs/adrian</A> </P>
<P>主题</P></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=12 border=0></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=8 border=0></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=2 border=0></TD>
<TD class=sort noWrap width=85><A href="http://www-128.ibm.com/developerworks/cn/views/java/articles.jsp?expand=&amp;sort_order=asc&amp;search_by=AOP%40Work&amp;show_abstract=true&amp;sort_by=%E6%97%A5%E6%9C%9F&amp;view_by=search"><FONT color=#5c81a7>日期</FONT></A>&nbsp;<A href="http://www-128.ibm.com/developerworks/cn/views/java/articles.jsp?expand=&amp;sort_order=asc&amp;search_by=AOP%40Work&amp;show_abstract=true&amp;sort_by=%E6%97%A5%E6%9C%9F&amp;view_by=search"><IMG height=16 alt="Sorted by 日期 - Click to reverse sort" src="http://www-128.ibm.com/developerworks/i/sort-ascend.gif" width=15 align=absMiddle border=0></A></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=2 border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><IMG height=2 alt="" src="http://www.ibm.com/i/c.gif" width=1 border=0></TD></TR>
<TR>
<TD class=lgray><IMG height=3 alt="" src="http://www.ibm.com/i/c.gif" width=1 border=0></TD></TR>
<TR>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/v14/rules/blue_rule.gif" width="100%"></TD></TR></TBODY></TABLE><!-- End Sort Selection Area --><!-- Start White Separator -->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD width="100%"><IMG height=8 alt="" src="http://www.ibm.com/i/c.gif" width=8></TD></TR></TBODY></TABLE><!-- End White Separator --><!-- END VIEW HEADER AREA --><!-- START VIEW CONTENT -->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=8><IMG height=8 alt="" src="http://www.ibm.com/i/c.gif" width=8 border=0></TD>
<TD width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD width="100%"><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=1 border=0></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=12 border=0></TD>
<TD width=100><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=100 border=0></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=8 border=0></TD>
<TD width=150><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=150 border=0></TD>
<TD><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=2 border=0></TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork17.html"><B><FONT color=#996699>AOP@Work: 用 Contract4J 进行组件设计</FONT></B></A><BR>契约式设计（Design by Contract）是切实可行的技术，可以阐明组件设计的细节、为客户记录正确的组件用法，并用编程的方式测试组件使用的顺应性（compliance）。在 <B>AOP@Work</B> 的最后一篇中，Dean Wampler 介绍了 Contract4J，这是契约式设计的工具，它用 Java 5 标注（annotation）指定合约，并在运行时用 AspectJ 方面计算合约。在成为 AOP 工具包中新增的一个举足轻重的工具的同时，Contract4J 迎合了面向方面设计的新趋势。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2006年4月28日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork16/"><B><FONT color=#5c81a7>AOP@Work: 使用方面的下几个步骤</FONT></B></A><BR>一旦涉足方面之后，您就会马不停蹄，但不带地图去旅行绝对不是个好主意。在本文，尊敬的方面发明人 Ron Bodkin 为您提供了成功地采用方面的四个阶段，从使用跟踪和测试的第一个实验一直到构建自己的可重用方面库。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2006年4月6日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork14/"><B><FONT color=#5c81a7>AOP@Work: 使用 AspectJ 5 检验库方面</FONT></B></A><BR>本文中，作者编了一个假想的故事，故事所讲述的世界离您的现实生活并不遥远，其中有 30 个重大的挑战。通过这个故事，您将学会如何使用及编写库方面，以及如何为相信这一技术和不相信这一技术的人交付解决方案。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2006年3月7日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork13.html"><B><FONT color=#5c81a7>AOP@Work: 用 AspectJ 和 Spring 进行依赖项插入</FONT></B></A><BR>依赖项插入和面向方面编程是互补的技术，所以想把它们结合在一起使用是很自然的。请跟随作者一起探索两者之间的关系，并了解怎样才能把它们组合在一起，来促进高级的依赖项插入场景。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2006年1月23日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork11/"><B><FONT color=#5c81a7>AOP@Work: 对方面进行单元测试</FONT></B></A><BR>AOP 使编写特定于应用程序的横切关注点测试比任何时候都要容易了。要了解其原因以及如何实现，请听作者介绍测试面向方面的代码所具有的好处，并展示在 AspectJ 中测试横切行为的样式。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年12月20日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork12/"><B><FONT color=#5c81a7>AOP@Work: 用 AspectJ 进行性能监视，第 2 部分</FONT></B></A><BR>本文中，作者展示了如何在 Glassbox Inspector 中添加企业监视功能，包括监视多个应用程序、Web 服务和 Web 应用程序框架。他还展示了如何跟踪应用程序错误并在监视代码中包含它们，并展示了如何以编程方式部署和控制这个监视基础架构。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年12月15日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork10/"><B><FONT color=#5c81a7>AOP@Work: 用 AspectJ 进行性能监视，第 1 部分</FONT></B></A><BR>随着 Ron Bodkin 介绍如何把 AspectJ 和 JMX 组合成灵活而且模块化的性能监视方式，就可以对散乱而纠缠不清的代码说再见了。在这篇文章（共分两部分）的第一部分中，Ron 用来自开放源码项目 Glassbox Inspector 的代码和想法帮助您构建一个监视系统，它提供的相关信息可以识别出特定问题，但是在生产环境中使用的开销却足够低。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年10月10日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork9/"><B><FONT color=#5c81a7>AOP@Work: 用新的 AJDT 本本简化 AOP 开发</FONT></B></A><BR>AJDT Eclipse 技术项负责人 Matt Chapman 将带您查看 AJDT 1.2 和 AJDT 1.3，它们分别是针对 Eclipse 3.0 和 Eclipse 3.1 的 AspectJ 开发工具的最新版本。这些版本的主要重点是将 AspectJ 与 Eclipse 平台更紧密地集成在一起，并为 AspectJ 开发人员提供更多 Java? 开发人员使用 Eclipse 时可以得到的高级工具支持。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年8月29日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork8/"><B><FONT color=#5c81a7>AOP@Work: 介绍 AspectJ 5</FONT></B></A><BR>目前，AspectJ 5 处在它的第二个里程碑版本，AspectJ 5 是 Java? 平台上面向方面编程前进的一大步。AspectJ 5 主要的重点是对 Java 5 中引入的新 Java 语言特性（包括注释和泛型）提供支持。另外，AspectJ 5 还包含没有捆绑到 Java 5 的新特性，例如编写方面使用的基于注释的风格、改进的装入时织入以及新的方面实例化模型。现在请随这个项目的首席开发人员 Adrian Colyer 抢鲜了解 AspectJ 5，他将介绍 AspectJ 5 语言和包含 AspectJ 编译器及相关工具的版本。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年8月11日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork7/"><B><FONT color=#5c81a7>AOP@Work: 设计切入点来避免模式密集</FONT></B></A><BR>在“JUnit: A Cook's Tour”一文中，作者 Erich Gamma 和 Kent Beck 讨论了 JUnit 的设计。他们指出，与很多成熟框架中的关键抽象一样，TestCase 也有很高的模式密集，易于使用而难以修改。在 <B>AOP@Work</B> 系列的第四期文章中，Wes Isberg 重温了 Cook's Tour，说明如何通过使用 AOP 切入点设计来代替面向对象设计，在一定程度上避免导致成熟的设计难以修改的模式密集。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年8月2日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork6/"><B><FONT color=#5c81a7>AOP@Work: 用 AspectJ 增强设计模式, 第 2 部分</FONT></B></A><BR>Nicholas Lesiecki 用这篇深入研究观察者(Observer)模式的文章，继续他对使用面向方面技术实现设计模式的好处的讨论。他演示了 AspectJ 如何使复杂的模式转换成可重用的基本方面，从而使框架作者能够支持预先构建的模式库，供开发人员使用这些模式。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年7月18日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork5/"><B><FONT color=#5c81a7>AOP@Work: 用 AspectJ 增强设计模式，第 1 部分 </FONT></B></A><BR>设计模式长期以来一直是一些经验丰富的开发人员的工具箱的重要组成部分。不幸的是，因为模式可以影响多个类，所以它们也是侵入性的、难于使用（和重用）。本文是 <B>AOP@Work</B> 系列的第 3 部分，是一篇由两部分组成的文章，在这篇文章中，Nicholas Lesiecki 将介绍 AOP 是怎样通过根本转变模式实现来解决这一问题的。他研究了三个经典的 Gof 设计模式 （适配器模式、修饰器模式和观察者模式），同时还将讨论使用面向方面技术实现这些模式所带来的实践和设计方面的好处。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年7月18日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork4/"><B><FONT color=#5c81a7>AOP@Work: AOP 和元数据：完美的匹配，第 2 部分</FONT></B></A><BR>在这篇由两部分组成的关于组合使用元数据和 AOP 的系列文章的第二部分中，作者及 AOP 实践者 Ramnivas Laddad 将推荐一种把元数据视为多维关注点空间中的签名的全新方法。他还将介绍有效组合使用元数据与 AOP 的一组准则，并讨论元数据注释将如何影响面向方面的编程的应用。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年4月18日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork3/index.html"><B><FONT color=#5c81a7>AOP@Work: AOP 和元数据：完美的匹配，第 1 部分</FONT></B></A><BR>在这篇由两个部分组成的系列文章的第 1 部分中，作者 Ramnivas Laddad 将对新的元数据功能进行概念性介绍，并展示在加入了元数据注释后，AOP 可以在什么地方获得最大的好处。然后他将分五步完成一个设计改造，从一个无元数据的 AOP 实现开始，最终得到一个结合了 Participant 设计模式与注释者-供应者（annotator-supplier）方面的 AOP。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年3月28日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork2/index.html"><B><FONT color=#5c81a7>AOP@Work: AOP 工具比较，第 2 部分</FONT></B></A><BR>在这个由两部分构成的 AOP 工具比较的第 2 部分中，面向方面专家 Mik Kersten 将把重点放在工具与开发环境的集成以及构建过程上，包括对 AOP 工具 IDE 特性的逐点比较。为了帮助制定最终决策，在进行总结的时候，作者将介绍这些快速发展的工具近期的发展情况，并提供每种工具优缺点的总结。注意，本文将解释最近宣布的 AspectJ 和 AspectWerkz 项目合并的意义。</TD>
<TD>&nbsp;</TD>
<TD width=100></TD>
<TD>&nbsp;</TD>
<TD width=150>2005年3月7日</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD colSpan=6>&nbsp;</TD></TR>
<TR vAlign=top>
<TD width="100%"><A href="http://www.ibm.com/developerworks/cn/java/j-aopwork1/index.html"><B><FONT color=#5c81a7>AOP@Work: AOP 工具比较，第 1 部分</FONT></B></A><BR>AOP 技术的时代已经来临，但是怎样才能为项目选择正确的工具呢？在新推出的 <B>AOP@Work</B> 系列的第一篇文章中，面向方面（aspect-oriented）的编程专家 Mik Kersten 将比较 4 个领先的 AOP 工具（AspectJ、AspectWerkz、JBoss AOP 和 Spring AOP），帮助大家判断应该选择哪一个工具。本文由两个部分组成，在文中，作者将重点介绍这些工具的语言机制和不同技术的优劣。</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></P>]]></description>
</item><item>
<title><![CDATA[Relo]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=20621</link>
<author>sixsun</author>
<pubDate>2006/12/9 12:31:33</pubDate>
<description><![CDATA[
<P><FONT size=2>Relo(<A href="http://relo.csail.mit.edu/">http://relo.csail.mit.edu/</A>)是一个帮助开发人员分析代码的工具，能够一步步的跟踪你所展开的代码包，并快速生成类似UML的类图。就是关系太复杂的时候线条一大堆.需要自己托拽图形来布局.</FONT></P>
<P><FONT size=2>这是apache commons-configuration-1.3-src中Configuration接口展开后的部分图示.</FONT></P>
<P><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://blogger.org.cn/blog/uploadfile/2006129123611223.PNG" border=0></P>
<P><SPAN class=style7><FONT size=2></FONT></SPAN>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[诊断 Java 代码]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=20535</link>
<author>sixsun</author>
<pubDate>2006/12/6 13:39:12</pubDate>
<description><![CDATA[<P>原文:<A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/index.html#author1"><NAME>Eric Allen</NAME></A>&nbsp;<A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/index.html">http://www-128.ibm.com/developerworks/cn/java/j-diag/index.html</A><BR>好像此连载还出了一本书&lt;java Bug 模式&gt;</P>
<P>===================================</P>
<P>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD><SPAN class=atitle>诊断 Java 代码</SPAN></TD>
<TD width=8><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=8 border=0></TD>
<TD align=right width=180><NOBR>
<TABLE cellSpacing=0 cellPadding=0>
<TBODY>
<TR vAlign=top>
<TD align=right></TD>
<TD width=46><A href="javascript:void newWindow()"><IMG height=26 alt="e-mail it!" src="http://www-128.ibm.com/developerworks/cn/i/icon-email.gif" width=46 border=0></A></TD></TR></TBODY></TABLE></NOBR></TD>
<TD width=6><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=6 border=0></TD></TR>
<TR vAlign=top>
<TD bgColor=#000000 colSpan=5><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=100 border=0></TD></TR>
<TR vAlign=top>
<TD bgColor=#ffffff colSpan=5><IMG height=8 alt="" src="http://www.ibm.com/i/c.gif" width=100 border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD width=5><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=5 border=0></TD>
<TD width="100%">
<TABLE cellSpacing=0 cellPadding=0 width=168 align=right border=0>
<TBODY>
<TR>
<TD width=8><IMG height=21 alt="" src="http://www.ibm.com/i/c.gif" width=5></TD>
<TD width=160>
<TABLE cellSpacing=0 cellPadding=0 width=160 border=0>
<TBODY>
<TR>
<TD width=160 bgColor=#000000 height=1><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR>
<TR>
<TD align=middle background=/developerworks/cn/i/bg-gold.gif height=5><B>订阅:</B></TD></TR>
<TR>
<TD width=160 bgColor=#666666 height=1><IMG height=1 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=1 width=160 border=0>
<TBODY>
<TR>
<TD><A href="http://www-128.ibm.com/developerworks/cn/newsletter/">developerWorks 时事通讯</A></TD></TR>
<TR>
<TD height=1><IMG height=5 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR>
<TR>
<TD height=1><IMG height=5 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=160 border=0>
<TBODY>
<TR>
<TD width=150 bgColor=#000000 colSpan=2 height=2><IMG height=2 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR>
<TR>
<TD width=150 bgColor=#ffffff colSpan=2 height=2><IMG height=2 alt="" src="http://www.ibm.com/i/c.gif" width=160></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<P><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/index.html#author1"><NAME>Eric Allen</NAME></A><BR>博士研究生, Rice 大学 Java 编程语言小组，Cycorp, Inc.<BR>2001 年 2 月 </P>
<BLOCKQUOTE>欢迎访问诊断 Java 代码，这里是隔周更新的 developerWorks Java 技术专区，讨论您日常编程工作的 Java 解决方案。所有论文，包括第一篇，都可以在这里找到</BLOCKQUOTE>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part1/index.html">错误模式：简介</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 2 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">首篇介绍了错误模式的一些概念，这对于提高您发现和纠正代码中错误的能力很有帮助。您将了解一个最常见的错误模式，它是您开始识别和避免更复杂错误模式的基础。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part2/index.html">Dangling Composite 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 3 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在 Java 编程中，最常见（也是被抱怨最多）的重复错误之一是无效指针异常。捕捉到其中一个错误的产生原因，真的会让您对您当初的择业决定产生怀疑。在诊断 Java 代码的这部分中，我们通过把和无效指针异常联系在一起的最常见的一个类型编成目录，来继续我们的错误模式检查，并一步步分析一个含有无效指针异常的类的示例。然后我们回顾了几种能帮您减少这种类型错误的编程技巧。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part3/index.html">Null Flag 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 3 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">为开发健壮的程序，我们用异常情况来替代空指针，但这却把控制流限制在方法调用和返回的普通方式，同时也掩盖了异常情况在那里发生的迹象。Eric Allen 在本栏中展示了这种错误模式（他称之为 Null Flag 错误模式）怎样产生不可预料的结果，而且调试起来也非常困难。与我们讨论过的其他错误模式一样，你可以应用某种编程技巧来减少这种类型错误的发生。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part4/index.html">Double Descent 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 4 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">类型转换错误信息通常表明在递归下行一个复合数据结构时出现概念性错误，虽然它通常比其它错误更易调试，但也具有更多隐蔽的错误行为。在诊断 Java 代码的这部份中，Eric Allen 讨论了程序员该到哪里查找此模式的错误，如何识别它，以及为了减少它的出现，程序员能做些什么。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part5/index.html">Liar View 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 4 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">GUI 一般是基于模型-视图-控制器体系结构设计的。其中，视图是从模型中分离出来的。这种分离对自动测试是一个挑战，因为我们很难确认模型中的状态改变是否在视图中得到了相应的反映，这样就产生了臭名昭著的 Liar View。诊断 Java 代码的这部分讨论的就是 Liar View 错误模式。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part6/index.html">Saboteur Data 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 5 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">当一个程序由于数据毁坏而崩溃时，要找到原因是很难的。即使一个程序很好地运行了很长一段时间，它还是经常可能在处理内部数据的过程中彻底崩溃。本文讨论的就是导致这种崩溃的错误模式，它为什么存在以及在发生之前或之后清除它的几种方法。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part7/index.html">Broken Dispatch 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 5 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在象 Java 语言这样的面向对象的语言中，方法是可重载和可覆盖的，即便在中等复杂程度的程序中，方法调度也会给代码管理带来困难。在本周的诊断 Java 代码中，Eric Allen 讨论了由这些困难导致的错误模式，概述了由于参数不匹配导致的错误方法调用的征兆，同时给出了应对这个问题的一些办法。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part8/index.html">提高 Java 代码的性能</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 5 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">很多算法用尾递归方法表示会显得格外简明。编译器会自动把这种方法转换成循环，以提高程序的性能。但在 Java 语言规范中，并没有要求一定要作这种转换，因此，并不是所有的 Java 虚拟机（JVM）都会做这种转换。这就意味着在 Java 语言中采用尾递归方法将导致巨大的内存占用，而这并不是我们期望的结果。Eric Allen 在本文中阐述了动态编译将会保持语言的语义，而静态编译则通常不会。他说明了为什么这是一个重要问题，并提供了一段代码来帮助您判断即时（JIT）编译器是否会在保持语言语义的同时做尾递归的代码转换。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part9/index.html">用记录器对方法调用的正确性作测试</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 6 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">用 JUnit 进行单元测试是确保您的代码库完整性的有效手段，但要对一些您想查验的不变量作单元测试则需要更高的技巧。在诊断 Java 代码的这部分中，Eric Allen 讨论了写一个单元测试的方法，以确保一系列方法调用按正确的顺序出现。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part10/index.html">Imposter Type 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">当在字段中用特定的标记来区别对象的类型时，如果关联的数据被标记标错了，就可能会产生错误 — 这就被称为 Imposter Type 错误模式。在诊断 Java 代码的这部分中，Eric Allen 诊察了这种错误的征兆及原因，详细说明了防止这种错误的方法，并讨论了一种试探性的混合实现：它虽不使用 imposter type，但最终还是有许多相同的弱点。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part11/index.html">Split Cleaner 错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">Java 编程语言的特色之一是存储自动管理，它把程序员从使用内存后忘记释放它的错误中解放出来。尽管如此，许多程序还是得处理资源问题，例如文件及数据库连接，这些都必须在使用之后显式地释放掉。跟手工管理存储一样，程序员在手工管理资源时也会犯很多错误。其中一个就是本周要讨论的话题 — Split Cleaner 错误模式。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part12/index.html">Fictitious Implementation 错误模式，第 1 部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">Java 语言避免了很多支持多继承的语言所特有的问题 — 部分是因为它把对接口不变量的规定限制在类型说明上。但这个限制结合糟糕的说明文档会产生问题：如果对接口如何实现做了错误的假定，那在运行时会碰到令人沮丧的错误。本文（第 1 部分，共 2 部分）概述了会导致这类错误的编程习惯及避免的办法。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part13/index.html">Fictitious Implementation 错误模式，第 2 部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">这个两部分系列的第二篇文章演示了两个解决这种虚假的实现错误的方便的工具。Eric Allen 向您显示了如何使用断言和单元测试作为可执行文档，使您的代码更安全，可移植性更强。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part14/index.html">孤线程（Orphaned Thread）错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 11 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在多线程代码中，使用驱动其它线程所负责的动作的单个主线程是常见的。这个主线程发送消息，通常是通过把它们放到一个队列中，然后其它线程处理这些消息。但是如果主线程抛出一个异常，那么剩余的线程会继续运行，等待更多输入到该队列，导致程序冻结。在诊断 Java 代码的这一部分中，专职 Java 开发者兼兼职捉虫者 Eric Allen 讨论检测、修复和避免这一错误模式。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part15/index.html">设计可测试的应用程序</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 11 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在诊断 Java 代码的这一部分中，Eric Allen 暂停了对具体错误模式的讨论，转而选择讨论关于设计易于、甚至我们乐于测试的软件的问题。他概述了七条设计原则，这些原则能大幅提高您编写测试代码的效率并因此提高结果代码库的健壮性。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part16/index.html">设计可扩展的应用程序，第一部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 12 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在诊断 Java 代码的这个部分和即将到来的几个部分中，Eric Allen 将他的讨论集中在判断一个新系统应该有多大的可扩展性、什么时候应用可扩展性是最佳的以及可扩展性与其它因素（特别是可测试性）的关系如何。在这第一篇文章中，他研究了能使一个软件系统具有可扩展性的各种方法以及每种形式的可扩展性各在什么样的环境中最有用。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part17/index.html">设计可扩展的应用程序，第二部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2001 年 12 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">玻璃箱可扩展性是指这样一种方式：在可以查看源代码而不可以修改它的情况下即可扩展一个软件系统 — 它是黑箱设计（在这里构建扩展时不查看原始代码）和白箱（扩展代码直接写入基础代码）设计的间的折衷办法。在这篇文章中，Eric Allen 详述了玻璃箱可扩展性主题并提供了一些关于如何实现它的提示。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part18/index.html">设计可扩展的应用程序，第三部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 2 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">Eric Allen 讨论了何时设计黑盒可扩展性的系统是有意义的，并提供了如何有效地实现这一设计的一些想法。阅读了本文后，您将知道何时使用黑盒并掌握如何实现它的一些技巧。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part19/index.html">设计可扩展的应用程序，第四部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 2 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在本文（“诊断 Java 代码”系列文章之一）中，作者 Eric Allen 展示了 S-expression — 由圆括号分隔的元素列表的语法表示法 — 如何用于提供实用的、轻量型黑箱可扩展性。使用 S-expression 的优势会在一个特定示例的上下文中讨论。作者还详述了 S-expression 的局限性，并提到了什么时候它们可能不是最适合应用程序的。阅读完本文之后，您将了解何时使用 S-expression 创建黑箱可扩展性。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part20/index.html">深度优先访问器和中断的分派</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 3 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在诊断 Java 代码的这一部分中，Eric Allen 讨论了如何通过使用深度优先访问器（Visitor 模式上的一个变体）使增加代码的简洁性成为可能。他描述了它的技术，讨论了它的优点和“错误（gotchas）”，警告读者有关与其使用相关的错误模式，并在特定示例的环境中说明了深度优先访问器。 读完本文后，您将了解如何使用深度优先访问器来获得编码优势，并了解使用这一技术的缺陷。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part21/index.html">在规范钢丝上行走</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 4 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">程序规范是任何软件项目中既关键又费时的一个部分。在诊断 Java 代码的这一部分中，作者 Eric Allen 将讨论为什么良好定义的规范对您的代码是必需的，并研究了传统软件工程方法以及极端编程方法，还比较了两者的优缺点。Eric 还讨论了您不希望定义程序规范的方法，并解释了原因。读完本文之后，您将理解如何衡量维护精确的设计规范的成本和收益。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part22/index.html">Repl 提供交互式评价</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 4 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">通常，在运行 Java 程序时，必须使用 String[] 输入参数将参数传入，从 main() 方法运行程序。但是如果程序仍在调试中，那么，这可能会成为一项繁重的任务。本月，Eric Allen 讨论对程序中的表达式和语句进行交互式评价的优点，并且提供几个帮助您处理这一任务的 Java repl（“read-eval-print-loop”工具，“读取-评价-打印-循环”工具）。他还讨论交互式评价如何帮助构建 GUI 和探索新的 API。阅读本文后，您将理解在预调试（pre-debugged）程序中交互地诊断小错误的做法及原因，您将能够使用一些 Java 工具来方便您的工作。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part23/index.html">连续初始化器错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">您经常会看到代码不是仅仅通过调用构造函数对类进行初始化，它还通过一些紧接着的意在设置各个域的动作对类进行初始化。不幸的是，这样紧接着的动作是错误的高发地带，会带来连续初始化（run-on initialization）类型的错误。在诊断 Java 代码的这一部分中，Eric Allen 探讨了连续初始化器（Run-on Initializer）错误，讨论了为什么要避免以及如何避免它，并演示了如何将它可能带来的损失降到最低。请单击本文顶部或底部的讨论在讨论论坛与作者和其他读者交流本文的心得。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag0521/index.html">平台相关性“gotcha 问题”</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 8月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">一次编写，随处运行。这是承诺，但 Java 语言有时候并不能做到。诚然，JVM 把跨平台互操作性的程度提到了前所未有的高度，然而，规范和实现级别上的一些小毛病却使得程序无法在多平台上表现出正确的行为。在本文中，Eric Allen 讨论了 Java 编程中要留意的一些与平台相关的方面，如尾递归调用以及内建的供应商、版本和操作系统相关性。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag/part25/index.html">拥护静态类型的理由”</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 9月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">许多流行语言 — 例如 Ruby、Python 和其它所谓的“脚本编制”语言 — 已不再把静态类型检查作为提高代码的可靠性的一种手段。尽管如此，静态类型检查仍是防止引入错误和进行错误检测的强大武器库中的重要武器之一。在本文中，Eric Allen 陈述拥护静态类型检查的理由，解释为什么我们要为 Java 语言支持它而高兴，讨论怎样改进它。请通过单击文章顶部或底部的讨论来参加本文的讨论论坛，与作者和其他读者交流本文的心得。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag0723/index.html">Java 编程中的断言和时态逻辑</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 9月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">虽然传统断言可以增加对 Java 代码执行的检查次数，但有许多检查不能用它们来执行。弥补这一缺陷的方法是使用“时态逻辑”，它是一种用于描述程序状态如何随时间而更改的形式体系。在本文中，Eric Allen 将讨论断言，介绍时态逻辑并描述用于处理程序中时态逻辑断言的工具（下一篇文章将检查以前的错误模式和时态逻辑的应用程序）。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag0827/index.html">将时态逻辑用于错误模式</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2002 年 11月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">时态逻辑（temporal logic）是一种用来描述程序状态如何随时间而更改的形式体系。本文是 Eric Allen 关于时态逻辑和断言的第二篇专栏文章，他讨论了如何通过使用时态逻辑断言防止几种最常见的错误模式。请单击文章顶部或底部的讨论参与本文的论坛，与作者和其他读者分享您关于本文的想法。。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag1015/index.html">单元测试与自动化代码分析协同工作</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 1月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">单元测试和静态分析通常被看作是有助于确保程序的正确性的互不相干的方法。本文研究了这两种方法之间的关系，并讨论了构成每种方法工作构架的工具如何相得益彰。特别地，Eric Allen 讨论了一些可用而又令人兴奋的新应用程序，这些应用程序允许您进一步提升您的单元测试。请单击文章顶部或底部的“讨论”参与本文的论坛，与作者和其它读者分享您的想法。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag1105/index.html">消除包间的耦合关联</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 3月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在测试程序时，如何应付模拟外部资源和库连接这一艰巨任务？基于组件的编程和去耦包相关性可以解决这个问题。基于组件的软件开发作为促进代码的一种手段而经常受到人们赞誉，另外它还有助于生成可测试代码。Eric Allen 用一些 Jiazzi（一种使用 Java 语言进行基于组件编程的功能强大的自由工具）示例展示了这种编程概念。可以通过论坛提出您对本文的想法，以飨笔者和其他读者。（您也可以单击本文顶部或底部的“讨论”参加论坛。）。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-diag1203/index.html">“杀手组合”— mixin、Jam 和单元测试</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 3月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">在 Java 语言中获得单继承编程的安全性需要付出极大的代价：有时必须沿着继承层次结构中的多条路径复制代码。要重新获得单继承 Java 代码中所失去的大多数表示，我们可以将 mixin 集成为一个扩展。本月，Eric Allen 解释了 mixin（那些由它们的父类参数化的类）的概念，以及它们如何能协助单元测试。他还描述了基于 mixin 编程的工具，并讨论了将 mixin 添加到您的 Java 代码中的可能方法。在本文的论坛中与作者及其他读者分享您对本文的看法。（也可以单击本文顶部或底部的讨论访问该论坛。）。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-djc02113/">轻松掌握 Java 泛型</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 5 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">本月的诊断 Java 代码介绍泛型类型（generic type）和支持它们的特性，计划在 2003 年末发布的 Tiger，也就是 Java V1.5 中打算包含这些泛型和特性。Eric Allen 提供了代码样本，这些样本通过重点描述诸如基本类型的限制、受限泛型和多态方法之类的 Tiger 特性来说明泛型类型的优缺点（即将发表的专栏文章将讨论其它特性，比如 Tiger 中泛型类型的特定表现以及可能扩展为 Tiger 之外的泛型类型）。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-djc03113/">轻松掌握 Java 泛型类型，第 2 部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 5 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">这个月，Eric Allen 继续讨论 JSR-14 和 Tiger 中的泛型类型（generic type）。他概括了在这些 Java 扩展中强制实施的几个限制，并说明这些扩展语言的编译器所使用的实现策略如何使这些限制必然存在。请在与本文一起提供的论坛中与作者和其他读者分享您对本文的心得。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-djc04093/">轻松掌握 Java 泛型，第 3 部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 6 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">Java 开发人员和研究人员 Eric Allen 继续讨论 JSR-14 和 Tiger 中的泛型类型，研究在泛型类型中添加对裸（naked）类型参数的 new 操作的支持所带来的问题。 </P>
<P><B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/"><A href="http://www-128.ibm.com/developerworks/cn/java/j-djc05133/">轻松掌握 Java 泛型，第 4 部分</A> </B><BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">2003 年 7 月 <BR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">Java 开发人员和研究人员 Eric Allen 讨论了通过泛型类型添加对 mixin 支持所带来的影响，并以此文来结束他对 JSR-14 和 Tiger 中泛型类型的由四部分组成的系列的讨论。在相关论坛中与作者及其他读者分享您对本文的看法。 </P>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><A name=author1></A><SPAN class=atitle2>关于作者</SPAN><BR>Eric Allen 毕业于 Cornell 大学，获得计算机科学和数学的学士学位。他是 <I xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">JavaWorld</I>上 Java 初学者论坛的主持人，也是 Rice 大学 Java 编程语言小组的博士研究生。他的研究涉及在源程序和字节码层次方面的正式语义模型和静态分析工具。目前，他正在为 NextGen 编程语言（泛型运行时类型的 Java 语言扩展）实现一个源程序到字节码的编译器。可通过 <A href="mailto:eallen@cs.rice.edu" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerworks/">eallen@cs.rice.edu</A>与 Eric 联系. </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></P>]]></description>
</item><item>
<title><![CDATA[重构：改善既有代码的设计]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=sixsun&amp;id=19206</link>
<author>sixsun</author>
<pubDate>2006/10/18 9:43:23</pubDate>
<description><![CDATA[<IFRAME src="http://www.china-pub.com/computers/common/Catalog.asp?IDD=12901&type=9" frameBorder=0 width="100%" height=650></IFRAME>]]></description>
</item>
</channel>
</rss>