<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UKoom &#187; GWT</title>
	<atom:link href="http://www.ukoom.com/tag/gwt/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ukoom.com</link>
	<description>Documentum, SharePoint, Alfresco, ECM...</description>
	<lastBuildDate>Tue, 25 Oct 2011 15:11:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>$wnd and $doc Calling native JavaScript with JSNI</title>
		<link>http://www.ukoom.com/wnd-and-doc-calling-native-javascript-with-jsni.htm</link>
		<comments>http://www.ukoom.com/wnd-and-doc-calling-native-javascript-with-jsni.htm#comments</comments>
		<pubDate>Tue, 15 Dec 2009 02:18:07 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=964</guid>
		<description><![CDATA[$wnd 是什么？
GWT provides the $wnd and $doc variables to refer to the window and document objects
GWT使用通过Java Native method使用它，声明一个native方法，将含有JavaScript的方法体注释。编译器将注释块内的内容逐字输出，使之与编译产生的JavaScript整合到一起。]]></description>
			<content:encoded><![CDATA[<p>$wnd and $doc Calling native JavaScript with JSNI</p>
<p>$wnd 是什么？</p>
<p>GWT provides the $wnd and $doc variables to refer to the window and document objects</p>
<p>GWT使用通过Java Native method使用它，声明一个native方法，将含有JavaScript的方法体注释。编译器将注释块内的内容逐字输出，使之与编译产生的JavaScript整合到一起。</p>
<p>Java调用JavaScript方法：</p>
<p>JSNI方法定义需要使用native关键字，并且需要在参数列表之后，结尾的分号之前定义。JSNI方法的开始使用 /*-{ , 结尾使用}-*/,例如：</p>
<p>public static native void alert(String msg) /*-{</p>
<p>         $wnd.alert(msg);</p>
<p>}-*/;</p>
<p>这是gwt  Window 类中的源码&#8211;一个标准的jsni 方法, 我们可以看到,方法实现就是一行简单的javascript 代码. (这里没有用 alert 或者 window.alert 的原因是: gwt 代码运行在一个iframe中,如果直接用alert或者window.alert,引用的是iframe文档,而不是host page 文档). 经过这个方法包装,以后在gwt程序中使用 &#8221; Window.alert&#8221;  实际上就是调用了javascript 的 alert 方法,当然你也可以不用这个封装, 直接实用 $wnd.alert .</p>
<p>当上述方法在Java中调用的时候，实际上将调用Window的alert()方法，将传入的内容打印出来。在Hosted Mode下，断点可以调协在上述方法中，可以查看传入的参数。</p>
<p>参考如下：</p>
<p><a href="http://www.javaeye.com/topic/365678">http://www.javaeye.com/topic/365678</a></p>
<p><a href="http://www.webreference.com/programming/java/toolkits/">http://www.webreference.com/programming/java/toolkits/</a></p>
<p>The GWT makes ingenious use of Java&#8217;s native methods with something called the JavaScript Native Interface. You declare native methods with commented-out bodies that contain JavaScript. When those native methods are compiled, the GWT incorporates the commented JavaScript. Here&#8217;s an example of such a native method:</p>
<p>Calling native JavaScript with JSNI</p>
<p><a href="http://www.ibm.com/developerworks/java/library/j-ajax4/">http://www.ibm.com/developerworks/java/library/j-ajax4/</a></p>
<p>Visual-effects libraries are becoming increasingly popular in Web application development, whether their effects are used to provide subtle user-interaction cues or just to add polish. I&#8217;d like to add some eye-candy to the Weather Reporter application. GWT doesn&#8217;t provide this type of functionality, but its JavaScript Native Interface (JSNI) offers a solution. JSNI lets you make JavaScript calls directly from GWT client Java code. This means that I can exploit effects from the Scriptaculous library (see Resources) or from the Yahoo! User Interface library, for example.</p>
<p>JSNI uses a cunning combination of the Java language&#8217;s native keyword and JavaScript embedded in a special comment block. It&#8217;s probably best explained by example, so Listing 10 shows a method that invokes a given Scriptaculous effect on an Element:</p>
<p>Listing 10. Invoking Scriptaculous effects with JSNI</p>
<p> private native void applyEffect(Element element, String effectName) /*-{</p>
<p>   // Trigger named Scriptaculous effect<br />
   $wnd.Effect[effectName](element);<br />
}-*/;</p>
<p>This is perfectly valid Java code because the compiler sees only private native void applyEffect(Element element, String effectName);. GWT parses the contents of the comment block and outputs the JavaScript verbatim. GWT provides the $wnd and $doc variables to refer to the window and document objects. In this case, I&#8217;m simply accessing the top-level Scriptaculous Effect object and using JavaScript&#8217;s square-bracket object-accessor syntax to invoke the named function specified by the caller. The Element type is a &#8220;magic&#8221; type provided by GWT that represents a Widget&#8217;s underlying HTML DOM element in both Java and JavaScript code. Strings are one of the few other types that can be passed transparently between Java code and JavaScript via JSNI.</p>
<p>Now I have a weather report that fades in nicely when the data is returned from the server. The final touch is to re-enable the ZIP code TextBox when the effect has finished. Scriptaculous uses an asynchronous callback mechanism to notify listeners about the life cycle of effects. This is where things get a little more complex because I need to have JavaScript call back into my GWT client Java code. In JavaScript, you can invoke any function with an arbitrary number of arguments, so Java-style method overloading doesn&#8217;t exist. This means that JSNI needs to use an unwieldy syntax to refer to Java methods to disambiguate possible overloads. The GWT documentation states this syntax as:</p>
<p>[instance-expr.]@class-name::method-name(param-signature)(arguments)<br />
 <br />
The instance-expr. part is optional because static methods are invoked without the need for an object reference.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/wnd-and-doc-calling-native-javascript-with-jsni.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart GWT FAQ</title>
		<link>http://www.ukoom.com/smart-gwt-faq.htm</link>
		<comments>http://www.ukoom.com/smart-gwt-faq.htm#comments</comments>
		<pubDate>Wed, 25 Nov 2009 06:49:10 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Web MVC]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=821</guid>
		<description><![CDATA[http://forums.smartclient.com/showthread.php?t=8159 Client Coding Can I mix Smart GWT and GWT widgets? Yes, with caveats. Smart GWT has interoperability support that allows a Smart GWT widget to be added to a GWT container and allows a GWT widget to be added to a Smart GWT container, and it&#8217;s appropriate to use this for: incremental migration to [...]]]></description>
			<content:encoded><![CDATA[<p>http://forums.smartclient.com/showthread.php?t=8159</p>
<p><strong>Client Coding</strong></p>
<ul>
<li><strong><a name="aMix">Can I mix Smart GWT and GWT widgets?</a></strong>
<p>Yes, with caveats.</p>
<p>Smart GWT has interoperability support that allows a Smart GWT widget to be added to a GWT<br />
container and allows a GWT widget to be added to a Smart GWT container, and it&#8217;s appropriate to<br />
use this for:</p>
<ul>
<li>incremental migration to Smart GWT, such as introducing singular, sophisticated Smart GWT<br />
components like the Calendar or CubeGrid to an existing GWT application</li>
<li>using sophisticated third-party GWT widgets within Smart GWT, where Smart GWT doesn&#8217;t have<br />
corresponding built-in functionality</li>
</ul>
<p>However it does <strong>not</strong> make sense to freely intermix Smart GWT and GWT (or other)<br />
components, that is, for example, you should not place GWT widgets within a Smart GWT container<br />
that is in turn within a GWT container.  In general, don&#8217;t intermix widgets unless the need for<br />
a feature forces you to.</p>
<p>The reason for this is that there are limits to the maximum degree that two Ajax widget kits<br />
(including GWT) can interoperate &#8211; there are no standards that allow interoperability in the<br />
areas of management of tab order, zIndex management, pixel-perfect layout, section 508<br />
accessibility and multi-level modality.</p>
<p>Note that &#8220;bugs&#8221; reported when intermixing GWT and Smart GWT inappropriately (that is, in<br />
contradiction to these guidelines) are generally going to be marked WONTFIX, although we will<br />
revisit this in the future if core GWT begins to support APIs that would allow better<br />
interoperability.</li>
<li><strong><a name="aContainer">How do I make a Smart GWT widget fill a basic HTML container or GWT container?</a></strong>
<p>Because Smart GWT&#8217;s pixel-perfect layout and auto-sizing support goes beyond the capabilities of<br />
simple CSS layout, components need to know the actual pixel width they have been allocated;<br />
they cannot &#8220;flow into&#8221; an HTML element of unspecified size.</p>
<p>The issue here is that GWT&#8217;s containers do not provide an API similar to Smart GWT&#8217;s<br />
Canvas.getInnerWidth(), which in Smart GWT can be used by child components to find out<br />
the available space to draw themselves in, and hence recursively lay out out their own<br />
children. Nor do GWT containers they fire events when they are resized, or when the<br />
available width changes for various reasons (e.g. scrollbar(s) introduced, or CSS style<br />
changes add borders and hence reduce space).</p>
<p>A lot of parent&lt;-&gt;child coordination and signaling is required to really create an extensible<br />
pixel-perfect layout system.  Smart GWT/SmartClient has implemented all the necessary hooks to<br />
allow a third-party widget to be embedded inside a Canvas and participate in a precise layout,<br />
but GWT is not there yet.</p>
<p>If you absolutely must place a Smart GWT interface inside a GWT container and you want it to<br />
fill the container, the best approach is to listen for a window-level resize event and run<br />
your own layout calculations that ultimately call resizeTo() on your topmost Smart GWT<br />
widget.  All Smart GWT widgets nested under that topmost widget will then handle layout normally.</p>
<p>NOTE: Don&#8217;t bother trying to find a way to insert width:100% into Smart GWT&#8217;s rendered HTML,<br />
this won&#8217;t work.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/smart-gwt-faq.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GWT and Documentum</title>
		<link>http://www.ukoom.com/gwt-and-documentum.htm</link>
		<comments>http://www.ukoom.com/gwt-and-documentum.htm#comments</comments>
		<pubDate>Wed, 18 Nov 2009 13:57:49 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Documentum]]></category>
		<category><![CDATA[GWT]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=780</guid>
		<description><![CDATA[Reference: http://stackoverflow.com/questions/952220/gwt-with-a-content-management-system http://developer.emc.com/developer/obt/GWT_DmClient.htm http://code.google.com/p/google-web-toolkit/ http://developerlife.com/tutorials/?p=124 http://onjava.com/pub/a/onjava/2006/05/31/working-with-google-web-toolkit.html?page=1 http://ajaxian.com/by/topic/gwt]]></description>
			<content:encoded><![CDATA[<p>Reference:</p>
<p>http://stackoverflow.com/questions/952220/gwt-with-a-content-management-system</p>
<p>http://developer.emc.com/developer/obt/GWT_DmClient.htm</p>
<p>http://code.google.com/p/google-web-toolkit/</p>
<p>http://developerlife.com/tutorials/?p=124</p>
<p>http://onjava.com/pub/a/onjava/2006/05/31/working-with-google-web-toolkit.html?page=1</p>
<p>http://ajaxian.com/by/topic/gwt</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/gwt-and-documentum.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

