[ https://issues.apache.org/jira/browse/WICKET-5677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14150728#comment-14150728 ]
ASF subversion and git services commented on WICKET-5677: --------------------------------------------------------- Commit 623da39243372d2e5a93d7e2ead8c47921929d59 in wicket's branch refs/heads/master from [~cmenzel] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=623da39 ] WICKET-5677 add onReAdd to Component Squashed commit of the following: commit fab66e85410c14b7a0ede5c953e315a7e5143e3d Merge: 10d83d2 c728d89 Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Sat Sep 27 19:35:52 2014 +0200 Merge branch 'wicket-6.x' into WICKET-5677 commit 10d83d2932c53dd165dbcc4c3f226f4597c142de Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Tue Aug 26 23:38:17 2014 +0200 WICKET-5677 readd should only be called after a remove, never before commit 0a8e964f1a3c3226f52ab22137455acf55f45c74 Merge: 055958a 3a5648b Author: Carl-Eric Menzel <cmen...@apache.org> Date: Mon Aug 25 07:41:06 2014 +0200 Merge branch 'wicket-6.x' into WICKET-5677 commit 055958a9c60db45d96c1828803dbee37e5926678 Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Mon Aug 25 07:23:57 2014 +0200 add re_added flag commit 348e9dbc899c3a62eccf7c50739162b0c0be63c2 Merge: 40c4210 c3eb7e2 Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Fri Aug 22 00:29:16 2014 +0200 Merge remote-tracking branch 'github/WICKET-5677' into WICKET-5677 Conflicts: wicket-core/src/main/java/org/apache/wicket/Component.java wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java commit c3eb7e24954d3909c74201682dba5e4de8fcadd4 Author: Carl-Eric Menzel <cmen...@apache.org> Date: Mon Aug 18 14:08:16 2014 +0200 WICKET-5677 clean up tests commit 4703c1ae1af91fdcca44e34edbeeb8bbaeb63b6c Author: Carl-Eric Menzel <cmen...@apache.org> Date: Mon Aug 18 13:35:44 2014 +0200 WICKET-5677 change onadd to onReAdd and only call when oninitialize wouldn't be called commit 70b7327d2ce142707171cd31a1b612cffaa7a066 Author: Carl-Eric Menzel <cmen...@apache.org> Date: Mon Aug 18 11:27:24 2014 +0200 added javadoc commit 9a6ba692a48b76c30ead6915d4bc43275a255b3c Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Mon Aug 18 10:42:33 2014 +0200 WICKET-5677: add onAddToPage lifecycle event commit 40c42104f9882b938dd84e8469f2922efebd2ce3 Author: Carl-Eric Menzel <cmen...@wicketbuch.de> Date: Mon Aug 18 10:42:33 2014 +0200 WICKET-5677: add onAddToPage lifecycle event (cherry picked from commit 0adb864ff18951a9630bd2339fb9e92963867d4a) Conflicts: wicket-core/src/main/java/org/apache/wicket/Component.java wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java > Components should have onAdd to complement onRemove > --------------------------------------------------- > > Key: WICKET-5677 > URL: https://issues.apache.org/jira/browse/WICKET-5677 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 6.16.0, 7.0.0-M2 > Reporter: Carl-Eric Menzel > Assignee: Carl-Eric Menzel > > When a component is removed from the tree, onRemove is called on it and all > its children, so they can do cleanup. When a component is added to the page, > there is no similar call that could do initializations. > Note: onInitialize sounds similar, but is actually rather different: > onInitialize is called exactly once, the very first time the component is > added to the page's component tree. It is basically a delayed constructor to > allow superclasses to depend on (abstract) methods implemented by subclasses > while giving the subclass's constructor a chance to run. > onInitialize is not called again if a component is removed from the hierarchy > and then added again. This happens, for example, in wizards, and in pages > that replace panels to show different views. > A good example is FencedFeedbackPanel, with the issue reported in > WICKET-5265: in onRemove, the FFP clears the fence marker in its fence > component. Stepping forward in a wizard where a step contains such an FFP > causes onRemove to be called. Going backwards then re-adds the step panel and > its FFP, but the fence is now broken, because the FFP has no way of knowing > that it was re-added. > I tried working around it using onConfigure and onBeforeRender. But due to > the way Wicket traverses the component tree, it is not always guaranteed that > this will be called soon enough, i.e. before an outer FFP has already > "stolen" the feedback messages that should have been protected by the fence. > I therefore propose adding a method onAddToPage that is called: > - whenever a component or one of its parents is added to the page component > tree, i.e. when it gets a connection to the page. > - never more than once per add > - never before the parent components are initialized. > If a component is added to a container before the container is added to the > page, this method should NOT be called - only when there is a path to the > page. > I have an implementation of this that is tested and fixes the problem in > WICKET-5265. I'll push it to a branch as soon as I can. It's currently based > on wicket-6.x but is easily portable to 7. It's not an API break, since only > non-abstract methods are added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)