Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5448

Minor Documentation Errors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.12.0
    • None
    • guide
    • None

    Description

      Fixed minor typos and reference errors in chapter 9 and 10.
      svn diff:

      Index: chapter10/chapter10_2.gdoc
      ===================================================================
      — chapter10/chapter10_2.gdoc (revision 1551496)
      +++ chapter10/chapter10_2.gdoc (working copy)
      @@ -112,5 +112,5 @@
      CompoundPropertyModel are particularly useful when used in combination with Wicket forms, as we will see in the next paragraph.

      {note}
      -Model is referred to as static model because the result of its method getObject is fixed an it is not dynamically evaluated each time the method is called. In contrast, models like PropertyModel and CompoundProperty Model are called dynamic models.
      +Model is referred to as static model because the result of its method getObject is fixed and it is not dynamically evaluated each time the method is called. In contrast, models like PropertyModel and CompoundProperty Model are called dynamic models.
      {note}

      \ No newline at end of file
      Index: chapter10/chapter10_4.gdoc
      ===================================================================
      — chapter10/chapter10_4.gdoc (revision 1551496)
      +++ chapter10/chapter10_4.gdoc (working copy)
      @@ -38,7 +38,7 @@
      </select>

       
      -The first option is a placeholder item corresponding to a null model value. By default DropDownChoice cannot have a null value so users are forced to select a not-null option. If we want to change this behavior we can set the nullValid flag to true via the setNullValid method. Please note that the placeholder text (“Chose one”) can be localized, as we will see in chapter 12. The other options are identified by the attribute value. By default the value of this attribute is the index of the single option inside the provided list of choices, while the text displayed to the user is obtained by  calling toString()on the choice object. This default behavior works fine as long as our options are simple objects like strings, but when we move to more complex objects we may need to implement a more sophisticated algorithm to generate the value to use as the option id and the one to display to user. Wicket has solved this problem with @org.apache.wicket.markup.html.form.IChoiceRender@ interface. This interface defines method getDisplayValue(T object) that is called to generate the value to display for the given choice object, and method getIdValue(T object, int index) that is called to generate the option id. The built-in implementation of this interface is class @org.apache.wicket.markup.html.form.ChoiceRenderer@ which renders the two values using property expressions.
      +The first option is a placeholder item corresponding to a null model value. By default DropDownChoice cannot have a null value so users are forced to select a not-null option. If we want to change this behavior we can set the nullValid flag to true via the setNullValid method. Please note that the placeholder text (“Chose one”) can be localized, as we will see in chapter 14. The other options are identified by the attribute value. By default the value of this attribute is the index of the single option inside the provided list of choices, while the text displayed to the user is obtained by  calling toString()on the choice object. This default behavior works fine as long as our options are simple objects like strings, but when we move to more complex objects we may need to implement a more sophisticated algorithm to generate the value to use as the option id and the one to display to user. Wicket has solved this problem with @org.apache.wicket.markup.html.form.IChoiceRender@ interface. This interface defines method getDisplayValue(T object) that is called to generate the value to display for the given choice object, and method getIdValue(T object, int index) that is called to generate the option id. The built-in implementation of this interface is class @org.apache.wicket.markup.html.form.ChoiceRenderer@ which renders the two values using property expressions.
       
       In the following code we want to show a list of Person objects using their full name as value to display and using their passport code as option id: 
       
      @@ -51,4 +51,4 @@
       form.add(new DropDownChoice<String>("persons", new Model<Person>(), persons, personRenderer));
       

      -The choice renderer can be assigned to the DropDownChoice using one of its constructor that accepts this type of parameter (like we did in the example above) or after its creation invoking setChoiceRenderer method.
      \ No newline at end of file
      +The choice renderer can be assigned to the DropDownChoice using one of its constructor that accepts this type of parameter (like we did in the example above) or after its creation invoking setChoiceRenderer method.
      Index: chapter9/chapter9_1.gdoc
      ===================================================================
      — chapter9/chapter9_1.gdoc (revision 1551496)
      +++ chapter9/chapter9_1.gdoc (working copy)
      @@ -59,9 +59,9 @@

      At first glance the URL above could seem a little weird, except for the last part which contains the two named parameters used to build the target page.

      -The reason for this “strange” URL is that, as we explained in paragraph 6.2.5, when a page is instantiated using a constructor with no argument or using a constructor that accepts only a PageParameters, Wicket will try to generate a static URL for it, with no session-relative informations. This kind of URL is called bookmarkable because it can be saved by the users as a bookmark and accessed at a later time.
      +The reason for this “strange” URL is that, as we explained in paragraph 8.3, when a page is instantiated using a constructor with no argument or using a constructor that accepts only a PageParameters, Wicket will try to generate a static URL for it, with no session-relative informations. This kind of URL is called bookmarkable because it can be saved by the users as a bookmark and accessed at a later time.

      -A bookmarkable URL is composed by a fixed prefix (which by default is bookmarkable) and the qualified name of the page class (org.wicketTutorial.PageWithParameters in our example). Segment wicket is another fixed prefix added by default during URL generation. In paragraph 8.6.4 we will see how to customize fixed prefixes with a custom implementation of IMapperContext interface.
      +A bookmarkable URL is composed by a fixed prefix (which by default is bookmarkable) and the qualified name of the page class (org.wicketTutorial.PageWithParameters in our example). Segment wicket is another fixed prefix added by default during URL generation. In paragraph 10.6 we will see how to customize fixed prefixes with a custom implementation of IMapperContext interface.

      Indexed parameters

      Index: chapter9/chapter9_6.gdoc
      ===================================================================
      — chapter9/chapter9_6.gdoc (revision 1551496)
      +++ chapter9/chapter9_6.gdoc (working copy)
      @@ -31,7 +31,7 @@
      }

       
      -Request mappers and the Application's method mount have been introduced in the previous chapter (paragraph 7.3.1).
      +Request mappers and the Application's method mount have been introduced in the previous chapter (paragraph 9.3).
       
       h3. Using parameter placeholders with mounted pages
       
      @@ -144,9 +144,9 @@
       
       h3. Controlling how page parameters are encoded with IPageParametersEncoder
       
      -Some request mappers (like MountedMapper and PackageMapper) can delegate page parameters encoding/decoding to interface @org.apache.wicket.request.mapper.parameter.IPage ParametersEncoder@. This entity exposes two methods: encodePageParameters() and decodePageParameters(): the first  one is invoked to encode page parameters into an URL while the second one extracts parameters from the URL.
      +Some request mappers (like MountedMapper and PackageMapper) can delegate page parameters encoding/decoding to interface @org.apache.wicket.request.mapper.parameter.IPageParametersEncoder@. This entity exposes two methods: encodePageParameters() and decodePageParameters(): the first  one is invoked to encode page parameters into an URL while the second one extracts parameters from the URL.
       
      -Wicket comes with a built-in implementation of this interface which encodes named page parameters as URL segments using the following patter: /paramName1/paramValue1/paramName2/param Value2...
      +Wicket comes with a built-in implementation of this interface which encodes named page parameters as URL segments using the following pattern: /paramName1/paramValue1/paramName2/param Value2...
       
       This built-in encoder is @org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder@ class. In the @PageParametersEncoderExample@ project we have manually mounted a @MountedMapper@ that takes as input also an @UrlPathPageParametersEncoder@:
       
      @@ -202,4 +202,4 @@
       	mountPage("/foo/", HomePage.class);
       

      -As pointed out in the code above, pages and resources must be mounted after having set CryptoMapper as root mapper, otherwise the mounted paths will not work.
      \ No newline at end of file
      +As pointed out in the code above, pages and resources must be mounted after having set CryptoMapper as root mapper, otherwise the mounted paths will not work.

      Attachments

        Activity

          People

            bitstorm Andrea Del Bene
            AMoser Alica Moser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: