Repository: wicket Updated Branches: refs/heads/master 53fdbc915 -> a1937c4b6
WICKET-6190 Update user guide to cover lambda support Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a1937c4b Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a1937c4b Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a1937c4b Branch: refs/heads/master Commit: a1937c4b6851597374527436ae9fcb4a0dd02f15 Parents: 53fdbc9 Author: Andrea Del Bene <[email protected]> Authored: Mon Jun 27 17:49:22 2016 +0200 Committer: Andrea Del Bene <[email protected]> Committed: Mon Jun 27 17:49:22 2016 +0200 ---------------------------------------------------------------------- .../src/docs/guide/modelsforms/modelsforms_1.gdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/a1937c4b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_1.gdoc ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_1.gdoc b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_1.gdoc index 750e399..431fa38 100644 --- a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_1.gdoc +++ b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_1.gdoc @@ -4,9 +4,9 @@ Model is essentially a "facade":http://en.wikipedia.org/wiki/Facade_pattern inte !uml-imodel.png! -The IModel interface defines just the methods needed to get and set a data object (getObject() and setObject()), decoupling components from concrete details about the persistence strategy adopted for data. In addition, the level of indirection introduced by models allows access data object only when it is really needed (for example during the rendering phase) and not earlier when it may not be ready to be used. +The main goal of @IModel@ interface is to decouple components from concrete details about the persistence strategy adopted for their data. In order to achieve this level of abstraction IModel defines the two methods required to get and set a data object: @getObject()@ and @setObject()@. The level of indirection introduced by models allows access data object only when it is really needed (for example during the rendering phase) and not earlier when it may not be ready to be used. In addition to @getObject()@ and @setObject()@, @IModel@ defines a richer set of methods, mostly meant to work with Java 8 lambdas. We will introduce them in the next paragraph. -Any component can get/set its model as well as its data object using the 4 public shortcut methods listed in the class diagram above. The two methods onModelChanged() and onModelChanging() are triggered by Wicket each time a model is modified: the first one is called after the model has been changed, the second one just before the change occurs. In the examples seen so far we have worked with Label component using its constructor which takes as input two string parameters, the component id and the text to display: +Any component can get/set its model as well as its data object using the 4 public shortcut methods listed in the class diagram above. The two methods @onModelChanged()@ and @onModelChanging()@ are triggered by Wicket each time a model is modified: the first one is called after the model has been changed, the second one just before the change occurs. In the examples seen so far we have worked with Label component using its constructor which takes as input two string parameters, the component id and the text to display: {code} add(new Label("helloMessage", "Hello WicketWorld!")); @@ -33,7 +33,7 @@ add(new Label("helloMessage", new Model<String>("Hello WicketWorld!"))); {code} {note} -The Model class comes with a bunch of factory methods that makes it easier to build new model instances. For example the of(T object) method creates a new instance of Model which wraps any Object instance inside it. So instead of writing +The Model class comes with a bunch of factory methods that makes it easier to build new model instances. For example the @of(T object)@ method creates a new instance of Model which wraps any Object instance inside it. So instead of writing new Model<String>("Hello WicketWorld!") @@ -41,7 +41,7 @@ we can write Model.of("Hello WicketWorld!") -If the data object is a List, a Map or a Set we can use similar methods called ofList, ofMap and ofSet. +If the data object is a @List@, a @Map@ or a @Set@ we can use similar methods called @ofList@, @ofMap@ and @ofSet@. From now on we will use these factory methods in our examples. {note}
