Re: Unable to Traverse with IVisitor: Some Class Names Have $1 at the end
hi Eugene. Super class will do that for you -- when you create an anonymous subclass of a button, its parent would be a Button. So just print out parent class name if the component's class name contains $ sign it will do the trick. best wishes, alex On Nov 1, 2012 6:09 PM, eugenebalt eugeneb...@yahoo.com wrote: Thanks Duesen, but if I get the superclass, how can I actually get the type of *this* class? I need to find out if the anonymous class is a Button, a TextField, a Link, etc. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unable-to-Traverse-with-IVisitor-Some-Class-Names-Have-1-at-the-end-tp4653532p4653536.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: chekbox - allow only 5 selected
Hi! As the first A in AJAX stands for Asynchronous, you may hit weird results with this solution, especially on slow internet connection. Which means that no one guarantees that if user clicks checkbox1 and then checkbox2 answers would arrive in such a manner. What I would do in this case - I would just write a very simple JQuery callback which would listen to checkbox check/uncheck events and would disable remaining checkboxes once 5 are selected, plus show warning. It is synchronous, immediate, and the rule - max 5 - seems to be easy to employ on the client side. Surely we need to leave the check for 'max 5' in the onsubmit validator as we want it to be independent of the javascript. Regards, Alex. 2012/7/3 Martin Grigorov mgrigo...@apache.org You can assign AjaxFormChoiceComponentUpdatingBehavior to the group and check its model object's size in #onUpdate() But this will fire Ajax requests for each and every click on the checkboxes. On Tue, Jul 3, 2012 at 7:09 PM, Dan12321 wee...@centrum.cz wrote: Hi, I have CheckGroupUser group = new CheckGroupUser(usersGroup, list); and in repeater I add checkbox: item.add(new CheckUser(checkboxUser, group)); I have got 20 checkboxes, but I want to allow only 5 checkboxes select. When will be selected more than 5 checkboxes, it shows error (in feedback). I want to check this when the checkbox is selected (not after submitting form). Could help me, how can I do it? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/chekbox-allow-only-5-selected-tp4650340.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Alexander Cherednichenko [ the only way out is the way up ]
Re: How to redirect to a page from an AJAX request?
hi! you could check it with the Wicket Ajax Debug - for the ajax redirect it should receive and process javascript instruction which resets location of the page. maybe there are some JS errors out there? On May 22, 2012 8:59 AM, Melinda Dweer melinda.dw...@gmail.com wrote: IFAIK setResponsePage(Page.class) should work: at least I remember using it successfully on an AJAX request cycle to redirect to a different page. Regards, Melinda On Tue, May 22, 2012 at 2:41 AM, Alec Swan alecs...@gmail.com wrote: Hello, I use AjaxSubmitLink to submit a form that has captcha. I refresh captcha by adding it to ajax request. However, when the user successfully submits the form I want to redirect the user to a different page. I tried setResponsePage and throw new RestartResponseException in AjaxSubmitLink#onSubmit, but they seem to have no effect. How can I redirect the user to a page from an ajax request? Thanks, Alec - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wizard clear all formfields
Hi! If the question is correctly understood by me, all u need is to traverse the form for all the components and clear input -- then just use form component visitor, traverse the entire form and clear components' input. however itd be good if someone else on the list told if such a solution is any good. regards, Alex. On May 15, 2012 10:50 AM, jensiator jens.alen...@gmail.com wrote: Hi everyone. I got a problem. Anyone ever had a first step contain for example a dropdown that will load default data to the other formcomponents in the wizard? The dropdown has got a ajaxformcomponentupdatingbehavior. We call our server in the ajax request and update a lot of properties in the model object. The model object shared between all of the pages. If you show step2 it will show the correct default values. If you then go back to step1 again and change the dropdown, step2 will not show the changes. This I because I need to clear the input of the formcomponents in step2. Is there any way to clear all formcomponents for all steps in a wizard. The problem is that only one step at the time is active. Is Overriding onBefore render on every single step the only way? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wizard-clear-all-formfields-tp4634057.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wizard clear all formfields
Then, manual traversal of the components of the newStep.getView(VIEW_ID, this, this) with the form component visitor and clearing input for every form component would work. Surely, if it is the same object returned every time from getView(...) 2012/5/15 jensiator jens.alen...@gmail.com Yes you are correct. I forgot to mention that I have already tried it. It does not work because Step2 formcomponents is not a part of the wizard form when step1 is. I think its done here in Wizard class public void onActiveStepChanged(IWizardStep newStep) { form.replace(newStep.getView(VIEW_ID, this, this)); form.replace(newStep.getHeader(HEADER_ID, this, this)); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wizard-clear-all-formfields-tp4634057p4634120.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Alexander Cherednichenko [ the only way out is the way up ]
Re: Bookmarkablepagelink with anchor
Hi! For this case we have subclassed protected CharSequence getURL() which is in BookmarkablePageLink. And - we just append anchor to it while passing it in the constructor or even model to the BookmarkablePageLink. In the override we call super.getURL() and then append an anchor. I see pretty much the same logic in some inner class of AutoLinkResolver -- so we are on the right way :) Regards, Alex. 2012/5/15 Gaetan Zoritchak g.zoritc...@moncoachfinance.com Hi all, I wanted to make a link on a Bookmarkablepage with an anchor. I didn't find how to do it. The link has a setAnchor(Component) method but it can't be that because the targeted anchor does not exist yet. My hope was that the method would take a String as parameter: myLink.setAnchor(#8765); What is the best way of doing it under wicket 1.5.x? Thanks, -- Alexander Cherednichenko [ the only way out is the way up ]
Re: Feedback panel inside form
Hi! We have created our own thing -- FeedbackLabel, which stands next to the component inside of a form, and also works as a feedback. It takes component to listen to as a constructor argument, and then just adds appropriate class/title when there's something to show. For our app, if something is wrong, label turns red and hovering it displays the error text. Then, for the case of Ajax Submit one would need to add all the feedback labels to the AjaxRequestTarget. We do this with the FormComponentVisitor. public class FeedbackLabel extends Label { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (feedbackSource.getFeedbackMessage() == null) { return; } if (feedbackSource.getFeedbackMessage().isRendered()) { return; } FeedbackMessage fbMessage = feedbackSource.getFeedbackMessage(); fbMessage.markRendered(); if (feedbackSource.getFeedbackMessage().getMessage() == null) { LOGGER.warn(Unable to render component feedback message - it is null! Component is + feedbackSource.getPath()); } tag.put(title, fbMessage.getMessage().toString()); tag.put(class, CSS_VALIDATION_ERROR_CLASS); } } br, alex. 2012/5/14 Martin Grigorov mgrigo...@apache.org On Mon, May 14, 2012 at 10:36 AM, Chris Colman chr...@stepaheadsoftware.com wrote: I added it inside the form in the markup and made sure I added the FeedbackPanel to the form component itself and it appears to work quite well. The wicket framework must have a flexible algorithm when looking for the FeedbackPanel component to toggles it's visibility and add error messages. I had previously always assumed that it only looked for the FeedbackPanel in the parent of the form component. FeedbackPanel cares about this itself. Depending on the feedbackmessagefilter it decides whether there are any messages for it and changes its visibility. FeedbackPanel do not know anything about any Form component(s). -Original Message- From: Andrea Del Bene [mailto:adelb...@ciseonweb.it] Sent: Monday, 14 May 2012 6:22 PM To: users@wicket.apache.org Subject: Re: Feedback panel inside form Hi, it's absolutely ok to insert a feedback panel into its form. Every example of feedback panel I have seen places the feedback panel outside the form element. I have some markup from a client that has some Javascript doing client side validation with a styled feedback panel (a div) inside the form element itself. Is it only convention that sees most Wicket samples having the feedback panel outside the form? i.e. can Wicket use a feedback panel that is actually inside the form? Yours sincerely, Chris Colman Pagebloom Team Leader, Step Ahead Software pagebloom - your business your website growing together Sydney:(+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 Email: chr...@stepahead.com.au mailto://chr...@stepahead.com.au Website: http://www.pagebloom.com blocked::http://www.pagebloom.com/ http://develop.stepaheadsoftware.com blocked::http://develop.stepaheadsoftware.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Alexander Cherednichenko [ the only way out is the way up ]
Re: Force child component enabled
Hi! I'd make this case more general -- we have faced the one like this in non-JS-case. For instance, there is a Panel which contains a DataTable. Each row of datatable represents a Document. Each row contains a set of buttons - Edit Confirm and Download. When panel is hidden due to security (isVisibleInHierarchy and authorization strategy) no issues here. However, in a case when we make the whole panel disabled with the permissions, everything would be disabled within this panel. It is good for Edit, Confirm buttons. It is not good for Download button. Requirement and common sense allow for viewing everything. I was unable to get this on easily :( Issue is that Component's both isEnableAllowed (bindings to the auth strategy) and isEnabledInHierarchy(traversing up component tree) are final. Thus there is no way to make an 'exception' for certain components. In our case, if the parent panel is disabled, everything within it would be disabled, with no exceptions. And we need an exception. We had to go the hard way of making our own layer of components which support more flexible enabled/readonly behavior -- extending every single component. Also, instead of using built-in MetaDataRoleAuthorizationStrategy which is looped into component's life cycle we had to bind this behavior in the compat layer component's own lifecycle (binding to onBeforeRender and modifying isEnabled accordingly). Maybe there's some better way that we missed? Using wicket 1.4 Thank you all! br, alex. 2012/5/9 Martin Grigorov mgrigo...@apache.org Hi, Why don't use plain Javascript for this. It will be faster because it wont make roundtrip to the server and wont be disabled as a Wicket component ? On Wed, May 9, 2012 at 12:06 PM, Jürgen Lind juergen.l...@iteratec.de wrote: Hi, I have a little problem in my application and maybe someone has an idea how to solve it: I have a complex form that is structured using a custom collapsible AJAX-panel to show/hide certain parts of the form. Now, if a user does not have the write permission for the form, the form is disabled and therefore all input elements as well (which is good). However, for obvious reaons, I would like the collapsible panels to remain enabled. How could I achieve this? I have already tried to have the ajax-link for the panel to always return true from isEnabled, but that seems to be overriden by the parent component. Any ideas where to look? Cheers, Jürgen - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Alexander Cherednichenko [ the only way out is the way up ]
Modal window close behavior - should it hide content?
Hi guys! Using wicket 1.4.18; experiencing a strange behavior. I have a form, modal window in it (we are chaining them). This 'outer' form has its own submit button. The content in modal window does have the form too, with its own validators. So, hierarchy looks like: userForm with submit button - Form (part of the ModalWindow markup) - Form inside modal window content - validator. Issue is that if i open the modal window, fail that validator inside form inside content of MW, and then _close_ modal window, submission of the outermost form fails with the validation of that validator! I did check the stuff, looks like wicket tries to validate it as a nested form, and thus fails. Weird thing is that innermost form is technically not visible on the page, but visible in terms of wicket hierarchy. I looked into the behavior of modal window on close, and it does _not_ hide content however the show() method does setVisible(true) to it. Am i missing something from the picture? Here's MW's close listener (invoked directly from AJAX behavior): protected final void respondOnWindowClosed(AjaxRequestTarget target) { shown = false; // should we cleanup the pagemap? if (deletePageMap == true) { // get the pagemap Session session = Session.get(); IPageMap pageMap = session.pageMapForName(getPageMapName(), false); // if there is any remove it if (pageMap != null) { session.removePageMap(pageMap); deletePageMap = false; } } if (windowClosedCallback != null) { windowClosedCallback.onClose(target); } } Thank you! Regards, -- Alexander Cherednichenko [ the only way out is the way up ]
Asking for download files with non-ascii names.
Hello! Faced an interesting problem, however few hours of googling and trial did not lead to success. wicket is 1.4 The problem: I have an AjaxDownload ( https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html) or DownloadLink ( http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/link/DownloadLink.html), both very good and cool components. Thank you the developers! I am streaming a dynamically-generated content to the user and want them to save it as a file. Usual implementation of both is coming down to ResourceStreamRequestTarget, which in turn does the actual streaming and also sets the content-disposition: attachment; filename=''. And here the trouble starts. If we have, say, cyrillic names of the files to present to user, they are displayed incorrectly in browser. ASCII is okay, but as soon as it comes down to non-english, encoding is broken. That's a good article describing problem in general - http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http (it is a problem of browsers, and not Wicket). The good solution seen there is to add content-disposition header without a filename, and make download happen off the URL which is ending in the desired filename. Now, the question - how do i do it in wicket? Say, I have an AjaxLink within page, which has an AjaxDownload attached to it. AjaxDownload is an anonymous inner class and is using some page's model to generate its data. The callback URL of this behavior is standard and is starting with ?, e.g. I can not add /filename.ext prior to it, it would break wicket's request target location with 404 as a result. The only idea I have at the moment is to mount the page with a Hybrid coding strategy, thus the filename would then be considered just as one of the parameters by the page, but the solution seems to be a little smelly. Did anyone face the same problem? Great thanks and appreciation in advance! with kindest regards, -- Alexander Cherednichenko [ the only way out is the way up ]
Re: Asking for download files with non-ascii names.
Hi guys, I am _really_ sorry for breaking a thread and re-posting it in a separate, but for some reason my personal mailbox was not hit with the answer, I only was able to find it in archives. Subscribed now. Unfortunately, the solution proposed would not work for me. The one in http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ would work well for files, etc, but the issue is that I have a resource, which is generated on-the-fly using values of the component's model. Just to give you a quick sample: // in page ctor: ... AJAXDownloadData download = new AjaxDownloadData() { @SpringBean private PDFGenerator pdfGenerator; public void getFileName() { return getComponent().getModelObject().getCyrillicFileName(); } public void getResourceStream() { return new ByteArrayResource(getComponent().getModelObject().getMimeType(), pdfGenerator.generateSmall(getComponent().getModelObject())).getResourceStream(); } } // end AjaxDownload AjaxLinkData dloadLink = new AjaxLinkData(download) { public void onClick(AjaxRequestTarget target) {downloadBehavior.initiate(target);} ) add(dloadLink); ... The issue with this code is that it is coupled with the model. I was also thinking of another solution: 1. Create a specific page with HybridMountParam or whatever allowing for any number of slashes in the end (so that the filename'd be considered just an ignored param. 2. Whenever the download behavior is needed, attach the download behavior to this component/page, persisting models in it. The issue with this approach is that URL mounting seems to be performed on the page basis, and I see no way of obtaining the reference to a new Page... Maybe there's a way we may attach many IBehaviorListeners to the instance of a page which would then mount under any URL we need? Thank you - and kindest regards, Alex. On Thu, Dec 15, 2011 Martin Grigorov wrote: lex...@gmail.com wrote: Hi, In my app we use Wicket's Resource to upload/download files. We do it to avoid synchronization on page access but I think you can solve your problem with this. Unfortunately I imagine the full solution with Wicket 1.5's #mountResource(). See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ for more details. On Thu, Dec 15, 2011 at 11:54 PM, Alexander Cherednichenko lex...@gmail.com wrote: Hello! Faced an interesting problem, however few hours of googling and trial did not lead to success. wicket is 1.4 The problem: I have an AjaxDownload ( https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html) or DownloadLink ( http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/link/DownloadLink.html), both very good and cool components. Thank you the developers! I am streaming a dynamically-generated content to the user and want them to save it as a file. Usual implementation of both is coming down to ResourceStreamRequestTarget, which in turn does the actual streaming and also sets the content-disposition: attachment; filename=''. This does not work for non-ascii. -- Alexander Cherednichenko [ the only way out is the way up ]