You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/03/26 22:53:54 UTC
svn commit: r928068 - in /pivot/trunk/tutorials/www:
platform_overview/wtk_classes-large.png
platform_overview/wtk_classes-small.png wtkx-primer.xml
Author: gbrown
Date: Fri Mar 26 21:53:54 2010
New Revision: 928068
URL: http://svn.apache.org/viewvc?rev=928068&view=rev
Log:
Add SuggestionPopup to class diagram; add Bindable to WTKX Primer.
Modified:
pivot/trunk/tutorials/www/platform_overview/wtk_classes-large.png
pivot/trunk/tutorials/www/platform_overview/wtk_classes-small.png
pivot/trunk/tutorials/www/wtkx-primer.xml
Modified: pivot/trunk/tutorials/www/platform_overview/wtk_classes-large.png
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/platform_overview/wtk_classes-large.png?rev=928068&r1=928067&r2=928068&view=diff
==============================================================================
Binary files - no diff available.
Modified: pivot/trunk/tutorials/www/platform_overview/wtk_classes-small.png
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/platform_overview/wtk_classes-small.png?rev=928068&r1=928067&r2=928068&view=diff
==============================================================================
Binary files - no diff available.
Modified: pivot/trunk/tutorials/www/wtkx-primer.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/wtkx-primer.xml?rev=928068&r1=928067&r2=928068&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/wtkx-primer.xml (original)
+++ pivot/trunk/tutorials/www/wtkx-primer.xml Fri Mar 26 21:53:54 2010
@@ -856,11 +856,24 @@ limitations under the License.
<p>
The <tt>org.apache.pivot.wtkx</tt> package includes an annotation that can be used to
simplify the process of mapping named objects into a Java application. The
- <tt>@WTKX</tt> annotation can be used to tag a member variable such that it will be
- automatically mapped to a named object in a WTKX file. The <tt>bind()</tt> method of
- <tt>WTKXSerializer</tt> is used to perform the actual mapping.
+ <tt>@WTKX</tt> annotation is used to tag a member variable so that it will be
+ automatically mapped to a named object in a WTKX file.
</p>
-
+
+ <p>
+ The <tt>bind()</tt> method of <tt>WTKXSerializer</tt> is used to perform the actual
+ mapping. However, it is often easier to use the <tt>Bindable</tt> interface.
+ Implementing this interface ensures that <tt>bind()</tt> will be automatically called
+ on the implementing class by the WTKX serializer.
+ </p>
+
+ <p>
+ <tt>Bindable</tt> defines a single method, <tt>initialize()</tt>, that is called when
+ the root element of a WTKX file has been fully loaded and the bound values have been
+ processed. This allows the bound class to perform any required initialization (often
+ event registration on the bound members).
+ </p>
+
<p>
For example, given the following WTKX:
</p>
@@ -878,8 +891,7 @@ limitations under the License.
<p>
a Java member variable declared as follows will be automatically populated with the
- declared <tt>Label</tt> instance when the <tt>WTKXSerializer#bind()</tt> method is
- called on an instance of the declaring class:
+ declared <tt>Label</tt> instance when the declaring class is bound:
</p>
<source type="java">
@@ -890,9 +902,9 @@ limitations under the License.
<p>
As a result, the <tt>@WTKX</tt> annotation can significanly simplify the process of
- working with loaded WTKX data in Java code. However, because it relies on reflection to
- set the member variables, it can only be used with trusted code, or to set public
- fields.
+ working with loaded WTKX data in Java code. However, it is important to note that,
+ because WTKX binding relies on reflection to set the member variables, it can only be
+ used with trusted code or to set the values of public fields.
</p>
<h2>Summary</h2>