Re: AutoCompleteTextField issues
Take a look at autocomplete's javadoc: * An {@link IAutoCompleteRenderer} is used for rendering of choices. To convert input back into a * non-String type you will have to provide a custom {@link IConverter}, either by overriding * {@link #getConverter(Class)} or by setting a suitable {@link IConverter} on the application's * {@link ConverterLocator}. Sven On 05/14/2013 11:26 PM, saty wrote: I have used this before as a simple String model which works fine but with other types i have some isues going on any help would be appreciated. using: final AutoCompleteTextFieldXYZ something = new AutoCompleteTextFieldXYZ(code, xYZTypeModel, renderer) the options are displayed correctly selects fine too but XYZ.getObject() call throws exception: java.lang.ClassCastException: java.lang.String cannot be cast to XYZ not sure how it is able to Set String in a XYZ type. I am using below renderer IAutoCompleteRendererXYZ renderer = new AbstractAutoCompleteTextRendererXYZ() { private static final long serialVersionUID = 1L; @Override protected String getTextValue(XYZ object) { return XYX.getDisplayText(); } }; Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AutoCompleteTextField-issues-tp4658798.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Attaching Ajax Function to Java Method
Hi, You can use TextTemplate to load the JavaScript with the placeholders. See https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/autocomplete-tagit-parent/autocomplete-tagit/src/main/java/org/wicketstuff/tagit/TagItAjaxBehavior.java#L96 for example. On Wed, May 15, 2013 at 5:19 AM, William Speirs wspe...@apache.org wrote: @Bas Gooren that code you linked was very helpful. I have what I want up and working, but it's using a bunch of ugly jQuery ajax callbacks hacked into StringBuilders :-( @Don Ferguson I don't *think* this is what I'm looking for as I have thousands of options and I don't want them rendered at page load. Instead I want to register a function that will call-back to my Java code when someone start typing and allows me to search. However, I did not run it, just looked at the code. Here is what I have, again it's ugly. Does anyone know how I can clean-up the jQuery.ajax stuff? I've gotta imagine there is a way to do it in Wicket. Thanks in advance... Bill- public class TypeaheadFieldT extends TextFieldT implements IResourceListener { private static final long serialVersionUID = 1L; public TypeaheadField(final String id, final IModelT model) { super(id, model); setOutputMarkupId(true); add(new AttributeModifier(data-provide, typeahead)); } @Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); StringBuilder sb = new StringBuilder(); sb.append($('#); sb.append(getMarkupId().replace(., .)); sb.append(').typeahead(); sb.append(getConfig()); sb.append();); response.render(OnDomReadyHeaderItem.forScript(sb.toString())); } private String getConfig() { final StringBuilder ajaxCall = new StringBuilder(); ajaxCall.append({ \source\: ); ajaxCall.append(function(query, process) { $.ajax({ url: \); ajaxCall.append(urlFor(IResourceListener.INTERFACE, null)); ajaxCall.append(\, data: { \query\: query }, success: function(data, status, jqXHR) { process(data); } }); }, ); ajaxCall.append(items: 4 }); return ajaxCall.toString(); } @Override public void onResourceRequested() { final Request request = getRequestCycle().getRequest(); final IRequestParameters params = request.getRequestParameters(); final String query = params.getParameterValue(query).toOptionalString(); WebResponse webResponse = (WebResponse) getRequestCycle().getResponse(); webResponse.setContentType(application/json); OutputStreamWriter out = new OutputStreamWriter(webResponse.getOutputStream(), getRequest().getCharset()); JSONWriter json = new JSONWriter(out); try { json.array(); json.value(Connecticut); json.value(California); json.value(Colorado); json.endArray(); } catch (JSONException e) { throw new WicketRuntimeException(Could not write Json response, e); } try { out.flush(); } catch (IOException e) { throw new WicketRuntimeException(Could not write Json to servlet response, e); } } } On Tue, May 14, 2013 at 10:04 PM, Don Ferguson don.fergu...@gmail.com wrote: The following seems to work (using wicket 6.7 with the experimental bootstrap module). Basically, this ajax behavior is called on page load. At that point, it writes out the javascript to initialize the object with typeahead parameters. HTML: input wicket:id=typeahead type=text data-provide=typeahead data-items=4 JAVA: add(new TextFieldString(typeahead).add(new TypeAhead())); TypeAhead Behavior: import org.apache.wicket.Component; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import java.util.Arrays; import java.util.List; public class TypeAhead extends AbstractDefaultAjaxBehavior { @Override protected void onBind() { super.onBind(); getComponent().setOutputMarkupId(true); } @Override protected void respond(AjaxRequestTarget target) { String sources = toJSONArray(getOptions()); String script = String.format($('#%s').typeahead( { source: %s } );, getComponent().getMarkupId(), sources); target.appendJavaScript(script); } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(OnDomReadyHeaderItem.forScript( this.getCallbackScript() )); } // OVERRIDE THIS TO SUPPLY LIST OF OPTIONS
Re: Call me page wicket from iframe in page.jsp
Hi, I don't quite understand your question. To have two http sessions you should have two separate applications - one .war with the JSPs and another with Wicket code. Merge them in one app with separate mappings (filter-mapping and servlet-mapping) and they will share the session. On Tue, May 14, 2013 at 6:27 PM, Alis ajcalve...@yahoo.es wrote: Thank you! Now, my problem is that there are two sessions (one in wicket application and another in jsp). How achievement maintain the values existing in the request from wicket to return to interact in the page jsp. Example: page in wicket (Page.java) WebRequestCycle cycle = (WebRequestCycle) RequestCycle.get(); HttpServletRequest request = cycle.getWebRequest().getHttpServletRequest(); HttpServletResponse response = cycle.getWebResponse().getHttpServletResponse(); HttpSession session = request.getSession(); How return a page in jsp. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Call-me-page-wicket-from-iframe-in-page-jsp-tp4658716p4658792.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 Wicket Training Consulting http://jWeekend.com http://jweekend.com/
Re: AutoCompleteTextField issues
Hi, as far as I remember I solved that by using one of the avalaible ACTF constructors with ClassT type. new AutoCompleteTextFieldXYZ(code, xYZTypeModel, renderer, XYZ.class) Patrick Am 14.05.2013 23:26, schrieb saty: I have used this before as a simple String model which works fine but with other types i have some isues going on any help would be appreciated. using: final AutoCompleteTextFieldXYZ something = new AutoCompleteTextFieldXYZ(code, xYZTypeModel, renderer) the options are displayed correctly selects fine too but XYZ.getObject() call throws exception: java.lang.ClassCastException: java.lang.String cannot be cast to XYZ not sure how it is able to Set String in a XYZ type. I am using below renderer IAutoCompleteRendererXYZ renderer = new AbstractAutoCompleteTextRendererXYZ() { private static final long serialVersionUID = 1L; @Override protected String getTextValue(XYZ object) { return XYX.getDisplayText(); } }; Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AutoCompleteTextField-issues-tp4658798.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 -- Mit freundlichen Grüßen, Patrick Davids NuboIT GmbH Co. KG Kieler Str. 103-107 • 25474 Bönningstedt Email: patrick.dav...@nuboit.de Handelsregister: HRA6819 Pi | Amtsgericht Pinneberg Geschäftsführung der Verwaltungsgesellschaft Daniel Fraga Zander HRB10145Pi | Amtsgericht Pinneberg - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ill really apreciate the help to get the selected item of a DropDownChoice using Scala
Hi, On Wed, May 15, 2013 at 6:32 AM, Bruno Moura brunormo...@gmail.com wrote: Hi For some weeks I'm trying to implement a simple combobox, DDC, and I'm struggling with this. I asked for some help several times but unfortunately I didn't archive my goal because I'm failing sometimes to understand scala with wicket, I have a little background with them at the moment. Anyway, my code is showed bellow: *// ComboBox in a listView item.add(new DropDownChoice(customerSelection, new PropertyModel[Customer](customer, name), listCustomer, new ChoiceRenderer[Customer](name))* DropDownChoice[Customer] If I create a variable, for example,* val custName*, to receive the name of the selected customer which functions I need to implement on the creation of DDC object and how can I retrieve this value for the variable? The way you already did it will set the selected value in customer's name. Check PropertyModel's javadoc to understand how it works. If you want to read/write the value in 'custName' then you have to use: new PropertyModel[String](this, custName) Thanks very much for help me. -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/
Re: Possible bug with AjaxLazyLoadPanel
Hi, See AjaxLazyLoadPanel's source. It uses a temporary component until the expensive one is loaded. On Tue, May 14, 2013 at 6:29 PM, Raul ralva...@netwie.com wrote: Hello, I'm trying to get a component to update with Ajax from a AjaxLink, but always returns null, the access component is as follows. Component current = this.getPage().get(commentsPanel).get (modalPanel); Where commentsPanel is a AjaxLazyLoadPanel and modalPanel is of type Panel, If commentsPanel I put Panel type, the component finds correctly, -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Possible-bug-with-AjaxLazyLoadPanel-tp4658793.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 Wicket Training Consulting http://jWeekend.com http://jweekend.com/
Re: Retrieve a value of textField and set the property of the Model
Hi, On Wed, May 15, 2013 at 6:18 AM, Bruno Moura brunormo...@gmail.com wrote: Hi Paul, thanks very much for your help! I followed your suggestion but this peace of code doesn't compile unfortunately: IModel descriptionModel = new PropertyModel[Meeting](meeting, description)); I have tried val descriptionModel[IModel] = new PropertyModel[Meeting](meeting, description)); //wrong systax for scala the easiest is: val descriptionModel = new PropertyModel[Meeting](meeting, description) the more explicit ones are: val descriptionModel : IModel[Meeting] = new PropertyModel[Meeting](meeting, description) val descriptionModel : PropertyModel[Meeting] = new PropertyModel[Meeting](meeting, description) and val descriptionModel = new IModel[Meeting](meeting, description)); // IModel can't be instanced But I'm doing this thing wrong. I made a great progress with my app but now I'm struggling with this issue and I spent a lot of time to archive this simple task. If I'm doing this stuff with java my life could be much easier :-D. I'll appreciate your hep again Thanks very much Bera 2013/5/10 Paul Bors p...@bors.ws Why the Ajax round-trips for each keyup to extract the model's object? Have you tried to implement just the Save link/button and then look-up the model object from inside the onClick() method? In your case it would come from the PropertyModel you use already: TextField description = new TextField(description,new PropertyModel[Meeting](meeting, description)) change to: IModel descriptionModel = new PropertyModel[Meeting](meeting, description)); TextField descriptionTextField = new TextField(description, descriptionModel ); and your link becomes: private class LinkSave(id: String, meeting: Meeting) extends AjaxLink[String](id) { @SpringBean var meetingMediator: TMeetingMediator = _ def onClick(target: AjaxRequestTarget) { meetingDAO.saveMeeting(descriptionModel.getObject()) } } Unless you want to also update some other element on the screen with each user key press I really don't think you need the keyup listener. ~ Thank you, Paul Bors On Thu, May 9, 2013 at 11:03 PM, Bruno Moura brunormo...@gmail.com wrote: I'm trying to implement a ListView and in on column of it I added a listView, for each line, I want to save the data inserted on it and update the model: I'm implemented the code bellow: val description = new TextField(description,new PropertyModel[Meeting](meeting, description)) description.add(new AjaxFormComponentUpdatingBehavior(keyup) { protected def onUpdate(target: AjaxRequestTarget) { description.getDefaultModelObjectAsString } }) item.add(description) And I added a link for each line of my ListView for save the information in database, each line is a instance of a model meeting as is showed bellow: item.add(new LinkSave(save, meeting)) private class LinkSave(id: String, meeting: Meeting) extends AjaxLink[String](id) { @SpringBean var meetingMediator: TMeetingMediator = _ setVisible(clickavel.asInstanceOf[Boolean]) add(new Label(label, new Model[String]() { override def getObject: String = Save })) def onClick(target: AjaxRequestTarget) { meetingDAO.saveMeeting(meeting) } } But unfortunately the code above doesn't work. It's fail to retrieve the value of the text field and also to set the attribute description of the Object meeting with the value of the text field, so in the database the column description is never filled Someone know where I am doing wrong stuff? Thanks a lot! Bera -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/
Re: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)
Hi, thanks for you quick replies! I will create the quick start and attach it to a jira ticket. Thanks to your hint Martin, for the moment I will use jQuery#replaceWith() to make sure my app runs as expected. Best Nico Am 14.05.2013 um 16:56 schrieb Martin Grigorov-4 [via Apache Wicket]: Hi, We use https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617 because it is faster than jQuery#replaceWith(). So yes, there is a small period when both the old and the new are in the DOM. As Sven asked - please create a quicktart and attach it to a ticket so we can see whether we will find a solution or we will have to use the slower way to replace. On Tue, May 14, 2013 at 4:48 PM, Sven Meier [hidden email] wrote: Create a quickstart and attach it to a Jira issue please. Sven On 05/14/2013 04:37 PM, Nico wrote: Hi I migrated my application from Wicket 1.5.10 to 6.7 During testing I recognized that during an ajax update (replacement) of a component, the markup of the component is twice in the HTML markup (the old and the new markup). Thus the execution of javascript inside a component may fail due to the fact, that two components with the same id are present in the HTML markup. EXAMPLE *HTML:* lt;a wicket:id=quot;testlinkquot;**gt;testlinklt;/agt; lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height: 100px; border: 1px solid #ccc;quot;gt; lt;script type=quot;text/javascript**quot;gt; alert(#39;hello#39;); lt;/scriptgt; lt;/divgt; *JAVA:* final WebMarkupContainer testbox = new WebMarkupContainer(testbox); testbox.setOutputMarkupId(**true); add(testbox); add(new AjaxLinkVoid(testlink) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { target.add(testbox); } }); So while the ajax update is processed the 'testbox' DIV and its javascript are present twice (the old and new DIV). If the javascript is a little more complex and for example changes stuff inside the DIV, the javascript will change stuff in the old instead of the new DIV container. My javascript relies on the fact, that an id should always be present just once. Why is the old DIV not removed first, before the new DIV is appended? Can I change this behavior somehow? Thanks in advance Nico -- View this message in context: http://apache-wicket.1842946.** n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-** in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.htmlhttp://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html Sent from the Users forum mailing list archive at Nabble.com. --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden email] For additional commands, e-mail: [hidden email] --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden email] For additional commands, e-mail: [hidden email] -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/ If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658791.html To unsubscribe from Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10), click here. NAML -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658813.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
Manage exceptions on a nested multipart upload form
Hi all ! I have a nested form inside a root one, both are multipart. I want to cutomize the onFileUploadException(..) method of the nested form in order to trace this event. So I overrided the method of my nested form instance, typically to get a trace of file size limit exceeded. But Wicket calls the onFileUploadException(..) on the root form, not on the nested one, so my overrided code doesn't apply. I found that it's due to the AjaxformSubmitBehavior which calls onFormSubmitted(..) on the root form, here's the code : protected void onEvent(final AjaxRequestTarget target) { getForm().getRootForm().onFormSubmitted(new IAfterFormSubmitter() { ... So I used my own behavior with the modified line (getRootForm() removed) : getForm().onFormSubmitted(new IAfterFormSubmitter() and it works : the onFileUploadException(..) of the nested form is called, not this of the root form. I couldn't find another way to make it work, did I miss something ? I think that Wicket should call onFileUploadException(..) on its nested forms so I think the actual behavior is a bug, am I wrong ? (I can fill in a bug if necessary) I'm using Wicket 1.5.10. Thanks !
Re: Manage exceptions on a nested multipart upload form
This was 'discussed' recently: http://apache-wicket.1842946.n4.nabble.com/Overriding-Form-onFileUploadException-in-nested-forms-td4657874.html I don't remember a Jira issue being created though. Sven On 05/15/2013 10:55 AM, Guillaume Mary wrote: Hi all ! I have a nested form inside a root one, both are multipart. I want to cutomize the onFileUploadException(..) method of the nested form in order to trace this event. So I overrided the method of my nested form instance, typically to get a trace of file size limit exceeded. But Wicket calls the onFileUploadException(..) on the root form, not on the nested one, so my overrided code doesn't apply. I found that it's due to the AjaxformSubmitBehavior which calls onFormSubmitted(..) on the root form, here's the code : protected void onEvent(final AjaxRequestTarget target) { getForm().getRootForm().onFormSubmitted(new IAfterFormSubmitter() { ... So I used my own behavior with the modified line (getRootForm() removed) : getForm().onFormSubmitted(new IAfterFormSubmitter() and it works : the onFileUploadException(..) of the nested form is called, not this of the root form. I couldn't find another way to make it work, did I miss something ? I think that Wicket should call onFileUploadException(..) on its nested forms so I think the actual behavior is a bug, am I wrong ? (I can fill in a bug if necessary) I'm using Wicket 1.5.10. Thanks ! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Possible bug with AjaxLazyLoadPanel
I know how it works, in my case the component is already loaded, and I can access it, the problem is I have to access the internal components of the AjaxLazyLoadPanel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Possible-bug-with-AjaxLazyLoadPanel-tp4658793p4658817.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
popup don't be closed with close link
Hi all, I want to close the (help) popup with keyboard. Bud it isn't possible. the close link in HelpPage deleted the content of the popup bud tthe popup don't be closed. can you help me please by this problem? Thanks ! TBEditpage.html: // td wicket:id=bmot_o class=berechnungsmotiva href=# tabindex=-1 wicket:id=helpBM/a/td TBEditpage.java: header.add(helpLink(help, berechnungsmotiv)); private AjaxLink helpLink(final String id, final String helpKey) { return HelpPage.link(id, new Model(helpKey), popupPage); } HelpPage.html: body wicket:extend div id=page div class=content wicket:id=content/div a wicket:id = close href=#close/a /div /wicket:extend /body HelpPage.java - ... public HelpPage(final String helpKey) { //Konstruktor String text = ... ... add(contentLabel(content, text)); add(new PopupCloseLink(close)); } ... public static AjaxLink link(final String id, final String key, final ModalWindow popup) { return link(id, new Model(key), popup); }
Stateless pages
Hey there, i'm currently trying to understand what is actually needed so Wicket considers a page stateful. Could you provide me some basic information on that? Basically, I want the user to authorize for the application and if he's not, he should be send back to the login page. In the case of session timeout, I want to add an error message to the login page, explaining what happened. I thought of using a SimplePageAuthorizationStrategy for the authorization part, and solve the session timeout topic by subclassing the LoginPage (as SessionTimeoutReloginPage or something) and register that as the PageExpiredErrorPage. But somehow, I can't get that error page to show up. The SimplePageAuthorizationStrategy always sends me straight back to the LoginPage after session timeout.
Re: Stateless pages
Hi, On Wed, May 15, 2013 at 4:16 PM, Benedikt Schlegel codecab.dri...@gmail.com wrote: Hey there, i'm currently trying to understand what is actually needed so Wicket considers a page stateful. Could you provide me some basic information on that? A Page is stateless by default. It becomes stateful when: - you call page.setStatelessHint(false) - you add a Component which org.apache.wicket.Component#getStatelessHint() returns false - you add a Behavior which org.apache.wicket.Behavior#getStatelessHint() returns false Basically, I want the user to authorize for the application and if he's not, he should be send back to the login page. In the case of session timeout, I want to add an error message to the login page, explaining what happened. I'm not sure you are able to do this. How you can recognize a request to an expired session versus a completely new request to the app (i.e. there is no session yet) ? I thought of using a SimplePageAuthorizationStrategy for the authorization part, and solve the session timeout topic by subclassing the LoginPage (as SessionTimeoutReloginPage or something) and register that as the PageExpiredErrorPage. PageExpierdErrorPage doesn't mean necessary that the session has expired. PageExpiredException is thrown when a page instance cannot be found in the page store. Reasons could be: - the page is not stored at all (e.g. problems during serialization or simply there is was no store operation for page with id=XYZ) - the store has been overloaded and the oldest page has been removed from it - the session has expired and all pages in the store (i.e. the history stack) has been removed But somehow, I can't get that error page to show up. The SimplePageAuthorizationStrategy always sends me straight back to the LoginPage after session timeout. -- Martin Grigorov Wicket Training Consulting http://jWeekend.com http://jweekend.com/
Re: Overriding Form.onFileUploadException in nested forms
issue 5190 created because of same question asked here http://apache-wicket.1842946.n4.nabble.com/Manage-exceptions-on-a-nested-multipart-upload-form-td4658815.html https://issues.apache.org/jira/browse/WICKET-5190 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-Form-onFileUploadException-in-nested-forms-tp4657874p4658821.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: Manage exceptions on a nested multipart upload form
sorry for duplicate, i will update the other post as I created a quickstart and created issue 5190: https://issues.apache.org/jira/browse/WICKET-5190 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Manage-exceptions-on-a-nested-multipart-upload-form-tp4658815p4658822.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: Stateless pages
For a brief introduction to stateless vs stateful pages you can read chapter 6 of free guide: http://code.google.com/p/wicket-guide/ Hey there, i'm currently trying to understand what is actually needed so Wicket considers a page stateful. Could you provide me some basic information on that? Basically, I want the user to authorize for the application and if he's not, he should be send back to the login page. In the case of session timeout, I want to add an error message to the login page, explaining what happened. I thought of using a SimplePageAuthorizationStrategy for the authorization part, and solve the session timeout topic by subclassing the LoginPage (as SessionTimeoutReloginPage or something) and register that as the PageExpiredErrorPage. But somehow, I can't get that error page to show up. The SimplePageAuthorizationStrategy always sends me straight back to the LoginPage after session timeout. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Attaching Ajax Function to Java Method
Hi Bill I would also suggest you take a look at the Wicket-Bootstrap project by agilecoders for Bootstrap integration. Is very good and has a lot of the bootstrap components. http://wb.agilecoders.de/demo/ and https://github.com/l0rdn1kk0n/wicket-bootstrap/ Thanks David On 14/05/13 21:36, William Speirs wrote: I'm trying to create a typeahead component for Wicket that uses Bootstrap's Typeahead: To set this up though I need to provide the .typeahead method in JavaScript with a function that will return the results, given the query. What I'd like to do is attach that JavaScript function to a Java method much like what is done with an AjaxEventBehavior [2]. I cannot figure out how to go about setting all of this up... any ideas? Thanks... Bill- [1] http://twitter.github.io/bootstrap/javascript.html#typeahead [2] http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html
Adding Custom validator for Listview having multiple checkboxes
I have Listview with multiple checkboxes. I need to do validation that atleast one checkbox is selected. For this I have used Custom validator to validate checkboxes and throw error. This validator has list having checkboxes In Listview populateItem method I am adding the checkboxes to this validator list. But issue is how to add validator to form. I used checkbox.getform().add(validator); But it is adding for every checkbox in listview. So on running application validate method of validator is called for each checkbox. How to resolve ths. Kindly provide input # new ListViewT(repeater, listModel) { @Override protected void populateItem(final ListItemT item) { final T current = item.getModelObject(); final IModelBoolean cbModel = new ListChoiceCheckBoxModelT(current, binding) { @Override protected boolean isChoiceEnabled(final T choice) { return EnumCheckBoxRepeaterPanel.this.isChoiceEnabled(choice); } }; CheckBox chkbox = new AjaxCheckBox(checkbox, cbModel) { @Override protected void onConfigure() { setEnabled(isChoiceEnabled(current)); } }; item.add(chkbox); validator.addComponents(chkbox); chkbox.getForm().add(new CheckboxesSelectValidator(chkBoxList, Invalid)); item.add(new Label(label, localizedModel(labels, current))); } }.setReuseItems(true); # public class CheckboxesSelectValidator extends AbstractFormValidator { private static final long serialVersionUID = -5475763159946590330L; /** form components to be checked. */ // private final CheckBox[] components; private final String optionsMessage; private final ListCheckBox components; public CheckboxesSelectValidator(final ListCheckBox components, final String optionsMessage) { this.components = components; this.optionsMessage = optionsMessage; } public void addComponents(final CheckBox checkbox) { components.add(checkbox); } @Override public FormComponent[] getDependentFormComponents() { return components.toArray(new FormComponent[components.size()]); } @Override public void validate(final Form? form) { for (CheckBox component : components) { component.isEnabled(); component.getValue(); } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-Custom-validator-for-Listview-having-multiple-checkboxes-tp4658825.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: form processing adding new inputs with an ajax onupdate
I never used onConfigure() but conform it's API is called once per request on a component before is about to be rendered. Thus your original code: @Override public void onConfigure() { setVisible(isOngoingService()); } Is only called once if I'm not mistaken. Whereas you want the field to toggle so it must be called more than once. Thus onUpdate() would do the job you want: @Override protected void onUpdate(AjaxRequestTarget target) { provisionDefaultPeriod.setVisible(isOngoingService()); target.add(provisionDefaultPeriod); } I might be mistaken, but since Wicket is open source code feel free to poke around it and understand it better. On Tue, May 14, 2013 at 5:18 AM, Simon B simon.bott...@gmail.com wrote: Hi Paul, I was mistaken. I apologise. Previously I hadn't completely removed the onConfigure method from the form component and simply called the setVisible in the onUpdate method of the AjaxFormComponentUpdatingBehavior(onchange) / AFCUB(onchange). So your suggestion worked! Thank you very much. I would still really like to understand why the onConfigure way of setting the visibility of the component didn't work, does anybody have any idea about this? Cheers Simon -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/form-processing-adding-new-inputs-with-an-ajax-onupdate-tp4658758p4658779.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: Adding Custom validator for Listview having multiple checkboxes
Place your table inside a CheckGroup and add the validator there. Below is my implementation of this validator: import org.apache.wicket.validation.IValidatable; import org.apache.wicket.validation.IValidator; import org.apache.wicket.validation.ValidationError; public class AtLeastOneSelectedValidatorT implements IValidatorCollectionT { private static final long serialVersionUID = 1L; private String resourceKey; public AtLeastOneSelectedValidator(String resourceKey) { setResourceKey(resourceKey); } @Override public void validate(IValidatableCollectionT validatable) { int numSelected = validatable.getValue().size(); if(numSelected 1) { validatable.error(new ValidationError().addKey(getResourceKey())); } } public void setResourceKey(String resourceKey) { this.resourceKey = resourceKey; } public String getResourceKey() { return resourceKey; } } On Wed, May 15, 2013 at 11:28 AM, Saravanan saravanan...@tcs.com wrote: I have Listview with multiple checkboxes. I need to do validation that atleast one checkbox is selected. For this I have used Custom validator to validate checkboxes and throw error. This validator has list having checkboxes In Listview populateItem method I am adding the checkboxes to this validator list. But issue is how to add validator to form. I used checkbox.getform().add(validator); But it is adding for every checkbox in listview. So on running application validate method of validator is called for each checkbox. How to resolve ths. Kindly provide input # new ListViewT(repeater, listModel) { @Override protected void populateItem(final ListItemT item) { final T current = item.getModelObject(); final IModelBoolean cbModel = new ListChoiceCheckBoxModelT(current, binding) { @Override protected boolean isChoiceEnabled(final T choice) { return EnumCheckBoxRepeaterPanel.this.isChoiceEnabled(choice); } }; CheckBox chkbox = new AjaxCheckBox(checkbox, cbModel) { @Override protected void onConfigure() { setEnabled(isChoiceEnabled(current)); } }; item.add(chkbox); validator.addComponents(chkbox); chkbox.getForm().add(new CheckboxesSelectValidator(chkBoxList, Invalid)); item.add(new Label(label, localizedModel(labels, current))); } }.setReuseItems(true); # public class CheckboxesSelectValidator extends AbstractFormValidator { private static final long serialVersionUID = -5475763159946590330L; /** form components to be checked. */ // private final CheckBox[] components; private final String optionsMessage; private final ListCheckBox components; public CheckboxesSelectValidator(final ListCheckBox components, final String optionsMessage) { this.components = components; this.optionsMessage = optionsMessage; } public void addComponents(final CheckBox checkbox) { components.add(checkbox); } @Override public FormComponent[] getDependentFormComponents() { return components.toArray(new FormComponent[components.size()]); } @Override public void validate(final Form? form) { for (CheckBox component : components) { component.isEnabled(); component.getValue(); } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-Custom-validator-for-Listview-having-multiple-checkboxes-tp4658825.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: Attaching Ajax Function to Java Method
On Wed, May 15, 2013 at 10:56 AM, David Beer david.m.b...@gmail.com wrote: Hi Bill I would also suggest you take a look at the Wicket-Bootstrap project by agilecoders for Bootstrap integration. Is very good and has a lot of the bootstrap components. http://wb.agilecoders.de/demo/ and https://github.com/l0rdn1kk0n/** wicket-bootstrap/ https://github.com/l0rdn1kk0n/wicket-bootstrap/ That's actually where I started, but they only support providing a list of choices up-front instead of the callback. I was able to get the callback working and with less StringBuilder hacky code by using a separate javascript file and TextTemplate as suggested by Martin Grigorov. I also tried to get the AutoCompleteTextField[1] component to work with Bootstrap, but couldn't figure out how to make all the CSS happy. Someone more familiar with both projects could probably pull it off though, and that would make a nice addition to Wicket or wicket-bootstrap by the Apache foundation [2]. Thanks for everyone's help... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.html [2] http://mvnrepository.com/artifact/org.apache.wicket/wicket-bootstrap
Feedback panel and form buttons in Wicket 6
I'm a bit confused, how come if I call error() from inside by form button and then refresh the feedback panel via ajax my error is not showing up? I always end up having to drop the error in the user's session. ~ Thank you, Paul Bors
Re: Feedback panel and form buttons in Wicket 6
Nevermind that... I forogt to add the feedback panel to the target :) ~ Thank you, Paul Bors On Wed, May 15, 2013 at 4:26 PM, Paul Bors p...@bors.ws wrote: I'm a bit confused, how come if I call error() from inside by form button and then refresh the feedback panel via ajax my error is not showing up? I always end up having to drop the error in the user's session. ~ Thank you, Paul Bors
How to inegrate CAS authentication with Apache wicket application?
Hi, I am working on a project where I have to integrate CAS authentication into an Apache Wicket application. Though I am still a beginner in web-development, I know how to implement CAS authentication into simple web-app (using Spring-security), where I define a directory/files which need authentication before User can access them. Following is the example CAS application structure, I have created and tested. In the below example, access to files in secure directory need authentication. http://apache-wicket.1842946.n4.nabble.com/file/n4658831/Screenshot-casexample.png The contents of applicationContext-security.xml are as below. But if I have to secure files in apache wicket application, how can I do this? I would like to start my application by displaying edu.vt.geoserver.HomePage.html without authentication and to set authentication requirement to access files in edu.vt.geoserver.securePages. Please see the attached structure of my target application. http://apache-wicket.1842946.n4.nabble.com/file/n4658831/49.png Let me know if anyone can help me in this regard. I have seen the Jasig's unofficial cas-client for wicket application, but still not sure what all changes I will need to do. Any help in this regard is highly appreciated. Thanks Sachin -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-inegrate-CAS-authentication-with-Apache-wicket-application-tp4658831.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: Feedback panel and form buttons in Wicket 6
Paul, Maybe you might want use AJAX event to automatically add feedback to target So, that you can safely forget;-) Cheers, Ernesto On Thu, May 16, 2013 at 12:30 AM, Paul Bors p...@bors.ws wrote: Nevermind that... I forogt to add the feedback panel to the target :) ~ Thank you, Paul Bors On Wed, May 15, 2013 at 4:26 PM, Paul Bors p...@bors.ws wrote: I'm a bit confused, how come if I call error() from inside by form button and then refresh the feedback panel via ajax my error is not showing up? I always end up having to drop the error in the user's session. ~ Thank you, Paul Bors -- Regards - Ernesto Reinaldo Barreiro
Re: Feedback panel and form buttons in Wicket 6
It is possible to add feedback panel automatically by implementing org.apache.wicket.ajax.IListener Here are are some examples: /** * TODO Suggest for jira addition, see * * http://apache-wicket.1842946.n4.nabble.com/HowTo-inject-FeedbackPanel-td2295430.html * * @author Martin * * Copyright (c) Koodaripalvelut.com Finland 2008 */ public static class TopMostVisibleFeedbackPanelAjaxAutoAdderListener implements IListener { private IFeedbackMessageFilter feedbackMessageFilter; /** * @see org.apache.wicket.ajax.AjaxRequestTarget.IListener#onBeforeRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget) */ @Override public void onBeforeRespond(MapString, Component map, AjaxRequestTarget target) { FeedbackMessages feedbackMessages = Session.get().getFeedbackMessages(); ListFeedbackMessage messages = feedbackMessages.messages(feedbackMessageFilter); if (!messages.isEmpty()) { Object feedbackPanel = null; for (FeedbackMessage feedbackMessage : messages) { Component component = feedbackMessage.getReporter(); if (component != null) { feedbackPanel = addFeedbackPanel(target, component); } } if (feedbackPanel == null) { // Some messages still want to become visible, try finding feedbackpanel from page addFeedbackPanel(target, target.getPage()); } } } /** * @param target * @param component * @return Object */ private Object addFeedbackPanel(AjaxRequestTarget target, Component component) { Object feedbackPanel = new VisitTopMostMarkupContainerPageOrModalWindowHavingVisibleChild(component, IFeedback.class).getFoundChild(); if (feedbackPanel instanceof Component) { if (!((Component) feedbackPanel).getOutputMarkupId()) { Utils.errorLog(TakpApplication.class, Cannot update feedbackComponent that does not have setOutputMarkupId( + component.getMarkupId() + ) property set to true. Component: + component.getPageRelativePath() + : + component); } else { target.addComponent((Component) feedbackPanel); // Add feedbackPanel to the ajax request target return feedbackPanel; } } return null; } /** * @param feedbackMessageFilter the feedbackMessageFilter to set * @return NearestFeedbackPanelAjaxAutoAdderListener */ public TopMostVisibleFeedbackPanelAjaxAutoAdderListener setFeedbackMessageFilter(IFeedbackMessageFilter feedbackMessageFilter) { this.feedbackMessageFilter = feedbackMessageFilter; return this; } /** * @return the feedbackMessageFilter */ public IFeedbackMessageFilter getFeedbackMessageFilter() { return feedbackMessageFilter; } /** * @see org.apache.wicket.ajax.AjaxRequestTarget.IListener#onAfterRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget.IJavascriptResponse) */ @Override public void onAfterRespond(MapString, Component map, org.apache.wicket.ajax.AjaxRequestTarget.IJavascriptResponse response) { // Override if necessary } } /** * @author Martin * * Copyright (c) Koodaripalvelut.com Finland 2008 */ public static class ErrorComponentAndNearestFeedbackPanelAjaxAutoAdderListener extends TopMostVisibleFeedbackPanelAjaxAutoAdderListener { /** * @see com.tustor.tuntinetti.view.TakpApplication.TopMostVisibleFeedbackPanelAjaxAutoAdderListener#onBeforeRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget) */ @Override public void onBeforeRespond(MapString, Component map, AjaxRequestTarget target) { super.onBeforeRespond(map, target); WicketUtils.ajaxRefreshErrorComponents(target); } } /** * @param target */ public static void ajaxRefreshErrorComponents(AjaxRequestTarget target) { ListFeedbackMessage feedbackMessages = Session.get().getFeedbackMessages().messages(new ErrorLevelFeedbackMessageFilter(FeedbackMessage.ERROR)); for (FeedbackMessage feedbackMessage : feedbackMessages) { if (feedbackMessage.getReporter() instanceof FormComponent) { if (feedbackMessage.getReporter().getOutputMarkupId()) { target.addComponent(feedbackMessage.getReporter()); } else { Utils.errorLog(WicketUtils.class, Cannot update component that does not have setOutputMarkupId property set to true. Component: + feedbackMessage.getReporter().getPageRelativePath()); } } } } 2013/5/16 Ernesto Reinaldo Barreiro reier...@gmail.com: Paul, Maybe you might want use AJAX event to automatically add feedback to target So, that you can safely forget;-) Cheers, Ernesto On Thu, May 16, 2013 at 12:30 AM, Paul Bors p...@bors.ws wrote: Nevermind that... I forogt to add the feedback panel to the target :) ~ Thank you, Paul Bors On Wed, May 15, 2013 at 4:26 PM,
Wicketstuff release cycle
Hello, I would like to ask a question regarding wicketstuff releases. According to Wicketstaff WIKI [1] last stable was made July 3, 2012, according to maven some modules were released 18-Apr-2013 and has version 6.7.0 [2]. Is there option to ask for release of the components [3] with the wicket 6.8.0 or maybe earlier Why I'm asking is because we are using apache ivy in our build and it is not very easy to get spapshot builds (it is necessary to specify version as 6.0-20130515.164331-3 and it tend to change after each build) Thanks in advance [1] https://github.com/wicketstuff/core/wiki [2] http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/ [3] https://oss.sonatype.org/content/repositories/snapshots/org/wicketstuff/wicketstuff-urlfragment/ http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/-- WBR Maxim aka solomax
Re: Wicketstuff release cycle
Normally Martin Grigorov will release a new version within a couple of days (sometimes just a matter of hours) after each wicket release... On Thu, May 16, 2013 at 8:16 AM, Maxim Solodovnik solomax...@gmail.comwrote: Hello, I would like to ask a question regarding wicketstuff releases. According to Wicketstaff WIKI [1] last stable was made July 3, 2012, according to maven some modules were released 18-Apr-2013 and has version 6.7.0 [2]. Is there option to ask for release of the components [3] with the wicket 6.8.0 or maybe earlier Why I'm asking is because we are using apache ivy in our build and it is not very easy to get spapshot builds (it is necessary to specify version as 6.0-20130515.164331-3 and it tend to change after each build) Thanks in advance [1] https://github.com/wicketstuff/core/wiki [2] http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/ [3] https://oss.sonatype.org/content/repositories/snapshots/org/wicketstuff/wicketstuff-urlfragment/ http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/ -- WBR Maxim aka solomax -- Regards - Ernesto Reinaldo Barreiro
Re: Wicketstuff release cycle
Thanks for the quick reply :) According to the maven no all components are released is there any whitelist or something to determine which components should be release and which are not? On Thu, May 16, 2013 at 11:21 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Normally Martin Grigorov will release a new version within a couple of days (sometimes just a matter of hours) after each wicket release... On Thu, May 16, 2013 at 8:16 AM, Maxim Solodovnik solomax...@gmail.com wrote: Hello, I would like to ask a question regarding wicketstuff releases. According to Wicketstaff WIKI [1] last stable was made July 3, 2012, according to maven some modules were released 18-Apr-2013 and has version 6.7.0 [2]. Is there option to ask for release of the components [3] with the wicket 6.8.0 or maybe earlier Why I'm asking is because we are using apache ivy in our build and it is not very easy to get spapshot builds (it is necessary to specify version as 6.0-20130515.164331-3 and it tend to change after each build) Thanks in advance [1] https://github.com/wicketstuff/core/wiki [2] http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/ [3] https://oss.sonatype.org/content/repositories/snapshots/org/wicketstuff/wicketstuff-urlfragment/ http://repo1.maven.org/maven2/org/wicketstuff/wicketstuff-yui-calendar/ -- WBR Maxim aka solomax -- Regards - Ernesto Reinaldo Barreiro -- WBR Maxim aka solomax
Session creates multiple times
Hello! I have a webApp, that have a webSession witch creates a connector and many managers. When I starts an app, session creates 2 times. When the page is starting to render it creates another 2 times and every user, when connecting to this app, creates another 2 sessions. I just realized that if I starts an app with path http://localhost:8080/QuickStart/home (home is mounted as a home page), the session creates ones, but if I push http://localhost:8080/QuickStart/home?0 or http://localhost:8080/QuickStart it creates 2 times. Is it normal? And can I do something with this problem to make session creates only ones? Thank you! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Session-creates-multiple-times-tp4658837.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