﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-实践-全程-随笔分类-Eclipse-RAP</title><link>http://blogjava.net/leeguannan/category/28897.html</link><description>预测未来的最好办法，就是把它创造出来 --- 阿伦.凯</description><language>zh-cn</language><lastBuildDate>Thu, 27 Mar 2008 12:00:54 GMT</lastBuildDate><pubDate>Thu, 27 Mar 2008 12:00:54 GMT</pubDate><ttl>60</ttl><item><title>RAP再次放入令人振奋的Demo</title><link>http://www.blogjava.net/leeguannan/archive/2008/03/27/188973.html</link><dc:creator>阿南</dc:creator><author>阿南</author><pubDate>Thu, 27 Mar 2008 04:29:00 GMT</pubDate><guid>http://www.blogjava.net/leeguannan/archive/2008/03/27/188973.html</guid><wfw:comment>http://www.blogjava.net/leeguannan/comments/188973.html</wfw:comment><comments>http://www.blogjava.net/leeguannan/archive/2008/03/27/188973.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/leeguannan/comments/commentRss/188973.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/leeguannan/services/trackbacks/188973.html</trackback:ping><description><![CDATA[<p>&#160;&#160;&#160; 此次RAP放出了draw2d_in_RAP的Demo，主要展示的是draw2D在RAP框架上的应用，还没有下载真正的Demo试用，但是从视频上看，好像是融合了flex来做图形展示和拖拽，有兴趣的朋友可以看看Demo的代码，然后告诉我~</p>  <p>&#160;&#160;&#160; 上次e4放出的基于web的IDE就使用flash作为代码展示和编辑的编辑器，看来Eclipse社团也感觉到纯的js基本上不能完成任务了。</p>  <p>Demo下载地址：<a title="http://www.innoopract.com/fileadmin/user_upload/Bilder/Films/draw2d_640x480.mp4" href="http://www.innoopract.com/fileadmin/user_upload/Bilder/Films/draw2d_640x480.mp4">http://www.innoopract.com/fileadmin/user_upload/Bilder/Films/draw2d_640x480.mp4</a></p> <img src ="http://www.blogjava.net/leeguannan/aggbug/188973.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/leeguannan/" target="_blank">阿南</a> 2008-03-27 12:29 <a href="http://www.blogjava.net/leeguannan/archive/2008/03/27/188973.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RAP官方老窝</title><link>http://www.blogjava.net/leeguannan/archive/2008/01/13/175002.html</link><dc:creator>阿南</dc:creator><author>阿南</author><pubDate>Sun, 13 Jan 2008 10:11:00 GMT</pubDate><guid>http://www.blogjava.net/leeguannan/archive/2008/01/13/175002.html</guid><wfw:comment>http://www.blogjava.net/leeguannan/comments/175002.html</wfw:comment><comments>http://www.blogjava.net/leeguannan/archive/2008/01/13/175002.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/leeguannan/comments/commentRss/175002.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/leeguannan/services/trackbacks/175002.html</trackback:ping><description><![CDATA[<p>有朋友在blog中给我留言，说找到RAP的官方地址，现在我就在此公布一下，有兴趣的朋友可以去看看Demo。</p> <p>官方首页</p> <p><a title="http://www.eclipse.org/rap/" href="http://www.eclipse.org/rap/">http://www.eclipse.org/rap/</a></p> <p>Demo地址</p> <p><a title="http://www.eclipse.org/rap/demos.php" href="http://www.eclipse.org/rap/demos.php">http://www.eclipse.org/rap/demos.php</a>&nbsp;&nbsp; 此页面提供3个Demo，其中的SWT的官方Demo的RAP实现在RAP的发行包中，自己下载下来，自己RUN起来就能看到了；</p> <p>&nbsp;</p> <p>RAP开发领头公司</p> <li><a href="http://innoopract.com">Innoopract</a>&nbsp;&nbsp; 从开发人员列表和官方网站的支持力度上，此公司最强！（好像是家德国公司！） <li><a href="http://oneandone.com">1&amp;1</a> <li><a href="http://www.cas.de/English/Home.asp">CAS</a></li><img src ="http://www.blogjava.net/leeguannan/aggbug/175002.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/leeguannan/" target="_blank">阿南</a> 2008-01-13 18:11 <a href="http://www.blogjava.net/leeguannan/archive/2008/01/13/175002.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一段来自ews.eclipse.technology.rap的关于Upload a file的代码</title><link>http://www.blogjava.net/leeguannan/archive/2008/01/11/174597.html</link><dc:creator>阿南</dc:creator><author>阿南</author><pubDate>Fri, 11 Jan 2008 05:17:00 GMT</pubDate><guid>http://www.blogjava.net/leeguannan/archive/2008/01/11/174597.html</guid><wfw:comment>http://www.blogjava.net/leeguannan/comments/174597.html</wfw:comment><comments>http://www.blogjava.net/leeguannan/archive/2008/01/11/174597.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/leeguannan/comments/commentRss/174597.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/leeguannan/services/trackbacks/174597.html</trackback:ping><description><![CDATA[<p><tt>I impleted my File upload/download system with rap internal Browser + servlet.     <br />upload dialog&amp;#65306;</tt></p>  <pre>public class FileUploadDialog extends TitleAreaDialog {
	private Browser browser;</pre>

<pre>	public FileUploadDialog(Shell parentShell) {
		super(parentShell);
	}</pre>

<pre>	/**
	 * Create contents of the dialog
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite area = (Composite) super.createDialogArea(parent);
		Composite container = new Composite(area, SWT.NONE);
		container.setLayout(new FillLayout());
		container.setLayoutData(new GridData(GridData.FILL_BOTH));</pre>

<br /><tt>browser = new Browser(container, SWT.NONE);
  <br />String url = &quot;<a href="http://"+rwt.getrequest/">http://&quot;+RWT.getRequest</a>().getServerName()+&quot;:&quot;+RWT.getRequest().getServerPort()+&quot;/web/fileupload.jsp&quot;;

  <br />String html = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot; ?&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;upload file&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&quot;+

  <br />&quot;&lt;form action=\&quot;&quot;+url+&quot;\&quot; enctype=\&quot;MULTIPART/FORM-DATA\&quot; method=\&quot;post\&quot;&gt;&lt;br /&gt;File Name:&lt;/br&gt;&lt;input type=\&quot;file\&quot;&quot;+

  <br />&quot; name=\&quot;filename\&quot;/&gt;&lt;br&gt;&lt;input type=\&quot;submit\&quot; value=\&quot;upload\&quot;/&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt; &quot;;

  <br />browser.setText(html);

  <br />setMessage(&quot;select a local file&quot;);

  <br />return area;

  <br />}</tt>

<pre>	/**
	 * Return the initial size of the dialog
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(382, 280);
	}</pre>

<pre>	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText(&quot;upload file&quot;);
	}</pre>

<pre>}</pre>

<pre><br />file upload sevlet:</pre>

<pre>public class FileUploadServlet extends HttpServlet {
	private static final long serialVersionUID = -7245361228773015964L;
	private String uploadPath = &quot;/upload/&quot;; // server file repository
	private String tempPath = &quot;/upload/tmp/&quot;; //temp file folder</pre>

<br /><tt>public void doPost(HttpServletRequest request, HttpServletResponse response)
  <br />throws IOException, ServletException {

  <br />try {

  <br />DiskFileUpload fu = new DiskFileUpload();

  <br />// max file size fu.setSizeMax(-1);

  <br />// buffer size

  <br />fu.setSizeThreshold(4096);

  <br />// temp path

  <br />fu.setRepositoryPath(tempPath);</tt>

<pre>			// get all uploa file
			List fileItems = fu.parseRequest(request);
			Iterator i = fileItems.iterator();
			while (i.hasNext()) {
				FileItem fi = (FileItem) i.next();
				// get the upload file name
				String fileName = fi.getName();
				String sep = System.getProperty(&quot;file.separator&quot;);
				int index = fileName.lastIndexOf(sep);
				if(index &gt;-1){
					fileName = fileName.substring(fileName.lastIndexOf(sep));
				}
				fi.write(new File(uploadPath + fileName));
				response.getWriter().println(fileName+&quot;upload success&quot;);
			}
		} catch (Exception e) {
		 //do something?
			e.printStackTrace();
		}
	}
	public void init() throws ServletException {
		if (!new File(uploadPath).isDirectory())
			new File(uploadPath).mkdirs();
		if (!new File(tempPath).isDirectory())
			new File(tempPath).mkdirs();
	}
}</pre>

<pre>registe servlet:</pre>

<pre><br />   public class HttpServiceTracker extends ServiceTracker {</pre>

<pre>       public HttpServiceTracker(BundleContext context) {
           super(context, HttpService.class.getName(), null);
       }</pre>

<br /><tt>public Object addingService(ServiceReference reference) {
  <br />final HttpService httpService = (HttpService) context

  <br />.getService(reference);

  <br />try {

  <br />//regist file upload servlet

  <br />HttpContext commonContext = new BundleEntryHttpContext(context

  <br />.getBundle(), fileFolder);

  <br />httpService.registerResources(fileContext, &quot;/&quot;, commonContext);</tt>

<br /><tt>Servlet adaptedJspServlet = new ContextPathServletAdaptor(
  <br />new FileUploadServlet(),

  <br />fileContext);

  <br />httpService.registerServlet(fileContext + &quot;/fileupload.file&quot;,

  <br />adaptedJspServlet, null, commonContext);</tt>

<pre>           } catch (Exception e) {
               e.printStackTrace();
           }
           return httpService;
       }</pre>

<br /><tt>public void removedService(ServiceReference reference, Object service) {
  <br />final HttpService httpService = (HttpService) service;

  <br />httpService.unregister(fileContext);

  <br />httpService.unregister(fileContext + &quot;/fileupload.jsp&quot;);

  <br />super.removedService(reference, service);

  <br />}

  <br />}</tt>

<pre>start servlet:</pre>

<pre>  add these code to the bundle start up method.
 	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
       httpServiceTracker = new HttpServiceTracker(context);
       httpServiceTracker.open();
       System.out.println(&quot;IM resource servlet started...&quot;);
	}</pre>

<p>&#160;</p>

<p>这个实现是在RAP中使用Browser+servlet实现的文件上传功能；</p>

<p>其实在RAP的cvs上已经放出了org.eclipse.rwt.widgets.upload，专用于上传的组件，测试了一下，效果还不错，有进度条提示；不过在IE6下，有点难看了，在FF3下不能使用；</p><img src ="http://www.blogjava.net/leeguannan/aggbug/174597.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/leeguannan/" target="_blank">阿南</a> 2008-01-11 13:17 <a href="http://www.blogjava.net/leeguannan/archive/2008/01/11/174597.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse-RCP开发者的福音</title><link>http://www.blogjava.net/leeguannan/archive/2008/01/10/174440.html</link><dc:creator>阿南</dc:creator><author>阿南</author><pubDate>Thu, 10 Jan 2008 13:13:00 GMT</pubDate><guid>http://www.blogjava.net/leeguannan/archive/2008/01/10/174440.html</guid><wfw:comment>http://www.blogjava.net/leeguannan/comments/174440.html</wfw:comment><comments>http://www.blogjava.net/leeguannan/archive/2008/01/10/174440.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/leeguannan/comments/commentRss/174440.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/leeguannan/services/trackbacks/174440.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp;&nbsp; Eclipse-RAP项目真的可以算是Eclipse-RCP开发者的福音，一套软件的开发成本，两套软件的特性~对于正在寻求C/S向B/S转移的公司来说，可以算是一个福音了。</p> <p>&nbsp;&nbsp;&nbsp; 公司最近正在做调整，打算将原有7大软件产品，在B/S上重新打造一番~前景很不错，市场价值非常大~我们所关心的并不是市场价值究竟有多大（有上面的大领导撑着，我们不用担心），我们关心的是，如何打破原有的B/S开发模式，让程序员们能高速的开发出需要系统，而且这些系统又能遵守共同的特点，原有的B/S开发模式只可能让程序员原来越不OO了，很有可能陷入JS的陷阱中。</p> <p>&nbsp;&nbsp;&nbsp; 我们把目光转移到了GWT上，他确实可以让JAVA开发人员只专注的写JAVA就可以了，一切都是它的事情了~但是最麻烦的事情，就是速度问题，编译的时候很慢，而且还提出了模块的概念，不好理解，放弃它的另一个最重要的原因是它并不是一个框架，只是一个工具集而已。</p> <p>&nbsp;&nbsp;&nbsp; 然后，我们发现了RAP-Rich Ajax Platform，从它的首页上并看不出什么特别，但是深入Demo，才真的发现别有洞天啊~原来一切来的都是那么简单~~~~它其实就是依照与Eclipse-RCP的基础运行时做了一套自己的基础运行时RAP，换句话说就是原本开发好的RCP项目，可以在仅增加一个扩展点的基础上，平滑的过度到RAP上，立即从一个C/S程序变成了一个B/S程序~真的很令人震惊！今天早上和同事配合，将我们几个月前做的4个插件，用了一早上的时间迁移到RAP上，几乎原有功能完全保留！</p> <p>&nbsp;&nbsp;&nbsp; 如果你也是用RCP做开发的话，建议你可以试试RAP，它会给你一想不到的体验！</p> <p>&nbsp;&nbsp;&nbsp; 需要注意的是，RAP是去年10月份才正式发布的1.0版本，所以还是有很多东西是没有，还是需要一段时间的等待，特别是在1.1发布后，几乎支持所有SWT的特性了~</p> <p>&nbsp;&nbsp;&nbsp; 为了深入的讨论RAP，我已经开放了Eclipse-RAP分类，慢慢会有更多的关于RAP的文章出现，努力丰富一下RAP的中文文档！</p><img src ="http://www.blogjava.net/leeguannan/aggbug/174440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/leeguannan/" target="_blank">阿南</a> 2008-01-10 21:13 <a href="http://www.blogjava.net/leeguannan/archive/2008/01/10/174440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>