Re: AbstractAjaxTimerBehavior and setInterval and clearInterval
Hi, I'm not sure how your logic looks like but the simplest solution that I see is to use a member boolean variable 'hasRendered' in your behavior and use it in #renderHead() so that the JS is contributed just once. if (!hasRendered) { hasRendered = true; response.render(OnDomReadyHeaderItem.forScript()); } On Thu, Mar 14, 2013 at 10:55 PM, infiniter infini...@gmail.com wrote: I created a very similar class to AbstractAjaxTimerBehavior, with the difference that I'm using setInterval instead of setTimeOut in #getJsTimeoutCall and I'm assigning a variable name to it, so that I can use the clearInterval in #getFailureScript , the problem I got is that in the response envelope I'm getting the script in #getJsTimeoutCall back, which is inside the evaluate block, and I don't want that because when the setInterval is set again the value in the variable changes therefore I cannot clear the interval and also it makes the response heavier. So basically I just want the script in #getJsTimeoutCall executed only once just to start the interval. I tried to make the response not return the evaluate block, but I was unsuccessful. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractAjaxTimerBehavior-and-setInterval-and-clearInterval-tp4657268.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 http://jweekend.com/
How to get correct path of component for put it in properties file
Hi all, I have problems to find the correct path of my component to place it in the properties file. In particular validation retrieves the name of the component through the properties file to display it in the browser if validation fails. I did component.getPath() and component.getRelativePath() in the code and put the result of both in properties file like: myPopupForm.myAttr=test1 templateContent.myPopupForm.myAttr=test2 But this didnt work. Is there a way how to find out the string which is the key for an entry in the properties file? Regards, yka -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-correct-path-of-component-for-put-it-in-properties-file-tp4657273.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: How to get correct path of component for put it in properties file
Hi, The key in properties file should look like: myForm.myField.SomeValidator=Error message I.e. it starts with the relative path and ends with the class name of the used validator. On Fri, Mar 15, 2013 at 2:47 PM, yka i...@jcoder.de wrote: Hi all, I have problems to find the correct path of my component to place it in the properties file. In particular validation retrieves the name of the component through the properties file to display it in the browser if validation fails. I did component.getPath() and component.getRelativePath() in the code and put the result of both in properties file like: myPopupForm.myAttr=test1 templateContent.myPopupForm.myAttr=test2 But this didnt work. Is there a way how to find out the string which is the key for an entry in the properties file? Regards, yka -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-correct-path-of-component-for-put-it-in-properties-file-tp4657273.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 http://jweekend.com/
ajax submit form on keyup
Hi, I have a simple filter form for a table, currently with one textfield, to which this behavior is added: new AjaxEventBehavior(keyup) { protected void onEvent(AjaxRequestTarget target) { // get search string from request, get new data and add table to target } protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { // set throttling } } Now I want to add few checkboxes to the form, which should be submited along. If the behavior is attached to the textfield, it's value is posted, but not of the checkboxes. If it's attached to the form, there's a ajax request but without any parameter at all. I could do it in pure jQuery, but is there a wicket way to do it? Thanks, Marek
Re: ajax submit form on keyup
Use AjaxFormSubmitBehavior Regards Sven On 03/15/2013 03:01 PM, M Kili wrote: Hi, I have a simple filter form for a table, currently with one textfield, to which this behavior is added: new AjaxEventBehavior(keyup) { protected void onEvent(AjaxRequestTarget target) { // get search string from request, get new data and add table to target } protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { // set throttling } } Now I want to add few checkboxes to the form, which should be submited along. If the behavior is attached to the textfield, it's value is posted, but not of the checkboxes. If it's attached to the form, there's a ajax request but without any parameter at all. I could do it in pure jQuery, but is there a wicket way to do it? Thanks, Marek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Prevent submit
Hi all, I have a form, which server-side processing takes takes 2-5 sec, at this time user can resubmit the form, this call goes to a queue and will be send right after the first one. I tried to play around the IAjaxCallListener but with no luck. How can I avoid this behaviour? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277.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: Prevent submit
Hi, You can disable the submit link/button in beforeSend handler and re-enable it in complete handler. This will work only if you make Ajax submit. For non-Ajax you will need to add onclick attribute to just disable it. On Fri, Mar 15, 2013 at 3:59 PM, Alexey Mukas alexey.mu...@gmail.comwrote: Hi all, I have a form, which server-side processing takes takes 2-5 sec, at this time user can resubmit the form, this call goes to a queue and will be send right after the first one. I tried to play around the IAjaxCallListener but with no luck. How can I avoid this behaviour? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277.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 http://jweekend.com/
Re: Prevent submit
Hi Martin, Thank for the fast reply, could you please tell me how can I manipulate it (make disable/enable) in those callbacks? Before your answer I came up with very dirty solution... public class AjaxBlockingListener extends AjaxCallListener{ public AjaxBlockingListener() { String clearCallbackQueue = Wicket.channelManager.channels[0].callbacks.length = 0; onComplete(clearCallbackQueue); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277p4657279.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: Prevent submit
Did it :) onBeforeSend(this.setAttribute('disabled', 'disabled');); onComplete(this.removeAttribute('disabled');); Thanks once again -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Prevent-submit-tp4657277p4657280.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: ajax submit form on keyup
Thanks, works flawlessly 2013/3/15 Sven Meier s...@meiers.net Use AjaxFormSubmitBehavior Regards Sven On 03/15/2013 03:01 PM, M Kili wrote: Hi, I have a simple filter form for a table, currently with one textfield, to which this behavior is added: new AjaxEventBehavior(keyup) { protected void onEvent(AjaxRequestTarget target) { // get search string from request, get new data and add table to target } protected void updateAjaxAttributes(**AjaxRequestAttributes attributes) { // set throttling } } Now I want to add few checkboxes to the form, which should be submited along. If the behavior is attached to the textfield, it's value is posted, but not of the checkboxes. If it's attached to the form, there's a ajax request but without any parameter at all. I could do it in pure jQuery, but is there a wicket way to do it? Thanks, Marek --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AbstractAjaxTimerBehavior and setInterval and clearInterval
ok, that was already implemented: * public void renderHead(IHeaderResponse response){ super.renderHead(response); WebRequest request = (WebRequest) RequestCycle.get().getRequest(); if (!stopped (!headRendered || !request.isAjax())) { headRendered = true; response.renderOnLoadJavascript(getJsTimeoutCall(updateInterval)); } } * (btw, I tried with response.renderOnDomReady) I also tried making the #respond method just do target.add(getComponent()) But my problem is that in each response the same script that was first loaded is also returned back in the evaluate block, which rewrites the interval variable and also makes the response much heavier (in my case the requests are very frequent) I traced my issue to #AjaxRequestTarget.respond and the following piece of code makes sure that the js passed to response.renderOnDomReady in my #renderHead will always be returned back in the response: * it = domReadyJavascripts.iterator(); while (it.hasNext()) String js = it.next(); respondInvocation(response, js); } * Any ideas are appreciated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractAjaxTimerBehavior-and-setInterval-and-clearInterval-tp4657268p4657282.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
PageableListView item removal
Hi all, I'm looking at a strange behavior of my PageableListView. I have a PageableListView with an AjaxPagingNavigator within a WebMarkupContainer. Recently I added an AjaxLink to the list view that removes an element from the underlying list. The view refreshes, but takes off the first(!) element of the list view instead of the element that was really deleted. If I refresh the whole page, the view displays correctly. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-item-removal-tp4657283.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: PageableListView item removal
Hi, you're probably using #setReuseItems(true) ? Show us your #populateItem() please. Sven On 03/15/2013 07:04 PM, N. Metzger wrote: Hi all, I'm looking at a strange behavior of my PageableListView. I have a PageableListView with an AjaxPagingNavigator within a WebMarkupContainer. Recently I added an AjaxLink to the list view that removes an element from the underlying list. The view refreshes, but takes off the first(!) element of the list view instead of the element that was really deleted. If I refresh the whole page, the view displays correctly. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-item-removal-tp4657283.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
Datatable Filtercolumn is not reacting
I use a datatable with FilterColumn. I specially made a IntegerColumn. It works fine, but if the user enters a blank or nothing the table is not refreshed. I can see that the old value is used. If a enter a zero or another integer value it works like i expected. How can I repair this problem My source is @SuppressWarnings({ unchecked, rawtypes, serial }) public TextFilteredPropertyColumn getInteger(String header,String sort,final String field,final int inputsize,final boolean formatOutput,final String format) { return new TextFilteredPropertyColumnString,IModel( new ModelString(header), sort, field) { @Override public void populateItem(final ItemICellPopulatorlt;String item, final String componentId,final IModelString rowModel) { Label label = new Label(componentId, createLabelModel(rowModel)){ public C IConverterC getConverter(ClassC type){ IConverter converter = new MyIntegerConverter(formatOutput,format); return converter; } }; item.add(label); } @Override public String getCssClass() { return numeric +field; }; @Override public Component getFilter(final String varComponentId, final FilterForm varForm) { TextFilterInteger filter = (TextFilterInteger) super.getFilter(varComponentId, varForm); filter.getFilter().add(new AttributeModifier(size, new ModelString(+inputsize))); filter.getFilter().add(new AttributeModifier(style, new ModelString(text-align:right;))); filter.getFilter().add(new AttributeModifier(class, new ModelString(numeric))); return filter; } }; } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Datatable-Filtercolumn-is-not-reacting-tp4657285.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: Datatable Filtercolumn is not reacting
What does your FilterForm's model object look like? Sven On 03/15/2013 09:04 PM, Delange wrote: I use a datatable with FilterColumn. I specially made a IntegerColumn. It works fine, but if the user enters a blank or nothing the table is not refreshed. I can see that the old value is used. If a enter a zero or another integer value it works like i expected. How can I repair this problem My source is @SuppressWarnings({ unchecked, rawtypes, serial }) public TextFilteredPropertyColumn getInteger(String header,String sort,final String field,final int inputsize,final boolean formatOutput,final String format) { return new TextFilteredPropertyColumnString,IModel( new ModelString(header), sort, field) { @Override public void populateItem(final ItemICellPopulatorlt;String item, final String componentId,final IModelString rowModel) { Label label = new Label(componentId, createLabelModel(rowModel)){ public C IConverterC getConverter(ClassC type){ IConverter converter = new MyIntegerConverter(formatOutput,format); return converter; } }; item.add(label); } @Override public String getCssClass() { return numeric +field; }; @Override public Component getFilter(final String varComponentId, final FilterForm varForm) { TextFilterInteger filter = (TextFilterInteger) super.getFilter(varComponentId, varForm); filter.getFilter().add(new AttributeModifier(size, new ModelString(+inputsize))); filter.getFilter().add(new AttributeModifier(style, new ModelString(text-align:right;))); filter.getFilter().add(new AttributeModifier(class, new ModelString(numeric))); return filter; } }; } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Datatable-Filtercolumn-is-not-reacting-tp4657285.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
Wicket Ajax Debug Errors - how to debug?
Hi all, I am using a modal window as a substitute for messageboxes. E.g. I have a few forms with an ajax submit button, and I am using the modal window to first display a confirmation message, and if the user accepts it, to display a success / failure message. I am getting frequent errors in the Wicket Ajax Debug console. One is: * ERROR: * Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: TypeError: Wicket.TimerHandles is undefined, text: (function(){clearTimeout(Wicket.TimerHandles['spinner21e']); delete Wicket.TimerHandles['spinner21e'];})(); The spinner control mentioned above is an image component with an AbstractAjaxTimerBehavior. In all cases of error, it has setVisibilityAllowed(false) (it's hidden). Usually the errors can be ignored and the page still functions normally. I've never really dug into the way ajax responses are handled so I'm not sure where to start in order to track this error down. Any ideas? Thanks in advance, Marios
Re: Serialization of DAO
I have a much better understanding on this now. Are there any plans to support injection on LDMs, or is there a suggested work around for this? It seems like you'd want a DAO service to get an object from the DB within a custom model so you can return that back to your component. ___ Stephen Walsh | http://connectwithawalsh.com On Thu, Mar 14, 2013 at 5:03 PM, Martin Grigorov mgrigo...@apache.orgwrote: Take a look at wicket-examples and the unit tests in wicket-guice module. On Thu, Mar 14, 2013 at 10:53 PM, Stephen Walsh step...@connectwithawalsh.com wrote: Any other thoughts on this? ___ Stephen Walsh | http://connectwithawalsh.com On Thu, Mar 14, 2013 at 10:30 AM, Stephen Walsh step...@connectwithawalsh.com wrote: Thanks, Martin. I intialize here, (which I just realized is not the best spot): private void setUpMongo() { mongo = MongoUtil.getMongo(); morphia = new Morphia().map(Blog.class).map(Person.class); blogDAO = new BlogDAO(mongo, morphia); } I am using the Wicket Guice module, and I think your second point is what I was getting at. From learning about Guice ( http://www.youtube.com/watch?feature=player_embeddedv=hBVJbzAagfs), I thought the point was to initialize once and then reuse wherever needed. I figured initialization would happen in the application class. Maybe I'm misunderstanding. If it's supposed to happen in the application class, then I don't really have need for a module because I don't have an interface in this case, right? Thanks for the help on this. ___ Stephen Walsh | http://connectwithawalsh.com On Thu, Mar 14, 2013 at 3:20 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I don't see how you initialize blogDAO. If you don't use wicket-ioc module then you will need to lookup the DAO from the application whenever you need it: public void onSubmit() { BlogDAO blogDao = MyApplication.get().getBlogDAO(); blogDao.save(blog); } This way you wont keep reference to it in the page/component and it wont be serialized. If you use wicket-guice module then you can do: @Inject private BlogDAO blogDao; and use it anywhere. Wicket will use Guice to lookup the bean at component creation but the bean will be wrapped in a serializable proxy. That is a lightweight proxy will be (de)serialized with the page. This is the recommended way. wicket-string works the same way. wicket-cdi leaves the proxy creation to the CDI implementation. On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh step...@connectwithawalsh.com wrote: I'm attempting to implement Guice for my DAO connections as my JBoss server keeps running out of memory. Not entirely sure why that is, but I'm hoping this is at least part of it. I read through http://markmail.org/message/sz64l4eytzc3ctkh and understand why the DAO needs to be serialized, and I also followed https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto try and figure out where and how exactly to inject my DAO. My DAO already extends a basic DAO class that has all of the basics for getting stuff from the database. Neither of these are interfaces (not sure if this is a problem or not). My DAO works just fine in panels, but as soon as it's on a page, it throws the not seralizable exception. Regardless it doesn't really solve the problem of really only needing one DAO for the whole application instead of creating one whenever it's needed in every place that it's needed. If I understand dependency injection, then this is the whole point. Here's my class. Hopefully someone can point me in the right direction for this page and my application class: public class EditBlogEntry extends BasePage { private Logger logger = LoggerFactory.getLogger(EditBlogEntry.class); private Mongo mongo; private Morphia morphia; private BlogDAO blogDAO; public EditBlogEntry(final Blog blogEntry) { // Add edit blogPost form to page Form? form = new Form(form); form.add(new Button(postIt) { @Override public void onSubmit() { // This merely gets a new mongo instance that has my blog entry mapped by morphia for saving the whole POJO to mongo setUpMongo(); blogDAO.save(blogEntry); BlogEntryDetails details = new BlogEntryDetails(new PageParameters().add(id, blogEntry.getObjectId().toString())); setResponsePage(details); } });
Re: PageableListView item removal
I wasn't using the setReuseItems property at all, but tried to set it to false: no change. Here's the code: serviceContainer = new WebMarkupContainer(serviceData); serviceContainer.setOutputMarkupId(true); serviceContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(15)){ protected void onPostProcessTarget(AjaxRequestTarget target){ try { services = administrationService.updateServices(uniqueId, midm, userMidm); logger.debug({}:{}: Services refreshed for user + username, uniqueId, midm); updateCounter ++; //stop update after 15 minutes if (updateCounter 60){ logger.debug({}:{}: Stopped service self updating behavior, uniqueId, midm); stop(target); } } catch (Exception e) { logger.debug({}:{}: Unable to refresh the service view for user + username, uniqueId, midm); warn(The system is unable to refresh the service view. Please reload the user.); } target.add(feedback); } }); PageableListViewService serviceList = new PageableListViewService(serviceList, new PropertyModelListlt;Service(ServicesTabPanel.this, services), ELEMENTS_PER_PAGE) { @Override protected void populateItem(ListItemService item) { final Service service = item.getModelObject(); final String serviceType = service.getServiceType(); item.add(new Label(serviceType, new PropertyModel(item.getModel(), serviceType))); item.add(new Label(login, new PropertyModel(item.getModel(), serviceLogin))); item.add(new Label(context, new PropertyModel(item.getModel(), serviceContext))); item.add(new Label(status, new PropertyModel(item.getModel(), accountStatusWebString))); item.add(new Label(syncDate, new PropertyModel(item.getModel(), timestamp))); item.add(new Label(expireDate, new PropertyModel(item.getModel(), serviceExpireDate))); if (service.isIntegrable()) item.add(new Label(integratable, true)); else item.add(new Label(integratable, false)); if (service.isIntegrated()) item.add(new Label(integrated, true)); else item.add(new Label(integrated, false)); item.add(new AjaxLink(syncButton){ public void onClick(AjaxRequestTarget target) { try { logger.info({}:{}: Synchonizing + serviceType + services for + userMidm, uniqueId, midm); administrationService.syncMidasUserService(uniqueId, midm, userMidm, serviceType); success(Synchronized Service +serviceType); } catch (Exception e) { logger.error(uniqueId + : Caught an exception during admin sync service + serviceType, e); error(An error occurred while trying to synchronize service + serviceType); } target.add(feedback, serviceContainer); } }); addRemoveServiceLink(item, service); } private void addRemoveServiceLink(ListItem item, final Service service){ AjaxLink removeServiceLink = new AjaxLink(removeServiceLink){ public void onClick(AjaxRequestTarget target) { int userMidm = service.getMidm(); try { administrationService.removeServiceFromUser(uniqueId, midm, userMidm, service); success(Successfully removed service + service.getServiceType() + (login + service.getServiceLogin() +) from current user.); services.remove(service); } catch (UnavailableDataSourceException e) { error(A database error occurred while trying to remove the service + service); }
Re: PageableListView item removal
Also, the ajax timer on the markup container stops after I hit the removeLink. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-item-removal-tp4657283p4657291.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