Re: DataTable generics vs. IColumn generics
Hi Patrick, you can let your column implementation be generic: public class LocationColumnT extends PropertyColumnT { public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorT cellItem, String componentId, IModelT rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel((IModelLocation)createDataModel(rowModel), Model.of(Session.get().getLocale(); } } What do you need more? Regards Sven Am 05.03.2015 um 15:34 schrieb Patrick Davids: Hi Sven, thanx for feedback. Ok, how to implement the LocationColumn more reusable? I dont want to be bound to a Datatable of Persons. I'd like to have a Column which works with a Locations, independently from which model-object the expression fetches the Location. Is there any way to do that? best regards Patrick Am 05.03.2015 um 15:19 schrieb Sven Meier: Hi, generic T is identical for the DataTable, and it's IColumns: it's the type of the row models. A column is responsible to provide a cell component for a row: For DataTable only the input (e.g. Person) is interesting, the output (Location) doesn't matter. Your LocationColumn should extend PropertyColumnPerson: public class LocationColumn extends PropertyColumnPerson{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorPerson cellItem, String componentId, IModelPerson rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel((IModelLocation)createDataModel(rowModel), Model.of(Session.get().getLocale(); } } Have fun Sven Am 05.03.2015 um 12:26 schrieb Patrick Davids: Hi all, whats the meaning of generic T on DataTables vs T of IColumn and T of ICellPopulator? As I understand its the type of object shown by the table rows. Reading the javadoc of AbstractColumn it says T (if I understand correct), its the type of object shown by the cell itself. But DataTable and its internal list of columns are bound together. T of both must be the same... I tried to implement something like this, and here I get problems. ListIColumnPerson, Void cols = new ArrayList(); cols.add(new PropertyColumnPerson, Void(Model.of(Name), name)); (compiler error) cols.add(new LocationColumn(location)); (compiler error) new DataTablePerson, Void(id, cols, new ListDataProviderPerson(), 50); public class LocationColumn extends PropertyColumnLocation{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorLocation cellItem, String componentId, IModelLocation rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel(rowModel, Model.of(Session.get().getLocale(); } } Also the Generic of ICellPopulator is bound to T of column. I always thought it could be possible to implement sub-class columns to allow special renderings of table-cells. But how can I achieve this, if also ICellPopulator is bound to T of the rowModel? kind regards Patrick - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to convert component model object to rendered HTML?
Guten Tag Martin Grigorov, am Donnerstag, 5. März 2015 um 08:47 schrieben Sie: You can call formComponent#clearInput() in #onError() callback method. This way Wicket will use the last (valid) model value. This way I would loose the current input of the user? You can also set custom model value in #onError() if you need. My model needs to be a list of unique IDs, I can't change that to a list of non unique company names. Looks like I would need something simple like overriding FormComponent.getValue, which is final... Who does call this method during the render process? I couldn't find the place, maybe I can hook the caller. Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
trying to redirect to external URL when using HttpsMapper
Dear Forum, I have a form on a page where user enters personal data, and the page has the @RequireHttps because I'm trying to make the information captured more secure. When the user clicks submit, the page should redirect to an external URL. In this case, PayPal checkout page. Unfortunately, on form submission, the page is not always redirected to the desired external URL. This problem only occurs on Production mode. Very frequently it is redirected to the 404 page-not-found page instead of the external URL. On my Wicket application, I call If I remove that line, then redirecting to an external page works without problem, but HTTPS on pages is no longer enforced. Has any of you encountered this problem in the past? Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/trying-to-redirect-to-external-URL-when-using-HttpsMapper-tp4669869.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: trying to redirect to external URL when using HttpsMapper
Hi, how do you redirect to the external url? Have you compared the request sequence in the browser (e.g. with Firebug)? What are the differences between the successful and the failed redirect? Regards Sven Am 05.03.2015 um 18:50 schrieb lucast: Dear Forum, I have a form on a page where user enters personal data, and the page has the @RequireHttps because I'm trying to make the information captured more secure. When the user clicks submit, the page should redirect to an external URL. In this case, PayPal checkout page. Unfortunately, on form submission, the page is not always redirected to the desired external URL. This problem only occurs on Production mode. Very frequently it is redirected to the 404 page-not-found page instead of the external URL. On my Wicket application, I call If I remove that line, then redirecting to an external page works without problem, but HTTPS on pages is no longer enforced. Has any of you encountered this problem in the past? Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/trying-to-redirect-to-external-URL-when-using-HttpsMapper-tp4669869.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket:enclosure tag issue - no exception for components missing in markup
Hello together, we've just recognized some strange behavior when using wicket:enclosure tag. The scenario: I have a page that has two labels in it's component hierarchy. In the pages markup one label is surrounded with an enclosure-tag, and this label is invisible. The second label was not added to the markup. When I now render the page I would expect a WicketRuntimeException because of the broken markup but the page will be rendered successfully. I would open a ticket in jira, but I want to ensure that I'm not creating a ticket for an already known bug or expected behavior. I have a small quickstart for that: @Test(expected = WicketRuntimeException.class) // fails public void renderInvisible() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(new TestPage(false)); tester.assertRenderedPage(TestPage.class); tester.assertVisible(secondLabel); // true } @Test(expected = WicketRuntimeException.class) // success public void renderVisible() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(new TestPage(true)); tester.assertRenderedPage(TestPage.class); } public static class TestPage extends WebPage implements IMarkupResourceStreamProvider { public TestPage(boolean labelVisible) { add(new Label(label, invisible).setVisible(labelVisible)); add(new Label(secondLabel, WTF?)); } @Override public IResourceStream getMarkupResourceStream(final MarkupContainer container, final Class? containerClass) { return new StringResourceStream(htmlbodywicket:enclosure child=\label\span wicket:id=\label\/span/wicket:enclosure/body/html); } } Maybe I could contribute a patch. Do you have any idea where I can find the cause of this issue? I've just found out, that unrenderedComponents list in Page#checkRendering is empty but it must not. cheers, Martin
Re: trying to redirect to external URL when using HttpsMapper
Hi Sven, Thanks for replying. on the ajax submit button I call: @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { redirectToInterceptPage(new RedirectPage(URLString)); } Have you compared the request sequence in the browser (e.g. with Firebug)? That is something I am not aware of. I'll look it up. Thanks, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/trying-to-redirect-to-external-URL-when-using-HttpsMapper-tp4669869p4669871.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to convert component model object to rendered HTML?
Guten Tag Thorsten Schöning, am Donnerstag, 5. März 2015 um 18:57 schrieben Sie: Looks like I would need something simple like overriding FormComponent.getValue, which is final... I found a simple workaround for me: Override onInvalid and getInputAsArray, in onInvalid I set an instance flag to note it was called, call inputChanged and reset the flag. inputChanged calls getInputAsArray (currently), which I overridden to respect my flag, in which case I provide my company names instead of the ids. The current model with ids is available using getConvertedInput and because auf the validation errors the changed raw input doesn't move forward into other wicket internals, but only gets rendered in the output. I know it's hacky, but that's exactly what I need. :-/ Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DataTable generics vs. IColumn generics
Hi all, whats the meaning of generic T on DataTables vs T of IColumn and T of ICellPopulator? As I understand its the type of object shown by the table rows. Reading the javadoc of AbstractColumn it says T (if I understand correct), its the type of object shown by the cell itself. But DataTable and its internal list of columns are bound together. T of both must be the same... I tried to implement something like this, and here I get problems. ListIColumnPerson, Void cols = new ArrayList(); cols.add(new PropertyColumnPerson, Void(Model.of(Name), name)); (compiler error) cols.add(new LocationColumn(location)); (compiler error) new DataTablePerson, Void(id, cols, new ListDataProviderPerson(), 50); public class LocationColumn extends PropertyColumnLocation{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorLocation cellItem, String componentId, IModelLocation rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel(rowModel, Model.of(Session.get().getLocale(); } } Also the Generic of ICellPopulator is bound to T of column. I always thought it could be possible to implement sub-class columns to allow special renderings of table-cells. But how can I achieve this, if also ICellPopulator is bound to T of the rowModel? kind regards Patrick - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket:enclosure tag issue - no exception for components missing in markup
Hi, I'd try with a proper .java/.html files. Using getMarkupResourceStream() is not always the same as the default/production way. Maybe the bug is somewhere there. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Mar 5, 2015 at 12:06 PM, Martin Sturm martin.st...@comsysto.com wrote: Hello together, we've just recognized some strange behavior when using wicket:enclosure tag. The scenario: I have a page that has two labels in it's component hierarchy. In the pages markup one label is surrounded with an enclosure-tag, and this label is invisible. The second label was not added to the markup. When I now render the page I would expect a WicketRuntimeException because of the broken markup but the page will be rendered successfully. I would open a ticket in jira, but I want to ensure that I'm not creating a ticket for an already known bug or expected behavior. I have a small quickstart for that: @Test(expected = WicketRuntimeException.class) // fails public void renderInvisible() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(new TestPage(false)); tester.assertRenderedPage(TestPage.class); tester.assertVisible(secondLabel); // true } @Test(expected = WicketRuntimeException.class) // success public void renderVisible() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(new TestPage(true)); tester.assertRenderedPage(TestPage.class); } public static class TestPage extends WebPage implements IMarkupResourceStreamProvider { public TestPage(boolean labelVisible) { add(new Label(label, invisible).setVisible(labelVisible)); add(new Label(secondLabel, WTF?)); } @Override public IResourceStream getMarkupResourceStream(final MarkupContainer container, final Class? containerClass) { return new StringResourceStream(htmlbodywicket:enclosure child=\label\span wicket:id=\label\/span/wicket:enclosure/body/html); } } Maybe I could contribute a patch. Do you have any idea where I can find the cause of this issue? I've just found out, that unrenderedComponents list in Page#checkRendering is empty but it must not. cheers, Martin
Re: DataTable generics vs. IColumn generics
Hi, generic T is identical for the DataTable, and it's IColumns: it's the type of the row models. A column is responsible to provide a cell component for a row: For DataTable only the input (e.g. Person) is interesting, the output (Location) doesn't matter. Your LocationColumn should extend PropertyColumnPerson: public class LocationColumn extends PropertyColumnPerson{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorPerson cellItem, String componentId, IModelPerson rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel((IModelLocation)createDataModel(rowModel), Model.of(Session.get().getLocale(); } } Have fun Sven Am 05.03.2015 um 12:26 schrieb Patrick Davids: Hi all, whats the meaning of generic T on DataTables vs T of IColumn and T of ICellPopulator? As I understand its the type of object shown by the table rows. Reading the javadoc of AbstractColumn it says T (if I understand correct), its the type of object shown by the cell itself. But DataTable and its internal list of columns are bound together. T of both must be the same... I tried to implement something like this, and here I get problems. ListIColumnPerson, Void cols = new ArrayList(); cols.add(new PropertyColumnPerson, Void(Model.of(Name), name)); (compiler error) cols.add(new LocationColumn(location)); (compiler error) new DataTablePerson, Void(id, cols, new ListDataProviderPerson(), 50); public class LocationColumn extends PropertyColumnLocation{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorLocation cellItem, String componentId, IModelLocation rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel(rowModel, Model.of(Session.get().getLocale(); } } Also the Generic of ICellPopulator is bound to T of column. I always thought it could be possible to implement sub-class columns to allow special renderings of table-cells. But how can I achieve this, if also ICellPopulator is bound to T of the rowModel? kind regards Patrick - 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: DataTable generics vs. IColumn generics
Hi Sven, thanx for feedback. Ok, how to implement the LocationColumn more reusable? I dont want to be bound to a Datatable of Persons. I'd like to have a Column which works with a Locations, independently from which model-object the expression fetches the Location. Is there any way to do that? best regards Patrick Am 05.03.2015 um 15:19 schrieb Sven Meier: Hi, generic T is identical for the DataTable, and it's IColumns: it's the type of the row models. A column is responsible to provide a cell component for a row: For DataTable only the input (e.g. Person) is interesting, the output (Location) doesn't matter. Your LocationColumn should extend PropertyColumnPerson: public class LocationColumn extends PropertyColumnPerson{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorPerson cellItem, String componentId, IModelPerson rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel((IModelLocation)createDataModel(rowModel), Model.of(Session.get().getLocale(); } } Have fun Sven Am 05.03.2015 um 12:26 schrieb Patrick Davids: Hi all, whats the meaning of generic T on DataTables vs T of IColumn and T of ICellPopulator? As I understand its the type of object shown by the table rows. Reading the javadoc of AbstractColumn it says T (if I understand correct), its the type of object shown by the cell itself. But DataTable and its internal list of columns are bound together. T of both must be the same... I tried to implement something like this, and here I get problems. ListIColumnPerson, Void cols = new ArrayList(); cols.add(new PropertyColumnPerson, Void(Model.of(Name), name)); (compiler error) cols.add(new LocationColumn(location)); (compiler error) new DataTablePerson, Void(id, cols, new ListDataProviderPerson(), 50); public class LocationColumn extends PropertyColumnLocation{ public LocationColumn(String expressionToLocation){ super(Model.of(Location), expressionToLocation); } @Override public void populateItem(ItemICellPopulatorLocation cellItem, String componentId, IModelLocation rowModel) { cellItem.add(new Label(componentId, new LocationFormatModel(rowModel, Model.of(Session.get().getLocale(); } } Also the Generic of ICellPopulator is bound to T of column. I always thought it could be possible to implement sub-class columns to allow special renderings of table-cells. But how can I achieve this, if also ICellPopulator is bound to T of the rowModel? kind regards Patrick - 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 -- Mit freundlichen Grüßen, Patrick Davids nuboLOGIC GmbH Co. KG Südportal 1 • 22848 Norderstedt Tel.: +49 40 228539 732 Email: patrick.dav...@nubologic.com http://www.nubologic.com Handelsregister: HRA6819 Pi | Amtsgericht Pinneberg Geschäftsführung der Verwaltungsgesellschaft Christian Capelle HRB10145Pi | Amtsgericht Pinneberg - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org