Re: Ajax and IComponentResolver
I've compiled the latest code from the wicket trunk and when plugging in the latest jars into our project I've seen that some changes have to be done in order to use wicket 1.5 (like some package names changed, can't find org.apache.wicket.Request). So I was wandering how far is the 1.5 release ? Because we're usually including final versions in our project. Thanks, Alex On 05/16/2011 06:28 PM, Martin Grigorov wrote: How to build Wicket is described at http://wicket.apache.org/contribute/build.html But the patch is only for 1.5. You can't use it in 1.4. I recommend you to upgrade. On Mon, May 16, 2011 at 5:16 PM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: I can try the patch and test, but I only have the wicket 1.4.17 jars. So can I do a code checkout from somewhere? :D Or get a jar that has the patch in it ? On 05/16/2011 05:50 PM, Martin Grigorov wrote: Sounds like https://issues.apache.org/jira/browse/WICKET-3719 Can you try the patch there and give feedback ? If it still fails then a quickstart app or a test case would help us to improve it. On Mon, May 16, 2011 at 4:43 PM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: Hello, I have a custom wicket html tag that is handled by a component resolver to automatically generate a component for it. And these components only exist at the render phase and aren't stored in the page tree. Now when Ajax is used to update a fragment of the web page, looks like the components for these wicket html tags were not rendered. So instead of getting the desired markup I get only the contents of the original markup. Might this be a bug? It looks like the component resolver doesn't work when the response is built for the ajax update. Any ideas/workarounds ? Thanks again, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax and IComponentResolver
I can try the patch and test, but I only have the wicket 1.4.17 jars. So can I do a code checkout from somewhere? :D Or get a jar that has the patch in it ? On 05/16/2011 05:50 PM, Martin Grigorov wrote: Sounds like https://issues.apache.org/jira/browse/WICKET-3719 Can you try the patch there and give feedback ? If it still fails then a quickstart app or a test case would help us to improve it. On Mon, May 16, 2011 at 4:43 PM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: Hello, I have a custom wicket html tag that is handled by a component resolver to automatically generate a component for it. And these components only exist at the render phase and aren't stored in the page tree. Now when Ajax is used to update a fragment of the web page, looks like the components for these wicket html tags were not rendered. So instead of getting the desired markup I get only the contents of the original markup. Might this be a bug? It looks like the component resolver doesn't work when the response is built for the ajax update. Any ideas/workarounds ? Thanks again, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Ajax and IComponentResolver
Hello, I have a custom wicket html tag that is handled by a component resolver to automatically generate a component for it. And these components only exist at the render phase and aren't stored in the page tree. Now when Ajax is used to update a fragment of the web page, looks like the components for these wicket html tags were not rendered. So instead of getting the desired markup I get only the contents of the original markup. Might this be a bug? It looks like the component resolver doesn't work when the response is built for the ajax update. Any ideas/workarounds ? Thanks again, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Weird jsp include output
Tried this version, but I can't figure out how to add the behaviour to the page at this point. Because for wicket defined html tags I know I have to use container./autoAdd/(component). Now with this method I can only add components and not behaviours. Using container.add(JspBehaviour) generates this exception "/Cannot modify component hierarchy after render phase has started (page version cant change then anymore)/". Am I doing something wrong? On 05/13/2011 10:57 AM, Martin Grigorov wrote: JspFileContainer extends AbstractBehavior From there on it should be easy to figure out. On Fri, May 13, 2011 at 9:48 AM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: I'm using version 1.4.17. How would you change it in to a Behaviour ? Are there some classes that you'll extend or implement? Thanks, Alex On 05/12/2011 10:08 PM, Martin Grigorov wrote: Not sure what exactly happens but looking at the code in wiki I'd re-make JspContainer to JspBehavior. I doubt this will help but you can try it anyway. Which version of Wicket do you use ? On Thu, May 12, 2011 at 8:56 PM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: Hi guys, I've implemented the tag as described in the wicket wiki< https://cwiki.apache.org/WICKET/including-jsp-files-in-html-templates.html and I use it to include the header and the footer in the current wicket page. Like this: // But the outcome is strange because the footer is above the page content: <header> /<footer>/ <wicket script declarations> <Page Content> I know that wicket html tags are processed before the page is built, but why do the html elements invert? Or is there a solution for this ? Thanks in advance, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Weird jsp include output
I'm using version 1.4.17. How would you change it in to a Behaviour ? Are there some classes that you'll extend or implement? Thanks, Alex On 05/12/2011 10:08 PM, Martin Grigorov wrote: Not sure what exactly happens but looking at the code in wiki I'd re-make JspContainer to JspBehavior. I doubt this will help but you can try it anyway. Which version of Wicket do you use ? On Thu, May 12, 2011 at 8:56 PM, Alexandru Artimon< aarti...@developmentgateway.org> wrote: Hi guys, I've implemented the tag as described in the wicket wiki< https://cwiki.apache.org/WICKET/including-jsp-files-in-html-templates.html> and I use it to include the header and the footer in the current wicket page. Like this: // But the outcome is strange because the footer is above the page content: <header> /<footer>/ <wicket script declarations> <Page Content> I know that wicket html tags are processed before the page is built, but why do the html elements invert? Or is there a solution for this ? Thanks in advance, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Nested forms quick question
Yes they are necessarily nested. Thanks Martin, I'll give it a try. Alex On 05/06/2011 09:15 PM, Martin Grigorov wrote: instead of setRequired() use isRequired(submittedForm == innerForm) On Fri, May 6, 2011 at 6:04 PM, Tito wrote: Are these necessarily nested forms? 2011/5/5 Alexandru Artimon Hey guys, When I submit the main form can I prevent the submit of the inner forms? I have some small forms to add items to the main form. The fields in the inner forms have setRequired(true), so when I submit the main form I get errors that those fields are empty. Any ideas? Thanks, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Nested forms quick question
Hey guys, When I submit the main form can I prevent the submit of the inner forms? I have some small forms to add items to the main form. The fields in the inner forms have setRequired(true), so when I submit the main form I get errors that those fields are empty. Any ideas? Thanks, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: LoadableDetachableModel small issue
Bas, This is what I wanted to find out if you guys use a different model for new items(before saving them). I had previously headed in the wrong way by not using LDM so I wanted to be sure I'm doing it correctly now. Thanks, Alexandru On 03/04/2011 04:19 PM, Bas Gooren wrote: Hi, I use a custom refreshingview which uses a LDM for existing items, and a serializing model for new items. When converting the input in my custom refreshingview (which is the component that "owns" the list) I handle both types of models. On refresh (re-display) it "replaces" the serializing models with LDMs if they are saved. Hope this helps :-) Bas Op 4-3-2011 15:14, Alexandru Artimon schreef: Not really, I want to find out what you guys do when in a form you add a new item to a collection(where the items are passed to a LDM and then showed). Do you save first the item and then pass it to a LDM? Or do you use a plain model? Or maybe something else? I'm trying to see that I'm not headed on the wrong track. Thanks, Alexandru On 03/04/2011 03:57 PM, mzem...@osc.state.ny.us wrote: Not completely sure what you're getting at, would RefreshingView help you? http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/repeater/RefreshingView.html From: Alexandru Artimon To: users@wicket.apache.org Date: 03/04/2011 08:31 AM Subject:LoadableDetachableModel small issue Hi guys, Thanks again for the previous help with the LoadableDetachableModel. Now I have a "workflow problem" related to LDM for which I think you guys might have a more elegant solution. I have a hibernate collection which is shown by a ListView. Each item is passed to a LDM and rendered with a custom component. Now the problem is when the user wants to add new items to the collection. Due to the use of the LDM I need to first save the empty-item in the DB just to receive an id which the LDM can use later to load the object. Acceptable, but what if the user decides to leave the page without saving the form. At the next load the empty-items will be there which is not the desired functionality. How do you guys handle new items which need to be passed to a LDM (in order to avoid all those problems generated by the Wicket Serializable Checker) ? Thanks a lot, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: LoadableDetachableModel small issue
Not really, I want to find out what you guys do when in a form you add a new item to a collection(where the items are passed to a LDM and then showed). Do you save first the item and then pass it to a LDM? Or do you use a plain model? Or maybe something else? I'm trying to see that I'm not headed on the wrong track. Thanks, Alexandru On 03/04/2011 03:57 PM, mzem...@osc.state.ny.us wrote: Not completely sure what you're getting at, would RefreshingView help you? http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/repeater/RefreshingView.html From: Alexandru Artimon To: users@wicket.apache.org Date: 03/04/2011 08:31 AM Subject:LoadableDetachableModel small issue Hi guys, Thanks again for the previous help with the LoadableDetachableModel. Now I have a "workflow problem" related to LDM for which I think you guys might have a more elegant solution. I have a hibernate collection which is shown by a ListView. Each item is passed to a LDM and rendered with a custom component. Now the problem is when the user wants to add new items to the collection. Due to the use of the LDM I need to first save the empty-item in the DB just to receive an id which the LDM can use later to load the object. Acceptable, but what if the user decides to leave the page without saving the form. At the next load the empty-items will be there which is not the desired functionality. How do you guys handle new items which need to be passed to a LDM (in order to avoid all those problems generated by the Wicket Serializable Checker) ? Thanks a lot, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
LoadableDetachableModel small issue
Hi guys, Thanks again for the previous help with the LoadableDetachableModel. Now I have a "workflow problem" related to LDM for which I think you guys might have a more elegant solution. I have a hibernate collection which is shown by a ListView. Each item is passed to a LDM and rendered with a custom component. Now the problem is when the user wants to add new items to the collection. Due to the use of the LDM I need to first save the empty-item in the DB just to receive an id which the LDM can use later to load the object. Acceptable, but what if the user decides to leave the page without saving the form. At the next load the empty-items will be there which is not the desired functionality. How do you guys handle new items which need to be passed to a LDM (in order to avoid all those problems generated by the Wicket Serializable Checker) ? Thanks a lot, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Hibernate lazy collections and Wicket Serializable Checker
Hi guys, Thanks for the replies, they pointed us in the right direction. I also found that I need to use OpenSessionInViewFilter with the Loadable Detachable Model. Alexandru On 02/14/2011 06:36 PM, Igor Vaynberg wrote: you really should not reference hibernate entities directly. use a loadable detachable model for that. otherwise when the page is deserialized the entity is detached from the session... -igor On Mon, Feb 14, 2011 at 8:23 AM, Alexandru Artimon wrote: Hello, I'm having some problems in porting our application to Wicket. Wicket Serializable Checker tries to see if all the fields in a hibernate bean are serializable, but some of the fields are collections that have lazy set to true. Now, at the moment it tries to check those collections the session is closed and thus a "failed to lazily initialize a collection" exception arises. If the session was open then this checker will probably initialize all the lazy collections recursive and will make the lazy setting useless. In order to avoid this problem I started setting the "lazy collection" fields to transient in the POJOs, which doesn't affect saving it with hibernate. But I realize we have a lot of collections with lazy true. Is there some elegant solution? Maybe like turning the Serializable Checker off? Thanks, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Hibernate lazy collections and Wicket Serializable Checker
Hello, I'm having some problems in porting our application to Wicket. Wicket Serializable Checker tries to see if all the fields in a hibernate bean are serializable, but some of the fields are collections that have lazy set to true. Now, at the moment it tries to check those collections the session is closed and thus a "failed to lazily initialize a collection" exception arises. If the session was open then this checker will probably initialize all the lazy collections recursive and will make the lazy setting useless. In order to avoid this problem I started setting the "lazy collection" fields to transient in the POJOs, which doesn't affect saving it with hibernate. But I realize we have a lot of collections with lazy true. Is there some elegant solution? Maybe like turning the Serializable Checker off? Thanks, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Saving a component in session
Hello, Thanks for the idea, I didn't know that I can get a callback url for the AbstractAjaxBehavior. It seems to be working now. I came across a small issue with Firefox 4(beta7): when the Ajax response arrives in the browser, usually Wicket runs the javascript embeded in the response. This doesn't happen in FF4b7, so components that work in FF3.6 (like AjaxEditableLabel) don't work in FF4. Don't know if it's because of FF or Wicket, but I thought maybe you guys should know and decide if it needs fixing or not. Alexandru On 09/27/2010 09:13 AM, Ernesto Reinaldo Barreiro wrote: What you want to achieve is been able to click on your labels (created via) and replace then with some editable components? If so, maybe you could do it as follows. 1-Place some abstract ajax behavior (AAB) on your "base" page so that you have some unique context to submit back changes on your labels texts 2-Modify you wicket:transforms so that it generates a new input field via JavaScript plus some link to submit or cancel you changes. You could use the URL of AAB to summit back to the server your changes via wicektAjaxGet() plus appending the text of the modified label as a parameter (plus a parameter identifying your key). 3-You process the result on the AAB (you will have your key and the modified message posted by step 2). Although I haven't tried the above myself, it seems to me that it could be easily achievable... Ernesto On Sun, Sep 26, 2010 at 8:40 PM, Mihai Postelnicu wrote: Any idea how can we approach this differently ? we need a component spawned in html (because we have some default translatable text in the html that we have to enclose and also acts as the key) with callbacks and two states (edit mode and read only, much like ajaxeditablelablel). Any idea is welcome ! Thanks Mihai On 09/26/2010 10:51 AM, Igor Vaynberg wrote: it can modify hierarchy, but the components it adds only exist during the render phase - so those components cannot receive callbacks or hold state. -igor On Sat, Sep 25, 2010 at 10:41 PM, Alexander Morozov wrote: So IComponentResolver cannot modify component hierarchy. Right ? And there is no way for the author to create and handle "special" tag. -- View this message in context:http://apache-wicket.1842946.n4.nabble.com/Saving-a-component-in-session-tp2551649p2714088.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org For additional commands, e-mail:users-h...@wicket.apache.org - To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org For additional commands, e-mail:users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Saving a component in session
Hello, I'll share the code gladly, here's the resolve method from the class implementing IComponentResolver: public boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) { if (tag.getName().compareTo("translate") == 0) { String messageKey = tag.getAttributes().getString("key"); if ((messageKey == null) || (messageKey.trim().length() == 0)) { throw new MarkupException( "Wrong format of : attribute 'key' is missing"); } final String id = TRANSLATION_COMPONENT_PREFIX + container.getPage().getAutoIndex(); Session session = container.getPage().getSession(); session.bind(); AjaxEditableLabel label = new AjaxEditableLabel(id, new Model(messageKey)); label.setOutputMarkupId(true); boolean ret = container.autoAdd(label, markupStream); session.setMetaData(TRANSLATION_KEY, label); // Yes, we handled the tag return true; } // We were not able to handle the tag return false; } On 09/24/2010 12:25 PM, Alexander Morozov wrote: Alexandru Artimon wrote: The thing is that I'm coding my own tag and I use a class that implements IComponentResolver in order to resolve it. Now the problem is that when I click on the AjaxEditableLabel (that took place of my tag) it makes an Ajax request in order to hide the label and show the editor, but wicket can't find the component in the page. Probably because the component resolver is run on render and the ajax request doesn't reach that point (or doesn't need to). So thats why I try to resolve the RequestTarget myself for the AjaxRequest and this involves the session stuff. I didn't find a better way yet. Maybe you guys have other ideas ? I think that the problem is in resolver. You should share the code...
Re: Saving a component in session
Hi, Thanks for the reply. The thing is that I'm coding my own tag and I use a class that implements IComponentResolver in order to resolve it. Now the problem is that when I click on the AjaxEditableLabel (that took place of my tag) it makes an Ajax request in order to hide the label and show the editor, but wicket can't find the component in the page. Probably because the component resolver is run on render and the ajax request doesn't reach that point (or doesn't need to). So thats why I try to resolve the RequestTarget myself for the AjaxRequest and this involves the session stuff. I didn't find a better way yet. Maybe you guys have other ideas ? Thanks, Alexandru On 09/23/2010 10:06 PM, Pointbreak wrote: You really don't want to save a component in a session. A component has its own lifecycle, tied to pagerequests, and its own scope tied to its parent components and the page it is part of. From what I understand of your story, what you should do is write your own component that wraps a Label or an AjaxEditLabel depending on some condition/mode. This is very easy to make with wicket. On Thu, 23 Sep 2010 13:24 +0300, "Mihai Postelnicu" wrote: Guys, I work on the same project as below (integrating an interface translator with Wicket) and we are a bit stuck. Any ideas? Thanks in advance for your time ! Mihai On 09/23/2010 12:29 PM, Alexandru Artimon wrote: Forgot to mention that the component is an AjaxEditableLabel and I need to save it to session because I'm creating a custom wicket tag for translation purposes. When in translator mode I want all the labels to be replaced by AjaxEditableLabel's so that the translator can do his job easier. The problem I have is that when I click on the label of the AjaxEditableLabel, it produces an ajax request in order to change visibility modes and show the edit box. I did my custom tag replacing by implementing an IComponentResolver, which (from what I figured) happens on render. So my AjaxEditableLabel component isn't in the page when the Ajax request arrives. I planned to solve this by fetching the missing component from the session on my own, by overwriting resolveListenerInterfaceTarget. Now when I fetch the original AjaxEditableLabel from the session, all it's children (the Label and TextField) are gone. Any ideas will be much appreciated. Thanks, Alexandru On 09/23/2010 11:57 AM, Alexandru Artimon wrote: Hello, I have a problem when saving a component to the session, all it's children disappear. I do the save like this: session.bind(); session.setMetaData(MY_KEY, component); Regards, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Saving a component in session
Yeah it's not what we need, that's why we are implementing some other. And also wicket:message doesn't have the ability to work in an "editor-mode". Alexandru On 09/23/2010 03:34 PM, Martin Grigorov wrote: I guess you are aware of ? On Thu, Sep 23, 2010 at 1:41 PM, Alexandru Artimon< aarti...@dgfoundation.org> wrote: Hello, This aproach didn't work for me. I tried first only adding an AjaxEditableLabel in my ComponentResolver, but once I clicked the label (in order to change into an edit box) wicket complained that it couldn't find the AjaxEditableLabel component in the Page. So that's how I ended up overwriting resolveListenerInterfaceTarget in order to resolve the AjaxEditableLabel. I couldn't return a new instance of it (because adding it to the page at this point seems difficult) so I thought to use the session. Our intended translation tag looks like this:[Here the default value for it]. We need something like this because we are porting an existing webapp to Wicket that has a similar mechanism now. Thanks, Alexandru On 09/23/2010 02:07 PM, Martin Grigorov wrote: I'm not sure why the children disappear but it looks odd to me to save component in the session in first place. why not: if (request.getParameter("editMode")) { label = new AjaxEditableLabel(id, model);} else {label = new Label(id, model);} parent.addOrReplace(label); ? On Thu, Sep 23, 2010 at 12:24 PM, Mihai Postelnicu< mposteln...@dgfoundation.org> wrote: Guys, I work on the same project as below (integrating an interface translator with Wicket) and we are a bit stuck. Any ideas? Thanks in advance for your time ! Mihai On 09/23/2010 12:29 PM, Alexandru Artimon wrote: Forgot to mention that the component is an AjaxEditableLabel and I need to save it to session because I'm creating a custom wicket tag for translation purposes. When in translator mode I want all the labels to be replaced by AjaxEditableLabel's so that the translator can do his job easier. The problem I have is that when I click on the label of the AjaxEditableLabel, it produces an ajax request in order to change visibility modes and show the edit box. I did my custom tag replacing by implementing an IComponentResolver, which (from what I figured) happens on render. So my AjaxEditableLabel component isn't in the page when the Ajax request arrives. I planned to solve this by fetching the missing component from the session on my own, by overwriting resolveListenerInterfaceTarget. Now when I fetch the original AjaxEditableLabel from the session, all it's children (the Label and TextField) are gone. Any ideas will be much appreciated. Thanks, Alexandru On 09/23/2010 11:57 AM, Alexandru Artimon wrote: Hello, I have a problem when saving a component to the session, all it's children disappear. I do the save like this: session.bind(); session.setMetaData(MY_KEY, component); Regards, Alexandru - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Saving a component in session
Hello, This aproach didn't work for me. I tried first only adding an AjaxEditableLabel in my ComponentResolver, but once I clicked the label (in order to change into an edit box) wicket complained that it couldn't find the AjaxEditableLabel component in the Page. So that's how I ended up overwriting resolveListenerInterfaceTarget in order to resolve the AjaxEditableLabel. I couldn't return a new instance of it (because adding it to the page at this point seems difficult) so I thought to use the session. Our intended translation tag looks like this: key="home:nameField">[Here the default value for it]. We need something like this because we are porting an existing webapp to Wicket that has a similar mechanism now. Thanks, Alexandru On 09/23/2010 02:07 PM, Martin Grigorov wrote: I'm not sure why the children disappear but it looks odd to me to save component in the session in first place. why not: if (request.getParameter("editMode")) { label = new AjaxEditableLabel(id, model);} else {label = new Label(id, model);} parent.addOrReplace(label); ? On Thu, Sep 23, 2010 at 12:24 PM, Mihai Postelnicu< mposteln...@dgfoundation.org> wrote: Guys, I work on the same project as below (integrating an interface translator with Wicket) and we are a bit stuck. Any ideas? Thanks in advance for your time ! Mihai On 09/23/2010 12:29 PM, Alexandru Artimon wrote: Forgot to mention that the component is an AjaxEditableLabel and I need to save it to session because I'm creating a custom wicket tag for translation purposes. When in translator mode I want all the labels to be replaced by AjaxEditableLabel's so that the translator can do his job easier. The problem I have is that when I click on the label of the AjaxEditableLabel, it produces an ajax request in order to change visibility modes and show the edit box. I did my custom tag replacing by implementing an IComponentResolver, which (from what I figured) happens on render. So my AjaxEditableLabel component isn't in the page when the Ajax request arrives. I planned to solve this by fetching the missing component from the session on my own, by overwriting resolveListenerInterfaceTarget. Now when I fetch the original AjaxEditableLabel from the session, all it's children (the Label and TextField) are gone. Any ideas will be much appreciated. Thanks, Alexandru On 09/23/2010 11:57 AM, Alexandru Artimon wrote: Hello, I have a problem when saving a component to the session, all it's children disappear. I do the save like this: session.bind(); session.setMetaData(MY_KEY, component); Regards, Alexandru
Re: Saving a component in session
Forgot to mention that the component is an AjaxEditableLabel and I need to save it to session because I'm creating a custom wicket tag for translation purposes. When in translator mode I want all the labels to be replaced by AjaxEditableLabel's so that the translator can do his job easier. The problem I have is that when I click on the label of the AjaxEditableLabel, it produces an ajax request in order to change visibility modes and show the edit box. I did my custom tag replacing by implementing an IComponentResolver, which (from what I figured) happens on render. So my AjaxEditableLabel component isn't in the page when the Ajax request arrives. I planned to solve this by fetching the missing component from the session on my own, by overwriting resolveListenerInterfaceTarget. Now when I fetch the original AjaxEditableLabel from the session, all it's children (the Label and TextField) are gone. Any ideas will be much appreciated. Thanks, Alexandru On 09/23/2010 11:57 AM, Alexandru Artimon wrote: Hello, I have a problem when saving a component to the session, all it's children disappear. I do the save like this: session.bind(); session.setMetaData(MY_KEY, component); Regards, Alexandru
Saving a component in session
Hello, I have a problem when saving a component to the session, all it's children disappear. I do the save like this: session.bind(); session.setMetaData(MY_KEY, component); Regards, Alexandru