Re: Best way to handle circular references
I have no problem other than i dont like it, but since I don't like it I'd like to know if someone else had the same thoughts I had and what was the conclusion. Giovanni what is the actual problem you are having with this other then i dont like it? -igor On Wed, Sep 23, 2009 at 3:21 AM, Giovanni Cuccu giovanni.cu...@cup2000.it wrote: Hi all, I'm developing a wicket application and I'm facing a problem. I built a menupanel that shows the menu to access the various aplication pages; since the panel needs to show the pages it contains a list of links that when clicked simply do the the following setResponsePage(new Page()); In the class menupanel.java I must reference Page In the class Page.java I must reference MenuPanel At the end I have a circular reference between manupanel and the various Page and I don't like it. While reading wicketInAction I noted that in the examples there is a circular reference between Checkout page and Index page. Are circular references unavoidable with Wicket? Is there a best practive to avoid this situation? Thanks, Giovanni -- Giovanni Cuccu Via del Borgo di S. Pietro, 90/c - 40126 Bologna e-mail: giovanni.cuccu _at_ cup2000.it - 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 -- Giovanni Cuccu Via del Borgo di S. Pietro, 90/c - 40126 Bologna e-mail: giovanni.cuccu _at_ cup2000.it - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4.1 and HtmlUnit
Hi Igor, yes the application works in a browser. But with wicket 1.4-rc2 my tests are working. The behavior in wicket has changed and Htmlunit has a problem with this. I just try to find the cause, to fix it (or report a bug in htmlunit). I also suppose it is indeed a problem in HtmlUnit but I couldn't localize the problem yet. Tomek 2009/9/23 Igor Vaynberg igor.vaynb...@gmail.com your app works fine in a browser, right? so its most likely an htmlunit problem. -igor On Wed, Sep 23, 2009 at 7:31 AM, Tomek Sniadach tomek.sniad...@googlemail.com wrote: Hi,after upgrade from wicket 1.4-rc2 to 1.4.1 I have problems with my HtmlUnit tests. It seems to be a problem with form submitting. I'm not sure if this is a wicket problem, but with version 1.4.rc2 it works fine. Here a sample code: HtmlPage page = client.getPage(request); HtmlButton btn = getSubmitButton(page); ... btn.click(); List results = page.getByXpath(xpath to my filter results); The problem is that the page isn't updated. When I write page = page.refresh(); after btn.click() it works fine, but it should not be necessary. The button causes an ajax request so btn.click() returns no new page. As I said, I don't know if this is a problem in wicket, but when I downgrade into 1.4-rc2 the tests work fine. I've also tried with 1.4.-rc5: he same as in 1.4.1 Does anyone has any idea? greets Tomek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicketstuff-merged-resources: New (much simpler) Version
Hi all, I just wanted to let you know that I've posted an article on the new version of wicketstuff-merged-resources: http://techblog.molindo.at/2009/09/wicketstuff-merged-resources-new-much-simpler-version.html For those that aren't aware of this small library: wicketstuff-merged-resources is a set of simple helper classes to improve Wicket interface loading performance. This is achieved with improved caching configuration and merging of shared resources without the need of touching any components (it's all done inside Application.init()). The initial code base was the outcome of Stefan Fussenegger's blog series called Wicket Interface Speed-Up. (from Wicket Stuff Wiki: http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources) Btw, if you're interested in serving Wicket-mounted resources from Amazon S3/CloudFront, it might be worth subscribing to my blog. I am planning a write-up on how to use wicketstuff-merged-resources to upload and mount resources to/from Amazon's CDN. Cheers, Stefan Fußenegger http://techblog.molindo.at/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best way to handle circular references
Best solution is ignore circular dependencies ;) ** Martin 2009/9/25 Giovanni Cuccu giovanni.cu...@cup2000.it: I have no problem other than i dont like it, but since I don't like it I'd like to know if someone else had the same thoughts I had and what was the conclusion. Giovanni what is the actual problem you are having with this other then i dont like it? -igor - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best way to handle circular references
a simple way to decouple the menu from the pages is to mount all the pages and pass the mount urls into the menu instead of the page classes. that way you wont have any imports other then java.lang.String -igor On Fri, Sep 25, 2009 at 12:06 AM, Giovanni Cuccu giovanni.cu...@cup2000.it wrote: I have no problem other than i dont like it, but since I don't like it I'd like to know if someone else had the same thoughts I had and what was the conclusion. Giovanni what is the actual problem you are having with this other then i dont like it? -igor On Wed, Sep 23, 2009 at 3:21 AM, Giovanni Cuccu giovanni.cu...@cup2000.it wrote: Hi all, I'm developing a wicket application and I'm facing a problem. I built a menupanel that shows the menu to access the various aplication pages; since the panel needs to show the pages it contains a list of links that when clicked simply do the the following setResponsePage(new Page()); In the class menupanel.java I must reference Page In the class Page.java I must reference MenuPanel At the end I have a circular reference between manupanel and the various Page and I don't like it. While reading wicketInAction I noted that in the examples there is a circular reference between Checkout page and Index page. Are circular references unavoidable with Wicket? Is there a best practive to avoid this situation? Thanks, Giovanni -- Giovanni Cuccu Via del Borgo di S. Pietro, 90/c - 40126 Bologna e-mail: giovanni.cuccu _at_ cup2000.it - 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 -- Giovanni Cuccu Via del Borgo di S. Pietro, 90/c - 40126 Bologna e-mail: giovanni.cuccu _at_ cup2000.it - 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: inmethod DataGrid javascript error (with fix?)
Thanks. Should be fixed in SVN. -Matej On Fri, Sep 25, 2009 at 2:05 AM, Russell Morrisey rmorri...@csc.com wrote: I'm getting a javascript error using the inmethod DataGrid; it looks to me like a bug with the DataGrid's script code. I am hoping that the DataGrid script can be patched =) When using the inmethod grid (com.inmethod.grid.datagrid.DataGrid), I get the error whenever I hover the mouse over a row in the grid. This seems to happen: -Only in IE6 -Only when window.update is already defined. In my case, my page has: input id=update value=UPDATE type=button /. (This button is just a stub, not wicket-enabled yet.) Debugging in Visual Studio, I see that there is a reference to the button (update) already defined, which seems to be generated automatically by IE. When I mouse over the grid I get: Object does not support this property or method, in AbstractGrid/res/script.js, in the updatePrelight method, on this line: update = function(e) { var scrollLeft; if (Wicket.Browser.isOpera()) { // for some reason opera doesn't preserve the scroll offset when changing/removing style bodyContainer1 = this.getElement( div, imxt-body-container1); scrollLeft = bodyContainer1.scrollLeft; //e.style.visibility = hidden; } if (e.imxtPrelight == true) { addClass(e, imxt-prelight); } else { removeClass(e, imxt-prelight); } if (Wicket.Browser.isOpera()) { //e.style.visibility = ; bodyContainer1 = this.getElement( div, imxt-body-container1); bodyContainer1.scrollLeft = scrollLeft; } }.bind(this); We use the DataGrid on another page in our production app and it doesn't experience this problem. The other page does not have a DOM element with id=update, or a window.update property. I think the script needs to be changed to: var update = function... So that the locally defined function isn't trying to overwrite the window.update property. I'm using datagrid version: 1.0.0-SNAPSHOT according to our project's POM. Thanks! Russell E. Morrisey Application Designer Associate Professional CSC NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Is it the best way to code a Link depending on a condition
In fact, the example createLabel is not really the most interesting. Let's me explaining what I consider as a good candidate and what I have done 1) A HTML page contains a table which is populated dynamically using a service collecting data from a DB. the last column of the table is a link (wicket id=linkRequest) that we would like to show or not depending if we have receive from the DB, the id (= primary key of the table DB) corresponding to the record Request to be opened in the screen page Request.html / RequestPage) 2) The populateItem method of the DataView allows me for each record to link the model (= item) returned by the IDataprovider to the columns of my table. To create the link to the HTML page, I use the Link class that I have modified like this : public class LinkRequestT extends LinkT { private static final long serialVersionUID = 3283912033862898645L; private RequestFormModel requestFormModel; public LinkRequest(String id) { super(id); } @Override public void onClick() { setResponsePage(new RequestPage(requestFormModel)); } public RequestFormModel getRequestFormModel() { return requestFormModel; } public void setRequestFormModel(RequestFormModel requestFormModel) { this.requestFormModel = requestFormModel; } } As you see the onClick() method is defined so I don't need to modify it when I add the link to my item. To create the link, I call a createLinkRequest Method who play the role of a factory for me public static LinkRequest createLinkRequest(String id) { LinkRequest linkReq = new LinkRequest(linkRequest); if ( id != null ) { // Link is enable with parameters required to open RequestPage RequestFormModel requestFormModel = new RequestFormModel(); requestFormModel.setId( Integer.parseInt( id ) ); linkReq.setRequestFormModel(requestFormModel); linkReq.add(getLinkRequestTxt( id )); } else { // Link is disable linkReq.add(getLinkRequestTxt()); linkReq.setEnabled(false); } return linkReq; } and I call this method from my polulateItem like this item.add( createLinkRequest( id which is equal to null or to a value ) ); Depending if the value is null or not, the link will be enable or disabled and the model required by my page request created accordingly. Is it a correct implementation or a stupid one ? In a previous reply, someone argues that we must override the method isEnabled() instead of using setEnable() ? Regards, Charles josephpachod wrote: hi Charles The whole issue is that you don't know how the data (in this case a String) is to be retrieved. Can it be read only once ? Should it be refresh on each request cycle ? On each access to the data ? Does it come from a database ? Wicket's model allows you to go away from all these considerations : you just want to be able to get the string. Just let the users of your wicket component decide how they want to provide the data. As such, your example is, I think, broken : private Label labelTitle; public static Label createLabelTitle(String title) { return new Label(title,new PropertyModel( ModelClass, title )); } What if someone wants to change this string ? title = my new title won't work there ! Thus, it should be, IMO : public static Label createLabelTitle(final IModelString titleModel) { return new Label(title,titleModel.get()); } ++ NB : you might be interested by this article http://blog.jteam.nl/2009/09/16/wicket-dos-and-donts/ Joseph, Can you explain a little bit what you mean by provide it with attribute (IModelString) ? private Label labelTitle; public static Label createLabelTitle(String title) { return new Label(title,new Model( title )); } -- becomes private Label labelTitle; public static Label createLabelTitle(String title) { return new Label(title,new PropertyModel( ModelClass, title )); } Is it right what I create ? Joseph Pachod wrote: cmoulliard wrote: What I have done to avoid to repeat the creation of the labels is to define and use static method private Label labelTitle; public static Label getLabelTitle(String title) { return new Label(title,new Model( title )); } I personally would name this method createLabelTitle(String title) or getNewLabelTitle(String title), for explicitness. Furthermore, I would directly
Date validation in a form / Javascriupt generation at the client side
I would like to know How I can validate the string date inputted by a user in a textfield of my form ? e.g : The SimpleDateformat to be used to create a java Date is : dd/MM/ So I would like to check that the user has well introduced its date using this format in the html field. Is it possible to this validation inside the Wicket Form ? Does Wicket generates javascript to validate this at the client side like it is possible in JSP (Struts) ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Display or not an image dynamically
How can I dynamically display or not an image (= a link) in a html table page using wicket ? It means that depending on a condition, the button link will be displayed or not at all. Is it possible to create a buttonLink in Wicket ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Display or not an image dynamically
Why not create your own panel with a link containing an image? I mean something like: wicket:panel a class=imagebutton wicket:id=link title=img wicket:id= image src=/span wicket:id=label/span/a wicket:child/ /wicket:panel And then control the visibility of this panel with isVisible()? Ernesto On Fri, Sep 25, 2009 at 11:50 AM, Charles Moulliard cmoulli...@gmail.comwrote: How can I dynamically display or not an image (= a link) in a html table page using wicket ? It means that depending on a condition, the button link will be displayed or not at all. Is it possible to create a buttonLink in Wicket ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket Stuff commit access
Hello Please grant me commit access for wicket stuff. I want help develop objectautocomplete component . My sf account name : slawekstec My Jira account name : slawekstec thanx Slawomir Stec - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Date validation in a form / Javascriupt generation at the client side
I would like to know How I can validate the string date inputted by a user in a textfield of my form ? you can use: org.apache.wicket.datetime.markup.html.form.DateTextField ex: DateTextField date = DateTextField.forDatePattern(date, dd/MM/); This component will validate the inputs against the date pattern. To output validations mensage, you can use an feedback panel http://www.jroller.com/wireframe/entry/wicket_client_side_validation On Fri, Sep 25, 2009 at 6:44 AM, Charles Moulliard cmoulli...@gmail.comwrote: I would like to know How I can validate the string date inputted by a user in a textfield of my form ? e.g : The SimpleDateformat to be used to create a java Date is : dd/MM/ So I would like to check that the user has well introduced its date using this format in the html field. Is it possible to this validation inside the Wicket Form ? Does Wicket generates javascript to validate this at the client side like it is possible in JSP (Struts) ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Difference between DropDownChoice and ListMultipleChoice from the eyes of an IVisitor
I've used the ShinyFormVisitor that Alastair Maw came up with (http://londonwicket.googlecode.com/files/LondonWicket-FormsWithFlair.pdf) to format the validation errors on my form. But now I'm running into something that I can't explain. I have two complex fields on my form, one a FormComponentPanel with a DropDownChoice on it, and one a FormComponentPanel with a ListMultipleChoice on it. Both are required fields. For the former the formatting works without a problem, but for the latter it does not. I've looked into the source code, but I don't see what is causing this difference in behavior. Can anybody tell me what I'm missing here? Because when I try submitting the form with the ListMultipleChoice as the only empty field, it does still stop short of actually saving the data, it merely doesn't show the error message I'm expecting. Regards, Linda - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
Hi, The TabbedPanel internaly uses a Loop to render the tab-components. During a normla GET request the Loop.onPopulate() method ensures that all the loop-childs are removed before adding them again to support a possible change of teh underlying Integer-model. Loop.onPopulate() @Override protected final void onPopulate() { // Remove any previous loop contents removeAll(); // Get number of iterations final int iterations = getIterations(); if (iterations 0) { // Create LoopItems for each iteration for (int iteration = 0; iteration iterations; iteration++) { // Create item for loop iteration LoopItem item = newItem(iteration); // Add and populate item add(item); populateItem(item); } } } The TabbedPanel creates the following LoopItem which access the ITab-List directly. return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag){...} @Override public boolean isVisible() { // direct access of the tab return getTabs().get(tabIndex).isVisible(); } }; The problem now is, if the tabs-list is modfied for example deleted, the onPopulate() method NEEDs to be invoked before the LoopItem.isVisible() the ensure that the old-Loop-childs (LoopItem) are deleted. This does not happen (Why?) if the TabbedPanel is added/updated in an ajax-call, resulting in ArrayIndexOufBounds-Exception in the LoopItem.isVisible() Method. (tabs.get(tabIndex)). My workaround currently is to invoke the onPopulate() manually during deletion (by beforeRender()). ((MarkupContainer)temporalTabs.get(tabs-container)).get(tabs).beforeRender(); Any Ideas, how to force the onPopulate() get called - maybe invoking modelChanged() on some component??? Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
IndexedSharedResourceCodingStrategy - shared resource not found
I'm mounting a shared resource with IndexedSharedResourceCodingStrategy and in my Application class I've got: init() { ... // DynamicCss extends DynamicWebResource Resource dynamicCssResource = new DynamicCss(); getSharedResources().add(dynCss, dynamicCssResource); mount(new IndexedSharedResourceCodingStrategy(style, dynCss)); ... } I can access the shared resource fine if I obtain it via the ResourceReference constructor e.g. in Page - add(CSSPackageResource.getHeaderContribution(new ResourceReference(dynCss), screen)); But if I try to access the resource via the mount point I get the following error in the logs: http://my host/context path/style o.a.wicket.request.target.resource.SharedResourceRequestTarget - shared resource dynCss not found or not allowed access Is this a bug in IndexedSharedResourceCodingStrategy or am I missing something? Any suggestions much appreciated. -Gianni - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
You can avoid this exception making sure to remove the tab from your panel before the request cycle enter in RESPOND step. On Fri, Sep 25, 2009 at 9:05 AM, Jens Zastrow m...@jens-zastrow.de wrote: Hi, The TabbedPanel internaly uses a Loop to render the tab-components. During a normla GET request the Loop.onPopulate() method ensures that all the loop-childs are removed before adding them again to support a possible change of teh underlying Integer-model. Loop.onPopulate() @Override protected final void onPopulate() { // Remove any previous loop contents removeAll(); // Get number of iterations final int iterations = getIterations(); if (iterations 0) { // Create LoopItems for each iteration for (int iteration = 0; iteration iterations; iteration++) { // Create item for loop iteration LoopItem item = newItem(iteration); // Add and populate item add(item); populateItem(item); } } } The TabbedPanel creates the following LoopItem which access the ITab-List directly. return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag){...} @Override public boolean isVisible() { // direct access of the tab return getTabs().get(tabIndex).isVisible(); } }; The problem now is, if the tabs-list is modfied for example deleted, the onPopulate() method NEEDs to be invoked before the LoopItem.isVisible() the ensure that the old-Loop-childs (LoopItem) are deleted. This does not happen (Why?) if the TabbedPanel is added/updated in an ajax-call, resulting in ArrayIndexOufBounds-Exception in the LoopItem.isVisible() Method. (tabs.get(tabIndex)). My workaround currently is to invoke the onPopulate() manually during deletion (by beforeRender()). ((MarkupContainer)temporalTabs.get(tabs-container)).get(tabs).beforeRender(); Any Ideas, how to force the onPopulate() get called - maybe invoking modelChanged() on some component??? Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Re: FYI: new wicket site
I added it to this Wiki page: http://cwiki.apache.org/confluence/display/WICKET/Sites+and+Products+based+on+Wicket Sites and Products based on Wicket -- View this message in context: http://www.nabble.com/FYI%3A-new-wicket-site-tp17226228p25612209.html Sent from the Wicket - User 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
Re: 508 ajaxdefaultdatatablepanel
can I make ajaxdefaultdatatablepanel 508 ? 508 (http://www.section508.gov/) I think the pagination provided by wicket is 508 am I right ? fachhoch wrote: I am using lot of ajaxdefaultdatatable and our application should be 508 , is there a way to create the sortable columns from this panel 508 ? here the code I use to create a columns new PropertyColumnWFStgAuditEntity(new ModelString(Audit Number),stgAuditGeneral.auditNumber, stgAuditGeneral.auditNumber); in this PropertyColumn or any method inside I can override to add 508 description ? -- View this message in context: http://www.nabble.com/508-ajaxdefaultdatatablepanel-tp25564175p25612339.html Sent from the Wicket - User 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
Re: AjaxFallbackDefaultDataTable header disappear
Meh, I am too retarded: Apparently Wicket 1.4.1 does solve this issue. Thanks a lot and sorry for the double post, Che Che Schneider wrote: Hello all, First of all, great mailing list and awesome knowledge assembled here. Some of the posts are true eye-openers... I have a little problem with Wicket, or - more likely - with my usage of it. Here goes: I am creating a AjaxFallbackDefaultDataTable and add a couple of rows and my own data provider to it. Nothing special until now. However, my data provider implements the count() and iterator(int, int) methods in a way that the result is depending on a filter field on the page. So basically, you can restrict the results in the table by filtering the name by the value in that field. All of this works great, I get a page counter that works fine and all is refreshed nicely via Ajax by calling: table.setCurrentPage(0); target.addComponent(table); when the form with the filter field is submitted. Also, the correct amount of hits and pages is always displayed in the header. However, if I ever filter so that the results of that search are less than the paging amount, the header disappears. No surprise there, that is what I expect: one page, no header. If I then change the filter so that more than one page of data is returned, the header of the table stays gone. There is no way short of refreshing the whole page to get the header to come back. Does anybody have any idea on why that is? I RTFM and STFW but apparently nobody has had that problem before (or I am too retarded to find it). Thanks a lot for your help, Che -- -- Flow Traders B.V. Che Schneider Software Development c...@flowtraders.com mailto:c...@flowtraders.com T +31 20 799 6788 F +31 20 799 6780 Jacob Bontiusplaats 9 1018 LL Amsterdam The Netherlands www.flowtraders.com http://www.flowtraders.com Chamber of Commerce Amsterdam 33.22.3268 Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. Flow Traders B.V. aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten. This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. Flow Traders B.V. accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AjaxFallbackDefaultDataTable header disappear
Hello all, First of all, great mailing list and awesome knowledge assembled here. Some of the posts are true eye-openers... I have a little problem with Wicket, or - more likely - with my usage of it. Here goes: I am creating a AjaxFallbackDefaultDataTable and add a couple of rows and my own data provider to it. Nothing special until now. However, my data provider implements the count() and iterator(int, int) methods in a way that the result is depending on a filter field on the page. So basically, you can restrict the results in the table by filtering the name by the value in that field. All of this works great, I get a page counter that works fine and all is refreshed nicely via Ajax by calling: table.setCurrentPage(0); target.addComponent(table); when the form with the filter field is submitted. Also, the correct amount of hits and pages is always displayed in the header. However, if I ever filter so that the results of that search are less than the paging amount, the header disappears. No surprise there, that is what I expect: one page, no header. If I then change the filter so that more than one page of data is returned, the header of the table stays gone. There is no way short of refreshing the whole page to get the header to come back. Does anybody have any idea on why that is? I RTFM and STFW but apparently nobody has had that problem before (or I am too retarded to find it). Thanks a lot for your help, Che -- -- Flow Traders B.V. Che Schneider Software Development c...@flowtraders.com mailto:c...@flowtraders.com T +31 20 799 6788 F +31 20 799 6780 Jacob Bontiusplaats 9 1018 LL Amsterdam The Netherlands www.flowtraders.com http://www.flowtraders.com Chamber of Commerce Amsterdam 33.22.3268 Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. Flow Traders B.V. aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten. This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. Flow Traders B.V. accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wizard help
Sorry for the duplicate post. I don't think my first post went through. I have looked at the examples and the javadocs but can't figure out how to do the following. I am a wicket newbie. I want to create a wizard with 2 steps implemented as panels. Step 1: Asks the user to enter some information. Validates that the information entered is in the database before moving to step 2. [I have this working] Step 2: Based on the information entered in step 1, look in the db for the matching data and display the rest of the information. [part I am having trouble with] This is to implement a forgot password functionality. Based on the username entered in step 1, look up a question in the db, then display the question to the user in step 2 so they can answer it. Then after successfully answering the question perform some logic to reset the password. I am just having trouble with the move from Step 1 to Step 2. I assume the success logic would be implemented in the onFinish() method of my ForgotPasswordWizard The code [just displaying the constructors]: public ForgotPasswordWizard(String id) { super(id); ForgotPasswordModel bean = new ForgotPasswordModel(); setDefaultModel(new CompoundPropertyModelForgotPasswordModel(bean)); WizardModel model = new WizardModel(); model.add(new ForgotPasswordStep1()); model.add(new ForgotPasswordStep2()); init(model); } public ForgotPasswordStep1() { super(new Model(ForgotPasword), new Model(Enter your username [email])); RequiredTextField username = new RequiredTextField(username); username.add(EmailAddressValidator.getInstance()); add(username); IFormValidator validator = new AccountValidator(username); this.add(validator); } public ForgotPasswordStep2() { super(new Model(ForgotPasword), new Model(Answer your Security Question)); // ?? // find the question from the db for the user ForgotPasswordModel myModel = (ForgotPasswordModel) this.getDefaultModelObject(); // access the db to get the actual question myModel.setQuestion([the question I shoud show]); // ??? add(new Label(question)); add(new RequiredTextField(answer)); } Thanks. Jeff
Re: Wizard help
I am just having trouble with the move from Step 1 to Step 2. I assume the success logic would be implemented in the onFinish() method of my ForgotPasswordWizard You can use an listener to implement success logic, onFinish will to be called when Finish button get pressed http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m1/org/apache/wicket/extensions/wizard/IWizardModelListener.html On Fri, Sep 25, 2009 at 11:00 AM, Jeffrey Schneller jeffrey.schnel...@envisa.com wrote: Sorry for the duplicate post. I don't think my first post went through. I have looked at the examples and the javadocs but can't figure out how to do the following. I am a wicket newbie. I want to create a wizard with 2 steps implemented as panels. Step 1: Asks the user to enter some information. Validates that the information entered is in the database before moving to step 2. [I have this working] Step 2: Based on the information entered in step 1, look in the db for the matching data and display the rest of the information. [part I am having trouble with] This is to implement a forgot password functionality. Based on the username entered in step 1, look up a question in the db, then display the question to the user in step 2 so they can answer it. Then after successfully answering the question perform some logic to reset the password. I am just having trouble with the move from Step 1 to Step 2. I assume the success logic would be implemented in the onFinish() method of my ForgotPasswordWizard The code [just displaying the constructors]: public ForgotPasswordWizard(String id) { super(id); ForgotPasswordModel bean = new ForgotPasswordModel(); setDefaultModel(new CompoundPropertyModelForgotPasswordModel(bean)); WizardModel model = new WizardModel(); model.add(new ForgotPasswordStep1()); model.add(new ForgotPasswordStep2()); init(model); } public ForgotPasswordStep1() { super(new Model(ForgotPasword), new Model(Enter your username [email])); RequiredTextField username = new RequiredTextField(username); username.add(EmailAddressValidator.getInstance()); add(username); IFormValidator validator = new AccountValidator(username); this.add(validator); } public ForgotPasswordStep2() { super(new Model(ForgotPasword), new Model(Answer your Security Question)); // ?? // find the question from the db for the user ForgotPasswordModel myModel = (ForgotPasswordModel) this.getDefaultModelObject(); // access the db to get the actual question myModel.setQuestion([the question I shoud show]); // ??? add(new Label(question)); add(new RequiredTextField(answer)); } Thanks. Jeff -- Pedro Henrique Oliveira dos Santos
Seeking speaker for BeJug, October 14th
The Belgian Java User Group is seeking a speaker for a Wicket event on October 14th, in Leuven, Belgium [1] You can find more details here: http://www.bejug.org/confluenceBeJUG/display/BeJUG/Home Due to a full schedule I'm not able to speak, so I'm looking for someone who wishes to promote Wicket for the Belgian Java folks. If you're interested, please contact i...@bejug.org for more details and appointments. Martijn Dashorst [1] http://maps.google.com/maps?client=safarirls=enq=maps+leuven+belgiumoe=UTF-8um=1ie=UTF-8hq=hnear=Leuven,+Belgiumei=TdC8SvuRGdD3-Qbiv_3RCwsa=Xoi=geocode_resultct=titleresnum=1 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
Did you mean the the tab from the TabbedPanel or the whole TabbedPane from my page? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Wizard help
Do I override the onFinish() method of my wizard or do I add a listener to my wizard and put the logic there? It looks like the wicket Wizard that I am extending already implements the IWizardModelListener [according to the java doc] This will allow me to perform logic needed when the wizard finishes. I still don't know how to perform logic between step 1 and step 2. Flow is: Step 1 = ask for username Step 1 = press next ?? Look up username in db and get additional info ?? Step 2 = present additional info for edit ?? Step 2 = press Finish Update the db and set response page to send the user on their way Do I use the onActiveStepChanged() method and use getActiveStep() to see what step I am coming from and do my lookup if the active step is 1? The examples don't show a good example of a wizard that uses data from one step to present additional information in another step. Otherwise the examples are very good. Thanks. -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Friday, September 25, 2009 10:12 AM To: users@wicket.apache.org Subject: Re: Wizard help I am just having trouble with the move from Step 1 to Step 2. I assume the success logic would be implemented in the onFinish() method of my ForgotPasswordWizard You can use an listener to implement success logic, onFinish will to be called when Finish button get pressed http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m1/org/apache/wi cket/extensions/wizard/IWizardModelListener.html On Fri, Sep 25, 2009 at 11:00 AM, Jeffrey Schneller jeffrey.schnel...@envisa.com wrote: Sorry for the duplicate post. I don't think my first post went through. I have looked at the examples and the javadocs but can't figure out how to do the following. I am a wicket newbie. I want to create a wizard with 2 steps implemented as panels. Step 1: Asks the user to enter some information. Validates that the information entered is in the database before moving to step 2. [I have this working] Step 2: Based on the information entered in step 1, look in the db for the matching data and display the rest of the information. [part I am having trouble with] This is to implement a forgot password functionality. Based on the username entered in step 1, look up a question in the db, then display the question to the user in step 2 so they can answer it. Then after successfully answering the question perform some logic to reset the password. I am just having trouble with the move from Step 1 to Step 2. I assume the success logic would be implemented in the onFinish() method of my ForgotPasswordWizard The code [just displaying the constructors]: public ForgotPasswordWizard(String id) { super(id); ForgotPasswordModel bean = new ForgotPasswordModel(); setDefaultModel(new CompoundPropertyModelForgotPasswordModel(bean)); WizardModel model = new WizardModel(); model.add(new ForgotPasswordStep1()); model.add(new ForgotPasswordStep2()); init(model); } public ForgotPasswordStep1() { super(new Model(ForgotPasword), new Model(Enter your username [email])); RequiredTextField username = new RequiredTextField(username); username.add(EmailAddressValidator.getInstance()); add(username); IFormValidator validator = new AccountValidator(username); this.add(validator); } public ForgotPasswordStep2() { super(new Model(ForgotPasword), new Model(Answer your Security Question)); // ?? // find the question from the db for the user ForgotPasswordModel myModel = (ForgotPasswordModel) this.getDefaultModelObject(); // access the db to get the actual question myModel.setQuestion([the question I shoud show]); // ??? add(new Label(question)); add(new RequiredTextField(answer)); } Thanks. Jeff -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form Data Not Available When Testing a TextArea component
I have a very simple Wicket web page with one TextArea for data entry on a form. This is contained in a NavomaticBorder. The form works properly, as the data is successfully saved to the database when the Submit button is clicked. My JUnit test fails however, because the data is null. I am using the setValue method of the FormTester object, and when I step through the code can see the value being saved. However, when I execute clickLink() and get into the form submit method, the data is null. I even tried stepping through the Wicket source code, but I can't figure out where the data gets lost. Can someone help with this? Here is my test code: WicketTester tester = new WicketTester(partSelectLicenseWeb); tester.startPage(LicenseDataReplace.class); FormTester formTester = tester.newFormTester(navomaticBorder:licenseDataReplaceForm); formTester.setValue(licenseCode, xyz); tester.clickLink(navomaticBorder:licenseDataReplaceForm:submitButton); tester.assertRenderedPage(LicenseDataReplaceResult.class); Page resultPage = tester.getLastRenderedPage(); numLicensesSaved = resultPage.get(numLicensesSaved).toString(); Here is my form HTML: form wicket:id=licenseDataReplaceForm action= wicket:message key=copy.paste.license.codeCopy and paste a license code:/wicket:messagebr/ textarea cols=50 rows=1 wicket:id=licenseCode/textareabr/ input wicket:id=submitButton type=submit value=Submit wicket:message=value:submit / /form Here is my (simplified) web page code: public class LicenseDataReplace extends WebPage { TextArea licenseCode = new TextArea(licenseCode, new Model()); public LicenseDataReplace() { class LicenseDataReplaceForm extends Form { protected void onSubmit() { String enteredCode = LicenseDataReplace.this .getLicenseCode() .getDefaultModelObjectAsString()); ... save enteredCode to database ... navigate to next page } public LicenseDataReplaceForm(String id) { super(id); } }; NavomaticBorder navomaticBorder = new NavomaticBorder(navomaticBorder); navomaticBorder.add(new Image(logo)); navomaticBorder.add(new Image(message)); Form form = new LicenseDataReplaceForm(licenseDataReplaceForm); form.add(licenseCode); SubmitLink submitLink = new SubmitLink(submitButton); form.add(submitLink); navomaticBorder.add(form); add(navomaticBorder); } STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify WHI Solutions immediately at g...@whisolutions.com, and destroy all copies of this message and any attachments.
Re: Palette Update Behaviour Problem
OK, I changed the code as follows, and I'm getting a null on the patentsPalette.getRecorderComponent() method. PaletteCategory patentsPalette = new PaletteCategory (categoryPalette, selected, allCategories, renderer, 10, false); final Recorder recorder = patentsPalette.getRecorderComponent (); recorder.add( new AjaxFormComponentUpdatingBehavior ( onchange ) { @Override protected void onUpdate ( AjaxRequestTarget ajaxRequestTarget ) { selectedDocumentModel.getObject().addCategory ((Category)recorder.getSelectedChoices().next()); } }); All of this takes place in the constructor for my form. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AjaxLink refresh and calling the constructor again.
On Fri, Sep 25, 2009 at 12:38 PM, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I have this: add(new PanelModulo(module,players,myPlayers.jpg, new PropertyModel(modelo,players), true){ private static final long serialVersionUID = -3739151258006568848L; @Override public Panel getPanelContenido(String id, IModel modelo) { return new Resumen(id, modelo); } }); I have a AjaxLink which takes the component module (component above) and added to the target. I see ajax wicket debug making the request but, I realized that It didn't call the constructor again, instead of It just re send the old render. I needed because the new PropertyModel(modelo, players) would come with new data. What am I doing wrong? ps: The constructor call getPanelContenido() method. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: Palette Update Behaviour Problem
Ok. I am sorry to bother you. I add the behavior at before render time: protected void onBeforeRender() { super.onBeforeRender(); final Recorder recorder=palette.getRecorderComponent(); palette.getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior( onchange) { @SuppressWarnings(unchecked) @Override protected void onUpdate(AjaxRequestTarget target) { } }); } and I has been working right to me. But, if you would like to extend Pallete and overwrite newRecorderCompoent + adding the behavior, It seemed to be fine. On Fri, Sep 25, 2009 at 12:27 PM, Tim Hughes thug...@troglobyte.com wrote: OK, I changed the code as follows, and I'm getting a null on the patentsPalette.getRecorderComponent() method. PaletteCategory patentsPalette = new PaletteCategory(categoryPalette, selected, allCategories, renderer, 10, false); final Recorder recorder = patentsPalette.getRecorderComponent(); recorder.add( new AjaxFormComponentUpdatingBehavior( onchange ) { @Override protected void onUpdate ( AjaxRequestTarget ajaxRequestTarget ) { selectedDocumentModel.getObject().addCategory((Category)recorder.getSelectedChoices().next()); } }); All of this takes place in the constructor for my form. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Fernando Wermus. www.linkedin.com/in/fernandowermus
User name validation - how to check database to find if a name has already been taken?
Hello, I would like to get your suggestion about how to validate a user name input by checking if the name has already been taken (exists in the back-end database); and how to show feedback messages right next to the input field if it has. Typically, when a user registers to a website, he needs to choose a user name, a password, etc. To make sure that the chosen name is unique, one needs to access the back-end database to check if it already exists. My solution right now is to extend AbstractValidatorString, and override onValidate(IValidatableString validatable) to put the database-checking logic in it. But the more I think about it, the more I felt it might be a wrong solution. The problem (I think, not 100% sure) is that onValidate(IValidatableString validatable) will be called during the form validation process, even if this process goes through, I may still find out later that the user chosen name has been taken when trying to save all the user inputs (name, password, etc) to the database. This happens when another user registers with the same name between the time the validation process finished and the time I start persisting all inputs from the first user to the database, So now I am trying to figure out another solution. Here is the idea: Instead of putting the database-checking logic into the validation process, I simply try to save all the user inputs into the database after receiving them. If an unique key exception happens, I know that the user chosen name has been taken. Now my questions are: 1. where should I put this save-catch-exception logic? Is Form.onSubmit() the right place to put it? 2. After I catch an unique key exception. How can I show a feedback message like This name has already been taken RIGHT NEXT to the user name input field? (Just like what a typical Wicket Validator does though FeedbackPanel). I am new to Wicket and your inputs and suggestions are greatly appreciated. Cheers Paul
Re: User name validation - how to check database to find if a name has already been taken?
I think you are overcomplicating things. Validate the users input, if two users want the same name within 1 second of each request you probably have bigger problems to deal with. Anyhow, when submit is called, if you get a nonunique exception. Catch in dao/service and throw an exception wicket can handle and present. Ryan Gravener http://bit.ly/no_word_docs On Fri, Sep 25, 2009 at 11:58 AM, Paul Huang paulhuan...@gmail.com wrote: Hello, I would like to get your suggestion about how to validate a user name input by checking if the name has already been taken (exists in the back-end database); and how to show feedback messages right next to the input field if it has. Typically, when a user registers to a website, he needs to choose a user name, a password, etc. To make sure that the chosen name is unique, one needs to access the back-end database to check if it already exists. My solution right now is to extend AbstractValidatorString, and override onValidate(IValidatableString validatable) to put the database-checking logic in it. But the more I think about it, the more I felt it might be a wrong solution. The problem (I think, not 100% sure) is that onValidate(IValidatableString validatable) will be called during the form validation process, even if this process goes through, I may still find out later that the user chosen name has been taken when trying to save all the user inputs (name, password, etc) to the database. This happens when another user registers with the same name between the time the validation process finished and the time I start persisting all inputs from the first user to the database, So now I am trying to figure out another solution. Here is the idea: Instead of putting the database-checking logic into the validation process, I simply try to save all the user inputs into the database after receiving them. If an unique key exception happens, I know that the user chosen name has been taken. Now my questions are: 1. where should I put this save-catch-exception logic? Is Form.onSubmit() the right place to put it? 2. After I catch an unique key exception. How can I show a feedback message like This name has already been taken RIGHT NEXT to the user name input field? (Just like what a typical Wicket Validator does though FeedbackPanel). I am new to Wicket and your inputs and suggestions are greatly appreciated. Cheers Paul - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Stuff commit access
You're added. -- Jeremy Thomerson http://www.wickettraining.com 2009/9/25 Slawek ss...@consol.pl Hello Please grant me commit access for wicket stuff. I want help develop objectautocomplete component . My sf account name : slawekstec My Jira account name : slawekstec thanx Slawomir Stec - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Stuff commit access
damn, beat me by a second! -igor On Fri, Sep 25, 2009 at 9:11 AM, Jeremy Thomerson jer...@wickettraining.com wrote: You're added. -- Jeremy Thomerson http://www.wickettraining.com 2009/9/25 Slawek ss...@consol.pl Hello Please grant me commit access for wicket stuff. I want help develop objectautocomplete component . My sf account name : slawekstec My Jira account name : slawekstec thanx Slawomir Stec - 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: Form Data Not Available When Testing a TextArea component
clickLink() ? shouldnt you be submitting the form? links dont submit forms afaik. -igor On Fri, Sep 25, 2009 at 8:21 AM, Caristi, Joe jcari...@whisolutions.com wrote: I have a very simple Wicket web page with one TextArea for data entry on a form. This is contained in a NavomaticBorder. The form works properly, as the data is successfully saved to the database when the Submit button is clicked. My JUnit test fails however, because the data is null. I am using the setValue method of the FormTester object, and when I step through the code can see the value being saved. However, when I execute clickLink() and get into the form submit method, the data is null. I even tried stepping through the Wicket source code, but I can't figure out where the data gets lost. Can someone help with this? Here is my test code: WicketTester tester = new WicketTester(partSelectLicenseWeb); tester.startPage(LicenseDataReplace.class); FormTester formTester = tester.newFormTester(navomaticBorder:licenseDataReplaceForm); formTester.setValue(licenseCode, xyz); tester.clickLink(navomaticBorder:licenseDataReplaceForm:submitButton); tester.assertRenderedPage(LicenseDataReplaceResult.class); Page resultPage = tester.getLastRenderedPage(); numLicensesSaved = resultPage.get(numLicensesSaved).toString(); Here is my form HTML: form wicket:id=licenseDataReplaceForm action= wicket:message key=copy.paste.license.codeCopy and paste a license code:/wicket:messagebr/ textarea cols=50 rows=1 wicket:id=licenseCode/textareabr/ input wicket:id=submitButton type=submit value=Submit wicket:message=value:submit / /form Here is my (simplified) web page code: public class LicenseDataReplace extends WebPage { TextArea licenseCode = new TextArea(licenseCode, new Model()); public LicenseDataReplace() { class LicenseDataReplaceForm extends Form { protected void onSubmit() { String enteredCode = LicenseDataReplace.this .getLicenseCode() .getDefaultModelObjectAsString()); ... save enteredCode to database ... navigate to next page } public LicenseDataReplaceForm(String id) { super(id); } }; NavomaticBorder navomaticBorder = new NavomaticBorder(navomaticBorder); navomaticBorder.add(new Image(logo)); navomaticBorder.add(new Image(message)); Form form = new LicenseDataReplaceForm(licenseDataReplaceForm); form.add(licenseCode); SubmitLink submitLink = new SubmitLink(submitButton); form.add(submitLink); navomaticBorder.add(form); add(navomaticBorder); } STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify WHI Solutions immediately at g...@whisolutions.com, and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: User name validation - how to check database to find if a name has already been taken?
Ryan Gravener-3 wrote: I think you are overcomplicating things. Validate the users input, if two users want the same name within 1 second of each request you probably have bigger problems to deal with. So you think my current solution (extending AbstractValidator) is OK? But I still need to catch nonunique exceptions when saving all user inputs. Anyhow, when submit is called, if you get a nonunique exception. Catch in dao/service and throw an exception wicket can handle and present. Ryan Gravener http://bit.ly/no_word_docs For additional commands, e-mail: users-h...@wicket.apache.org Can you be a little bit more specific? After I catch a nonuqniue exception, how should I change the page markup to present an error message? Any examples/references will be helpful. -- View this message in context: http://www.nabble.com/User-name-validation---how-to-check-database-to-find-if-a-name-has--already-been-taken--tp25614625p25615006.html Sent from the Wicket - User 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
Re: User name validation - how to check database to find if a name has already been taken?
form { onsubmit() { try { users.persist(getmodelobject()); } catch (usernamealreadyexistsexception e) { error(error.username.exists); } } } -igor On Fri, Sep 25, 2009 at 9:05 AM, Ryan Gravener r...@ryangravener.com wrote: I think you are overcomplicating things. Validate the users input, if two users want the same name within 1 second of each request you probably have bigger problems to deal with. Anyhow, when submit is called, if you get a nonunique exception. Catch in dao/service and throw an exception wicket can handle and present. Ryan Gravener http://bit.ly/no_word_docs On Fri, Sep 25, 2009 at 11:58 AM, Paul Huang paulhuan...@gmail.com wrote: Hello, I would like to get your suggestion about how to validate a user name input by checking if the name has already been taken (exists in the back-end database); and how to show feedback messages right next to the input field if it has. Typically, when a user registers to a website, he needs to choose a user name, a password, etc. To make sure that the chosen name is unique, one needs to access the back-end database to check if it already exists. My solution right now is to extend AbstractValidatorString, and override onValidate(IValidatableString validatable) to put the database-checking logic in it. But the more I think about it, the more I felt it might be a wrong solution. The problem (I think, not 100% sure) is that onValidate(IValidatableString validatable) will be called during the form validation process, even if this process goes through, I may still find out later that the user chosen name has been taken when trying to save all the user inputs (name, password, etc) to the database. This happens when another user registers with the same name between the time the validation process finished and the time I start persisting all inputs from the first user to the database, So now I am trying to figure out another solution. Here is the idea: Instead of putting the database-checking logic into the validation process, I simply try to save all the user inputs into the database after receiving them. If an unique key exception happens, I know that the user chosen name has been taken. Now my questions are: 1. where should I put this save-catch-exception logic? Is Form.onSubmit() the right place to put it? 2. After I catch an unique key exception. How can I show a feedback message like This name has already been taken RIGHT NEXT to the user name input field? (Just like what a typical Wicket Validator does though FeedbackPanel). I am new to Wicket and your inputs and suggestions are greatly appreciated. Cheers Paul - 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/TabbedPanel] Issue deleting all tabs + ajax-update
ok i'm a little bit confused :-( I didt want to invoke 'tabs.remove()' during a onRender(), but during the onClick() method of by AjaxFallbackLink - like in your example. Using a normal Link the TabbedPanel doesnt throw the exception. Try your example with the AjaxTabbedPane and a AjaxFallbackLink. Then in onClick() you have to add the tp the the AjaxRequestTarget, which later leads to the ArrayIndexOutOfBoundsException. Pedro Santos schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: defaultFormProcessing is no longer considered when processing multipart form in ajax request
Igor, it seems the 1.4 snapshot in the maven repository still contains 1.5 code. I built wicket from sources locally. When I tested the project against that build I found yet another problem. Attempt to submit the form (no matter what value the default processing flag has) led to response with 404 status. I realized that it was the UploadProgressBar's progressbar.js resource reference whose url was obtained using MixedParamHybridUrlCodingStrategy. I created a demo project and attached it to the following issue: https://issues.apache.org/jira/browse/WICKET-2491 Please have a look. I suppose the problem caused by request context that does not countain mounted part of the page so the url to the resource does not contain the ../../.. part and as the result being applied to the page with context /some/some/some causes 404. igor.vaynberg wrote: the problem is that trunk did not have version numbers updated so it was building as 1.4 for a while. this has been fixed so latest snapshots should be properly built out of branch. -igor On Sat, Sep 19, 2009 at 10:50 PM, Vladimir K koval...@gmail.com wrote: The latest 1.4 snapshot does not define IComponentBorder interface in addition to disappeared form component persistence. Is it supposed that 1.4.2 breaks compatibility with 1.4.1? I see the only way to check the fix in wicket-ajax.js - mix it into wicket 1.4.1 jar. Vladimir K wrote: I use 1.4-snapshot from http://wicketstuff.org/maven/repository/org/apache/wicket/wicket/1.4-SNAPSHOT/ Persistence of form components has been removed from 1.4 as well.z martin-g wrote: You have to use 1.4.x branch. trunk is for 1.5. form persistence is removed only in trunk El vie, 18-09-2009 a las 05:32 -0700, Vladimir K escribió: Igor, thanks for the fix. I tried to compile against 1.4.2-20090916 and obtained two compilation errors. Now FormComponent does not contain method setPersistent() and Page does not contain method removePersistedFormData(). What API should be used instead? Vladimir K wrote: Igor, could you plan it for 1.4.2? Vladimir K wrote: done https://issues.apache.org/jira/browse/WICKET-2463 Vladimir K wrote: sure igor.vaynberg wrote: i guess create a quickstart and attach it to a jira issue. when i tested buttons, while developing the feature, it seemed to work fine. -igor On Wed, Sep 9, 2009 at 10:40 PM, Vladimir K koval...@gmail.com wrote: it is attached to the input tag as follows: form wicket:id=actionForm enctype='multipart/form-data' div class=buttonBox input wicket:id=cancelAction type=submit wicket:message=value:command.cancelAction/input /div /form From my perspective the request is submitted very similar to as I remember submitting drop downs many years ago select onchange=this.form.submit(); The request parameters contain the name of the form instead of the name of the button. igor.vaynberg wrote: this bit of javascript: if (submitButton != null) { s += Wicket.Form.encode(submitButton) + =1; } is needed because we do perform a custom form serialization - really just constructing the query string - that we submit back to server via ajax. the multipart handling performs a regular post into a hidden iframe so the browser performs the serialization - and that should include the button. what markup is your button attached to? -igor On Wed, Sep 9, 2009 at 8:18 PM, Vladimir Kovalyuk koval...@gmail.com wrote: I added AjaxFallbackButton(Cancel).setDefaultFormProcessing(false) to the multipart form and when it is pressed the form is handled as well as the button would have defaultFormProcessing=true. It happens because request parameters does not contain the name of the submitting button. The magic is in the new code in wicket-ajax.js // Submits a form using ajax. // This method serializes a form and sends it as POST body. submitForm: function(form, submitButton) { if (this.handleMultipart(form)) { return true; } var body = function() { var s = Wicket.Form.serialize(form); if (submitButton != null) { s += Wicket.Form.encode(submitButton) + =1; } return s; } return this.request.post(body); }, I believe the problem is caused by handleMultipart(form) invocation. submitForm function accepts submitButton parameter but does not passes it to handleMultipart function. Igor could you clarify that? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
I couldn't simulate, can you send the stack trace? On Fri, Sep 25, 2009 at 1:25 PM, Jens Zastrow m...@jens-zastrow.de wrote: ok i'm a little bit confused :-( I didt want to invoke 'tabs.remove()' during a onRender(), but during the onClick() method of by AjaxFallbackLink - like in your example. Using a normal Link the TabbedPanel doesnt throw the exception. Try your example with the AjaxTabbedPane and a AjaxFallbackLink. Then in onClick() you have to add the tp the the AjaxRequestTarget, which later leads to the ArrayIndexOutOfBoundsException. Pedro Santos schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
RE: Form Data Not Available When Testing a TextArea component
Thank you. That was it. I appreciate the help! -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Friday, September 25, 2009 12:22 PM To: users@wicket.apache.org Subject: Re: Form Data Not Available When Testing a TextArea component clickLink() ? shouldnt you be submitting the form? links dont submit forms afaik. -igor On Fri, Sep 25, 2009 at 8:21 AM, Caristi, Joe jcari...@whisolutions.com wrote: I have a very simple Wicket web page with one TextArea for data entry on a form. This is contained in a NavomaticBorder. The form works properly, as the data is successfully saved to the database when the Submit button is clicked. My JUnit test fails however, because the data is null. I am using the setValue method of the FormTester object, and when I step through the code can see the value being saved. However, when I execute clickLink() and get into the form submit method, the data is null. I even tried stepping through the Wicket source code, but I can't figure out where the data gets lost. Can someone help with this? Here is my test code: WicketTester tester = new WicketTester(partSelectLicenseWeb); tester.startPage(LicenseDataReplace.class); FormTester formTester = tester.newFormTester(navomaticBorder:licenseDataReplaceForm); formTester.setValue(licenseCode, xyz); tester.clickLink(navomaticBorder:licenseDataReplaceForm:submitButton); tester.assertRenderedPage(LicenseDataReplaceResult.class); Page resultPage = tester.getLastRenderedPage(); numLicensesSaved = resultPage.get(numLicensesSaved).toString(); Here is my form HTML: form wicket:id=licenseDataReplaceForm action= wicket:message key=copy.paste.license.codeCopy and paste a license code:/wicket:messagebr/ textarea cols=50 rows=1 wicket:id=licenseCode/textareabr/ input wicket:id=submitButton type=submit value=Submit wicket:message=value:submit / /form Here is my (simplified) web page code: public class LicenseDataReplace extends WebPage { TextArea licenseCode = new TextArea(licenseCode, new Model()); public LicenseDataReplace() { class LicenseDataReplaceForm extends Form { protected void onSubmit() { String enteredCode = LicenseDataReplace.this .getLicenseCode() .getDefaultModelObjectAsString()); ... save enteredCode to database ... navigate to next page } public LicenseDataReplaceForm(String id) { super(id); } }; NavomaticBorder navomaticBorder = new NavomaticBorder(navomaticBorder); navomaticBorder.add(new Image(logo)); navomaticBorder.add(new Image(message)); Form form = new LicenseDataReplaceForm(licenseDataReplaceForm); form.add(licenseCode); SubmitLink submitLink = new SubmitLink(submitButton); form.add(submitLink); navomaticBorder.add(form); add(navomaticBorder); } STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify WHI Solutions immediately at g...@whisolutions.com, and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify WHI Solutions immediately at g...@whisolutions.com, and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Activate datapicker onblur
Hi all, how can i activate (open datapicker window) when user click(or focus) on the correlate textbox? Thanks Luca
Re: AjaxLink refresh and calling the constructor again.
ajax wicket debug making the request but, I realized that It didn't call the constructor again the components add to ajax request target already are instantiated. You need to resolve the complexity of new data refresh on your component model. See if at some point you are updating players property in an object outside the model. On Fri, Sep 25, 2009 at 12:42 PM, Fernando Wermus fernando.wer...@gmail.com wrote: On Fri, Sep 25, 2009 at 12:38 PM, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I have this: add(new PanelModulo(module,players,myPlayers.jpg, new PropertyModel(modelo,players), true){ private static final long serialVersionUID = -3739151258006568848L; @Override public Panel getPanelContenido(String id, IModel modelo) { return new Resumen(id, modelo); } }); I have a AjaxLink which takes the component module (component above) and added to the target. I see ajax wicket debug making the request but, I realized that It didn't call the constructor again, instead of It just re send the old render. I needed because the new PropertyModel(modelo, players) would come with new data. What am I doing wrong? ps: The constructor call getPanelContenido() method. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos
GridView and refreshing with an ajax call
Hi all,I have an ajaxclick which should refresh a gridview, but this doesnt happened. I saw someone reporting the same issue and I would like to know if this has been fixed it. The fact, it is that the gridview' s model is called just one at construction time. It does refresh the gridview but with the old data from the model. Thanks in advance. -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: AjaxLink refresh and calling the constructor again.
I do. I realized the following: ListDataProvider which I extend to get the data show, doesnt take models!! It only takes list. When ayaxlink is called, the ListDataProvider is refreshed but with old data because It lacks of a model. There is a mail talking about this issue. http://osdir.com/ml/users-wicket.apache.org/2009-03/msg01175.html On Fri, Sep 25, 2009 at 1:42 PM, Pedro Santos pedros...@gmail.com wrote: ajax wicket debug making the request but, I realized that It didn't call the constructor again the components add to ajax request target already are instantiated. You need to resolve the complexity of new data refresh on your component model. See if at some point you are updating players property in an object outside the model. On Fri, Sep 25, 2009 at 12:42 PM, Fernando Wermus fernando.wer...@gmail.com wrote: On Fri, Sep 25, 2009 at 12:38 PM, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I have this: add(new PanelModulo(module,players,myPlayers.jpg, new PropertyModel(modelo,players), true){ private static final long serialVersionUID = -3739151258006568848L; @Override public Panel getPanelContenido(String id, IModel modelo) { return new Resumen(id, modelo); } }); I have a AjaxLink which takes the component module (component above) and added to the target. I see ajax wicket debug making the request but, I realized that It didn't call the constructor again, instead of It just re send the old render. I needed because the new PropertyModel(modelo, players) would come with new data. What am I doing wrong? ps: The constructor call getPanelContenido() method. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos -- Fernando Wermus. www.linkedin.com/in/fernandowermus
ListDataProvider doesnt take models. Why?
I have some problems refreshing a GridView because ListDataProvider doesnt take Models. Why? It doesnt make sense, models are an esencial part of wicket and I couldn't find any implementation which takes model. Am I wrong? I had to implement my own ListDataProvider. package com.misPartidos.web.widgets.resumenes; import java.io.Serializable; import java.util.Iterator; import java.util.List; import org.apache.wicket.markup.repeater.data.IDataProvider; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; public class MyListDataProvider implements IDataProvider { private static final long serialVersionUID = -1233815423206383563L; private IModel list; public MyListDataProvider(IModel list){ this.list=list; } @SuppressWarnings(unchecked) public Iterator iterator(final int first, final int count) { int toIndex = first + count; if (toIndex size()) { toIndex = size(); } return getList().subList(first, toIndex).listIterator(); } public int size() { return getList().size(); } public IModel model(Object object) { return new Model((Serializable)object); } public void detach() { } @SuppressWarnings(unchecked) public List getList(){ return (List) list.getObject(); } } -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: AjaxLink refresh and calling the constructor again.
1 - be sure to work on those list items. You are working on new ones? Keep an referent to this list, call list.clear() and add those new items on it. 2 - how about to implement your own IDataProvider? ListDataProvider is a very simple implementation that helds one single list On Fri, Sep 25, 2009 at 1:52 PM, Fernando Wermus fernando.wer...@gmail.comwrote: I do. I realized the following: ListDataProvider which I extend to get the data show, doesnt take models!! It only takes list. When ayaxlink is called, the ListDataProvider is refreshed but with old data because It lacks of a model. There is a mail talking about this issue. http://osdir.com/ml/users-wicket.apache.org/2009-03/msg01175.html On Fri, Sep 25, 2009 at 1:42 PM, Pedro Santos pedros...@gmail.com wrote: ajax wicket debug making the request but, I realized that It didn't call the constructor again the components add to ajax request target already are instantiated. You need to resolve the complexity of new data refresh on your component model. See if at some point you are updating players property in an object outside the model. On Fri, Sep 25, 2009 at 12:42 PM, Fernando Wermus fernando.wer...@gmail.com wrote: On Fri, Sep 25, 2009 at 12:38 PM, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I have this: add(new PanelModulo(module,players,myPlayers.jpg, new PropertyModel(modelo,players), true){ private static final long serialVersionUID = -3739151258006568848L; @Override public Panel getPanelContenido(String id, IModel modelo) { return new Resumen(id, modelo); } }); I have a AjaxLink which takes the component module (component above) and added to the target. I see ajax wicket debug making the request but, I realized that It didn't call the constructor again, instead of It just re send the old render. I needed because the new PropertyModel(modelo, players) would come with new data. What am I doing wrong? ps: The constructor call getPanelContenido() method. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos
Problem with @RequireHttps and Tests
I put the @RequireHttps annotation in my LoginPage, and it's work fine when i run the app. But when i run my tests all test fail, if I remove @RequireHttps all test pass correctly Here's the problem, when i run this code without the annotation the wicket tester call the button btn_login. If i put the @RequireHttps annotation this code don't work. protected final static void logarUsuario() { tester.startPage(LoginPage.class); tester.assertRenderedPage(LoginPage.class); tester.assertNoErrorMessage(); final FormTester form = tester.newFormTester(form); form.setValue(email, username); form.setValue(pass, password); form.submit(btn_login); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket-auth-roles + EJB 3 (Authentication and Authorization)
jraanamo wrote: - how did you get the principal all the way to the ejb container (via jndi context?) and which container were you using? - were you able to handle authorization via e.g. @RolesAllowed annotations? Ok, I got principal delegated to ejb container by using Glassfish's ProgrammaticLogin - if anyone is interested. The problem though is that no roles are returned by this api so I cannot populate hive's LoginContext properly. I wonder is Swarm+EJB3 is a good idea or maybe I should stick with auth-roles. Any experiences would be welcome. -- View this message in context: http://www.nabble.com/Wicket-auth-roles-%2B-EJB-3-%28Authentication-and-Authorization%29-tp22649841p25616404.html Sent from the Wicket - User 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
Re: Problem with @RequireHttps and Tests
so in your tests do not install the httpsrequestcycleprocessor -igor On Fri, Sep 25, 2009 at 10:46 AM, Rangel Preis rangel...@gmail.com wrote: I put the @RequireHttps annotation in my LoginPage, and it's work fine when i run the app. But when i run my tests all test fail, if I remove @RequireHttps all test pass correctly Here's the problem, when i run this code without the annotation the wicket tester call the button btn_login. If i put the @RequireHttps annotation this code don't work. protected final static void logarUsuario() { tester.startPage(LoginPage.class); tester.assertRenderedPage(LoginPage.class); tester.assertNoErrorMessage(); final FormTester form = tester.newFormTester(form); form.setValue(email, username); form.setValue(pass, password); form.submit(btn_login); } Thanks all. - 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
2 new models for wicket
heyho everyone, since i'm not satisfied with the provided models, i started to write my own. the current behaviour with compoundproperty model is, that compoundproperty model serves as host for an object and components can use properties of that host by having the correct id that has to equal the name of the property. since wicket is a component-oriented framework, there is a use case that happens very often. it is that you have some domain-object that you write an edit-form for that allows you to edit the properties of this domain-object. now if you want to use this edit-form, you have to give it a model, which would be a compoundpropertymodel. every component inside can now use it by having the correct id. suppose our domain-object A is in this case a property of another domain-object B: B.A . if i want to use the edit-form like it was supposed to, i would have to give it a compoundpropertymodel. this means, i have to get A out of B and put it inside a new compoundpropertymodel. but i dont want to do this. i want to have exactly one object-hosting model off which every other component can look up its needed properties. i believe i'm doing this for reasons of performance, because i believe that if a would have another compoundpropertymodel, there would be more serialization-work. besides that i would use detachable-models, which would worsen the situation, because A would be loaded twice! the solution for a single object-hosting compoundpropertymodel would be to adapt the component ids in A's editform, which is completely unacceptable because it would now depend on the fact, that A is now inside another object. what if B was a property of C? or if C in turn was a property of D? or if A was standalone. only one use case is covered with this solution. its not acceptable for a component oriented framework. thats why i started to write my own models. there should be an object-hosting model and some kind of property-model that can use the hosting model. the root-markupcontainer would therefor have such a hosting model which provided B. this markup-container would hold A's edit-form as a child and give it such a property-model that can access the host-model's object. now the magic thing, this property-model in turn would serve as host for A's edit-form. all the components in this edit-form in turn would have such property-models again, that access the edit-forms modelobject and resolve the desired properties. therefor i called this property-model InheritedPropertyModel. another, in my eyes, advantage is, that if a component doesnt have its own model, it will receive the next model up in the component-hierarchy. and because i think this is good, i also made the host-model an inheritedmodel and since it is also chainable, i called it InheritedChainableModel. now i tried to implement those two and there is a problem i'm facing. i can't traverse through the component-hierarchy to find the right model-object. i need this object so i can run the propertyresolver on it. i can only call getDefaultModelObject() to find out. and now there is the problem: imagine the following component hierarchy: panel-markupcontainer-form-label InheritedChainingModel-InheritedPropertyModel-nothing-InheritedPropertyModel B-A-nothing-somePropertyOfA the label calls getObject(): this.owner.getParent().getDefaultModelObject() the InheritedPropertyModel knows its owner (IComponentAssignedModel) which is the label, calls its parent, which is the form and asks for the default model-object. since the form doesnt have a model, it's getDefaultModelObject() calls: initModel() initModel() traverses the component-hierarchy up until it finds the first IComponentInheritedModel. it finds it in the markupcontainer and its an InheritedPropertyModel. this one now is asked getObject(): this.owner.getParent().getDefaultModelObject() this one will give the object of the hosting InheritedChainingModel of the panel with B in it. now B is given back to the markupcontainer which continues its getObject(): (W)PropertyResolver.getValue(this.property, target); property is A and target is B - A as object is returned to the form which in turn continues its getObject(): (W)PropertyResolver.getValue(this.property, target); since this model is an inherited from markupcontainer, it has the same property which is A, but the target this time is A itself, coming from the markupcontainer. and this is the problem... when i look at a components model, i dont want it to be initialized, i just want to know if there is some IComponentInheritedModel. getModelImpl() is the way to go, but it is not visible. getInnermostModel() calls getDefaultModel(). i dont have a chance. or can somebody see a solution to this? i think there isnt any. since i'm willing to contribute those two models, i propose to change something in the wickets component-code. give me a hasModel(). or give me a public getModel(). i would do these
Re: AjaxLink refresh and calling the constructor again.
Pedro, I chose the second option and now is working. What I do not understand is why there isnt a ListDataProvider (provided by wicket) that accepts models. On Fri, Sep 25, 2009 at 2:23 PM, Pedro Santos pedros...@gmail.com wrote: 1 - be sure to work on those list items. You are working on new ones? Keep an referent to this list, call list.clear() and add those new items on it. 2 - how about to implement your own IDataProvider? ListDataProvider is a very simple implementation that helds one single list On Fri, Sep 25, 2009 at 1:52 PM, Fernando Wermus fernando.wer...@gmail.comwrote: I do. I realized the following: ListDataProvider which I extend to get the data show, doesnt take models!! It only takes list. When ayaxlink is called, the ListDataProvider is refreshed but with old data because It lacks of a model. There is a mail talking about this issue. http://osdir.com/ml/users-wicket.apache.org/2009-03/msg01175.html On Fri, Sep 25, 2009 at 1:42 PM, Pedro Santos pedros...@gmail.com wrote: ajax wicket debug making the request but, I realized that It didn't call the constructor again the components add to ajax request target already are instantiated. You need to resolve the complexity of new data refresh on your component model. See if at some point you are updating players property in an object outside the model. On Fri, Sep 25, 2009 at 12:42 PM, Fernando Wermus fernando.wer...@gmail.com wrote: On Fri, Sep 25, 2009 at 12:38 PM, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I have this: add(new PanelModulo(module,players,myPlayers.jpg, new PropertyModel(modelo,players), true){ private static final long serialVersionUID = -3739151258006568848L; @Override public Panel getPanelContenido(String id, IModel modelo) { return new Resumen(id, modelo); } }); I have a AjaxLink which takes the component module (component above) and added to the target. I see ajax wicket debug making the request but, I realized that It didn't call the constructor again, instead of It just re send the old render. I needed because the new PropertyModel(modelo, players) would come with new data. What am I doing wrong? ps: The constructor call getPanelContenido() method. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Pedro Henrique Oliveira dos Santos -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: 2 new models for wicket
Puhh, very long article. Did you've tried MyDomainModel myDomainModel; CompoundPropertyModel model = new CompoundPropertyModel(myDomainModel); AContainer.add(new MarkupContainer(new PropertyModel(model, theGetPropertyInMyDomainModelToSubModel)); If MyDomainModel provides an accessor for theGetPropertyInMyDomainModelToSubModel you can build the chain. HTH Per g...@gmx.net schrieb: heyho everyone, since i'm not satisfied with the provided models, i started to write my own. the current behaviour with compoundproperty model is, that compoundproperty model serves as host for an object and components can use properties of that host by having the correct id that has to equal the name of the property. since wicket is a component-oriented framework, there is a use case that happens very often. it is that you have some domain-object that you write an edit-form for that allows you to edit the properties of this domain-object. now if you want to use this edit-form, you have to give it a model, which would be a compoundpropertymodel. every component inside can now use it by having the correct id. suppose our domain-object A is in this case a property of another domain-object B: B.A . if i want to use the edit-form like it was supposed to, i would have to give it a compoundpropertymodel. this means, i have to get A out of B and put it inside a new compoundpropertymodel. but i dont want to do this. i want to have exactly one object-hosting model off which every other component can look up its needed properties. i believe i'm doing this for reasons of performance, because i believe that if a would have another compoundpropertymodel, there would be more serialization-work. besides that i would use detachable-models, which would worsen the situation, because A would be loaded twice! the solution for a single object-hosting compoundpropertymodel would be to adapt the component ids in A's editform, which is completely unacceptable because it would now depend on the fact, that A is now inside another object. what if B was a property of C? or if C in turn was a property of D? or if A was standalone. only one use case is covered with this solution. its not acceptable for a component oriented framework. thats why i started to write my own models. there should be an object-hosting model and some kind of property-model that can use the hosting model. the root-markupcontainer would therefor have such a hosting model which provided B. this markup-container would hold A's edit-form as a child and give it such a property-model that can access the host-model's object. now the magic thing, this property-model in turn would serve as host for A's edit-form. all the components in this edit-form in turn would have such property-models again, that access the edit-forms modelobject and resolve the desired properties. therefor i called this property-model InheritedPropertyModel. another, in my eyes, advantage is, that if a component doesnt have its own model, it will receive the next model up in the component-hierarchy. and because i think this is good, i also made the host-model an inheritedmodel and since it is also chainable, i called it InheritedChainableModel. now i tried to implement those two and there is a problem i'm facing. i can't traverse through the component-hierarchy to find the right model-object. i need this object so i can run the propertyresolver on it. i can only call getDefaultModelObject() to find out. and now there is the problem: imagine the following component hierarchy: panel-markupcontainer-form-label InheritedChainingModel-InheritedPropertyModel-nothing-InheritedPropertyModel B-A-nothing-somePropertyOfA the label calls getObject(): this.owner.getParent().getDefaultModelObject() the InheritedPropertyModel knows its owner (IComponentAssignedModel) which is the label, calls its parent, which is the form and asks for the default model-object. since the form doesnt have a model, it's getDefaultModelObject() calls: initModel() initModel() traverses the component-hierarchy up until it finds the first IComponentInheritedModel. it finds it in the markupcontainer and its an InheritedPropertyModel. this one now is asked getObject(): this.owner.getParent().getDefaultModelObject() this one will give the object of the hosting InheritedChainingModel of the panel with B in it. now B is given back to the markupcontainer which continues its getObject(): (W)PropertyResolver.getValue(this.property, target); property is A and target is B - A as object is returned to the form which in turn continues its getObject(): (W)PropertyResolver.getValue(this.property, target); since this model is an inherited from markupcontainer, it has the same property which is A, but the target this time is A itself, coming from the markupcontainer. and this is the problem... when i look at a components model, i dont want it to be initialized, i just want to know if there is some
Re: 2 new models for wicket
or new CompoundPropertyModel(new PropertyModel(model, theGetPropertyInMyDomainModelToSubModel)) which basically creates a CPM that refers to a property of another CPM. personally i do not like CPMs, they are a shortcut that gets abused way too often :) -igor On Fri, Sep 25, 2009 at 11:21 AM, Per Newgro per.new...@gmx.ch wrote: Puhh, very long article. Did you've tried MyDomainModel myDomainModel; CompoundPropertyModel model = new CompoundPropertyModel(myDomainModel); AContainer.add(new MarkupContainer(new PropertyModel(model, theGetPropertyInMyDomainModelToSubModel)); If MyDomainModel provides an accessor for theGetPropertyInMyDomainModelToSubModel you can build the chain. HTH Per g...@gmx.net schrieb: heyho everyone, since i'm not satisfied with the provided models, i started to write my own. the current behaviour with compoundproperty model is, that compoundproperty model serves as host for an object and components can use properties of that host by having the correct id that has to equal the name of the property. since wicket is a component-oriented framework, there is a use case that happens very often. it is that you have some domain-object that you write an edit-form for that allows you to edit the properties of this domain-object. now if you want to use this edit-form, you have to give it a model, which would be a compoundpropertymodel. every component inside can now use it by having the correct id. suppose our domain-object A is in this case a property of another domain-object B: B.A . if i want to use the edit-form like it was supposed to, i would have to give it a compoundpropertymodel. this means, i have to get A out of B and put it inside a new compoundpropertymodel. but i dont want to do this. i want to have exactly one object-hosting model off which every other component can look up its needed properties. i believe i'm doing this for reasons of performance, because i believe that if a would have another compoundpropertymodel, there would be more serialization-work. besides that i would use detachable-models, which would worsen the situation, because A would be loaded twice! the solution for a single object-hosting compoundpropertymodel would be to adapt the component ids in A's editform, which is completely unacceptable because it would now depend on the fact, that A is now inside another object. what if B was a property of C? or if C in turn was a property of D? or if A was standalone. only one use case is covered with this solution. its not acceptable for a component oriented framework. thats why i started to write my own models. there should be an object-hosting model and some kind of property-model that can use the hosting model. the root-markupcontainer would therefor have such a hosting model which provided B. this markup-container would hold A's edit-form as a child and give it such a property-model that can access the host-model's object. now the magic thing, this property-model in turn would serve as host for A's edit-form. all the components in this edit-form in turn would have such property-models again, that access the edit-forms modelobject and resolve the desired properties. therefor i called this property-model InheritedPropertyModel. another, in my eyes, advantage is, that if a component doesnt have its own model, it will receive the next model up in the component-hierarchy. and because i think this is good, i also made the host-model an inheritedmodel and since it is also chainable, i called it InheritedChainableModel. now i tried to implement those two and there is a problem i'm facing. i can't traverse through the component-hierarchy to find the right model-object. i need this object so i can run the propertyresolver on it. i can only call getDefaultModelObject() to find out. and now there is the problem: imagine the following component hierarchy: panel-markupcontainer-form-label InheritedChainingModel-InheritedPropertyModel-nothing-InheritedPropertyModel B-A-nothing-somePropertyOfA the label calls getObject(): this.owner.getParent().getDefaultModelObject() the InheritedPropertyModel knows its owner (IComponentAssignedModel) which is the label, calls its parent, which is the form and asks for the default model-object. since the form doesnt have a model, it's getDefaultModelObject() calls: initModel() initModel() traverses the component-hierarchy up until it finds the first IComponentInheritedModel. it finds it in the markupcontainer and its an InheritedPropertyModel. this one now is asked getObject(): this.owner.getParent().getDefaultModelObject() this one will give the object of the hosting InheritedChainingModel of the panel with B in it. now B is given back to the markupcontainer which continues its getObject(): (W)PropertyResolver.getValue(this.property, target); property is A and target is B - A as object is returned to the form which in turn continues its getObject():
Re: GridView and refreshing with an ajax call
Did you add the component to AjaxRequestTarget target.addComponent(yourGridview) Also don't forget this : yourGridview.setOutputMarkupId(true); A.B.A 2009/9/25 Fernando Wermus fernando.wer...@gmail.com Hi all,I have an ajaxclick which should refresh a gridview, but this doesnt happened. I saw someone reporting the same issue and I would like to know if this has been fixed it. The fact, it is that the gridview' s model is called just one at construction time. It does refresh the gridview but with the old data from the model. Thanks in advance. -- Fernando Wermus. www.linkedin.com/in/fernandowermus -- Altuğ.
html tag doesn't render by the browser
Hi all ; Problem is html tag - bold brdoesn't process ; I don't know if this problem related with Wicket. Let me explain it by simple code: HTML side : wicket:panel span wicket:id=test test code comes here /span /wicket:panel Java side : String test = Java bSoftware/b technology.; item.add( new Label(test, test) ); When i test the code; i see the output like that : Java bSoftware/b technology. Note : Software is not in bold; the html source code and the view is the same bSoftware/b. Any suggestions ? Thanks. -- Altuğ.
Re: html tag doesn't render by the browser
Wicket is using html scape character to output your string on model, so it will to be presented as '' and ''. u can set FLAG_ESCAPE_MODEL_STRINGS to the componet http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString() On Fri, Sep 25, 2009 at 7:38 PM, Altuğ B. Altıntaş alt...@gmail.com wrote: Hi all ; Problem is html tag - bold brdoesn't process ; I don't know if this problem related with Wicket. Let me explain it by simple code: HTML side : wicket:panel span wicket:id=test test code comes here /span /wicket:panel Java side : String test = Java bSoftware/b technology.; item.add( new Label(test, test) ); When i test the code; i see the output like that : Java bSoftware/b technology. Note : Software is not in bold; the html source code and the view is the same bSoftware/b. Any suggestions ? Thanks. -- Altuğ. -- Pedro Henrique Oliveira dos Santos
Re: html tag doesn't render by the browser
Thanks Pedro; String test = Get the latest Java bSoftware/b and br/explore how Java technology provides a better digital experience.; Label label = new Label(test, new Model(test)); label.setEscapeModelStrings(false); works for me !! setEscapeModelStrings(false); is the key part. Thanks. 2009/9/26 Pedro Santos pedros...@gmail.com Wicket is using html scape character to output your string on model, so it will to be presented as '' and ''. u can set FLAG_ESCAPE_MODEL_STRINGS to the componet http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString()http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString%28%29 On Fri, Sep 25, 2009 at 7:38 PM, Altuğ B. Altıntaş alt...@gmail.com wrote: Hi all ; Problem is html tag - bold brdoesn't process ; I don't know if this problem related with Wicket. Let me explain it by simple code: HTML side : wicket:panel span wicket:id=test test code comes here /span /wicket:panel Java side : String test = Java bSoftware/b technology.; item.add( new Label(test, test) ); When i test the code; i see the output like that : Java bSoftware/b technology. Note : Software is not in bold; the html source code and the view is the same bSoftware/b. Any suggestions ? Thanks. -- Altuğ. -- Pedro Henrique Oliveira dos Santos -- Altuğ.
Re: Form Processing problem on pages with Border - Wicket 1.4.1
When I first posted this, I posted it multiple times thinking that it wasn't going through. Sorry about that. Pedro S had posted a reply to one of the duplicates I have since removed and I wanted to put it here: = The internalUpdateFormComponentModels method in 1.3.6 didn't look for the border and visit it's components. It's not obvious to me why this needs to be done now in 1.4. The objective is to notify form's event to generic containers... When the form is submitted, the DropDownChoice's value is being reset. you can implement the updateModel() of your DropDownChoice and implement the behavior you are expecting, or you can require on JIRA that the wicket form component stop notifying your components on generic containers. http://issues.apache.org/jira/browse/WICKET-1853 = I thought about this. Here's the problem: When I change the value I really do need to update the backing model. If I override updateModel (and don't call the super updateModel) my backing model will never be updated when the dropdown is changed. If I don't override it, or do and call the super method, I'll get a null value on every form submit from Form#component. I put a QuickStart up here: http://silverlion.com/flavius/BorderVisit.zip If you unzip it and run mvn jetty:run this will demonstrate what's going on. Just go to the home page and press the submit button. So overriding updateModel() isn't an option, as I see it. My choices that I see thus far are: 1. Alter the wicket source code to remove the updates on Border, which I really don't want to do because I haven't gone through everything to see what I will break doing that. 2. Move away from using a Border and lose the ability to swap out borders based on role/group, etc I would love a third option that I currently don't see. As a side note, I can see the benefit of notifying all the components in the border, but can't that be an optional thing? In my onSubmit() method, I can always call FormComponent.visitComponentsPostOrder(border, new FormModelUpdateVisitor(this)); But with the way it is now, I have no way to opt out of having my components updated. Is anybody else who uses borders having an issue like this? -- View this message in context: http://www.nabble.com/Form-Processing-problem-on-pages-with-Border---Wicket-1.4.1-tp25595716p25621988.html Sent from the Wicket - User 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
Re: html tag doesn't render by the browser
on your label call .setEscapeModelStrings(true); -- Jeremy Thomerson http://www.wickettraining.com On Fri, Sep 25, 2009 at 6:28 PM, Altuğ B. Altıntaş alt...@gmail.com wrote: Thanks Pedro; String test = Get the latest Java bSoftware/b and br/explore how Java technology provides a better digital experience.; Label label = new Label(test, new Model(test)); label.setEscapeModelStrings(false); works for me !! setEscapeModelStrings(false); is the key part. Thanks. 2009/9/26 Pedro Santos pedros...@gmail.com Wicket is using html scape character to output your string on model, so it will to be presented as '' and ''. u can set FLAG_ESCAPE_MODEL_STRINGS to the componet http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString()http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString%28%29 http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString%28%29 On Fri, Sep 25, 2009 at 7:38 PM, Altuğ B. Altıntaş alt...@gmail.com wrote: Hi all ; Problem is html tag - bold brdoesn't process ; I don't know if this problem related with Wicket. Let me explain it by simple code: HTML side : wicket:panel span wicket:id=test test code comes here /span /wicket:panel Java side : String test = Java bSoftware/b technology.; item.add( new Label(test, test) ); When i test the code; i see the output like that : Java bSoftware/b technology. Note : Software is not in bold; the html source code and the view is the same bSoftware/b. Any suggestions ? Thanks. -- Altuğ. -- Pedro Henrique Oliveira dos Santos -- Altuğ.
Re: html tag doesn't render by the browser
Oops - meant false - and then also saw the other replies. -- Jeremy Thomerson http://www.wickettraining.com On Fri, Sep 25, 2009 at 10:42 PM, Jeremy Thomerson jer...@wickettraining.com wrote: on your label call .setEscapeModelStrings(true); -- Jeremy Thomerson http://www.wickettraining.com On Fri, Sep 25, 2009 at 6:28 PM, Altuğ B. Altıntaş alt...@gmail.comwrote: Thanks Pedro; String test = Get the latest Java bSoftware/b and br/explore how Java technology provides a better digital experience.; Label label = new Label(test, new Model(test)); label.setEscapeModelStrings(false); works for me !! setEscapeModelStrings(false); is the key part. Thanks. 2009/9/26 Pedro Santos pedros...@gmail.com Wicket is using html scape character to output your string on model, so it will to be presented as '' and ''. u can set FLAG_ESCAPE_MODEL_STRINGS to the componet http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString()http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString%28%29 http://static.ddpoker.com/javadoc/wicket/1.4-rc2/org/apache/wicket/Component.html#getDefaultModelObjectAsString%28%29 On Fri, Sep 25, 2009 at 7:38 PM, Altuğ B. Altıntaş alt...@gmail.com wrote: Hi all ; Problem is html tag - bold brdoesn't process ; I don't know if this problem related with Wicket. Let me explain it by simple code: HTML side : wicket:panel span wicket:id=test test code comes here /span /wicket:panel Java side : String test = Java bSoftware/b technology.; item.add( new Label(test, test) ); When i test the code; i see the output like that : Java bSoftware/b technology. Note : Software is not in bold; the html source code and the view is the same bSoftware/b. Any suggestions ? Thanks. -- Altuğ. -- Pedro Henrique Oliveira dos Santos -- Altuğ.