Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for 
change notification.

The following page has been changed by DanielJue:
http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock

The comment on the change is:
Just reworded some English, minor changes.

------------------------------------------------------------------------------
  
  We will follow the tutorial available on 
[http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html 
Tapestry 5 BeanEditForm].
  
- Our editor will be functionally equivalent to the Enum editor (a dropdown 
select), but we want to manage a list of value as source of option for the drop 
down list in place of an Enum.
+ Our editor will be functionally equivalent to the Enum editor (a dropdown 
select), but we want to manage a list of values as source of options for the 
drop down list in place of an Enum.
  
  In the following part of this doc, ${Tapestry5 java root} represents the 
tapestry root package (the one configured in your web.xml) and ${Tapestry5 
resources root} represents the matching resources package.
  
  == Process to define a new block editor ==
  
- So, the first thing to define is the object that will represent the list of 
value with a selection.
+ So, the first thing to define is the object that will represent the list of 
values with a selection.
  
- This class is quite simple: it contains a list of available options (Strng) 
and an index that point to the selected value. We put it in a data package, 
apart from Tapestry monitored package.
+ This class is quite simple: it contains a list of available options (String) 
and an index that points to the selected value. We put it in a data package, 
apart from Tapestry monitored package.
  
  When initialized, we just need to change the index to use it.
  
@@ -103, +103 @@

  Now that the global infrastructure is in place, we have to deal with the 
logic of the editor in `AppPropertyEditBlocks.java`.
  Basically, we have two things to deals with:
   * how the parameters are passed to the property editor,
-  * and how we implement a drop-down select component in tapestry.
+  * and how we implement a drop-down select component in Tapestry.
- These concerns are addressed with that code:
+ These concerns are addressed with this code:
  {{{
  @Environmental
  private PropertyEditContext context;
@@ -117, +117 @@

  private Select select;
  }}}
  
- The environmental `PropertyEditContext` is the object "pushed in the context" 
of the block editor by the `BeanEditForm` for each properties of the edited 
bean. It is that object that is used as data source for the editor. So, for us, 
it will be a `DropDownList` object, (for this example, we don't really care own 
the bean editor push and pop it to environment, but you can understand it in 
the 
[http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
 BeanEditForm code], just search for `_environment.push()` / 
`_environment.pop()` ).
+ The environmental `PropertyEditContext` is the object "pushed in the context" 
of the block editor by the `BeanEditForm` for each of the properties of the 
edited bean. It is the object that is used as data source for the editor. So, 
for us, it will be a `DropDownList` object, (for this example, we don't really 
care who owns the bean editor push and pop it to the environment, but you can 
understand it in the 
[http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
 BeanEditForm code], just search for `_environment.push()` / 
`_environment.pop()` ).
  
- A drop-down list is implemented by the 
[http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#org.apache.tapestry.corelib.components.select
 select component] in tapestry 5.
+ A drop-down list is implemented by the 
[http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#org.apache.tapestry.corelib.components.select
 select component] in Tapestry 5.
  This component is built with a '''model''' that is the source of available 
options, a '''value''' that is the bi-directional conduit to get/set the 
selected value, and a '''value encoder''' that translate the value in a 
displayable shape (a String), and reciprocally (String to value type).
  
  So, we let '''validate''', '''label''' and '''clientId''' parameters to what 
the `BeanEditForm` put into the context (that's why these parameters begin by 
'''prop:contex''' ;) and we concentrate to '''value''', '''encoder''' and 
'''model'''.
@@ -174, +174 @@

      /* retrieve the list of options */
      public List<OptionModel> getOptions() { return this.optionModels; }
  
-     /* we have to define what is an option, so we must implement OptionModel 
*/
+     /* we have to define what an option is, so we must implement OptionModel 
*/
      private class ValueOptionModel implements OptionModel {
          [...]
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to