Re: Page with AjaxSelfUpdatingTimerBehavior in multiple browser tabs
Hi, I did tried that but didn't work. Ended up with increasing org.apache.wicket.settings.IStoreSettings.setMaxSizePerSession(Bytes) to keep more pages in store. Are there any negative aspects of doing that beside (obvious) disk space? Thanks, Zbynek On Tue, Jul 28, 2020 at 2:07 PM Martin Grigorov wrote: > Hi, > > On Tue, Jul 28, 2020 at 11:09 AM Zbynek Vavros > wrote: > > > Hi, > > > > We have a page with AjaxSelfUpdatingTimerBehavior and now one of our > > customers is complaining about "weird" behavior when this page is opened > in > > multiple browser tabs (yeah yeah we told him not to do it...). > > > > What happens is that after opening this page in new tab, the previous tab > > gets ajax redirect on mentioned timer. > > > > After some digging I found out that this is happening because the page is > > stateful. > > Excerpt from Wicket code: > > > > // If the page is stateful then we cannot assume that the listener > > interface is > > // invoked on its initial state (right after page initialization) and > that > > its > > // component and/or behavior will be available. That's why the listener > > interface > > // should be ignored and the best we can do is to re-paint the newly > > constructed > > // page. > > > > I did use StatelessChecker (very useful!) and found out that the reason > is > > this AjaxSelfUpdatingTimerBehavior. > > > > Googling around I found this thread from 2011 - > > > > > http://apache-wicket.1842946.n4.nabble.com/Stateless-page-with-an-auto-update-section-td3795927.html > > . > > The suggestion here is to "roll your own timer behavior". > > > > Well, I spent some time with Wicket already but this is beyond my > > knowledge. Can anyone please point me the right direction? Is this even > > possible? I just have to say the AjaxSelfUpdatingTimerBehavior must stay > - > > this page displays progress bar of background task that is > non-negotiable. > > > > Try by overwriting AjaxSelfUpdatingTimerBehavior#getStatelessHint() and > return true. > Depending on how complex is your logic in #onTimer() it may work or not. > See https://stackoverflow.com/a/10589807/497381 for more details. We > integrated the Jolira's Wicket-Stateless approach in Wicket core since > ver.7.4.0. > > > > > > Thanks, > > Zbynek > > >
Page with AjaxSelfUpdatingTimerBehavior in multiple browser tabs
Hi, We have a page with AjaxSelfUpdatingTimerBehavior and now one of our customers is complaining about "weird" behavior when this page is opened in multiple browser tabs (yeah yeah we told him not to do it...). What happens is that after opening this page in new tab, the previous tab gets ajax redirect on mentioned timer. After some digging I found out that this is happening because the page is stateful. Excerpt from Wicket code: // If the page is stateful then we cannot assume that the listener interface is // invoked on its initial state (right after page initialization) and that its // component and/or behavior will be available. That's why the listener interface // should be ignored and the best we can do is to re-paint the newly constructed // page. I did use StatelessChecker (very useful!) and found out that the reason is this AjaxSelfUpdatingTimerBehavior. Googling around I found this thread from 2011 - http://apache-wicket.1842946.n4.nabble.com/Stateless-page-with-an-auto-update-section-td3795927.html. The suggestion here is to "roll your own timer behavior". Well, I spent some time with Wicket already but this is beyond my knowledge. Can anyone please point me the right direction? Is this even possible? I just have to say the AjaxSelfUpdatingTimerBehavior must stay - this page displays progress bar of background task that is non-negotiable. Thanks, Zbynek
Stateless page with AjaxSelfUpdatingTimerBehavior
Hi, We have a page with AjaxSelfUpdatingTimerBehavior and now one of our customers is complaining about "weird" behavior when this page is opened in multiple browser tabs (yeah yeah we told him not to do it...). What happens is that after opening this page in new tab, the previous tab gets ajax redirect on mentioned timer. After some digging I found out that this is happening because the page is stateful. Excerpt from Wicket code: // If the page is stateful then we cannot assume that the listener interface is // invoked on its initial state (right after page initialization) and that its // component and/or behavior will be available. That's why the listener interface // should be ignored and the best we can do is to re-paint the newly constructed // page. I did use StatelessChecker (very useful!) and found out that the reason is this AjaxSelfUpdatingTimerBehavior. Googling around I found this thread from 2011 - http://apache-wicket.1842946.n4.nabble.com/Stateless-page-with-an-auto-update-section-td3795927.html. The suggestion here is to "roll your own timer behavior". Well, I spent some time with Wicket already but this is beyond my knowledge. Can anyone please point me the right direction? Is this even possible? I just have to say the AjaxSelfUpdatingTimerBehavior must stay - this page displays progress bar of background task that is non-negotiable. Thanks, Zbynek
Re: StringResourceModel parameter and AJAX update
Thats it, silly me, thanks! ZV On Wed, Jan 22, 2020 at 5:42 AM Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Hi, > > Instead of passing as parameter selectedUser try passing > > new IModel { > getObject() { > return selectedUser; > } > } > > as parameter. If you are using wicket 7.x then instead of IModel you could > use an AbstractReadonlyModel > > On Tue, Jan 21, 2020 at 11:31 PM Zbynek Vavros > wrote: > > > Hi, > > > > just simple use-case but I can't figure it out. > > > > I have DropDownChoice that selects User and Label having > > StringResourceModel where the parameter (new > > StringResourceModel(...).setParameter(selectedUser)) is the selected > user. > > How do I update the Label's model so that it reflects User selected via > > AJAX? > > > > Thanks, > > Zbynek > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Re: StringResourceModel parameter and AJAX update
Hey, AbstractReadOnlyModel seems better but you pointed me the right direction, thanks! Zbynek On Wed, Jan 22, 2020 at 5:42 AM Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Hi, > > Instead of passing as parameter selectedUser try passing > > new IModel { > getObject() { > return selectedUser; > } > } > > as parameter. If you are using wicket 7.x then instead of IModel you could > use an AbstractReadonlyModel > > On Tue, Jan 21, 2020 at 11:31 PM Zbynek Vavros > wrote: > > > Hi, > > > > just simple use-case but I can't figure it out. > > > > I have DropDownChoice that selects User and Label having > > StringResourceModel where the parameter (new > > StringResourceModel(...).setParameter(selectedUser)) is the selected > user. > > How do I update the Label's model so that it reflects User selected via > > AJAX? > > > > Thanks, > > Zbynek > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
StringResourceModel parameter and AJAX update
Hi, just simple use-case but I can't figure it out. I have DropDownChoice that selects User and Label having StringResourceModel where the parameter (new StringResourceModel(...).setParameter(selectedUser)) is the selected user. How do I update the Label's model so that it reflects User selected via AJAX? Thanks, Zbynek
Re: Programmatic creation of messages with nested components
How about using org.apache.wicket.markup.IMarkupResourceStreamProvider ? Zbynek On Thu, Jul 25, 2019 at 6:48 AM Martin Terra < martin.te...@koodaripalvelut.com> wrote: > Hi! > > Can you show an example of solution now vs. solution after change, what are > the benefits of such visibility change to your case? Maybe there is another > way to accomplish your goal? > > ** > Martin > > ke 24. heinäk. 2019 klo 22.25 Thomas Heigl (tho...@umschalt.com) > kirjoitti: > > > Hi all, > > > > I'd like to create Wicket messages with child components programatically. > > Currently, this is only possible by using the tag and > > nesting components inside of it. > > > > For most use cases this is sufficient, but I sometimes come across cases > > where I'd like to programatically define the message key instead of > > hard-coding it in the template. > > > > The class that does all the interpolation is currently > > private: > > org.apache.wicket.markup.resolver.WicketMessageResolver.MessageContainer > > > > Would it be possible to make this a public (top-level) class in Wicket 9? > > If I understand correctly, this would solve my requirement without any > > other code changes. > > > > Best regards, > > > > Thomas > > >
Re: DataTable and SelectAll checkbox
My bad, using Sven's example it works fine, my app wasn't reloaded properly. Zbynek On Thu, Jul 18, 2019 at 3:21 PM Zbynek Vavros wrote: > Hey Ilia, > > I am quite aware about this and we do something similar, I was just > wondering is there is "native" Wickety way... > > Thanks, > Zbynek > > On Thu, Jul 18, 2019 at 2:06 AM Илья Нарыжный wrote: > >> Hello, >> >> Or you can check implementation of IColumn with "Select All" here: >> >> https://github.com/OrienteerBAP/Orienteer/blob/master/orienteer-core/src/main/java/org/orienteer/core/component/table/CheckBoxColumn.java#L49-L64 >> >> Thanks, >> Ilia >> >> - >> Orienteer(http://orienteer.org) - open source Business Application >> Platform >> >> On Wed, Jul 17, 2019 at 11:36 AM Sven Meier wrote: >> >> > Hi, >> > >> > have to taken a look at: >> > >> > >> > >> https://github.com/apache/wicket/blob/wicket-8.x/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage.java >> > >> > That's the trick. >> > >> > Have fun >> > Sven >> > >> > >> > On 17.07.19 20:15, Zbynek Vavros wrote: >> > > Hi, >> > > >> > > I know this is quite old but since I do migration to Wicket8 now I >> think >> > if >> > > there is any "nice" way to do this. >> > > >> > > The thing is we have this "mighty" checkbox in the header of a >> checkbox >> > > column. >> > > For now we use jQuery but for sure there has to be better way. >> > > >> > > From what I have found the best way seems to use HeaderlessColumn and >> > put >> > > this mighty checkbox into a panel that goes into getHeader(final >> String >> > > componentId). >> > > And of course checkbox for each row into populateItem(Item cellItem, >> > > String componentId, IModel rowModel). >> > > >> > > The thing is, using CheckBoxGroup and CheckBoxGroupSelector these two >> are >> > > quite separated so not even wrapping whole DataTable in CheckBoxGroup >> > > doesn't really seem to do the trick. >> > > >> > > Anyone figured out a better way or is jquery the thing for this? >> > > >> > > Zbynek >> > > >> > >> > - >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> > For additional commands, e-mail: users-h...@wicket.apache.org >> > >> > >> >
Re: DataTable and SelectAll checkbox
Hey Ilia, I am quite aware about this and we do something similar, I was just wondering is there is "native" Wickety way... Thanks, Zbynek On Thu, Jul 18, 2019 at 2:06 AM Илья Нарыжный wrote: > Hello, > > Or you can check implementation of IColumn with "Select All" here: > > https://github.com/OrienteerBAP/Orienteer/blob/master/orienteer-core/src/main/java/org/orienteer/core/component/table/CheckBoxColumn.java#L49-L64 > > Thanks, > Ilia > > - > Orienteer(http://orienteer.org) - open source Business Application > Platform > > On Wed, Jul 17, 2019 at 11:36 AM Sven Meier wrote: > > > Hi, > > > > have to taken a look at: > > > > > > > https://github.com/apache/wicket/blob/wicket-8.x/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage.java > > > > That's the trick. > > > > Have fun > > Sven > > > > > > On 17.07.19 20:15, Zbynek Vavros wrote: > > > Hi, > > > > > > I know this is quite old but since I do migration to Wicket8 now I > think > > if > > > there is any "nice" way to do this. > > > > > > The thing is we have this "mighty" checkbox in the header of a checkbox > > > column. > > > For now we use jQuery but for sure there has to be better way. > > > > > > From what I have found the best way seems to use HeaderlessColumn and > > put > > > this mighty checkbox into a panel that goes into getHeader(final String > > > componentId). > > > And of course checkbox for each row into populateItem(Item cellItem, > > > String componentId, IModel rowModel). > > > > > > The thing is, using CheckBoxGroup and CheckBoxGroupSelector these two > are > > > quite separated so not even wrapping whole DataTable in CheckBoxGroup > > > doesn't really seem to do the trick. > > > > > > Anyone figured out a better way or is jquery the thing for this? > > > > > > Zbynek > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > >
Re: DataTable and SelectAll checkbox
Hi Sven, yeah that's what I found and tried but ended up with org.apache.wicket.markup.MarkupException: Unable to find component with id 'checkGroupSelector' in [CheckGroup [Component id = checkGroup]] Expected: 'searchResultComponent:subtaskListForm:checkGroup:checkGroupSelector'. Found with similar names: 'searchResultComponent:subtaskListForm:checkGroup:dataTable:topToolbars:toolbars:2:headers:2:header:label:checkGroupSelector' The issue as I understand it is that CheckGroupSelector is in Panel that is created in Column.getHeader(). Of course outside of the DataTable's column the selector works just fine. Zbynek On Wed, Jul 17, 2019 at 8:36 PM Sven Meier wrote: > Hi, > > have to taken a look at: > > > https://github.com/apache/wicket/blob/wicket-8.x/wicket-examples/src/main/java/org/apache/wicket/examples/compref/CheckGroupPage.java > > That's the trick. > > Have fun > Sven > > > On 17.07.19 20:15, Zbynek Vavros wrote: > > Hi, > > > > I know this is quite old but since I do migration to Wicket8 now I think > if > > there is any "nice" way to do this. > > > > The thing is we have this "mighty" checkbox in the header of a checkbox > > column. > > For now we use jQuery but for sure there has to be better way. > > > > From what I have found the best way seems to use HeaderlessColumn and > put > > this mighty checkbox into a panel that goes into getHeader(final String > > componentId). > > And of course checkbox for each row into populateItem(Item cellItem, > > String componentId, IModel rowModel). > > > > The thing is, using CheckBoxGroup and CheckBoxGroupSelector these two are > > quite separated so not even wrapping whole DataTable in CheckBoxGroup > > doesn't really seem to do the trick. > > > > Anyone figured out a better way or is jquery the thing for this? > > > > Zbynek > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
DataTable and SelectAll checkbox
Hi, I know this is quite old but since I do migration to Wicket8 now I think if there is any "nice" way to do this. The thing is we have this "mighty" checkbox in the header of a checkbox column. For now we use jQuery but for sure there has to be better way. >From what I have found the best way seems to use HeaderlessColumn and put this mighty checkbox into a panel that goes into getHeader(final String componentId). And of course checkbox for each row into populateItem(Item cellItem, String componentId, IModel rowModel). The thing is, using CheckBoxGroup and CheckBoxGroupSelector these two are quite separated so not even wrapping whole DataTable in CheckBoxGroup doesn't really seem to do the trick. Anyone figured out a better way or is jquery the thing for this? Zbynek
Re: Wicket tests with Spring Boot
Not sure if it helps or it is what are you looking for but this is how I do it. I have abstract base class that - sets Wicket application into Spring ApplicationContext - creates WicketTester - uses static configuration class to create mocks of required Spring components in ApplicationContext that are in turn injected into Wicket components using @SpringBean @RunWith(SpringRunner.class) @ContextConfiguration @ImportAutoConfiguration(WicketAutoConfiguration.class) public abstract class BaseWicketTest { @Autowired protected WebApplication wicketApplication; @Autowired protected ApplicationContext applicationContextMock; protected WicketTester wicketTester; @Before public void baseSetUp() { ReflectionTestUtils.setField(wicketApplication, "applicationContext", applicationContextMock); wicketTester = new WicketTester(wicketApplication); } @Configuration @ComponentScan({"my.package"}) @Import(AnotherConfiguration.class) public static class Config { @Bean UserDetailsService userDetailsService() { return mock(MyUserDetailsService.class); } } } Then all test classes extend this abstract base class. @RunWith(SpringRunner.class) public class WicketComponentTest extends BaseWicketTest { // autowired mock @Autowired private UserDetailsService userDetailsServiceMock; @Test public void testSomething() { // stub userDetailsServiceMock using Mockito when() // perform wicket component initialization and do tests (submit form, perform ajax etc) // validate userDetailsServiceMock using Mockito verify() } } Does everything I need and seems pretty clear to me but maybe someone here has a better setup. Zbynek On Wed, Jul 10, 2019 at 11:41 AM Tom Götz wrote: > We have both, a service layer and a persistence layer (each in it's own > maven module). We use Spring Data Jpa repositories for the persistence > layer and Liquibase for managing DB changes. When testing the Wicket layer > I don't want the complete persistence and service layer to be initialized > by Spring (e.g. no need for persistence context initialization and > Liquibase), but would prefer to work with mocks. Is that enough information > for you or what else should I provide? > Tom > > > Am 10.07.2019 um 11:00 schrieb Andrei Kondratev < > andrei.kondra...@unimarket.com>: > > > > Hi Tom! > > > > It depends on the implementation. If you have a service level it's not > necessary to mock persistence, but enough to mock services and inject them > (if you use @Autowired annotation). > > > > Could you please give a bit more examples of what you're trying to test? > > > > > >> On Wed, 10 Jul 2019 at 20:56, "Tom Götz" wrote: > >> Hi there, > >> > >> we have a Spring Boot based webapp (Wicket 8.4 with wicket-spring-boot > 2.1.6) and would like to create a base test class for our Wicket tests. For > testing, we would like to mock the service and persistence layer (e.g. with > Mockito). Is there a good example for that purpose? > >> > >> Cheers > >> Tom > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > > -- > > ANDREW KONDRATEV > > TECHNICAL LEAD > > > > > > > > MOB +64 210 492 674 > > EMAIL andrei.kondra...@unimarket.com > > www.unimarket.com > > > > Simple and easy-to-use software that brings all your procurement into > one place. >
Re: DropDownChoice - choices type vs model type
Hey, well " why not place in the JAXB annotations into the same class" - first after that the entity ends with gazilion of annotations on every field. Second, not sure how JAXB helps with stuff like jackson marshalling. Completely agreeing with dozer!!! :) Zbynek On Mon, Jul 1, 2019 at 9:27 PM Tobias Soloschenko wrote: > Hi, > > just my 5 Cent but I hate conversion methods to transform JPA objects to > DTO - why not place in the JAXB annotations into the same class - this > prevents a lot of code and please no DozerBeanMapper ;-) > > kind regards > > Tobias > > > Am 01.07.2019 um 21:19 schrieb Zbynek Vavros : > > > > I don't want DTO - entity relation, the idea here is to make clear > > separation of JPA entities and DTOs that can be send over REST/RMI > > call/serialized. > > > > So you don't think there is some "wickety " magic to make this less > painful? > > Own class is sure thing, if nothing else than for tests... > > > > Zbynek > > > > > > > >> On Mon, Jul 1, 2019 at 7:22 PM Sven Meier wrote: > >> > >> Hi, > >> > >> preferably your dto would hold a batch instance instead of the name > only. > >> > >> In your case you have to do the mapping somewhere, the renderer is a > >> good place for that. > >> Move it into its own class file so it won't hurt so much :P. > >> > >> Have fun > >> Sven > >> > >> > >>> On 01.07.19 14:45, Zbynek Vavros wrote: > >>> Hi, > >>> > >>> I don't have any specific use-case for this but I'm interested on how > to > >> do > >>> this properly. > >>> > >>> There is a DropDownChoice that displays list of Batches. > >>> Now the display option should be "id" and "name" concated together and > >>> the DropDownChoice selection model will be only the name. > >>> > >>> Batch is simple entity/DTO with Long id and String name, something > like: > >>> > >>> public class Batch implements Serializable { > >>> private Long id; > >>> private String name; > >>> } > >>> > >>> DropDownChoice is added to form that has CompoundPropertyModel for > >> example > >>> like this: > >>> > >>> public class ResultDto implement Serializable { > >>> private String batchName; > >>> } > >>> > >>> the only solution I can think of is custom IChoiceRenderer but looks > >> nasty > >>> > >>> List batches = Lists.newArrayList(); > >>> List names > >>> =batches.stream().map(Batch::getName).collect(Collectors.toList()); > >>> > >>> add(new DropDownChoice<>(" batchName ", names, new > >>> IChoiceRenderer() { > >>> @Override > >>> public Object getDisplayValue(String name) { > >>> > >>> Batch batch1 = batches.stream().filter(batch -> > >>> name.equalsIgnoreCase(batch.getName())).findFirst().get(); > >>> > >>> return batch1.getId() + " - " + batch1.getName(); > >>> } > >>> > >>> @Override > >>> public String getIdValue(String object, int index) { > >>> return String.valueOf(index); > >>> } > >>> > >>> @Override > >>> public String getObject(String id, IModel >>> extends String>> choices) { > >>> return batches.get(Integer.valueOf(id)).getName() > >>> } > >>> })); > >>> > >>> Surely there has to be a better way to do this! > >>> > >>> Zbynek > >>> > >> > >> - > >> 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: DropDownChoice - choices type vs model type
I don't want DTO - entity relation, the idea here is to make clear separation of JPA entities and DTOs that can be send over REST/RMI call/serialized. So you don't think there is some "wickety " magic to make this less painful? Own class is sure thing, if nothing else than for tests... Zbynek On Mon, Jul 1, 2019 at 7:22 PM Sven Meier wrote: > Hi, > > preferably your dto would hold a batch instance instead of the name only. > > In your case you have to do the mapping somewhere, the renderer is a > good place for that. > Move it into its own class file so it won't hurt so much :P. > > Have fun > Sven > > > On 01.07.19 14:45, Zbynek Vavros wrote: > > Hi, > > > > I don't have any specific use-case for this but I'm interested on how to > do > > this properly. > > > > There is a DropDownChoice that displays list of Batches. > > Now the display option should be "id" and "name" concated together and > > the DropDownChoice selection model will be only the name. > > > > Batch is simple entity/DTO with Long id and String name, something like: > > > > public class Batch implements Serializable { > > private Long id; > > private String name; > > } > > > > DropDownChoice is added to form that has CompoundPropertyModel for > example > > like this: > > > > public class ResultDto implement Serializable { > > private String batchName; > > } > > > > the only solution I can think of is custom IChoiceRenderer but looks > nasty > > > > List batches = Lists.newArrayList(); > > List names > > =batches.stream().map(Batch::getName).collect(Collectors.toList()); > > > > add(new DropDownChoice<>(" batchName ", names, new > > IChoiceRenderer() { > > @Override > > public Object getDisplayValue(String name) { > > > > Batch batch1 = batches.stream().filter(batch -> > > name.equalsIgnoreCase(batch.getName())).findFirst().get(); > > > > return batch1.getId() + " - " + batch1.getName(); > > } > > > > @Override > > public String getIdValue(String object, int index) { > > return String.valueOf(index); > > } > > > > @Override > > public String getObject(String id, IModel > extends String>> choices) { > > return batches.get(Integer.valueOf(id)).getName() > > } > > })); > > > > Surely there has to be a better way to do this! > > > > Zbynek > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
DropDownChoice - choices type vs model type
Hi, I don't have any specific use-case for this but I'm interested on how to do this properly. There is a DropDownChoice that displays list of Batches. Now the display option should be "id" and "name" concated together and the DropDownChoice selection model will be only the name. Batch is simple entity/DTO with Long id and String name, something like: public class Batch implements Serializable { private Long id; private String name; } DropDownChoice is added to form that has CompoundPropertyModel for example like this: public class ResultDto implement Serializable { private String batchName; } the only solution I can think of is custom IChoiceRenderer but looks nasty List batches = Lists.newArrayList(); List names =batches.stream().map(Batch::getName).collect(Collectors.toList()); add(new DropDownChoice<>(" batchName ", names, new IChoiceRenderer() { @Override public Object getDisplayValue(String name) { Batch batch1 = batches.stream().filter(batch -> name.equalsIgnoreCase(batch.getName())).findFirst().get(); return batch1.getId() + " - " + batch1.getName(); } @Override public String getIdValue(String object, int index) { return String.valueOf(index); } @Override public String getObject(String id, IModel> choices) { return batches.get(Integer.valueOf(id)).getName() } })); Surely there has to be a better way to do this! Zbynek
Re: Lazy modal window
Aha I see, the solution is to set the content panel when the ajax event occurs... Thanks! On Mon, Mar 11, 2019 at 10:10 PM Sven Meier wrote: > Hi, > > publish you quickstart on a public repository (e.g. Github) or store it > on a file hoster so we can take a look. > > But it's not hard actually - you can delay setting the content of your > dialog until it is shown: > > @Override > public void onClick(AjaxRequestTarget target) > { > modal2.setContent(createContent(modal2.getContentId())); > modal2.setWindowClosedCallback(target -> modal2.setContent(new > WebMarkupContainer(modal2.getContentId())) ); > modal2.show(target); > } > > Have fun > Sven > > > Am 11.03.19 um 17:20 schrieb Zbynek Vavros: > > Well for me the code in content's panel is executed when the page > > containing the link/button is rendered. > > Doesn't matter if I click it or not. Maybe I do smth terribly wrong... > > > > I could provide quick-start I'm just not sure how it works here (do I > > attach it to email?). > > > > On Mon, Mar 11, 2019 at 1:17 PM Martin Grigorov > > wrote: > > > >> On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros > >> wrote: > >> > >>> Let's say modal windows does some quite expensive query and user > never > >>> displays this window. > >>> In this case the query will be done even when not needed. > >>> > >>> Is there any other way to make sure the content isn't loaded until > >> needed? > >> The content of the ModalWindow is shown after your application executes > >> modalWindow.show(target), e.g. after clicking on a link/button. > >> > >> > >> > >>> > >>> On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov > >>> wrote: > >>> > >>>> Hi, > >>>> > >>>> On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros < > zbynekvav...@gmail.com > >>>> wrote: > >>>> > >>>>> Hi, > >>>>> > >>>>> I see content of modal windows being created even before the window > >> was > >>>>> displayed. > >>>>> Is proper way to make this lazy by using AjaxLazyLoadPanel in > >>>>> ModalWindow.setContent ? > >>>>> > >>>> This is a matter of requirements/taste. > >>>> Your users would prefer to see the content as soon as possible. > >>>> > >>>> > >>>>> Thanks > >>>>> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Lazy modal window
Well for me the code in content's panel is executed when the page containing the link/button is rendered. Doesn't matter if I click it or not. Maybe I do smth terribly wrong... I could provide quick-start I'm just not sure how it works here (do I attach it to email?). On Mon, Mar 11, 2019 at 1:17 PM Martin Grigorov wrote: > On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros > wrote: > > > Let's say modal windows does some quite expensive query and user never > > displays this window. > > In this case the query will be done even when not needed. > > > > Is there any other way to make sure the content isn't loaded until > needed? > > > > The content of the ModalWindow is shown after your application executes > modalWindow.show(target), e.g. after clicking on a link/button. > > > > > > > > > On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov > > wrote: > > > > > Hi, > > > > > > On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros > > > > wrote: > > > > > > > Hi, > > > > > > > > I see content of modal windows being created even before the window > was > > > > displayed. > > > > Is proper way to make this lazy by using AjaxLazyLoadPanel in > > > > ModalWindow.setContent ? > > > > > > > > > > This is a matter of requirements/taste. > > > Your users would prefer to see the content as soon as possible. > > > > > > > > > > > > > > Thanks > > > > > > > > > >
Re: Lazy modal window
Let's say modal windows does some quite expensive query and user never displays this window. In this case the query will be done even when not needed. Is there any other way to make sure the content isn't loaded until needed? On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov wrote: > Hi, > > On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros > wrote: > > > Hi, > > > > I see content of modal windows being created even before the window was > > displayed. > > Is proper way to make this lazy by using AjaxLazyLoadPanel in > > ModalWindow.setContent ? > > > > This is a matter of requirements/taste. > Your users would prefer to see the content as soon as possible. > > > > > > Thanks > > >
Lazy modal window
Hi, I see content of modal windows being created even before the window was displayed. Is proper way to make this lazy by using AjaxLazyLoadPanel in ModalWindow.setContent ? Thanks
Re: Wicket and material theme
Excelent! Thanks On Thu, Mar 7, 2019, 6:59 AM Martin Grigorov wrote: > Hi, > > On Thu, Mar 7, 2019 at 12:14 AM Zbynek Vavros > wrote: > > > Hi Martin, > > > > sorry if the message understood was to put this project in a bad light, > not > > at all! > > > > I played with it a while and seems to be doing exactly what advertised. > > Maybe a question (since I see you are one of the authors) - how does one > > add a theme? > > By checking the ThemeProvider I see only "bootstrap" theme is available > by > > default. > > How to add new theme into provider? > > > > "bootstrap" theme is the default one and it is in wicket-bootstrap-core > module. > All other themes are in wicket-bootstrap-themes module: > > https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/wicket-7.x/bootstrap-themes > To set it up you need to do something like: > > final IBootstrapSettings settings = new BootstrapSettings(); > > Bootstrap.builder().withBootstrapSettings(settings).install(yourApplication); > ThemeProvider themeProvider = new SingleThemeProvider(new > MaterialDesignTheme()); > settings.setThemeProvider(themeProvider); > > See how the demo application does it here: > > https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/10a60be4e68038e4b1d275bc598835d12f5a715d/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples/WicketApplication.java#L209-L218 > > > > > > Thanks, > > Zbynek > > > > On Wed, Mar 6, 2019 at 9:51 AM Martin Grigorov > > wrote: > > > > > Hi, > > > > > > On Wed, Mar 6, 2019 at 1:36 AM Zbynek Vavros > > > wrote: > > > > > > > Hi, > > > > > > > > for a new project we would like to use (hopefully) well known > material > > > > design. > > > > After some discussion we discarded using any popular JS frameworks. > > > > Since most of us work with Wicket for quite some time and we all like > > it > > > > we would like to stick with it. > > > > > > > > Now would be the recommended way to use material design with Wicket? > > > > > > > > There is an integration project > > > > https://github.com/l0rdn1kk0n/wicket-bootstrap > > > > that doesn't seem to be very actual (failed builds, TBD in docs...). > > > > > > > > > > - failed builds are due to bad CI servers. The project uses TravisCI > > > because it is free and the builds there are very unstable. If you build > > the > > > project locally with "mvn clean package" it will build just fine. > > > - TBD in docs: well, it is an open source project... People contribute > as > > > much as they need for their apps. It is better than nothing. > > > > > > > > > > It also doesn't seem to implement even basic components ( > > > > > > > > > > > > > > https://material-components.github.io/material-components-web-catalog/#/component/text-field > > > > ). > > > > Or maybe I missed something? > > > > > > > > > > Wicket-Bootstrap project, as its name suggests, provides integration > with > > > Bootstrap <https://getbootstrap.com/>. The Material design is just one > > of > > > the themes for Bootstrap, provided by > > > https://github.com/FezVrasta/bootstrap-material-design/ > > > > > > > > > https://fezvrasta.github.io/bootstrap-material-design/docs/4.0/examples/checkout/ > > > shows a form with this theme. I am not sure whether it completely > > > implements the "specification" > > > > > > > > > > > > > > Another option would be to do all styling manually, well... > > > > > > > > Did anyone used material with Wicket? > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > >
Re: Wicket and material theme
Hi Martin, sorry if the message understood was to put this project in a bad light, not at all! I played with it a while and seems to be doing exactly what advertised. Maybe a question (since I see you are one of the authors) - how does one add a theme? By checking the ThemeProvider I see only "bootstrap" theme is available by default. How to add new theme into provider? Thanks, Zbynek On Wed, Mar 6, 2019 at 9:51 AM Martin Grigorov wrote: > Hi, > > On Wed, Mar 6, 2019 at 1:36 AM Zbynek Vavros > wrote: > > > Hi, > > > > for a new project we would like to use (hopefully) well known material > > design. > > After some discussion we discarded using any popular JS frameworks. > > Since most of us work with Wicket for quite some time and we all like it > > we would like to stick with it. > > > > Now would be the recommended way to use material design with Wicket? > > > > There is an integration project > > https://github.com/l0rdn1kk0n/wicket-bootstrap > > that doesn't seem to be very actual (failed builds, TBD in docs...). > > > > - failed builds are due to bad CI servers. The project uses TravisCI > because it is free and the builds there are very unstable. If you build the > project locally with "mvn clean package" it will build just fine. > - TBD in docs: well, it is an open source project... People contribute as > much as they need for their apps. It is better than nothing. > > > > It also doesn't seem to implement even basic components ( > > > > > https://material-components.github.io/material-components-web-catalog/#/component/text-field > > ). > > Or maybe I missed something? > > > > Wicket-Bootstrap project, as its name suggests, provides integration with > Bootstrap <https://getbootstrap.com/>. The Material design is just one of > the themes for Bootstrap, provided by > https://github.com/FezVrasta/bootstrap-material-design/ > > https://fezvrasta.github.io/bootstrap-material-design/docs/4.0/examples/checkout/ > shows a form with this theme. I am not sure whether it completely > implements the "specification" > > > > > > Another option would be to do all styling manually, well... > > > > Did anyone used material with Wicket? > > > > Thanks, > > Zbynek > > >
Wicket and material theme
Hi, for a new project we would like to use (hopefully) well known material design. After some discussion we discarded using any popular JS frameworks. Since most of us work with Wicket for quite some time and we all like it we would like to stick with it. Now would be the recommended way to use material design with Wicket? There is an integration project https://github.com/l0rdn1kk0n/wicket-bootstrap that doesn't seem to be very actual (failed builds, TBD in docs...). It also doesn't seem to implement even basic components ( https://material-components.github.io/material-components-web-catalog/#/component/text-field ). Or maybe I missed something? Another option would be to do all styling manually, well... Did anyone used material with Wicket? Thanks, Zbynek
Re: Model map with enum as a key
Do you mean to manually iterate through the map and converting the string keys Wicket binds to enum keys? Even if I try to iterate through the map I get the same ClassCastException. Somehow Wicket managed to insert String as a key instead of enum. Zbynek On Mon, Feb 4, 2019 at 1:55 PM Francois Meillet wrote: > use MyEnum.valueOf("your string ») before saving the data > > François > > > > > Le 4 févr. 2019 à 13:51, Zbynek Vavros a écrit > : > > > > I got this class that has map with enums as keys: > > > > public class MasterClass { > > > >private Map config = Maps.newHashMap(); > > } > > > > enum is classic: > > > > public enum MyEnum { > >VALUE1, > >VALUE2 > > } > > > > now I would like to use one entry of this map as a model for TextField: > > > > new RequiredTextField<>("componentId", new > > PropertyModel<>(modelObject.getConfig(), "VALUE1"))) > > > > but when saved to DB Hibernate says the key is String and Enum is > expected: > > java.lang.ClassCastException: java.lang.String cannot be cast to > > java.lang.Enum > > > > Using ChainingModel or > > Model.of(modelObject.getConfig().get(MyEnum.VALUE1))) causes the value > not > > to be bind at all. > > > > I know I can use "side" property and fill this map manually in onSubmit > > just before saving to DB but would like to avoid that. > > > > Thanks > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Model map with enum as a key
I got this class that has map with enums as keys: public class MasterClass { private Map config = Maps.newHashMap(); } enum is classic: public enum MyEnum { VALUE1, VALUE2 } now I would like to use one entry of this map as a model for TextField: new RequiredTextField<>("componentId", new PropertyModel<>(modelObject.getConfig(), "VALUE1"))) but when saved to DB Hibernate says the key is String and Enum is expected: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum Using ChainingModel or Model.of(modelObject.getConfig().get(MyEnum.VALUE1))) causes the value not to be bind at all. I know I can use "side" property and fill this map manually in onSubmit just before saving to DB but would like to avoid that. Thanks
Re: WicketTester and stateless component
Thanks Sven, nice to know I was "close" :) And let me express the gratitude to all Wicket community, getting help like this is why I struggle to move to some new fancy framework instead of good old Wicket. Zbynek On Sun, Feb 3, 2019 at 7:24 PM Sven Meier wrote: > Hi, > > indeed, since your page is bookmarkable (has a default constructor) and > is stateless, Wicket redirects to a fresh instance for render. > > You can prevent this by disabling statelessness: > > if(StringUtils.hasText(msg)) { > this.message = msg; > setStatelessHint(false); > } else { > this.message = getString("sapi2.page.error.default_message"); > } > > Have fun > Sven > > > Am 03.02.19 um 16:20 schrieb Zbynek Vavros: > > I have simple page for displaying messages: > > > > @MountPath("/wicket/page/error") > > public class ErrorPage extends WebPage { > > > > private String message; > > > > public ErrorPage() { > > this(null); > > } > > > > public ErrorPage(String msg) { > > if(StringUtils.hasText(msg)) { > > this.message = msg; > > } else { > > this.message = > getString("sapi2.page.error.default_message"); > > } > > add(new Label("errorMsg", > > this.message).setEscapeModelStrings(false)); > > } > > > > public String getMessage() { > > return message; > > } > > } > > > > now I would like to test this with WickeTester: > > > > @Testpublic void testPageRenders() { > > > > wicketTester.startPage(new ErrorPage(message)); > > ErrorPage errorPage = (ErrorPage) > > wicketTester.getLastRenderedPage(); > > assertEquals(message, errorPage.getMessage()); > > } > > > > but the test is failing and I can see the constructor is called twice, > once > > with my "message" parameter (as expected) and then again via empty > > constructor and thus the errorPage.getMessage() returns null. Why is the > > empty constructor called at all? After some painful debugging I suspect > it > > has something to do with the page being stateless... > > > > Zbynek > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
WicketTester and stateless component
I have simple page for displaying messages: @MountPath("/wicket/page/error") public class ErrorPage extends WebPage { private String message; public ErrorPage() { this(null); } public ErrorPage(String msg) { if(StringUtils.hasText(msg)) { this.message = msg; } else { this.message = getString("sapi2.page.error.default_message"); } add(new Label("errorMsg", this.message).setEscapeModelStrings(false)); } public String getMessage() { return message; } } now I would like to test this with WickeTester: @Testpublic void testPageRenders() { wicketTester.startPage(new ErrorPage(message)); ErrorPage errorPage = (ErrorPage) wicketTester.getLastRenderedPage(); assertEquals(message, errorPage.getMessage()); } but the test is failing and I can see the constructor is called twice, once with my "message" parameter (as expected) and then again via empty constructor and thus the errorPage.getMessage() returns null. Why is the empty constructor called at all? After some painful debugging I suspect it has something to do with the page being stateless... Zbynek
Validation message parameters and internationalization
So I am using localized version of validation message for required fields Required=My custom message for field '${label}' but the resulting message contains field ID as parameters and result is i.e. "My custom message for field 'password'" since the whole page is not in English I would like to have the parameter localized as well. Some of the users do not speak English and they would not understand what "password" is. I see in code of org.apache.wicket.markup.html.form.FormComponent that the component's getId() is used as parameter. Any way to customize this? I can surely use validation message for this specific field with key i.e. "password.Required" but I would like to be more generic. Thanks, Zbynek
Re: Internationalization
Aha the index! Thanks On Sun, Jan 27, 2019 at 11:21 PM Martin Grigorov wrote: > Hi, > > if MyWicketApplication is the name of your application class then all you > need to do is to create MyWicketApplication.properties next to it and it > will be used with priority overthe defaults. > > If this is not the case then use .add(0, new Bundle) and it will be > consulted first. > > > On Mon, Jan 28, 2019, 00:10 Zbynek Vavros > > Hi, > > > > I'm trying to provide custom properties file for Wicket application. > > > > I was going to use BundleStringResourceLoader using > > > > getResourceSettings().getStringResourceLoaders().add(new > > BundleStringResourceLoader("MyWicketApplication")). > > > > Then I replaced "Required" message with my message it is not used. > > After debugging into org.apache.wicket.Localizer I can see it iterates > > through org.apache.wicket.resource.loader.IStringResourceLoader in this > > order: > > > > ComponentStringResourceLoader > > PackageStringResourceLoader > > ClassStringResourceLoader > > ValidatorStringResourceLoader > > InitializerStringResourceLoader > > BundleStringResourceLoader > > > > So the "Required" message is loaded from InitializerStringResourceLoader > > before my BundleStringResourceLoader is hit. > > > > How to properly provide Wicket with custom bundle containing ALL types of > > messages? > > > > Thanks, > > Zbynek > > >
Internationalization
Hi, I'm trying to provide custom properties file for Wicket application. I was going to use BundleStringResourceLoader using getResourceSettings().getStringResourceLoaders().add(new BundleStringResourceLoader("MyWicketApplication")). Then I replaced "Required" message with my message it is not used. After debugging into org.apache.wicket.Localizer I can see it iterates through org.apache.wicket.resource.loader.IStringResourceLoader in this order: ComponentStringResourceLoader PackageStringResourceLoader ClassStringResourceLoader ValidatorStringResourceLoader InitializerStringResourceLoader BundleStringResourceLoader So the "Required" message is loaded from InitializerStringResourceLoader before my BundleStringResourceLoader is hit. How to properly provide Wicket with custom bundle containing ALL types of messages? Thanks, Zbynek
Re: Wicket Spring boot versus actuator (wicket 8.2.0) + spring security (boot 2.1.2)
I did it using BundleStringResourceLoader in the end. Well that's the point of having two WebSecurityConfigurerAdapters. One takes care about your actuator using HTTP Basic http.antMatcher("/actuator/**").authorizeRequests().anyRequest().hasRole("ACTUATOR_ROLE").and().httpBasic(); and the one one takes care about Wicket http.antMatcher("/wicket/**").authorizeRequests() .antMatchers("/wicket/page/login**").permitAll() .antMatchers("/wicket/page/**").hasRole("WICKET") .and().formLogin().loginPage("/wicket/page/login").loginProcessingUrl("/fake-url") .and().csrf().disable(); this will redirect to login page in case you are not logged in. Regarding lack of privileges (roles) that's another story and you should probably read Spring Security docs on how to properly handle those since it's not really related (i.e. user is already logged in, you sure you want to re-login?). Zbynek On Fri, Jan 25, 2019 at 11:05 AM nino martinez wael < nino.martinez.w...@gmail.com> wrote: > Have you gone through this : > > > https://ci.apache.org/projects/wicket/guide/8.x/single.html#_extending_the_default_lookup_algorithm > (which seems you have, please show a little code) > > And could you tell med howto make Spring redirect to my wicket login page > for all urls except /actuator (which is handled by basic auth)? Also every > wicket page which requires authentication should redirect to /login page if > you either lack permissions or arent logged in.. > > -Nino > > > > On Fri, Jan 25, 2019 at 8:18 AM Zbynek Vavros > wrote: > > > Took me some time to understand as well so I'm glad share :) > > > > I'm in process of tuning this setup so just out of curiosity how did you > > set up the Wicket properties file(s)? I don't like the idea to having > > properties in src/main/java and looking for proper way to load them from > > custom location like > > src/main/resources/properties/MyWicketApplication.properties. > > > > In out previous project we used I18n.init() method but I'm thinking more > > Wicket-y way, > > maybe using BundleStringResourceLoader ? But so far no luck making that > > work... > > > > Zbynek > > > > On Fri, Jan 25, 2019 at 6:34 AM nino martinez wael < > > nino.martinez.w...@gmail.com> wrote: > > > > > Yes this is exactly how I've done it :) Thanks for taking time to > help... > > > > > > @WicketSignInPage > > > @MountPath("page/login") > > > public class LoginPage extends BasePage { > > > > > > public LoginPage(PageParameters parameters) { > > > super(parameters); > > > > > > if (((AbstractAuthenticatedWebSession) getSession()).isSignedIn()) { > > > continueToOriginalDestination(); > > > } > > > add(new LoginForm("loginForm")); > > > } > > > > > > private class LoginForm extends StatelessForm { > > > > > > private String username; > > > private String password; > > > > > > public LoginForm(String id) { > > > super(id); > > > setModel(new CompoundPropertyModel<>(this)); > > > add(new FeedbackPanel("feedback")); > > > add(new RequiredTextField("username")); > > > add(new PasswordTextField("password")); > > > } > > > > > > @Override > > > protected void onSubmit() { > > > AuthenticatedWebSession session = AuthenticatedWebSession.get(); > > > if (session.signIn(username, password)) { > > > setResponsePage(HomePage.class); > > > } else { > > > error("Login failed"); > > > } > > > } > > > } > > > } > > > > > > > > > On Thu, Jan 24, 2019 at 4:17 PM Zbynek Vavros > > > wrote: > > > > > > > Is seems you have mixed my code with your code somehow. > > > > You must configure formLogin() and specify loginPage() pointing to > your > > > > Wicket login page (maybe using @MountPath?). > > > > The .loginProcessingUrl() points to "/fake-url" because the > > > authentication > > > > itself is called from Wicket login page > > > > via AuthenticatedWebSession.get().signIn(). Or do you use other > > mechanism > > > > in your Wicket login page? > > > > > > > > Zbynek > > > > > > > > On Thu, Jan 24, 2019 at 4:13 PM nino martinez wael < > > > > nino.martinez.w...@gm
Re: Wicket Spring boot versus actuator (wicket 8.2.0) + spring security (boot 2.1.2)
Took me some time to understand as well so I'm glad share :) I'm in process of tuning this setup so just out of curiosity how did you set up the Wicket properties file(s)? I don't like the idea to having properties in src/main/java and looking for proper way to load them from custom location like src/main/resources/properties/MyWicketApplication.properties. In out previous project we used I18n.init() method but I'm thinking more Wicket-y way, maybe using BundleStringResourceLoader ? But so far no luck making that work... Zbynek On Fri, Jan 25, 2019 at 6:34 AM nino martinez wael < nino.martinez.w...@gmail.com> wrote: > Yes this is exactly how I've done it :) Thanks for taking time to help... > > @WicketSignInPage > @MountPath("page/login") > public class LoginPage extends BasePage { > > public LoginPage(PageParameters parameters) { > super(parameters); > > if (((AbstractAuthenticatedWebSession) getSession()).isSignedIn()) { > continueToOriginalDestination(); > } > add(new LoginForm("loginForm")); > } > > private class LoginForm extends StatelessForm { > > private String username; > private String password; > > public LoginForm(String id) { > super(id); > setModel(new CompoundPropertyModel<>(this)); > add(new FeedbackPanel("feedback")); > add(new RequiredTextField("username")); > add(new PasswordTextField("password")); > } > > @Override > protected void onSubmit() { > AuthenticatedWebSession session = AuthenticatedWebSession.get(); > if (session.signIn(username, password)) { > setResponsePage(HomePage.class); > } else { > error("Login failed"); > } > } > } > } > > > On Thu, Jan 24, 2019 at 4:17 PM Zbynek Vavros > wrote: > > > Is seems you have mixed my code with your code somehow. > > You must configure formLogin() and specify loginPage() pointing to your > > Wicket login page (maybe using @MountPath?). > > The .loginProcessingUrl() points to "/fake-url" because the > authentication > > itself is called from Wicket login page > > via AuthenticatedWebSession.get().signIn(). Or do you use other mechanism > > in your Wicket login page? > > > > Zbynek > > > > On Thu, Jan 24, 2019 at 4:13 PM nino martinez wael < > > nino.martinez.w...@gmail.com> wrote: > > > > > It sort of works, If I go to the actuator I get the http basic auth, > if I > > > on the same session goto my pages.. I get an "ugly" access denied page > > and > > > not the configured wicket login page. So it sort of works.. > > > > > > If I just goto localhost:8080/ I get an default spring login page not > the > > > wicket one.. Upon succesfull login it forwards me to the wicket login > > page, > > > where I can login again and then get to the real application.. > > > > > > Below my current code: > > > > > > > > > package dk.netdesign.ccadmin.frontend.security; > > > > > > import org.springframework.context.annotation.Bean; > > > import org.springframework.context.annotation.Configuration; > > > import org.springframework.core.annotation.Order; > > > import > org.springframework.security.authentication.AuthenticationManager; > > > import > > > > > > > > > org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; > > > import > > > > org.springframework.security.config.annotation.web.builders.HttpSecurity; > > > import > > > > > > > > > org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; > > > import org.springframework.security.config.http.SessionCreationPolicy; > > > import org.springframework.security.core.Authentication; > > > import org.springframework.security.core.context.SecurityContextHolder; > > > import org.springframework.security.core.userdetails.User; > > > import > org.springframework.security.core.userdetails.UserDetailsService; > > > import > org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; > > > import > > > org.springframework.security.provisioning.InMemoryUserDetailsManager; > > > import org.springframework.stereotype.Component; > > > > > > @Configuration > > > public class WicketWebSecurityAdapterConfig extends > > > WebSecurityConfigurerAdapter { > > > > > > > > > @Configuration > > > @Order(1) > > > public static class RestSecurityConfig extends > &
Re: Wicket Spring boot versus actuator (wicket 8.2.0) + spring security (boot 2.1.2)
Is seems you have mixed my code with your code somehow. You must configure formLogin() and specify loginPage() pointing to your Wicket login page (maybe using @MountPath?). The .loginProcessingUrl() points to "/fake-url" because the authentication itself is called from Wicket login page via AuthenticatedWebSession.get().signIn(). Or do you use other mechanism in your Wicket login page? Zbynek On Thu, Jan 24, 2019 at 4:13 PM nino martinez wael < nino.martinez.w...@gmail.com> wrote: > It sort of works, If I go to the actuator I get the http basic auth, if I > on the same session goto my pages.. I get an "ugly" access denied page and > not the configured wicket login page. So it sort of works.. > > If I just goto localhost:8080/ I get an default spring login page not the > wicket one.. Upon succesfull login it forwards me to the wicket login page, > where I can login again and then get to the real application.. > > Below my current code: > > > package dk.netdesign.ccadmin.frontend.security; > > import org.springframework.context.annotation.Bean; > import org.springframework.context.annotation.Configuration; > import org.springframework.core.annotation.Order; > import org.springframework.security.authentication.AuthenticationManager; > import > > org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; > import > org.springframework.security.config.annotation.web.builders.HttpSecurity; > import > > org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; > import org.springframework.security.config.http.SessionCreationPolicy; > import org.springframework.security.core.Authentication; > import org.springframework.security.core.context.SecurityContextHolder; > import org.springframework.security.core.userdetails.User; > import org.springframework.security.core.userdetails.UserDetailsService; > import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; > import > org.springframework.security.provisioning.InMemoryUserDetailsManager; > import org.springframework.stereotype.Component; > > @Configuration > public class WicketWebSecurityAdapterConfig extends > WebSecurityConfigurerAdapter { > > > @Configuration > @Order(1) > public static class RestSecurityConfig extends > WebSecurityConfigurerAdapter { > > @Override > protected void configure(HttpSecurity http) throws Exception { > > > > http.antMatcher("/actuator/**").authorizeRequests().anyRequest().hasRole("ACTUATOR") > .and().csrf().disable() > > > .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) > .and().httpBasic(); > } > } > > @Configuration > @Order(2) > public static class WicketSecurityConfig extends > WebSecurityConfigurerAdapter { > @Override > protected void configure(HttpSecurity http) throws Exception { > http.antMatcher("/page/**").authorizeRequests() > .antMatchers("/page/login**").permitAll() > .antMatchers("/page/**").hasAnyAuthority("USER", > "ADMIN") > > > .and().formLogin().loginPage("/page/login").loginProcessingUrl("/fake-url") > > .and().csrf().disable(); > } > } > > @Bean > public static BCryptPasswordEncoder passwordEncoder() { > return new BCryptPasswordEncoder(); > } > > @Bean(name = "authenticationManager") > @Override > public AuthenticationManager authenticationManagerBean() throws > Exception { > > return super.authenticationManagerBean(); > } > public interface IAuthenticationFacade { > Authentication getAuthentication(); > } > @Component > public class AuthenticationFacade implements IAuthenticationFacade { > > @Override > public Authentication getAuthentication() { > return SecurityContextHolder.getContext().getAuthentication(); > } > } > > @Bean > public UserDetailsService userDetailsService() { > InMemoryUserDetailsManager manager = new > InMemoryUserDetailsManager(); > manager.createUser( > User.withUsername("admin") > > .password(passwordEncoder().encode("admin")).authorities("USER", "ADMIN") > .build()); > > manager.createUser( > User.withUsername("actuator") > > .password(passwordEncode
Re: Wicket Spring boot versus actuator (wicket 8.2.0) + spring security (boot 2.1.2)
In my case it works something like this: @Configuration @EnableWebSecurity public class SecurityConfiguration { @Configuration @Order(1) public static class RestSecurityConfig extends WebSecurityConfigurerAdapter { .. user details service, auth providers etc @Override protected void configure(HttpSecurity http) throws Exception { http.antMatcher("/api/**").authorizeRequests().anyRequest().authenticated() .and().csrf().disable() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and().httpBasic(); } } @Configuration @Order(2) public static class WicketSecurityConfig extends WebSecurityConfigurerAdapter { .. user details service, auth providers etc @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(wicketAuthenticationProvider); } @Override protected void configure(HttpSecurity http) throws Exception { http.antMatcher("/page/**").authorizeRequests() .antMatchers("/page/login**").permitAll() .antMatchers("/page/**").hasRole("ROLE") .and().formLogin().loginPage("/page/login").loginProcessingUrl("/fake-url") .and().csrf().disable(); } @Override @Bean(name = "authenticationManager") public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } } } The RestSecurityConfigwould be what you would do for actuators, for me thats the REST API. Not the order of "antMatcher", "authorizeRequests" and " antMatchers". Zbynek On Thu, Jan 24, 2019 at 3:09 PM nino martinez wael < nino.martinez.w...@gmail.com> wrote: > do you have an example? OR is it just to cut them into two like: > WebSecurityConfigurerAdapter A: > > > http.authorizeRequests().antMatchers("/actuator/**","/actuator").hasRole("ACTUATOR").and().httpBasic(); > > WebSecurityConfigurerAdapter B: > http > .csrf().disable() > .authorizeRequests().anyRequest().permitAll() > .and() > .logout() > .permitAll(); > http.headers().frameOptions().disable(); > > > On Thu, Jan 24, 2019 at 3:06 PM Zbynek Vavros > wrote: > > > Hi, > > > > I did similar thing, the trick here is to use two > > WebSecurityConfigurerAdaptes. > > > > Zbynek > > > > On Thu, Jan 24, 2019 at 2:55 PM nino martinez wael < > > nino.martinez.w...@gmail.com> wrote: > > > > > Hope its okay to use the wicket user mailing list for this:) > > > > > > First of all thanks to MarcGiffing for making the project. But I cannot > > get > > > actuator endpoints to work with spring security and wicket spring > boot.. > > > I've tried a lot of things.. > > > > > > IN my WebSecurityConfigurerAdapter: > > > > > > http > > > > > > > > > > > > .authorizeRequests().antMatchers("/actuator/**","/actuator").hasRole("ACTUATOR").and().httpBasic(); > > > > > > http > > > .csrf().disable() > > > .authorizeRequests().anyRequest().permitAll() > > > .and() > > > .logout() > > > .permitAll(); > > > http.headers().frameOptions().disable(); > > > > > > But that just disables actuator and messes with the Wicket side of the > > > security.. Any one have some clues= > > > > > > -- > > > Best regards / Med venlig hilsen > > > Nino Martinez > > > > > > > > -- > Best regards / Med venlig hilsen > Nino Martinez >
Re: Wicket Spring boot versus actuator (wicket 8.2.0) + spring security (boot 2.1.2)
Hi, I did similar thing, the trick here is to use two WebSecurityConfigurerAdaptes. Zbynek On Thu, Jan 24, 2019 at 2:55 PM nino martinez wael < nino.martinez.w...@gmail.com> wrote: > Hope its okay to use the wicket user mailing list for this:) > > First of all thanks to MarcGiffing for making the project. But I cannot get > actuator endpoints to work with spring security and wicket spring boot.. > I've tried a lot of things.. > > IN my WebSecurityConfigurerAdapter: > > http > > > .authorizeRequests().antMatchers("/actuator/**","/actuator").hasRole("ACTUATOR").and().httpBasic(); > > http > .csrf().disable() > .authorizeRequests().anyRequest().permitAll() > .and() > .logout() > .permitAll(); > http.headers().frameOptions().disable(); > > But that just disables actuator and messes with the Wicket side of the > security.. Any one have some clues= > > -- > Best regards / Med venlig hilsen > Nino Martinez >
Re: [VOTE] drop wicketstuff-editable-grid
Well as I said, never used this myself but find it very useful. On Sat, Nov 24, 2018 at 1:09 PM Maxim Solodovnik wrote: > Already published modules will stay in maven report forever > I would like to remove modules not being used by users > It was decided modules should be voted one by one > If someone uses module - no problem, I'll search for other modules :) > > WBR, Maxim > (from mobile, sorry for the typos) > > On Sat, Nov 24, 2018, 18:40 Zbynek Vavros > > Hi, > > > > I have never used this module myself with Wicket but I did with my > previous > > stack. > > And can surely imagine scenario to use it today! > > > > Can you please explain a bit what is the idea behind dropping this > module? > > If its only in keeping it up-to-date with Wicket core version, isn't it > > enough to just > > state that this is only supported by Wicket X.Y ? > > > > Zbynek > > > > On Sat, Nov 24, 2018 at 11:14 AM Maxim Solodovnik > > wrote: > > > > > Hello All, > > > > > > wicketstuff currently has 238 modules, some are not being used > > > I would like to perform some house keeping > > > > > > According to > > > > > > > > > https://mvnrepository.com/artifact/org.wicketstuff/wicketstuff-editable-grid > > > > > > wicketstuff-editable-grid is not being used since `Oct, 2015` > > > > > > Would it be OK to drop this module from wicketstuff master (9.0.0)? > > > > > > -- > > > WBR > > > Maxim aka solomax > > > > > >
Re: [VOTE] drop wicketstuff-editable-grid
Hi, I have never used this module myself with Wicket but I did with my previous stack. And can surely imagine scenario to use it today! Can you please explain a bit what is the idea behind dropping this module? If its only in keeping it up-to-date with Wicket core version, isn't it enough to just state that this is only supported by Wicket X.Y ? Zbynek On Sat, Nov 24, 2018 at 11:14 AM Maxim Solodovnik wrote: > Hello All, > > wicketstuff currently has 238 modules, some are not being used > I would like to perform some house keeping > > According to > > https://mvnrepository.com/artifact/org.wicketstuff/wicketstuff-editable-grid > > wicketstuff-editable-grid is not being used since `Oct, 2015` > > Would it be OK to drop this module from wicketstuff master (9.0.0)? > > -- > WBR > Maxim aka solomax >
Re: Wicket 8.1.0 changelog
Thanks. On Tue, Sep 18, 2018 at 12:10 PM Andrea Del Bene wrote: > Hi, > > no it's the page that is wrong. Thank you for having shared the problem > with use. I will fix it asap. In the meantime you can find the changelog > here: > > https://www.apache.org/dist/wicket/8.1.0/CHANGELOG-8.x > > On Tue, Sep 18, 2018 at 11:49 AM Zbynek Vavros > wrote: > > > The changelog in > > https://wicket.apache.org/start/wicket-8.x.html#change-log > > says " The change log is not available at the current state of the > > development process.". > > > > Since 8.1.0 was just released... or is there another place to look for > > changelog for 8.1.0 ? > > > > Zbynek > > > > > -- > Andrea Del Bene. > Apache Wicket committer. >
Wicket 8.1.0 changelog
The changelog in https://wicket.apache.org/start/wicket-8.x.html#change-log says " The change log is not available at the current state of the development process.". Since 8.1.0 was just released... or is there another place to look for changelog for 8.1.0 ? Zbynek
Re: Ajax and async task
Hi Ernesto, sorry I was away in the afternoon/evening. Passing application into runnable constructor is working for me! Many thanks On Wed, Jun 20, 2018 at 11:13 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > https://github.com/reiern70/antilia-bits/blob/master/ > bgprocess/src/main/java/com/antilia/task/TasksRunnable.java#L28 > > On Wed, Jun 20, 2018 at 12:10 PM, Ernesto Reinaldo Barreiro < > reier...@gmail.com> wrote: > > > Did you look at > > > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > > > > > > > On Wed, Jun 20, 2018 at 12:05 PM, Zbynek Vavros > > wrote: > > > >> Still the same: > >> > >> org.apache.wicket.WicketRuntimeException: There is no application > >> attached > >> to current thread pool-XX-thread-XX > >> > >> Zbynek > >> > >> > >> > >> On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro < > >> reier...@gmail.com> wrote: > >> > >> > Maybe this can help > >> > > >> > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > >> > > >> > On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros < > zbynekvav...@gmail.com > >> > > >> > wrote: > >> > > >> > > Hi, > >> > > > >> > > I've got an AjaxButton and hidden panel with progress bar and status > >> > > message which is hidden in the beggining. > >> > > My idea is to display the panel when the button is clicked and span > >> long > >> > > task. > >> > > This task would update a counter that the progress will display > using > >> > > AjaxSelfUpdatingTimerBehavior. > >> > > > >> > > The problem is that the task has to be run in separate thread so the > >> ajax > >> > > completes > >> > > and panel is even displayed before task end. > >> > > > >> > > Got the idea from > >> > > https://stackoverflow.com/questions/15337198/wicket- > >> > > calling-a-lengthy-operation-and-updating-through-ajax > >> > > . > >> > > > >> > > But I'm getting org.apache.wicket.WicketRuntimeException: There is > no > >> > > application attached to current thread Thread-XX. > >> > > > >> > > Any suggestions? > >> > > > >> > > Thanks, > >> > > Zbynek > >> > > > >> > > >> > > >> > > >> > -- > >> > Regards - Ernesto Reinaldo Barreiro > >> > > >> > > > > > > > > -- > > Regards - Ernesto Reinaldo Barreiro > > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Re: Ajax and async task
Works just fine for me here. Seems this may be related to using Google Guice: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Thread-68 at org.apache.wicket.Application.get(Application.java:236) at org.apache.wicket.guice.GuiceProxyTargetLocator.getInjector(GuiceProxyTargetLocator.java:135) at org.apache.wicket.guice.GuiceProxyTargetLocator.locateProxyTarget(GuiceProxyTargetLocator.java:60) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:498) Zbynek On Wed, Jun 20, 2018 at 11:30 AM, Maxim Solodovnik wrote: > "There is no application attached to current thread" error is usually mean > Application.get() is not working > > On Wed, Jun 20, 2018 at 4:21 PM Zbynek Vavros > wrote: > > > Yeah the difference (from what I see) is that ThreadPoolExecutor is used > in > > BgProcessApplication. > > And usage of > > > > https://ci.apache.org/projects/wicket/apidocs/6.x/ > org/apache/wicket/Session.html#bind() > > that is non-related. > > None of that helps me... > > > > @Maxim: Not sure what you mean but ThreadContext.getApplication() returns > > my application > > without the need to do anything > > > > Zbynek > > > > On Wed, Jun 20, 2018 at 11:10 AM, Ernesto Reinaldo Barreiro < > > reier...@gmail.com> wrote: > > > > > Did you look at > > > > > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > > > > > > > > > > > On Wed, Jun 20, 2018 at 12:05 PM, Zbynek Vavros < > zbynekvav...@gmail.com> > > > wrote: > > > > > > > Still the same: > > > > > > > > org.apache.wicket.WicketRuntimeException: There is no application > > > attached > > > > to current thread pool-XX-thread-XX > > > > > > > > Zbynek > > > > > > > > > > > > > > > > On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro < > > > > reier...@gmail.com> wrote: > > > > > > > > > Maybe this can help > > > > > > > > > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > > > > > > > > > On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros < > > > zbynekvav...@gmail.com> > > > > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I've got an AjaxButton and hidden panel with progress bar and > > status > > > > > > message which is hidden in the beggining. > > > > > > My idea is to display the panel when the button is clicked and > span > > > > long > > > > > > task. > > > > > > This task would update a counter that the progress will display > > using > > > > > > AjaxSelfUpdatingTimerBehavior. > > > > > > > > > > > > The problem is that the task has to be run in separate thread so > > the > > > > ajax > > > > > > completes > > > > > > and panel is even displayed before task end. > > > > > > > > > > > > Got the idea from > > > > > > https://stackoverflow.com/questions/15337198/wicket- > > > > > > calling-a-lengthy-operation-and-updating-through-ajax > > > > > > . > > > > > > > > > > > > But I'm getting org.apache.wicket.WicketRuntimeException: There > is > > > no > > > > > > application attached to current thread Thread-XX. > > > > > > > > > > > > Any suggestions? > > > > > > > > > > > > Thanks, > > > > > > Zbynek > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > > > > > > > > > > > > > > > -- > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > > -- > WBR > Maxim aka solomax >
Re: Ajax and async task
Yeah the difference (from what I see) is that ThreadPoolExecutor is used in BgProcessApplication. And usage of https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/Session.html#bind() that is non-related. None of that helps me... @Maxim: Not sure what you mean but ThreadContext.getApplication() returns my application without the need to do anything Zbynek On Wed, Jun 20, 2018 at 11:10 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Did you look at > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > > > On Wed, Jun 20, 2018 at 12:05 PM, Zbynek Vavros > wrote: > > > Still the same: > > > > org.apache.wicket.WicketRuntimeException: There is no application > attached > > to current thread pool-XX-thread-XX > > > > Zbynek > > > > > > > > On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro < > > reier...@gmail.com> wrote: > > > > > Maybe this can help > > > > > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > > > > > On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros < > zbynekvav...@gmail.com> > > > wrote: > > > > > > > Hi, > > > > > > > > I've got an AjaxButton and hidden panel with progress bar and status > > > > message which is hidden in the beggining. > > > > My idea is to display the panel when the button is clicked and span > > long > > > > task. > > > > This task would update a counter that the progress will display using > > > > AjaxSelfUpdatingTimerBehavior. > > > > > > > > The problem is that the task has to be run in separate thread so the > > ajax > > > > completes > > > > and panel is even displayed before task end. > > > > > > > > Got the idea from > > > > https://stackoverflow.com/questions/15337198/wicket- > > > > calling-a-lengthy-operation-and-updating-through-ajax > > > > . > > > > > > > > But I'm getting org.apache.wicket.WicketRuntimeException: There is > no > > > > application attached to current thread Thread-XX. > > > > > > > > Any suggestions? > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > > > > > > > > -- > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Re: Ajax and async task
Still the same: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-XX-thread-XX Zbynek On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Maybe this can help > > https://github.com/reiern70/antilia-bits/tree/master/bgprocess > > On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros > wrote: > > > Hi, > > > > I've got an AjaxButton and hidden panel with progress bar and status > > message which is hidden in the beggining. > > My idea is to display the panel when the button is clicked and span long > > task. > > This task would update a counter that the progress will display using > > AjaxSelfUpdatingTimerBehavior. > > > > The problem is that the task has to be run in separate thread so the ajax > > completes > > and panel is even displayed before task end. > > > > Got the idea from > > https://stackoverflow.com/questions/15337198/wicket- > > calling-a-lengthy-operation-and-updating-through-ajax > > . > > > > But I'm getting org.apache.wicket.WicketRuntimeException: There is no > > application attached to current thread Thread-XX. > > > > Any suggestions? > > > > Thanks, > > Zbynek > > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Ajax and async task
Hi, I've got an AjaxButton and hidden panel with progress bar and status message which is hidden in the beggining. My idea is to display the panel when the button is clicked and span long task. This task would update a counter that the progress will display using AjaxSelfUpdatingTimerBehavior. The problem is that the task has to be run in separate thread so the ajax completes and panel is even displayed before task end. Got the idea from https://stackoverflow.com/questions/15337198/wicket-calling-a-lengthy-operation-and-updating-through-ajax . But I'm getting org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Thread-XX. Any suggestions? Thanks, Zbynek
Re: Paint UI before starting long running tasked
I did used a nasty way by using AjaxLazyLoadPanel and providing my custom loading as both - lazy load component (with code in renderHead) and loading component (empty renderHead) . Not the most elegant way but from user point of view its ideal :) Zbynek On Thu, May 31, 2018, 16:25 Martin Grigorov wrote: > On Wed, May 30, 2018 at 6:00 PM, Zbynek Vavros > wrote: > > > Hey, > > > > this is weird, I can see the Ajax loading during renderHead() processing > > and then switch to my loading. > > > > Maybe I could describe what I'm doing in more details (with > > AjaxLazyLoadPanel being used): > > Loader from AjaxLazyLoadPanel is displayed. > > Remote REST is being called, response from REST is passed to JS function > - > > at this moment my panel is rendered. > > JS then calls remote service via websocket, receives response, passed > that > > response to Wicket JS callback function. > > This calls yet another REST endpoint and saves result into DB. > > > > After that I replace my loading with success message. > > > > I would like to "ideally" have all this covered by single loading panel. > > > > You will need to create a custom Panel to do all this. > I guess you can still use AjaxLazyLoadPanel if you use Java WebSocket > client, but this is something you have to decide. > > > > > > Zbynek > > > > > > On Wed, May 30, 2018 at 3:32 PM, Martin Grigorov > > wrote: > > > > > Hi, > > > > > > Do you use AjaxLazyLoadPanel for the loading image + result panel ? > > > You can move your #renderHead() logic to the result panel's > renderHead(). > > > > > > On Wed, May 30, 2018 at 3:05 PM, Zbynek Vavros > > > > wrote: > > > > > > > Hi, > > > > > > > > I got a wizard and one of its steps display loading image while > > > > processing long running task. After this task JavaScript is being > > called. > > > > > > > > I've put the code into render renderHead() method of the step itself: > > > > > > > > @Override > > > > public void renderHead(IHeaderResponse response) { > > > > // process task > > > > String taskResult = ... > > > > // call JavaScript with result > > > > response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + > > > > taskResult + ")")); > > > > } > > > > > > > > When I click the NEXT button, this long running task is executed > before > > > > the step with loading image is rendered. > > > > I guess I need to move the code somewhere else than renderHead() but > > > where? > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > >
Re: Paint UI before starting long running task
I could use onAfterRender() but I can't call JS from that. On Wed, May 30, 2018 at 5:00 PM, Zbynek Vavros wrote: > Hey, > > this is weird, I can see the Ajax loading during renderHead() processing > and then switch to my loading. > > Maybe I could describe what I'm doing in more details (with > AjaxLazyLoadPanel being used): > Loader from AjaxLazyLoadPanel is displayed. > Remote REST is being called, response from REST is passed to JS function - > at this moment my panel is rendered. > JS then calls remote service via websocket, receives response, passed that > response to Wicket JS callback function. > This calls yet another REST endpoint and saves result into DB. > > After that I replace my loading with success message. > > I would like to "ideally" have all this covered by single loading panel. > > Zbynek > > > On Wed, May 30, 2018 at 3:32 PM, Martin Grigorov > wrote: > >> Hi, >> >> Do you use AjaxLazyLoadPanel for the loading image + result panel ? >> You can move your #renderHead() logic to the result panel's renderHead(). >> >> On Wed, May 30, 2018 at 3:05 PM, Zbynek Vavros >> wrote: >> >> > Hi, >> > >> > I got a wizard and one of its steps display loading image while >> > processing long running task. After this task JavaScript is being >> called. >> > >> > I've put the code into render renderHead() method of the step itself: >> > >> > @Override >> > public void renderHead(IHeaderResponse response) { >> > // process task >> > String taskResult = ... >> > // call JavaScript with result >> > response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + >> > taskResult + ")")); >> > } >> > >> > When I click the NEXT button, this long running task is executed before >> > the step with loading image is rendered. >> > I guess I need to move the code somewhere else than renderHead() but >> where? >> > >> > Thanks, >> > Zbynek >> > >> > >
Re: Paint UI before starting long running task
Hey, this is weird, I can see the Ajax loading during renderHead() processing and then switch to my loading. Maybe I could describe what I'm doing in more details (with AjaxLazyLoadPanel being used): Loader from AjaxLazyLoadPanel is displayed. Remote REST is being called, response from REST is passed to JS function - at this moment my panel is rendered. JS then calls remote service via websocket, receives response, passed that response to Wicket JS callback function. This calls yet another REST endpoint and saves result into DB. After that I replace my loading with success message. I would like to "ideally" have all this covered by single loading panel. Zbynek On Wed, May 30, 2018 at 3:32 PM, Martin Grigorov wrote: > Hi, > > Do you use AjaxLazyLoadPanel for the loading image + result panel ? > You can move your #renderHead() logic to the result panel's renderHead(). > > On Wed, May 30, 2018 at 3:05 PM, Zbynek Vavros > wrote: > > > Hi, > > > > I got a wizard and one of its steps display loading image while > > processing long running task. After this task JavaScript is being called. > > > > I've put the code into render renderHead() method of the step itself: > > > > @Override > > public void renderHead(IHeaderResponse response) { > > // process task > > String taskResult = ... > > // call JavaScript with result > > response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + > > taskResult + ")")); > > } > > > > When I click the NEXT button, this long running task is executed before > > the step with loading image is rendered. > > I guess I need to move the code somewhere else than renderHead() but > where? > > > > Thanks, > > Zbynek > > >
Paint UI before starting long running task
Hi, I got a wizard and one of its steps display loading image while processing long running task. After this task JavaScript is being called. I've put the code into render renderHead() method of the step itself: @Override public void renderHead(IHeaderResponse response) { // process task String taskResult = ... // call JavaScript with result response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + taskResult + ")")); } When I click the NEXT button, this long running task is executed before the step with loading image is rendered. I guess I need to move the code somewhere else than renderHead() but where? Thanks, Zbynek
Re: Lazy loading of Wizard's steps
Aha per page, I see. Thanks! On Tue, May 29, 2018 at 9:46 AM, Sven Meier wrote: > Hi, > > you can change all resource strings, for the next button put > > org.apache.wicket.extensions.wizard.next=hooray > > ... into your page's resource file (e.g. MyPage.properties). > > Have fun > Sven > > Am 29. Mai 2018 09:40:42 MESZ schrieb Zbynek Vavros < > zbynekvav...@gmail.com>: > >I've played around with models but no success. > >DynamicWizardStep did the trick. > > > >Maybe one more question, is it possible to hide/change title of wizard > >buttons? > >Ideally in per-wizard fashion so I can customize each wizard in our > >app. > > > >Thanks > > > > > >On Tue, May 29, 2018 at 9:36 AM, Sven Meier wrote: > > > >> ... or let both steps work on a model with a list: the first step > >puts > >> item into it, and the second step reads from it. > >> > >> Have fun > >> Sven > >> > >> Am 29. Mai 2018 00:29:12 MESZ schrieb Sebastien : > >> >Hi, AFAIR this is possible with DynamicWizardStep > >> >
Re: Lazy loading of Wizard's steps
I've played around with models but no success. DynamicWizardStep did the trick. Maybe one more question, is it possible to hide/change title of wizard buttons? Ideally in per-wizard fashion so I can customize each wizard in our app. Thanks On Tue, May 29, 2018 at 9:36 AM, Sven Meier wrote: > ... or let both steps work on a model with a list: the first step puts > item into it, and the second step reads from it. > > Have fun > Sven > > Am 29. Mai 2018 00:29:12 MESZ schrieb Sebastien : > >Hi, AFAIR this is possible with DynamicWizardStep >
Lazy loading of Wizard's steps
Hi, is it possible to lazy load wizard steps? I got a List that is initialized empty, filled in step1 and then printed in step2. But I can see that step2's constructor is being called when the wizard is constructed and getting empty list before it can be filled in step1. Thanks, Zbynek
Re: Calling Wicket from JS
Thanks Martin, exactly what I was looking for! On Fri, May 25, 2018 at 1:54 PM, Martin Grigorov <mgrigo...@apache.org> wrote: > Hi, > > You need to use POST method for your Ajax request. > See AbstractDefaultAjaxBehavior#updateAjaxAttributes() > > On Fri, May 25, 2018 at 2:41 PM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > Hey, > > > > I am using the callBackScript() of AbstractDefaultAjaxBehavior: > > AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior() > { > > > > @Override > > public CharSequence getCallbackFunction(CallbackParameter... > > extraParameters) { > > return super.getCallbackFunction(extraParameters); > > } > > > > @Override > > public void renderHead(Component component, IHeaderResponse > > response) { > > super.renderHead(component, response); > > String callBackScript = > > getCallbackFunction(CallbackParameter.explicit(JS_PARAM_CERTIFICATE), > > CallbackParameter.explicit(JS_PARAM_CERTIFICATE_CHAIN)).toString(); > > callBackScript = "sendCertificate=" + callBackScript + > ";"; > > > > response.render(OnDomReadyHeaderItem.forScript(callBackScript)); > > } > > > > protected void respond(final AjaxRequestTarget target) { > > > > String certificate = > > getRequest().getRequestParameters().getParameterValue(JS_PARAM_ > > CERTIFICATE).toString(); > > String certificateChain = > > getRequest().getRequestParameters().getParameterValue(JS_PARAM_ > > CERTIFICATE_CHAIN).toString(); > > } > > }; > > add(behavior); > > > > > > The problem is that I need to send certificate and certificateChain from > JS > > and these are obviously quite long. Thus I am getting " Wicket.Ajax: > > Wicket.Ajax.Call.failure: > > Error while parsing response: Request-URI Too Long". > > > > Any idea how to solve this? > > > > I am on Wicket 7.0.0... > > > > Thanks, > > Zbynek > > >
Calling Wicket from JS
Hey, I am using the callBackScript() of AbstractDefaultAjaxBehavior: AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior() { @Override public CharSequence getCallbackFunction(CallbackParameter... extraParameters) { return super.getCallbackFunction(extraParameters); } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); String callBackScript = getCallbackFunction(CallbackParameter.explicit(JS_PARAM_CERTIFICATE), CallbackParameter.explicit(JS_PARAM_CERTIFICATE_CHAIN)).toString(); callBackScript = "sendCertificate=" + callBackScript + ";"; response.render(OnDomReadyHeaderItem.forScript(callBackScript)); } protected void respond(final AjaxRequestTarget target) { String certificate = getRequest().getRequestParameters().getParameterValue(JS_PARAM_CERTIFICATE).toString(); String certificateChain = getRequest().getRequestParameters().getParameterValue(JS_PARAM_CERTIFICATE_CHAIN).toString(); } }; add(behavior); The problem is that I need to send certificate and certificateChain from JS and these are obviously quite long. Thus I am getting " Wicket.Ajax: Wicket.Ajax.Call.failure: Error while parsing response: Request-URI Too Long". Any idea how to solve this? I am on Wicket 7.0.0... Thanks, Zbynek
Re: DropDownChoice models
Hi, sry got to this just now. You are correct sir! Thanks! Zbynek On Wed, Jan 11, 2017 at 1:47 PM, Sven Meier <s...@meiers.net> wrote: > Hi, > > Im not sure I got this right but seems to me you still have to call >> "User.findOne(id)" for each user >> > > actually not, findOne() is called for the currently selected user only - > that's the advantage. > > Regards > Sven > > > On 11.01.2017 13:16, Zbynek Vavros wrote: > >> Hi, >> >> Im not sure I got this right but seems to me you still have to call >> "User.findOne(id)" for each user >> that touches DB (big nope) or create a Map<ID, User> that doesn't sound >> great either. >> >> Seems to me the best way is to fetch all users from DB and in >> ChoiceRenderer just >> iterate and get the correct one by ID... >> >> Zbynek >> >> On Wed, Jan 11, 2017 at 1:01 PM, Sven Meier <s...@meiers.net> wrote: >> >> Hi, >>> >>> as an alternative you can use a custom model instead: >>> >>> IModel target = ...; >>> >>> IModel userModel = new IModel() { >>> public void setObject(User user) { >>> target.set(user.getId()); >>> } >>> public User getObject() { >>> return User.findOne(target.get()); >>> } >>> } >>> >>> Then your choice can just work on a user: >>> >>> DropDownChoice usersDropDown = new DropDownChoice<>("userId", >>> userModel, User.getUsers()); >>> >>> Both approaches have advantages and disadvantages. >>> >>> Have fun >>> Sven >>> >>> >>> >>> On 11.01.2017 11:38, Zbynek Vavros wrote: >>> >>> Hey, >>>> >>>> I have a DropDownChoice for list of users. I want to display user's name >>>> but bind user's ID. >>>> So far I have come to this (ugly) solution that can surely be improved: >>>> >>>> // create model with Long userId... >>>> final DropDownChoice usersDropDown = new DropDownChoice<>( >>>> "userId", Lists.transform(User.getUsers(), new >>>> Function<User, Long>() { >>>> @Nullable >>>> @Override >>>> public Long apply(@Nullable final User user) { >>>> return user.getId(); >>>> } >>>> }), >>>> new ChoiceRenderer() { >>>> @Override >>>> public Object getDisplayValue(final Long id) { >>>> return User.findOne(id); >>>> } >>>> } >>>> ); >>>> >>>> Thanks for any pointers. >>>> Zbynek >>>> >>>> >>>> - >>> 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: DropDownChoice models
Hey, I dont really think so because this kind of renderer will use these ("name" and "id) as property expression from User object. And then the DropDown selection itself would be of type User as well. I want the selection to be only user's ID, not the whole User object. The whole point is just to be able to decouple form DTO from JPA entities... On Wed, Jan 11, 2017 at 1:37 PM, Sebastienwrote: > Hi Zbynek, > > Maybe I missed something about your problem, but wouldn't this be enough? > new ChoiceRenderer("name", "id") > > Best regards, > Sebastien. >
Re: DropDownChoice models
Hi, Im not sure I got this right but seems to me you still have to call "User.findOne(id)" for each user that touches DB (big nope) or create a Map<ID, User> that doesn't sound great either. Seems to me the best way is to fetch all users from DB and in ChoiceRenderer just iterate and get the correct one by ID... Zbynek On Wed, Jan 11, 2017 at 1:01 PM, Sven Meier <s...@meiers.net> wrote: > Hi, > > as an alternative you can use a custom model instead: > > IModel target = ...; > > IModel userModel = new IModel() { > public void setObject(User user) { > target.set(user.getId()); > } > public User getObject() { > return User.findOne(target.get()); > } > } > > Then your choice can just work on a user: > > DropDownChoice usersDropDown = new DropDownChoice<>("userId", > userModel, User.getUsers()); > > Both approaches have advantages and disadvantages. > > Have fun > Sven > > > > On 11.01.2017 11:38, Zbynek Vavros wrote: > >> Hey, >> >> I have a DropDownChoice for list of users. I want to display user's name >> but bind user's ID. >> So far I have come to this (ugly) solution that can surely be improved: >> >> // create model with Long userId... >> final DropDownChoice usersDropDown = new DropDownChoice<>( >> "userId", Lists.transform(User.getUsers(), new >> Function<User, Long>() { >> @Nullable >> @Override >> public Long apply(@Nullable final User user) { >> return user.getId(); >> } >> }), >> new ChoiceRenderer() { >> @Override >> public Object getDisplayValue(final Long id) { >> return User.findOne(id); >> } >> } >> ); >> >> Thanks for any pointers. >> Zbynek >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
DropDownChoice models
Hey, I have a DropDownChoice for list of users. I want to display user's name but bind user's ID. So far I have come to this (ugly) solution that can surely be improved: // create model with Long userId... final DropDownChoice usersDropDown = new DropDownChoice<>( "userId", Lists.transform(User.getUsers(), new Function() { @Nullable @Override public Long apply(@Nullable final User user) { return user.getId(); } }), new ChoiceRenderer() { @Override public Object getDisplayValue(final Long id) { return User.findOne(id); } } ); Thanks for any pointers. Zbynek
Re: WicketTester + DateTimeField
WICKET-6153 created. Thanks ! On Thu, Apr 28, 2016 at 8:07 PM, Martin Grigorov <mgrigo...@apache.org> wrote: > You are very right! > Please a ticket! > > In the meantime you can use tester.getSession().setLocale(locale) > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Apr 28, 2016 at 4:52 PM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > Hi, > > > > finally got to fix that test and I don't have method setLocale(aLocale) > on > > MockHttpServletRequest. > > I am on Wicket 7.0.0... > > > > Zbynek > > > > On Tue, Apr 26, 2016 at 6:12 PM, Zbynek Vavros <zbynekvav...@gmail.com> > > wrote: > > > > > Hey, > > > > > > good point, thanks a lot ! > > > I was using the inner workings of DateTextField to get the formatted > > > string with locale > > > > > > DateFormat.getDateInstance(DateFormat.SHORT, > > > Locale.getDefault()).format(date) > > > > > > but setting the locale on request is much better, thanks again ! > > > > > > Zbynek > > > > > > On Tue, Apr 26, 2016 at 6:01 PM, Martin Grigorov < > > > martin.grigo...@gmail.com> wrote: > > > > > >> Hi, > > >> > > >> WicketTester simulates browser behavior, so it sends String that is > > >> converted to a Date by the Wicket component. > > >> You can use tester.getRequest().setLocale(aLocale) to simulate > localized > > >> browser. > > >> On Apr 26, 2016 4:22 PM, "Zbynek Vavros" <zbynekvav...@gmail.com> > > wrote: > > >> > > >> Hi, > > >> > > >> whats the proper way to work with WicketTester and DateTimeFields ? > > >> I am using > > >> > > >> FormTester.setValue("myDateTimeField". "formattedDateTime"); > > >> > > >> is there any way using proper date instead of string (that differs > with > > >> locales) ? > > >> using DateTimeField.setModelObject() or > > >> DateTimeField.setDefaultModejObject > > >> breaks our validator that works with getConvertedInput... > > >> > > >> Thanks, > > >> Zbynek > > >> > > > > > > > > >
Re: WicketTester + DateTimeField
Hi, finally got to fix that test and I don't have method setLocale(aLocale) on MockHttpServletRequest. I am on Wicket 7.0.0... Zbynek On Tue, Apr 26, 2016 at 6:12 PM, Zbynek Vavros <zbynekvav...@gmail.com> wrote: > Hey, > > good point, thanks a lot ! > I was using the inner workings of DateTextField to get the formatted > string with locale > > DateFormat.getDateInstance(DateFormat.SHORT, > Locale.getDefault()).format(date) > > but setting the locale on request is much better, thanks again ! > > Zbynek > > On Tue, Apr 26, 2016 at 6:01 PM, Martin Grigorov < > martin.grigo...@gmail.com> wrote: > >> Hi, >> >> WicketTester simulates browser behavior, so it sends String that is >> converted to a Date by the Wicket component. >> You can use tester.getRequest().setLocale(aLocale) to simulate localized >> browser. >> On Apr 26, 2016 4:22 PM, "Zbynek Vavros" <zbynekvav...@gmail.com> wrote: >> >> Hi, >> >> whats the proper way to work with WicketTester and DateTimeFields ? >> I am using >> >> FormTester.setValue("myDateTimeField". "formattedDateTime"); >> >> is there any way using proper date instead of string (that differs with >> locales) ? >> using DateTimeField.setModelObject() or >> DateTimeField.setDefaultModejObject >> breaks our validator that works with getConvertedInput... >> >> Thanks, >> Zbynek >> > >
Re: WicketTester + DateTimeField
Hey, good point, thanks a lot ! I was using the inner workings of DateTextField to get the formatted string with locale DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).format(date) but setting the locale on request is much better, thanks again ! Zbynek On Tue, Apr 26, 2016 at 6:01 PM, Martin Grigorov <martin.grigo...@gmail.com> wrote: > Hi, > > WicketTester simulates browser behavior, so it sends String that is > converted to a Date by the Wicket component. > You can use tester.getRequest().setLocale(aLocale) to simulate localized > browser. > On Apr 26, 2016 4:22 PM, "Zbynek Vavros" <zbynekvav...@gmail.com> wrote: > > Hi, > > whats the proper way to work with WicketTester and DateTimeFields ? > I am using > > FormTester.setValue("myDateTimeField". "formattedDateTime"); > > is there any way using proper date instead of string (that differs with > locales) ? > using DateTimeField.setModelObject() or DateTimeField.setDefaultModejObject > breaks our validator that works with getConvertedInput... > > Thanks, > Zbynek >
WicketTester + DateTimeField
Hi, whats the proper way to work with WicketTester and DateTimeFields ? I am using FormTester.setValue("myDateTimeField". "formattedDateTime"); is there any way using proper date instead of string (that differs with locales) ? using DateTimeField.setModelObject() or DateTimeField.setDefaultModejObject breaks our validator that works with getConvertedInput... Thanks, Zbynek
Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior
I'm not sure we understand each other. Such a behavior is already there using AjaxFormComponentUpdatingBehavior ("change"). This way ajax is triggered ONLY when value is selected from choices (either by mouse or by keyboard). = exactly what I want. I tested this in small prototype and it works just fine. My issue is that this doesn't work in our business app so I am trying to find why this works in prototype app but not in business app (as I mentioned both use wicket-core and wicket-extensions 7.0.0). What I found out is that in both cases (prototype and business app) the event in line 178 in wicket-autocomplete.js is invoked as expected. The issue is that business app does no ajax call after that. To summarize all I would like is some help with JS debugging since I am java-dev and js-noob :( On Thu, Jan 21, 2016 at 10:35 AM, Martin Grigorov <mgrigo...@apache.org> wrote: > OK. I understand now. > Looking at wicket-autocomplete.js I see that it triggers "change" event > after click on an entry. > To support use cases like yours it has to trigger some custom event too, > e.g. "itemselected.wa" ("wa" is a sample namespace for > wicket-autocomplete). The you can use > AjaxFormComponentUpdatingBehavior("itemselected.wa"). > Please create a ticket in our JIRA! > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Jan 21, 2016 at 10:27 AM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > What I mean by final value is value selected from list of options. > > The OnChangeAjaxBehavior you suggested will do ajax on every key stroke. > > So lets say my autocomplete display list of cities. > > I want the method called when user selects a value "London" from list. > > Not on each stoke "L", "Lo", "Lon"... > > > > As I said, this is because I need to use the selected value for > additional > > processing. > > > > On Thu, Jan 21, 2016 at 9:56 AM, Martin Grigorov <mgrigo...@apache.org> > > wrote: > > > > > Hi, > > > > > > How do you decide when "final" value is entered ? > > > You can use Ajax throttling to avoid sending requests on every typed > > > character but only after N ms after the last typed character. See > > > AjaxRequestAttributes#setThrottling() for this option. > > > There is no magic that will read your users' mind to tell whether an > > > entered value is final or not. > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > https://twitter.com/mtgrigorov > > > > > > On Thu, Jan 21, 2016 at 9:48 AM, Zbynek Vavros <zbynekvav...@gmail.com > > > > > wrote: > > > > > > > Hey, > > > > > > > > sorry for not explaining properly... > > > > I already tried that and in this case the the ajax call is triggered > > > > on "inputchange" as well, meaning on every key stroke. > > > > > > > > This is not desirable because we use the value of this autocomplete > > field > > > > to calculate value of another fields in form. This calculation should > > > > happen only > > > > when "final" value is selected. > > > > > > > > Zbynek > > > > > > > > On Thu, Jan 21, 2016 at 9:27 AM, Martin Grigorov < > mgrigo...@apache.org > > > > > > > wrote: > > > > > > > > > Hi, > > > > > > > > > > It is not very clear what exactly is the issue. > > > > > As far as I understand the problem is that the Ajax call is > triggered > > > > only > > > > > when you navigate to another form field. If this is the issue then > > try > > > by > > > > > using OnChangeAjaxBehavior instead of > > > AjaxFormComponentUpdatingBehavior. > > > > > > > > > > Martin Grigorov > > > > > Wicket Training and Consulting > > > > > https://twitter.com/mtgrigorov > > > > > > > > > > On Wed, Jan 20, 2016 at 2:44 PM, Zbynek Vavros < > > zbynekvav...@gmail.com > > > > > > > > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > in our project we have an AutoCompleteTextField with > > > > > > AjaxFormComponentUpdatingBehavior ("change" event) attached. > > > > > > > > > > > > Small prototype I did proves that HTTP POST is done when an item > is > > > > > > selected from choices (either by mouse or keyboard). But for some > > > > reason > > > > > > the same code doesn't work in our project. It is required to move > > > focus > > > > > to > > > > > > another component for the POST to be send. The behavior works > like > > if > > > > > > "blur" type of event is set but there is "change". > > > > > > > > > > > > I'm quite new to Wicket so I tried to compare all HTML & JS files > > but > > > > > they > > > > > > all seem to be the same. > > > > > > Is there some other debug I can use to find what is going on (I > > > suspect > > > > > > something in JS but JS isn't my specialty) ? > > > > > > > > > > > > > > > > > > Oh and both wicket-core and wicket-extension is 7.0.0. > > > > > > > > > > > > Thanks, > > > > > > Zbynek > > > > > > > > > > > > > > > > > > > > >
Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior
I was s afraid of that :D Just out of curiosity, I see in wicket-autocomplete.js that the onchange event sets "triggerChangeOnHide" to true. How is this handled afterwards ? I mean how does it get from here to calling the ajax ? Thanks! On Thu, Jan 21, 2016 at 11:50 AM, Sven Meier <s...@meiers.net> wrote: > Hi, > > well, it seems you'll have to strip down your business app until it works > as expected :P > > Have fun > Sven > > > On 21.01.2016 11:47, Zbynek Vavros wrote: > >> I'm not sure we understand each other. >> Such a behavior is already there using AjaxFormComponentUpdatingBehavior >> ("change"). >> This way ajax is triggered ONLY when value is selected from choices >> (either >> by mouse or by keyboard). >> = exactly what I want. >> >> I tested this in small prototype and it works just fine. >> >> My issue is that this doesn't work in our business app so I am trying to >> find why this works in prototype app >> but not in business app (as I mentioned both use wicket-core and >> wicket-extensions 7.0.0). >> >> What I found out is that in both cases (prototype and business app) >> the event in line 178 in wicket-autocomplete.js is invoked as expected. >> The >> issue is that business app does no ajax call after that. >> >> To summarize all I would like is some help with JS debugging since I am >> java-dev and js-noob :( >> >> On Thu, Jan 21, 2016 at 10:35 AM, Martin Grigorov <mgrigo...@apache.org> >> wrote: >> >> OK. I understand now. >>> Looking at wicket-autocomplete.js I see that it triggers "change" event >>> after click on an entry. >>> To support use cases like yours it has to trigger some custom event too, >>> e.g. "itemselected.wa" ("wa" is a sample namespace for >>> wicket-autocomplete). The you can use >>> AjaxFormComponentUpdatingBehavior("itemselected.wa"). >>> Please create a ticket in our JIRA! >>> >>> Martin Grigorov >>> Wicket Training and Consulting >>> https://twitter.com/mtgrigorov >>> >>> On Thu, Jan 21, 2016 at 10:27 AM, Zbynek Vavros <zbynekvav...@gmail.com> >>> wrote: >>> >>> What I mean by final value is value selected from list of options. >>>> The OnChangeAjaxBehavior you suggested will do ajax on every key stroke. >>>> So lets say my autocomplete display list of cities. >>>> I want the method called when user selects a value "London" from list. >>>> Not on each stoke "L", "Lo", "Lon"... >>>> >>>> As I said, this is because I need to use the selected value for >>>> >>> additional >>> >>>> processing. >>>> >>>> On Thu, Jan 21, 2016 at 9:56 AM, Martin Grigorov <mgrigo...@apache.org> >>>> wrote: >>>> >>>> Hi, >>>>> >>>>> How do you decide when "final" value is entered ? >>>>> You can use Ajax throttling to avoid sending requests on every typed >>>>> character but only after N ms after the last typed character. See >>>>> AjaxRequestAttributes#setThrottling() for this option. >>>>> There is no magic that will read your users' mind to tell whether an >>>>> entered value is final or not. >>>>> >>>>> Martin Grigorov >>>>> Wicket Training and Consulting >>>>> https://twitter.com/mtgrigorov >>>>> >>>>> On Thu, Jan 21, 2016 at 9:48 AM, Zbynek Vavros <zbynekvav...@gmail.com >>>>> wrote: >>>>> >>>>> Hey, >>>>>> >>>>>> sorry for not explaining properly... >>>>>> I already tried that and in this case the the ajax call is triggered >>>>>> on "inputchange" as well, meaning on every key stroke. >>>>>> >>>>>> This is not desirable because we use the value of this autocomplete >>>>>> >>>>> field >>>> >>>>> to calculate value of another fields in form. This calculation should >>>>>> happen only >>>>>> when "final" value is selected. >>>>>> >>>>>> Zbynek >>>>>> >>>>>> On Thu, Jan 21, 2016 at 9:27 AM, Martin Grigorov < >>>>>> >>>>> mgrigo...@apache.org >>&g
Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior
What I mean by final value is value selected from list of options. The OnChangeAjaxBehavior you suggested will do ajax on every key stroke. So lets say my autocomplete display list of cities. I want the method called when user selects a value "London" from list. Not on each stoke "L", "Lo", "Lon"... As I said, this is because I need to use the selected value for additional processing. On Thu, Jan 21, 2016 at 9:56 AM, Martin Grigorov <mgrigo...@apache.org> wrote: > Hi, > > How do you decide when "final" value is entered ? > You can use Ajax throttling to avoid sending requests on every typed > character but only after N ms after the last typed character. See > AjaxRequestAttributes#setThrottling() for this option. > There is no magic that will read your users' mind to tell whether an > entered value is final or not. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Jan 21, 2016 at 9:48 AM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > Hey, > > > > sorry for not explaining properly... > > I already tried that and in this case the the ajax call is triggered > > on "inputchange" as well, meaning on every key stroke. > > > > This is not desirable because we use the value of this autocomplete field > > to calculate value of another fields in form. This calculation should > > happen only > > when "final" value is selected. > > > > Zbynek > > > > On Thu, Jan 21, 2016 at 9:27 AM, Martin Grigorov <mgrigo...@apache.org> > > wrote: > > > > > Hi, > > > > > > It is not very clear what exactly is the issue. > > > As far as I understand the problem is that the Ajax call is triggered > > only > > > when you navigate to another form field. If this is the issue then try > by > > > using OnChangeAjaxBehavior instead of > AjaxFormComponentUpdatingBehavior. > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > https://twitter.com/mtgrigorov > > > > > > On Wed, Jan 20, 2016 at 2:44 PM, Zbynek Vavros <zbynekvav...@gmail.com > > > > > wrote: > > > > > > > Hi, > > > > > > > > in our project we have an AutoCompleteTextField with > > > > AjaxFormComponentUpdatingBehavior ("change" event) attached. > > > > > > > > Small prototype I did proves that HTTP POST is done when an item is > > > > selected from choices (either by mouse or keyboard). But for some > > reason > > > > the same code doesn't work in our project. It is required to move > focus > > > to > > > > another component for the POST to be send. The behavior works like if > > > > "blur" type of event is set but there is "change". > > > > > > > > I'm quite new to Wicket so I tried to compare all HTML & JS files but > > > they > > > > all seem to be the same. > > > > Is there some other debug I can use to find what is going on (I > suspect > > > > something in JS but JS isn't my specialty) ? > > > > > > > > > > > > Oh and both wicket-core and wicket-extension is 7.0.0. > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > >
Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior
Hey, sorry for not explaining properly... I already tried that and in this case the the ajax call is triggered on "inputchange" as well, meaning on every key stroke. This is not desirable because we use the value of this autocomplete field to calculate value of another fields in form. This calculation should happen only when "final" value is selected. Zbynek On Thu, Jan 21, 2016 at 9:27 AM, Martin Grigorov <mgrigo...@apache.org> wrote: > Hi, > > It is not very clear what exactly is the issue. > As far as I understand the problem is that the Ajax call is triggered only > when you navigate to another form field. If this is the issue then try by > using OnChangeAjaxBehavior instead of AjaxFormComponentUpdatingBehavior. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Wed, Jan 20, 2016 at 2:44 PM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > Hi, > > > > in our project we have an AutoCompleteTextField with > > AjaxFormComponentUpdatingBehavior ("change" event) attached. > > > > Small prototype I did proves that HTTP POST is done when an item is > > selected from choices (either by mouse or keyboard). But for some reason > > the same code doesn't work in our project. It is required to move focus > to > > another component for the POST to be send. The behavior works like if > > "blur" type of event is set but there is "change". > > > > I'm quite new to Wicket so I tried to compare all HTML & JS files but > they > > all seem to be the same. > > Is there some other debug I can use to find what is going on (I suspect > > something in JS but JS isn't my specialty) ? > > > > > > Oh and both wicket-core and wicket-extension is 7.0.0. > > > > Thanks, > > Zbynek > > >
AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior
Hi, in our project we have an AutoCompleteTextField with AjaxFormComponentUpdatingBehavior ("change" event) attached. Small prototype I did proves that HTTP POST is done when an item is selected from choices (either by mouse or keyboard). But for some reason the same code doesn't work in our project. It is required to move focus to another component for the POST to be send. The behavior works like if "blur" type of event is set but there is "change". I'm quite new to Wicket so I tried to compare all HTML & JS files but they all seem to be the same. Is there some other debug I can use to find what is going on (I suspect something in JS but JS isn't my specialty) ? Oh and both wicket-core and wicket-extension is 7.0.0. Thanks, Zbynek